diff --git a/depends/CMakeLists.txt b/depends/CMakeLists.txt index 7c3300b82..15ff52488 100644 --- a/depends/CMakeLists.txt +++ b/depends/CMakeLists.txt @@ -2,18 +2,10 @@ add_subdirectory(lodepng) add_subdirectory(lua) add_subdirectory(md5) - -option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" OFF) -option(protobuf_INSTALL "Install protobuf binaries and files" OFF) -option(protobuf_BUILD_TESTS "Build tests" OFF) -add_subdirectory(protobuf EXCLUDE_FROM_ALL) -if(UNIX) - set_target_properties(libprotoc PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-stringop-overflow") - set_target_properties(libprotobuf PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-stringop-overflow") - set_target_properties(libprotobuf-lite PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-stringop-overflow") -endif() +add_subdirectory(protobuf) if(UNIX AND NOT APPLE) # remove this once our MSVC build env has been updated +option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" OFF) add_subdirectory(googletest) if(UNIX) set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-Wno-maybe-uninitialized -Wno-sign-compare") diff --git a/depends/protobuf/CMakeLists.txt b/depends/protobuf/CMakeLists.txt index 04cb3303a..b12230b71 100644 --- a/depends/protobuf/CMakeLists.txt +++ b/depends/protobuf/CMakeLists.txt @@ -1,351 +1,195 @@ -# Minimum CMake required -cmake_minimum_required(VERSION 3.5) - -if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Configuring...") -endif() - -# CMake policies -cmake_policy(SET CMP0022 NEW) -# On MacOS use @rpath/ for target's install name prefix path -if (POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif () -# Clear VERSION variables when no VERSION is given to project() -if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif() -# MSVC runtime library flags are selected by an abstraction. -if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) -endif() - -# Project -project(protobuf C CXX) - -if(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE) - if(CMAKE_PROJECT_NAME STREQUAL "protobuf") - get_filename_component(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) - endif() - get_filename_component(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) - get_filename_component(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR} DIRECTORY) - get_filename_component(protobuf_SOURCE_DIR ${protobuf_SOURCE_DIR} DIRECTORY) -endif() - -# Add c++11 flags -if (CYGWIN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") -else() - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) -endif() - -# The Intel compiler isn't able to deal with noinline member functions of -# template classes defined in headers. As such it spams the output with -# warning #2196: routine is both "inline" and "noinline" -# This silences that warning. -if (CMAKE_CXX_COMPILER_ID MATCHES Intel) - string(APPEND CMAKE_CXX_FLAGS " -diag-disable=2196") -endif() - -# Options -option(protobuf_INSTALL "Install protobuf binaries and files" ON) -if(WITH_PROTOC) - set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE) -endif() -option(protobuf_BUILD_TESTS "Build tests" ON) -option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF) -option(protobuf_BUILD_EXAMPLES "Build examples" OFF) -option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON) -option(protobuf_BUILD_LIBPROTOC "Build libprotoc" OFF) -option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF) -if (BUILD_SHARED_LIBS) - set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON) -else (BUILD_SHARED_LIBS) - set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF) -endif (BUILD_SHARED_LIBS) -option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT}) -include(CMakeDependentOption) -cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON - "NOT protobuf_BUILD_SHARED_LIBS" OFF) -set(protobuf_WITH_ZLIB_DEFAULT ON) -option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT}) -set(protobuf_DEBUG_POSTFIX "d" - CACHE STRING "Default debug postfix") -mark_as_advanced(protobuf_DEBUG_POSTFIX) -# User options -include(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake) - -# Overrides for option dependencies -if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS) - set(protobuf_BUILD_LIBPROTOC ON) -endif () -# Path to main configure script -set(protobuf_CONFIGURE_SCRIPT "${protobuf_SOURCE_DIR}/configure.ac") - -# Parse configure script -set(protobuf_AC_INIT_REGEX - "^AC_INIT\\(\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\]\\)$") -file(STRINGS "${protobuf_CONFIGURE_SCRIPT}" protobuf_AC_INIT_LINE - LIMIT_COUNT 1 REGEX "^AC_INIT") -# Description -string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\1" - protobuf_DESCRIPTION "${protobuf_AC_INIT_LINE}") -# Version -string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2" - protobuf_VERSION_STRING "${protobuf_AC_INIT_LINE}") -# Contact -string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3" - protobuf_CONTACT "${protobuf_AC_INIT_LINE}") -# Parse version tweaks -set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1" - protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2" - protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3" - protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5" - protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}") - -message(STATUS "${protobuf_VERSION_PRERELEASE}") - -# Package version -set(protobuf_VERSION - "${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") - -if(protobuf_VERSION_PRERELEASE) - set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}") -else() - set(protobuf_VERSION "${protobuf_VERSION}.0") +project(protobuf) + +set(HASH_MAP_H ) +set(HASH_SET_H ) +set(HASH_NAMESPACE std) +set(HASH_MAP_CLASS unordered_map) +set(HASH_SET_CLASS unordered_set) +set(HAVE_HASH_MAP 1) +set(HAVE_HASH_SET 1) + +if(HAVE_HASH_MAP EQUAL 0) + message(SEND_ERROR "Could not find a working hash map implementation. Please install GCC >= 4.4, and all necessary 32-bit C++ development libraries.") endif() -message(STATUS "${protobuf_VERSION}") -if(protobuf_VERBOSE) - message(STATUS "Configuration script parsing status [") - message(STATUS " Description : ${protobuf_DESCRIPTION}") - message(STATUS " Version : ${protobuf_VERSION} (${protobuf_VERSION_STRING})") - message(STATUS " Contact : ${protobuf_CONTACT}") - message(STATUS "]") +if(UNIX) + find_package(Threads REQUIRED) endif() -add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD) - -if (protobuf_DISABLE_RTTI) - add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1) -endif() - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map -"{ - global: - main; - local: - *; -};") -# CheckLinkerFlag module available in CMake >=3.18. -if(${CMAKE_VERSION} VERSION_GREATER 3.18 OR ${CMAKE_VERSION} VERSION_EQUAL 3.18) - include(CheckLinkerFlag) - check_linker_flag(CXX -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map protobuf_HAVE_LD_VERSION_SCRIPT) -else() - include(CheckCXXSourceCompiles) - set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map) - check_cxx_source_compiles(" - int main() { - return 0; - } - " protobuf_HAVE_LD_VERSION_SCRIPT) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h") + +set(LIBPROTOBUF_LITE_HDRS + google/protobuf/io/coded_stream.h + google/protobuf/io/coded_stream_inl.h + google/protobuf/stubs/common.h + ${CMAKE_CURRENT_BINARY_DIR}/config.h + google/protobuf/extension_set.h + google/protobuf/generated_message_util.h + google/protobuf/stubs/hash.h + google/protobuf/stubs/map-util.h + google/protobuf/message_lite.h + google/protobuf/stubs/once.h + google/protobuf/repeated_field.h + google/protobuf/stubs/stl_util-inl.h + google/protobuf/wire_format_lite.h + google/protobuf/wire_format_lite_inl.h + google/protobuf/io/zero_copy_stream.h + google/protobuf/io/zero_copy_stream_impl_lite.h + google/protobuf/io/gzip_stream.h + google/protobuf/io/zero_copy_stream_impl.h +) + +set(LIBPROTOBUF_FULL_HDRS + google/protobuf/descriptor.h + google/protobuf/descriptor.pb.h + google/protobuf/descriptor_database.h + google/protobuf/dynamic_message.h + google/protobuf/generated_message_reflection.h + google/protobuf/compiler/importer.h + google/protobuf/message.h + google/protobuf/compiler/parser.h + google/protobuf/io/printer.h + google/protobuf/reflection_ops.h + google/protobuf/service.h + google/protobuf/stubs/strutil.h + google/protobuf/stubs/substitute.h + google/protobuf/text_format.h + google/protobuf/io/tokenizer.h + google/protobuf/unknown_field_set.h + google/protobuf/wire_format.h +) + +list(APPEND LIBPROTOBUF_FULL_HDRS ${LIBPROTOBUF_LITE_HDRS}) + +set(LIBPROTOBUF_LITE_SRCS + google/protobuf/io/coded_stream.cc + google/protobuf/stubs/common.cc + google/protobuf/extension_set.cc + google/protobuf/generated_message_util.cc + google/protobuf/message_lite.cc + google/protobuf/stubs/once.cc + google/protobuf/repeated_field.cc + google/protobuf/wire_format_lite.cc + google/protobuf/io/zero_copy_stream.cc + google/protobuf/io/zero_copy_stream_impl_lite.cc + google/protobuf/io/gzip_stream.cc + google/protobuf/io/zero_copy_stream_impl.cc +) + +set(LIBPROTOBUF_FULL_SRCS + google/protobuf/descriptor.cc + google/protobuf/descriptor.pb.cc + google/protobuf/descriptor_database.cc + google/protobuf/dynamic_message.cc + google/protobuf/extension_set_heavy.cc + google/protobuf/generated_message_reflection.cc + google/protobuf/compiler/importer.cc + google/protobuf/io/gzip_stream.cc + google/protobuf/message.cc + google/protobuf/compiler/parser.cc + google/protobuf/io/printer.cc + google/protobuf/reflection_ops.cc + google/protobuf/service.cc + google/protobuf/stubs/structurally_valid.cc + google/protobuf/stubs/strutil.cc + google/protobuf/stubs/substitute.cc + google/protobuf/text_format.cc + google/protobuf/io/tokenizer.cc + google/protobuf/unknown_field_set.cc + google/protobuf/wire_format.cc + google/protobuf/io/zero_copy_stream_impl.cc +) + +set(LIBPROTOC_HDRS + google/protobuf/compiler/code_generator.h + google/protobuf/compiler/command_line_interface.h + google/protobuf/compiler/cpp/cpp_enum.h + google/protobuf/compiler/cpp/cpp_enum_field.h + google/protobuf/compiler/cpp/cpp_extension.h + google/protobuf/compiler/cpp/cpp_field.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_message.h + google/protobuf/compiler/cpp/cpp_message_field.h + google/protobuf/compiler/cpp/cpp_primitive_field.h + google/protobuf/compiler/cpp/cpp_service.h + google/protobuf/compiler/cpp/cpp_string_field.h + google/protobuf/compiler/plugin.h + google/protobuf/compiler/plugin.pb.h + google/protobuf/compiler/subprocess.h + google/protobuf/compiler/zip_writer.h +) + +set(LIBPROTOC_SRCS + google/protobuf/compiler/code_generator.cc + google/protobuf/compiler/command_line_interface.cc + google/protobuf/compiler/cpp/cpp_enum.cc + google/protobuf/compiler/cpp/cpp_enum_field.cc + google/protobuf/compiler/cpp/cpp_extension.cc + google/protobuf/compiler/cpp/cpp_field.cc + google/protobuf/compiler/cpp/cpp_file.cc + google/protobuf/compiler/cpp/cpp_generator.cc + google/protobuf/compiler/cpp/cpp_helpers.cc + google/protobuf/compiler/cpp/cpp_message.cc + google/protobuf/compiler/cpp/cpp_message_field.cc + google/protobuf/compiler/cpp/cpp_primitive_field.cc + google/protobuf/compiler/cpp/cpp_service.cc + google/protobuf/compiler/cpp/cpp_string_field.cc + google/protobuf/compiler/plugin.cc + google/protobuf/compiler/plugin.pb.cc + google/protobuf/compiler/subprocess.cc + google/protobuf/compiler/zip_writer.cc +) + +list(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS}) + +if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Wno-unused-local-typedefs -Wno-misleading-indentation -Wno-class-memaccess -Wno-sign-compare") +elseif(MSVC) + # Disable warnings for integer conversion to smaller type + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") endif() -file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map) - -find_package(Threads REQUIRED) -set(_protobuf_FIND_ZLIB) -if (protobuf_WITH_ZLIB) - find_package(ZLIB) - if (ZLIB_FOUND) - set(HAVE_ZLIB 1) - # FindZLIB module define ZLIB_INCLUDE_DIRS variable - # Set ZLIB_INCLUDE_DIRECTORIES for compatible - set(ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRECTORIES} ${ZLIB_INCLUDE_DIRS}) - # Using imported target if exists - if (TARGET ZLIB::ZLIB) - set(ZLIB_LIBRARIES ZLIB::ZLIB) - set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()") - endif (TARGET ZLIB::ZLIB) - else (ZLIB_FOUND) - set(HAVE_ZLIB 0) - # Explicitly set these to empty (override NOT_FOUND) so cmake doesn't - # complain when we use them later. - set(ZLIB_INCLUDE_DIRECTORIES) - set(ZLIB_LIBRARIES) - endif (ZLIB_FOUND) -endif (protobuf_WITH_ZLIB) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +set(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${ZLIB_INCLUDE_DIRS}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) -if (HAVE_ZLIB) - add_definitions(-DHAVE_ZLIB) -endif (HAVE_ZLIB) +# Protobuf shared libraries -# We need to link with libatomic on systems that do not have builtin atomics, or -# don't have builtin support for 8 byte atomics -set(protobuf_LINK_LIBATOMIC false) -if (NOT MSVC) - include(CheckCXXSourceCompiles) - set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11) - check_cxx_source_compiles(" - #include - int main() { - return std::atomic{}; - } - " protobuf_HAVE_BUILTIN_ATOMICS) - if (NOT protobuf_HAVE_BUILTIN_ATOMICS) - set(protobuf_LINK_LIBATOMIC true) - endif (NOT protobuf_HAVE_BUILTIN_ATOMICS) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) -endif (NOT MSVC) +add_library(protobuf SHARED ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS}) +ide_folder(protobuf "Depends") +add_library(protobuf-lite SHARED ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS}) +ide_folder(protobuf-lite "Depends") -if (protobuf_BUILD_SHARED_LIBS) - set(protobuf_SHARED_OR_STATIC "SHARED") -else (protobuf_BUILD_SHARED_LIBS) - set(protobuf_SHARED_OR_STATIC "STATIC") - # The CMAKE__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) - if (protobuf_MSVC_STATIC_RUNTIME) - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) - else() - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>DLL) - endif() - 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) +set_target_properties(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) +set_target_properties(protobuf-lite PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) -if (MSVC) - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # Build with multiple processes - add_definitions(/MP) - endif() - # Set source file and execution character sets to UTF-8 - add_definitions(/utf-8) - # MSVC warning suppressions - add_definitions( - /wd4065 # switch statement contains 'default' but no 'case' labels - /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data - /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' - /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data - /wd4305 # 'identifier' : truncation from 'type1' to 'type2' - /wd4307 # 'operator' : integral constant overflow - /wd4309 # 'conversion' : truncation of constant value - /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' - /wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning) - /wd4996 # The compiler encountered a deprecated declaration. - ) - # Allow big object - add_definitions(/bigobj) - string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) - string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR}) - string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}") - configure_file(${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in extract_includes.bat) +target_link_libraries(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) +target_link_libraries(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) - # Suppress linker warnings about files with no symbols defined. - set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") +install(TARGETS protobuf-lite + LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} + RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) - 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() +if(NOT CMAKE_CROSSCOMPILING) + # Protobuf compiler shared library - # Generate the version.rc file used elsewhere. - configure_file(${protobuf_SOURCE_DIR}/cmake/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) - set(protobuf_version_rc_file ${CMAKE_CURRENT_BINARY_DIR}/version.rc) + add_library(protoc SHARED ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS}) + ide_folder(protoc "Depends") - # Add the "lib" prefix for generated .lib outputs. - set(LIB_PREFIX lib) -else (MSVC) - # No version.rc file. - set(protobuf_version_rc_file) + set_target_properties(protoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS) + target_link_libraries(protoc protobuf) - # When building with "make", "lib" prefix will be added automatically by - # the build tool. - set(LIB_PREFIX) -endif (MSVC) + # Protobuf compiler executable -include_directories( - ${ZLIB_INCLUDE_DIRECTORIES} - ${protobuf_BINARY_DIR} - ${protobuf_SOURCE_DIR}/src) + add_executable(protoc-bin google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h) + ide_folder(protoc-bin "Depends") -if (protobuf_UNICODE) - add_definitions(-DUNICODE -D_UNICODE) -endif (protobuf_UNICODE) + set_target_properties(protoc-bin PROPERTIES OUTPUT_NAME protoc) + target_link_libraries(protoc-bin protoc) -include(${protobuf_SOURCE_DIR}/cmake/libprotobuf-lite.cmake) -include(${protobuf_SOURCE_DIR}/cmake/libprotobuf.cmake) -if (protobuf_BUILD_LIBPROTOC) - include(${protobuf_SOURCE_DIR}/cmake/libprotoc.cmake) -endif (protobuf_BUILD_LIBPROTOC) -if (protobuf_BUILD_PROTOC_BINARIES) - include(${protobuf_SOURCE_DIR}/cmake/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) - enable_testing() - include(${protobuf_SOURCE_DIR}/cmake/tests.cmake) -endif (protobuf_BUILD_TESTS) - -if (protobuf_BUILD_CONFORMANCE) - include(${protobuf_SOURCE_DIR}/cmake/conformance.cmake) -endif (protobuf_BUILD_CONFORMANCE) - -if (protobuf_INSTALL) - include(${protobuf_SOURCE_DIR}/cmake/install.cmake) -endif (protobuf_INSTALL) - -if (protobuf_BUILD_EXAMPLES) - include(${protobuf_SOURCE_DIR}/cmake/examples.cmake) -endif (protobuf_BUILD_EXAMPLES) - -if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Configuring done") -endif(protobuf_VERBOSE) + export(TARGETS protoc-bin FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake ) +endif() diff --git a/depends/protobuf/LICENSE b/depends/protobuf/COPYING.txt similarity index 95% rename from depends/protobuf/LICENSE rename to depends/protobuf/COPYING.txt index 19b305b00..e1c4f52e7 100644 --- a/depends/protobuf/LICENSE +++ b/depends/protobuf/COPYING.txt @@ -1,32 +1,33 @@ -Copyright 2008 Google Inc. 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. - * 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. - -Code generated by the Protocol Buffer compiler is owned by the owner -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. +Copyright 2008, Google Inc. +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. + * 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. + +Code generated by the Protocol Buffer compiler is owned by the owner +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. diff --git a/depends/protobuf/cmake/CMakeLists.txt b/depends/protobuf/cmake/CMakeLists.txt deleted file mode 100644 index 4e3957358..000000000 --- a/depends/protobuf/cmake/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -message(WARNING "Calling of cmake with source directory set to \"cmake\" subdirectory of Protocol Buffers project is deprecated. Top-level directory of Protocol Buffers project should be used instead.") - -project(protobuf C CXX) - -set(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE TRUE) - -include(../CMakeLists.txt) diff --git a/depends/protobuf/cmake/README.md b/depends/protobuf/cmake/README.md deleted file mode 100644 index ce3e68023..000000000 --- a/depends/protobuf/cmake/README.md +++ /dev/null @@ -1,399 +0,0 @@ -This directory contains *CMake* files that can be used to build protobuf -with *MSVC* on *Windows*. You can build the project from *Command Prompt* -and using an *Visual Studio* IDE. - -You need to have [CMake](http://www.cmake.org), [Visual Studio](https://www.visualstudio.com) -and optionally [Git](http://git-scm.com) installed on your computer before proceeding. - -Most of the instructions will be given to the *Сommand Prompt*, but the same -actions can be performed using appropriate GUI tools. - -Environment Setup -================= - -Open the appropriate *Command Prompt* from the *Start* menu. - -For example *x86 Native Tools Command Prompt for VS 2019*: - - C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional> - -Change to your working directory: - - C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>cd C:\Path\to - C:\Path\to> - -Where *C:\Path\to* is path to your real working directory. - -Create a folder where protobuf headers/libraries/binaries will be installed after built: - - C:\Path\to>mkdir install - -If *cmake* command is not available from *Command Prompt*, add it to system *PATH* variable: - - C:\Path\to>set PATH=%PATH%;C:\Program Files (x86)\CMake\bin - -If *git* command is not available from *Command Prompt*, add it to system *PATH* variable: - - C:\Path\to>set PATH=%PATH%;C:\Program Files\Git\cmd - -Optionally, you will want to download [ninja](https://ninja-build.org/) and add it to your *PATH* variable. - - C:\Path\to>set PATH=%PATH%;C:\tools\ninja - -Good. Now you are ready to continue. - -Getting Sources -=============== - -You can get the latest stable source packages from the release page: - - https://github.com/protocolbuffers/protobuf/releases/latest - -For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if -you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package -contains C++ source already); if you need C++ and multiple other languages, -download `protobuf-all-[VERSION].tar.gz`. - -Or you can use git to clone from protobuf git repository. - - C:\Path\to> mkdir src & cd src - C:\Path\to\src> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git - -Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *main* -if you want to get the latest code. - -Go to the project folder: - - C:\Path\to\src> cd protobuf - C:\Path\to\src\protobuf> - -Remember to update any submodules if you are using git clone (you can skip this -step if you are using a release .tar.gz or .zip package): - -```console -C:\Path\to\src\protobuf> git submodule update --init --recursive -``` - -Good. Now you are ready for *CMake* configuration. - -CMake Configuration -=================== - -*CMake* supports a lot of different -[generators](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html) -for various native build systems. - -Of most interest to Windows programmers are the following: - -* [Makefile](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators). - This generates NMake Makefiles for Visual Studio. These work, but they are rather slow. - -* [Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators) - This generates a Visual Studio solution for the project. - -* [Ninja](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#ninja-generator) - This uses the external tool [Ninja](https://ninja-build.org/) to build. It is the fastest solution available. - -Note that as of Visual Studio 2015, Visual Studio includes -[support for opening directly CMake-based projects](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio). - -It is considered good practice not to build CMake projects in the source tree but in a separate folder. - -Create a temporary *build* folder and change your working directory to it: - - mkdir C:\Path\to\build\protobuf - cd C:\Path\to\build\protobuf - C:\Path\to\build\protobuf> - -The *Makefile* and *Ninja* generators can build the project in only one configuration, so you need to build -a separate folder for each configuration. - -To start using a *Release* configuration via the *NMmake* generator: - - C:\Path\to\build\protobuf>mkdir release & cd release - C:\Path\to\build\protobuf\release>cmake -G "NMake Makefiles" ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ - C:\Path\to\src\protobuf - -It will generate a *NMake* *Makefile* in the current directory. - -To use *Debug* configuration using *Ninja*: - - C:\Path\to\build\protobuf>mkdir debug & cd debug - C:\Path\to\build\protobuf\debug>cmake -G "Ninja" ^ - -DCMAKE_BUILD_TYPE=Debug ^ - -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ - C:\Path\to\src\protobuf - -It will generate *Ninja* build scripts in current directory. - -The *Visual Studio* generator is multi-configuration: it will generate a single *.sln* file that can be used for both *Debug* and *Release*: - - C:\Path\to\build\protobuf>mkdir solution & cd solution - C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^ - -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ - C:\Path\to\src\protobuf - -It will generate *Visual Studio* solution file *protobuf.sln* in current directory. - -Unit Tests ----------- - -Unit tests are being built along with the rest of protobuf. The unit tests require Google Mock (now a part of Google Test). - -A copy of [Google Test](https://github.com/google/googletest) is included as a Git submodule in the `third-party/googletest` folder. -(You do need to initialize the Git submodules as explained above.) - -Alternately, you may want to use protobuf in a larger set-up, you may want to use that standard CMake approach where -you build and install a shared copy of Google Test. - -After you've built and installed your Google Test copy, you need add the following definition to your *cmake* command line -during the configuration step: `-Dprotobuf_USE_EXTERNAL_GTEST=ON`. -This will cause the standard CMake `find_package(GTest REQUIRED)` to be used. - -[find_package](https://cmake.org/cmake/help/latest/command/find_package.html) will search in a default location, -which on Windows is *C:\Program Files*. This is most likely not what you want. You will want instead to search for -Google Test in your project's root directory (i.e. the same directory you've passed to `CMAKE_INSTALL_PREFIX` when -building Google Test). For this, you need to set the `CMAKE_PREFIX_PATH` CMake variable. (There are other ways in CMake, -see the [manual](https://cmake.org/cmake/help/latest/command/find_package.html) for details.) - -For example: - - C:\Path\to\build\protobuf>mkdir solution & cd solution - C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^ - -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ - -DCMAKE_PREFIX_PATH=C:\Path\to\my_big_project ^ - -Dprotobuf_USE_EXTERNAL_GTEST=ON ^ - C:\Path\to\src\protobuf - -In most cases, `CMAKE_PREFIX_PATH` and `CMAKE_INSTALL_PREFIX` will point to the same directory. - -To disable testing completely, you need to add the following argument to you *cmake* command line: `-Dprotobuf_BUILD_TESTS=OFF`. - -For example: - - C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^ - -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ - -Dprotobuf_BUILD_TESTS=OFF ^ - C:\Path\to\src\protobuf - -Compiling -========= - -The standard way to compile a *CMake* project is `cmake --build `. - - -Note that if your generator supports multiple configurations, you will probably want to specify which one to build: - - cmake --build C:\Path\to\build\protobuf\solution --config Release - -You can also run directly the build tool you've configured: - - C:\Path\to\build\protobuf\release>nmake - -or - - C:\Path\to\build\protobuf\debug>ninja - -And wait for the compilation to finish. - -If you prefer to use the IDE: - - * Open the generated protobuf.sln file in Microsoft Visual Studio. - * Choose "Debug" or "Release" configuration as desired. - * From the Build menu, choose "Build Solution". - -And wait for the compilation to finish. - -Testing -======= - -To run unit-tests, first you must compile protobuf as described above. -Then run: - - C:\Path\to\protobuf\cmake\build\release>ctest --progress --output-on-failure - -You can also build the `check` target (not idiomatic CMake usage, though): - - C:\Path\to\protobuf\cmake\build\release>cmake --build . --target check - -or - - C:\Path\to\build\protobuf\release>ninja check - -You can also build project *check* from Visual Studio solution. -Yes, it may sound strange, but it works. - -You should see output similar to: - - Running main() from gmock_main.cc - [==========] Running 1546 tests from 165 test cases. - - ... - - [==========] 1546 tests from 165 test cases ran. (2529 ms total) - [ PASSED ] 1546 tests. - -To run specific tests, you need to pass some command line arguments to the test program itself: - - C:\Path\to\build\protobuf\release>tests.exe --gtest_filter=AnyTest* - Running main() from gmock_main.cc - Note: Google Test filter = AnyTest* - [==========] Running 3 tests from 1 test case. - [----------] Global test environment set-up. - [----------] 3 tests from AnyTest - [ RUN ] AnyTest.TestPackAndUnpack - [ OK ] AnyTest.TestPackAndUnpack (0 ms) - [ RUN ] AnyTest.TestPackAndUnpackAny - [ OK ] AnyTest.TestPackAndUnpackAny (0 ms) - [ RUN ] AnyTest.TestIs - [ OK ] AnyTest.TestIs (0 ms) - [----------] 3 tests from AnyTest (1 ms total) - - [----------] Global test environment tear-down - [==========] 3 tests from 1 test case ran. (2 ms total) - [ PASSED ] 3 tests. - -Note that the tests must be run from the source folder. - -If all tests are passed, safely continue. - -Installing -========== - -To install protobuf to the *install* folder you've specified in the configuration step, you need to build the `install` target: - - cmake --build C:\Path\to\build\protobuf\solution --config Release --target install - -Or if you prefer: - - C:\Path\to\build\protobuf\release>nmake install - -or - - C:\Path\to\build\protobuf\debug>ninja install - -You can also build project *INSTALL* from Visual Studio solution. -It sounds not so strange and it works. - -This will create the following folders under the *install* location: - * bin - that contains protobuf *protoc.exe* compiler; - * include - that contains C++ headers and protobuf *.proto files; - * lib - that contains linking libraries and *CMake* configuration files for *protobuf* package. - -Now you can if needed: - * Copy the contents of the include directory to wherever you want to put headers. - * Copy protoc.exe wherever you put build tools (probably somewhere in your PATH). - * Copy linking libraries libprotobuf[d].lib, libprotobuf-lite[d].lib, and libprotoc[d].lib wherever you put libraries. - -To avoid conflicts between the MSVC debug and release runtime libraries, when -compiling a debug build of your application, you may need to link against a -debug build of libprotobufd.lib with "d" postfix. Similarly, release builds should link against -release libprotobuf.lib library. - -DLLs vs. static linking -======================= - -Static linking is now the default for the Protocol Buffer libraries. Due to -issues with Win32's use of a separate heap for each DLL, as well as binary -compatibility issues between different versions of MSVC's STL library, it is -recommended that you use static linkage only. However, it is possible to -build libprotobuf and libprotoc as DLLs if you really want. To do this, -do the following: - - * Add an additional flag `-Dprotobuf_BUILD_SHARED_LIBS=ON` when invoking cmake - * Follow the same steps as described in the above section. - * When compiling your project, make sure to `#define PROTOBUF_USE_DLLS`. - -When distributing your software to end users, we strongly recommend that you -do NOT install libprotobuf.dll or libprotoc.dll to any shared location. -Instead, keep these libraries next to your binaries, in your application's -own install directory. C++ makes it very difficult to maintain binary -compatibility between releases, so it is likely that future versions of these -libraries will *not* be usable as drop-in replacements. - -If your project is itself a DLL intended for use by third-party software, we -recommend that you do NOT expose protocol buffer objects in your library's -public interface, and that you statically link protocol buffers into your -library. - -ZLib support -============ - -If you want to include GzipInputStream and GzipOutputStream -(google/protobuf/io/gzip_stream.h) in libprotobuf, you will need to do a few -additional steps. - -Obtain a copy of the zlib library. The pre-compiled DLL at zlib.net works. -You need prepare it: - - * Make sure zlib's two headers are in your `C:\Path\to\install\include` path - * Make sure zlib's linking libraries (*.lib file) is in your - `C:\Path\to\install\lib` library path. - -You can also compile it from source by yourself. - -Getting sources: - - C:\Path\to\src>git clone -b v1.2.8 https://github.com/madler/zlib.git - C:\Path\to\src>cd zlib - -Compiling and Installing: - - C:\Path\to\src\zlib>mkdir C:\Path\to\build\zlib & cd C:\Path\to\build\zlib - C:\Path\to\build\zlib>mkdir release & cd release - C:\Path\to\build\zlib\release>cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_INSTALL_PREFIX=C:\Path\to\install C:\Path\to\src\zlib - C:\Path\to\src\zlib\build\release>cmake --build . --target install - -You can make *debug* version or use *Visual Studio* generator also as before for the -protobuf project. - -Now add *bin* folder from *install* to system *PATH*: - - C:\Path\to>set PATH=%PATH%;C:\Path\to\install\bin - -You need reconfigure protobuf with flag `-Dprotobuf_WITH_ZLIB=ON` when invoking cmake. - -Note that if you have compiled ZLIB yourself, as stated above, -further disable the option `-Dprotobuf_MSVC_STATIC_RUNTIME=OFF`. - -If it reports NOTFOUND for zlib_include or zlib_lib, you might haven't put -the headers or the .lib file in the right directory. - -If you already have ZLIB library and headers at some other location on your system then alternatively you can define following configuration flags to locate them: - - -DZLIB_INCLUDE_DIR= - -DZLIB_LIB= - -Build and testing protobuf as usual. - -Notes on Compiler Warnings -========================== - -The following warnings have been disabled while building the protobuf libraries -and compiler. You may have to disable some of them in your own project as -well, or live with them. - -* C4244 - Conversion from 'type1' to 'type2', possible loss of data. -* C4251 - 'identifier' : class 'type' needs to have dll-interface to be used by - clients of class 'type2' -* C4267 - Conversion from 'size_t' to 'type', possible loss of data. -* C4305 - 'identifier' : truncation from 'type1' to 'type2' -* C4355 - 'this' : used in base member initializer list -* C4800 - 'type' : forcing value to bool 'true' or 'false' (performance warning) -* C4996 - 'function': was declared deprecated - -C4251 is of particular note, if you are compiling the Protocol Buffer library -as a DLL (see previous section). The protocol buffer library uses templates in -its public interfaces. MSVC does not provide any reasonable way to export -template classes from a DLL. However, in practice, it appears that exporting -templates is not necessary anyway. Since the complete definition of any -template is available in the header files, anyone importing the DLL will just -end up compiling instances of the templates into their own binary. The -Protocol Buffer implementation does not rely on static template members being -unique, so there should be no problem with this, but MSVC prints warning -nevertheless. So, we disable it. Unfortunately, this warning will also be -produced when compiling code which merely uses protocol buffers, meaning you -may have to disable it in your code too. diff --git a/depends/protobuf/cmake/conformance.cmake b/depends/protobuf/cmake/conformance.cmake deleted file mode 100644 index d6c435ac3..000000000 --- a/depends/protobuf/cmake/conformance.cmake +++ /dev/null @@ -1,49 +0,0 @@ - -add_custom_command( - OUTPUT ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc - 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 -) - -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 ${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/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_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_proto2.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc -) - -target_include_directories( - conformance_test_runner - PUBLIC ${protobuf_SOURCE_DIR}/conformance) - -target_include_directories( - conformance_cpp - PUBLIC ${protobuf_SOURCE_DIR}/conformance) - -target_link_libraries(conformance_test_runner libprotobuf) -target_link_libraries(conformance_cpp libprotobuf) diff --git a/depends/protobuf/cmake/examples.cmake b/depends/protobuf/cmake/examples.cmake deleted file mode 100644 index 3b83d2b4c..000000000 --- a/depends/protobuf/cmake/examples.cmake +++ /dev/null @@ -1,57 +0,0 @@ -if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Examples Configuring...") -endif() - -get_filename_component(examples_dir "${protobuf_SOURCE_DIR}/examples" ABSOLUTE) - -if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Examples Configuring done") -endif() -include(ExternalProject) - -# Internal utility function: Create a custom target representing a build of examples with custom options. -function(add_examples_build NAME) - - ExternalProject_Add(${NAME} - PREFIX ${NAME} - SOURCE_DIR "${examples_dir}" - BINARY_DIR ${NAME} - STAMP_DIR ${NAME}/logs - INSTALL_COMMAND "" #Skip - LOG_CONFIGURE 1 - CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}" - "-Dprotobuf_VERBOSE:BOOL=${protobuf_VERBOSE}" - ${ARGN} - ) - set_property(TARGET ${NAME} PROPERTY FOLDER "Examples") - set_property(TARGET ${NAME} PROPERTY EXCLUDE_FROM_ALL TRUE) -endfunction() - -# Add examples as an external project. -# sub_directory cannot be used because the find_package(protobuf) call would cause failures with redefined targets. -add_examples_build(examples "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}") -add_dependencies(examples libprotobuf protoc) - -option(protobuf_BUILD_EXAMPLES_MULTITEST "Build Examples in multiple configurations. Useful for testing." OFF) -mark_as_advanced(protobuf_BUILD_EXAMPLES_MULTITEST) -if(protobuf_BUILD_EXAMPLES_MULTITEST) - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - - #Build using the legacy compatibility module. - add_examples_build(examples-legacy - "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}" - "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE" - ) - add_dependencies(examples-legacy libprotobuf protoc) - - #Build using the installed library. - add_examples_build(examples-installed - "-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" - ) - - #Build using the installed library in legacy compatibility mode. - add_examples_build(examples-installed-legacy - "-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" - "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE" - ) -endif() diff --git a/depends/protobuf/cmake/extract_includes.bat.in b/depends/protobuf/cmake/extract_includes.bat.in deleted file mode 100644 index 129282921..000000000 --- a/depends/protobuf/cmake/extract_includes.bat.in +++ /dev/null @@ -1,144 +0,0 @@ -mkdir include -mkdir include\google -mkdir include\google\protobuf -mkdir include\google\protobuf\compiler -mkdir include\google\protobuf\compiler\cpp -mkdir include\google\protobuf\compiler\csharp -mkdir include\google\protobuf\compiler\java -mkdir include\google\protobuf\compiler\objectivec -mkdir include\google\protobuf\compiler\php -mkdir include\google\protobuf\compiler\python -mkdir include\google\protobuf\compiler\ruby -mkdir include\google\protobuf\io -mkdir include\google\protobuf\stubs -mkdir include\google\protobuf\util -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h" include\google\protobuf\any.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h" include\google\protobuf\any.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h" include\google\protobuf\api.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h" include\google\protobuf\arena.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena_impl.h" include\google\protobuf\arena_impl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenaz_sampler.h" include\google\protobuf\arenaz_sampler.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\file.h" include\google\protobuf\compiler\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\generator.h" include\google\protobuf\compiler\cpp\generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\helpers.h" include\google\protobuf\compiler\cpp\helpers.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\names.h" include\google\protobuf\compiler\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\generator.h" include\google\protobuf\compiler\java\generator.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\kotlin_generator.h" include\google\protobuf\compiler\java\kotlin_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\names.h" include\google\protobuf\compiler\java\names.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 -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\generator.h" include\google\protobuf\compiler\python\generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\pyi_generator.h" include\google\protobuf\compiler\python\pyi_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h" include\google\protobuf\descriptor.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h" include\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\endian.h" include\google\protobuf\endian.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_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_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 -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\inlined_string_field.h" include\google\protobuf\inlined_string_field.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\io_win32.h" include\google\protobuf\io\io_win32.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h" include\google\protobuf\io\strtod.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h" include\google\protobuf\io\tokenizer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h" include\google\protobuf\io\zero_copy_stream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h" include\google\protobuf\io\zero_copy_stream_impl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h" include\google\protobuf\io\zero_copy_stream_impl_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h" include\google\protobuf\map.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h" include\google\protobuf\map_entry.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h" include\google\protobuf\map_entry_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h" include\google\protobuf\map_field.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h" include\google\protobuf\map_field_inl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h" include\google\protobuf\map_field_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h" include\google\protobuf\map_type_handler.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\google\protobuf\message.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\parse_context.h" include\google\protobuf\parse_context.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port.h" include\google\protobuf\port.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_def.inc" include\google\protobuf\port_def.inc -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" include\google\protobuf\port_undef.inc -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 -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h -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\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 -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\map_util.h" include\google\protobuf\stubs\map_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\strutil.h" include\google\protobuf\stubs\strutil.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h" include\google\protobuf\type.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h" include\google\protobuf\unknown_field_set.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\delimited_message_util.h" include\google\protobuf\util\delimited_message_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_comparator.h" include\google\protobuf\util\field_comparator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_mask_util.h" include\google\protobuf\util\field_mask_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\json_util.h" include\google\protobuf\util\json_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\message_differencer.h" include\google\protobuf\util\message_differencer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\time_util.h" include\google\protobuf\util\time_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h" include\google\protobuf\util\type_resolver.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h" include\google\protobuf\util\type_resolver_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" include\google\protobuf\wire_format.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.proto" include\google\protobuf\descriptor.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.proto" include\google\protobuf\duration.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.proto" include\google\protobuf\empty.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.proto" include\google\protobuf\field_mask.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.proto" include\google\protobuf\source_context.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.proto" include\google\protobuf\struct.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.proto" include\google\protobuf\timestamp.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.proto" include\google\protobuf\type.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.proto" include\google\protobuf\wrappers.proto diff --git a/depends/protobuf/cmake/install.cmake b/depends/protobuf/cmake/install.cmake deleted file mode 100644 index 825cb25fc..000000000 --- a/depends/protobuf/cmake/install.cmake +++ /dev/null @@ -1,156 +0,0 @@ -include(GNUInstallDirs) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake - ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake - ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY) - -set(_protobuf_libraries libprotobuf-lite libprotobuf) -if (protobuf_BUILD_LIBPROTOC) - list(APPEND _protobuf_libraries libprotoc) -endif (protobuf_BUILD_LIBPROTOC) - -foreach(_library ${_protobuf_libraries}) - set_property(TARGET ${_library} - PROPERTY INTERFACE_INCLUDE_DIRECTORIES - $ - $) - if (UNIX AND NOT APPLE) - set_property(TARGET ${_library} - PROPERTY INSTALL_RPATH "$ORIGIN") - elseif (APPLE) - set_property(TARGET ${_library} - PROPERTY INSTALL_RPATH "@loader_path") - endif() - install(TARGETS ${_library} EXPORT protobuf-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}) -endforeach() - -if (protobuf_BUILD_PROTOC_BINARIES) - install(TARGETS protoc EXPORT protobuf-targets - 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}") - elseif (APPLE) - set_property(TARGET protoc - PROPERTY INSTALL_RPATH "@loader_path/../lib") - endif() -endif (protobuf_BUILD_PROTOC_BINARIES) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - -file(STRINGS ${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in _extract_strings - REGEX "^copy") -foreach(_extract_string ${_extract_strings}) - string(REGEX REPLACE "^.* .+ include\\\\(.+)$" "\\1" - _header ${_extract_string}) - string(REPLACE "\\" "/" _header ${_header}) - get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/src/${_header}" ABSOLUTE) - get_filename_component(_extract_name ${_header} NAME) - get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" DIRECTORY) - if(EXISTS "${_extract_from}") - install(FILES "${_extract_from}" - DESTINATION "${_extract_to}" - COMPONENT protobuf-headers - RENAME "${_extract_name}") - else() - message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in " - "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" " - "but there not exists. The file will not be installed.") - endif() -endforeach() - -# Internal function for parsing auto tools scripts -function(_protobuf_auto_list FILE_NAME VARIABLE) - file(STRINGS ${FILE_NAME} _strings) - set(_list) - foreach(_string ${_strings}) - set(_found) - string(REGEX MATCH "^[ \t]*${VARIABLE}[ \t]*=[ \t]*" _found "${_string}") - if(_found) - string(LENGTH "${_found}" _length) - string(SUBSTRING "${_string}" ${_length} -1 _draft_list) - foreach(_item ${_draft_list}) - string(STRIP "${_item}" _item) - list(APPEND _list "${_item}") - endforeach() - endif() - endforeach() - set(${VARIABLE} ${_list} PARENT_SCOPE) -endfunction() - -# Install well-known type proto files -_protobuf_auto_list("${protobuf_SOURCE_DIR}/src/Makefile.am" nobase_dist_proto_DATA) -foreach(_file ${nobase_dist_proto_DATA}) - get_filename_component(_file_from "${protobuf_SOURCE_DIR}/src/${_file}" ABSOLUTE) - get_filename_component(_file_name ${_file} NAME) - get_filename_component(_dir ${_file} DIRECTORY) - if(EXISTS "${_file_from}") - install(FILES "${_file_from}" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_dir}" - COMPONENT protobuf-protos - RENAME "${_file_name}") - else() - message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in " - "\"${protobuf_SOURCE_DIR}/src/Makefile.am\" as nobase_dist_proto_DATA " - "but there not exists. The file will not be installed.") - endif() -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_SOURCE_DIR}/cmake/protobuf-config.cmake.in - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY) -configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config-version.cmake.in - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY) -configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-module.cmake.in - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY) -configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY) - -# Allows the build directory to be used as a find directory. - -if (protobuf_BUILD_PROTOC_BINARIES) - export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc - NAMESPACE protobuf:: - FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake - ) -else (protobuf_BUILD_PROTOC_BINARIES) - export(TARGETS libprotobuf-lite libprotobuf - NAMESPACE protobuf:: - FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake - ) -endif (protobuf_BUILD_PROTOC_BINARIES) - -install(EXPORT protobuf-targets - DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - NAMESPACE protobuf:: - COMPONENT protobuf-export) - -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ - DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - COMPONENT protobuf-export - PATTERN protobuf-targets.cmake EXCLUDE -) - -option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF) -if(protobuf_INSTALL_EXAMPLES) - install(DIRECTORY examples/ - DESTINATION "${CMAKE_INSTALL_EXAMPLEDIR}" - COMPONENT protobuf-examples) -endif() diff --git a/depends/protobuf/cmake/libprotobuf-lite.cmake b/depends/protobuf/cmake/libprotobuf-lite.cmake deleted file mode 100644 index 83e970312..000000000 --- a/depends/protobuf/cmake/libprotobuf-lite.cmake +++ /dev/null @@ -1,118 +0,0 @@ -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/arenaz_sampler.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_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 - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc -) - -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/arenaz_sampler.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.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_tctable_decl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/port.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/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/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/stl_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h -) - -add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${protobuf_version_rc_file}) -if(protobuf_HAVE_LD_VERSION_SCRIPT) - if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) - target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) - elseif(protobuf_BUILD_SHARED_LIBS) - target_link_libraries(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) - endif() - set_target_properties(libprotobuf-lite PROPERTIES - LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) -endif() -target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -if(protobuf_LINK_LIBATOMIC) - target_link_libraries(libprotobuf-lite PRIVATE atomic) -endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") - target_link_libraries(libprotobuf-lite PRIVATE log) -endif() -target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src) -if(protobuf_BUILD_SHARED_LIBS) - target_compile_definitions(libprotobuf-lite - PUBLIC PROTOBUF_USE_DLLS - PRIVATE LIBPROTOBUF_EXPORTS) -endif() -set_target_properties(libprotobuf-lite PROPERTIES - VERSION ${protobuf_VERSION} - SOVERSION 32 - OUTPUT_NAME ${LIB_PREFIX}protobuf-lite - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") -add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) diff --git a/depends/protobuf/cmake/libprotobuf.cmake b/depends/protobuf/cmake/libprotobuf.cmake deleted file mode 100644 index 07e4bcf57..000000000 --- a/depends/protobuf/cmake/libprotobuf.cmake +++ /dev/null @@ -1,134 +0,0 @@ -set(libprotobuf_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc - ${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_tctable_full.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/substitute.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/field_mask_utility.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_escaping.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_writer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/proto_writer.cc - ${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/utility.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.cc -) - -set(libprotobuf_includes - ${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 - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h - ${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_internal.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/text_format.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.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 -) - -add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${protobuf_version_rc_file}) -if(protobuf_HAVE_LD_VERSION_SCRIPT) - if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) - target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map) - elseif(protobuf_BUILD_SHARED_LIBS) - target_link_libraries(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map) - endif() - set_target_properties(libprotobuf PROPERTIES - LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map) -endif() -target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -if(protobuf_WITH_ZLIB) - target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES}) -endif() -if(protobuf_LINK_LIBATOMIC) - target_link_libraries(libprotobuf PRIVATE atomic) -endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") - target_link_libraries(libprotobuf PRIVATE log) -endif() -target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src) -if(protobuf_BUILD_SHARED_LIBS) - target_compile_definitions(libprotobuf - PUBLIC PROTOBUF_USE_DLLS - PRIVATE LIBPROTOBUF_EXPORTS) -endif() -set_target_properties(libprotobuf PROPERTIES - VERSION ${protobuf_VERSION} - SOVERSION 32 - OUTPUT_NAME ${LIB_PREFIX}protobuf - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") -add_library(protobuf::libprotobuf ALIAS libprotobuf) diff --git a/depends/protobuf/cmake/libprotoc.cmake b/depends/protobuf/cmake/libprotoc.cmake deleted file mode 100644 index 15a47e53f..000000000 --- a/depends/protobuf/cmake/libprotoc.cmake +++ /dev/null @@ -1,136 +0,0 @@ -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/enum.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/extension.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/file.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/padding_optimizer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/parse_function_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/service.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/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/context.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/extension.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/extension_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/file.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator_factory.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/kotlin_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/map_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_builder.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_builder_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/primitive_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/service.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/shared_code_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/string_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/string_field_lite.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/generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/pyi_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_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/file.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/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/java/generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/kotlin_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.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/php/php_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/pyi_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator.h -) - -add_library(libprotoc ${protobuf_SHARED_OR_STATIC} - ${libprotoc_files} ${libprotoc_headers} ${protobuf_version_rc_file}) -if(protobuf_HAVE_LD_VERSION_SCRIPT) - if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) - target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map) - elseif(protobuf_BUILD_SHARED_LIBS) - target_link_libraries(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map) - endif() - set_target_properties(libprotoc PROPERTIES - LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map) -endif() -target_link_libraries(libprotoc PRIVATE libprotobuf) -if(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} - SOVERSION 32 - OUTPUT_NAME ${LIB_PREFIX}protoc - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") -add_library(protobuf::libprotoc ALIAS libprotoc) diff --git a/depends/protobuf/cmake/protobuf-config-version.cmake.in b/depends/protobuf/cmake/protobuf-config-version.cmake.in deleted file mode 100644 index 3fa01763e..000000000 --- a/depends/protobuf/cmake/protobuf-config-version.cmake.in +++ /dev/null @@ -1,60 +0,0 @@ -set(PACKAGE_VERSION "@protobuf_VERSION@") -set(${PACKAGE_FIND_NAME}_VERSION_PRERELEASE "@protobuf_VERSION_PRERELEASE@" PARENT_SCOPE) - -# Prerelease versions cannot be passed in directly via the find_package command, -# so we allow users to specify it in a variable -if(NOT DEFINED "${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE") - set("${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}" "") -else() - set(PACKAGE_FIND_VERSION ${PACKAGE_FIND_VERSION}-${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}) -endif() -set(PACKAGE_FIND_VERSION_PRERELEASE "${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}") - -# VERSION_EQUAL ignores the prerelease strings, so we use STREQUAL. -if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) - set(PACKAGE_VERSION_EXACT TRUE) -endif() - -set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise - -if(PACKAGE_FIND_VERSION) #Only perform version checks if one is given - if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@") - set(PACKAGE_VERSION_COMPATIBLE FALSE) - elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) - set(PACKAGE_VERSION_COMPATIBLE FALSE) - elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) - # Do not match prerelease versions to non-prerelease version requests. - if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "") - message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@' or greater.") - set(PACKAGE_VERSION_COMPATIBLE FALSE) - endif() - - # Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers. - if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@") - set(PACKAGE_VERSION_COMPATIBLE FALSE) - endif() - endif() -endif() - -# Check and save build options used to create this package -macro(_check_and_save_build_option OPTION VALUE) - if(DEFINED ${PACKAGE_FIND_NAME}_${OPTION} AND - NOT ${PACKAGE_FIND_NAME}_${OPTION} STREQUAL ${VALUE}) - set(PACKAGE_VERSION_UNSUITABLE TRUE) - endif() - set(${PACKAGE_FIND_NAME}_${OPTION} ${VALUE} PARENT_SCOPE) -endmacro() -_check_and_save_build_option(WITH_ZLIB @protobuf_WITH_ZLIB@) -_check_and_save_build_option(MSVC_STATIC_RUNTIME @protobuf_MSVC_STATIC_RUNTIME@) -_check_and_save_build_option(BUILD_SHARED_LIBS @protobuf_BUILD_SHARED_LIBS@) - -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if(CMAKE_SIZEOF_VOID_P AND "@CMAKE_SIZEOF_VOID_P@") - # check that the installed version has the same 32/64bit-ness as the one which is currently searching: - if(NOT CMAKE_SIZEOF_VOID_P EQUAL "@CMAKE_SIZEOF_VOID_P@") - math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) - endif() -endif() - diff --git a/depends/protobuf/cmake/protobuf-config.cmake.in b/depends/protobuf/cmake/protobuf-config.cmake.in deleted file mode 100644 index 61669118c..000000000 --- a/depends/protobuf/cmake/protobuf-config.cmake.in +++ /dev/null @@ -1,169 +0,0 @@ -# User options -include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake") - -# Depend packages -@_protobuf_FIND_ZLIB@ - -# Imported targets -include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake") - -function(protobuf_generate) - include(CMakeParseArguments) - - set(_options APPEND_PATH) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS) - if(COMMAND target_sources) - list(APPEND _singleargs TARGET) - endif() - set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) - - cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") - - if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) - message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") - return() - endif() - - if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) - message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") - return() - endif() - - if(NOT protobuf_generate_LANGUAGE) - set(protobuf_generate_LANGUAGE cpp) - endif() - string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) - - if(NOT protobuf_generate_PROTOC_OUT_DIR) - set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) - set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}") - endif() - - foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS}) - # append comma - not using CMake lists and string replacement as users - # might have semicolons in options - if(_plugin_options) - set( _plugin_options "${_plugin_options},") - endif() - set(_plugin_options "${_plugin_options}${_option}") - endforeach() - - if(protobuf_generate_PLUGIN) - set(_plugin "--plugin=${protobuf_generate_PLUGIN}") - endif() - - if(NOT protobuf_generate_GENERATE_EXTENSIONS) - if(protobuf_generate_LANGUAGE STREQUAL cpp) - set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) - elseif(protobuf_generate_LANGUAGE STREQUAL python) - set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) - else() - message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") - return() - endif() - endif() - - if(protobuf_generate_TARGET) - get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) - foreach(_file ${_source_list}) - if(_file MATCHES "proto$") - list(APPEND protobuf_generate_PROTOS ${_file}) - endif() - endforeach() - endif() - - if(NOT protobuf_generate_PROTOS) - message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") - return() - endif() - - if(protobuf_generate_APPEND_PATH) - # Create an include path for each file specified - foreach(_file ${protobuf_generate_PROTOS}) - get_filename_component(_abs_file ${_file} ABSOLUTE) - get_filename_component(_abs_dir ${_abs_file} DIRECTORY) - list(FIND _protobuf_include_path ${_abs_dir} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${_abs_dir}) - endif() - endforeach() - endif() - - foreach(DIR ${protobuf_generate_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - 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(_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}) - list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") - endforeach() - list(APPEND _generated_srcs_all ${_generated_srcs}) - - set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}") - if(protobuf_generate_PROTOC_OPTIONS) - set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}") - endif() - if(_plugin_options) - set(_comment "${_comment}, plugin-options: ${_plugin_options}") - endif() - - add_custom_command( - OUTPUT ${_generated_srcs} - COMMAND protobuf::protoc - ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} - DEPENDS ${_abs_file} protobuf::protoc - COMMENT ${_comment} - VERBATIM ) - endforeach() - - set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) - if(protobuf_generate_OUT_VAR) - set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) - endif() - if(protobuf_generate_TARGET) - target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) - endif() - -endfunction() - -# CMake FindProtobuf module compatible file -if(protobuf_MODULE_COMPATIBLE) - include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake") -endif() diff --git a/depends/protobuf/cmake/protobuf-lite.pc.cmake b/depends/protobuf/cmake/protobuf-lite.pc.cmake deleted file mode 100644 index 9745cb89c..000000000 --- a/depends/protobuf/cmake/protobuf-lite.pc.cmake +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: Protocol Buffers -Description: Google's Data Interchange Format -Version: @protobuf_VERSION@ -Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} -Conflicts: protobuf diff --git a/depends/protobuf/cmake/protobuf-module.cmake.in b/depends/protobuf/cmake/protobuf-module.cmake.in deleted file mode 100644 index 0bb05e38f..000000000 --- a/depends/protobuf/cmake/protobuf-module.cmake.in +++ /dev/null @@ -1,189 +0,0 @@ -# This file contains backwards compatibility patches for various legacy functions and variables -# Functions - -function(PROTOBUF_GENERATE_CPP SRCS HDRS) - cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN}) - - set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") - if(NOT _proto_files) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") - return() - endif() - - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - set(_append_arg APPEND_PATH) - endif() - - if(DEFINED Protobuf_IMPORT_DIRS) - set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) - endif() - - set(_outvar) - protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) - - set(${SRCS}) - set(${HDRS}) - foreach(_file ${_outvar}) - if(_file MATCHES "cc$") - list(APPEND ${SRCS} ${_file}) - else() - list(APPEND ${HDRS} ${_file}) - endif() - endforeach() - set(${SRCS} ${${SRCS}} PARENT_SCOPE) - set(${HDRS} ${${HDRS}} PARENT_SCOPE) -endfunction() - -function(PROTOBUF_GENERATE_PYTHON SRCS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") - return() - endif() - - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - set(_append_arg APPEND_PATH) - endif() - - if(DEFINED Protobuf_IMPORT_DIRS) - set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) - endif() - - set(_outvar) - protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) - set(${SRCS} ${_outvar} PARENT_SCOPE) -endfunction() - -# Environment - -# Backwards compatibility -# Define camel case versions of input variables -foreach(UPPER - PROTOBUF_SRC_ROOT_FOLDER - PROTOBUF_IMPORT_DIRS - PROTOBUF_DEBUG - PROTOBUF_LIBRARY - PROTOBUF_PROTOC_LIBRARY - PROTOBUF_INCLUDE_DIR - PROTOBUF_PROTOC_EXECUTABLE - PROTOBUF_LIBRARY_DEBUG - PROTOBUF_PROTOC_LIBRARY_DEBUG - PROTOBUF_LITE_LIBRARY - PROTOBUF_LITE_LIBRARY_DEBUG - ) - if (DEFINED ${UPPER}) - string(REPLACE "PROTOBUF_" "Protobuf_" Camel ${UPPER}) - if (NOT DEFINED ${Camel}) - set(${Camel} ${${UPPER}}) - endif() - endif() -endforeach() - -if(DEFINED Protobuf_SRC_ROOT_FOLDER) - message(AUTHOR_WARNING "Variable Protobuf_SRC_ROOT_FOLDER defined, but not" - " used in CONFIG mode") -endif() - -include(SelectLibraryConfigurations) - -# Internal function: search for normal library as well as a debug one -# if the debug one is specified also include debug/optimized keywords -# in *_LIBRARIES variable -function(_protobuf_find_libraries name filename) - if(${name}_LIBRARIES) - # Use result recorded by a previous call. - elseif(${name}_LIBRARY) - # Honor cache entry used by CMake 3.5 and lower. - set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE) - elseif(TARGET protobuf::lib${filename}) - 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) - - select_library_configurations(${name}) - set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE) - set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE) - endif() -endfunction() - -# -# Main. -# - -# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc -# for each directory where a proto file is referenced. -if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH) - set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE) -endif() - -# The Protobuf library -_protobuf_find_libraries(Protobuf protobuf) - -# The Protobuf Lite library -_protobuf_find_libraries(Protobuf_LITE protobuf-lite) - -# The Protobuf Protoc Library -_protobuf_find_libraries(Protobuf_PROTOC protoc) - -# Set the include directory -get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf - INTERFACE_INCLUDE_DIRECTORIES) - -# Set the protoc Executable -if(NOT Protobuf_PROTOC_EXECUTABLE AND TARGET protobuf::protoc) - 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) - endif() - if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") - get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc - IMPORTED_LOCATION_NOCONFIG) - endif() -endif() - -# Version info variable -set(Protobuf_VERSION "@protobuf_VERSION@") - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf - REQUIRED_VARS Protobuf_PROTOC_EXECUTABLE Protobuf_LIBRARIES Protobuf_INCLUDE_DIRS - VERSION_VAR Protobuf_VERSION -) - -# Backwards compatibility -# Define upper case versions of output variables -foreach(Camel - Protobuf_VERSION - Protobuf_SRC_ROOT_FOLDER - Protobuf_IMPORT_DIRS - Protobuf_DEBUG - Protobuf_INCLUDE_DIRS - Protobuf_LIBRARIES - Protobuf_PROTOC_LIBRARIES - Protobuf_LITE_LIBRARIES - Protobuf_LIBRARY - Protobuf_PROTOC_LIBRARY - Protobuf_INCLUDE_DIR - Protobuf_PROTOC_EXECUTABLE - Protobuf_LIBRARY_DEBUG - Protobuf_PROTOC_LIBRARY_DEBUG - Protobuf_LITE_LIBRARY - Protobuf_LITE_LIBRARY_DEBUG - ) - string(TOUPPER ${Camel} UPPER) - set(${UPPER} ${${Camel}}) -endforeach() diff --git a/depends/protobuf/cmake/protobuf-options.cmake b/depends/protobuf/cmake/protobuf-options.cmake deleted file mode 100644 index 93ec898e4..000000000 --- a/depends/protobuf/cmake/protobuf-options.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# Verbose output -option(protobuf_VERBOSE "Enable for verbose output" OFF) -mark_as_advanced(protobuf_VERBOSE) - -# FindProtobuf module compatible -option(protobuf_MODULE_COMPATIBLE "CMake built-in FindProtobuf.cmake module compatible" OFF) -mark_as_advanced(protobuf_MODULE_COMPATIBLE) diff --git a/depends/protobuf/cmake/protobuf.pc.cmake b/depends/protobuf/cmake/protobuf.pc.cmake deleted file mode 100644 index f068e6926..000000000 --- a/depends/protobuf/cmake/protobuf.pc.cmake +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: Protocol Buffers -Description: Google's Data Interchange Format -Version: @protobuf_VERSION@ -Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} -Conflicts: protobuf-lite diff --git a/depends/protobuf/cmake/protoc.cmake b/depends/protobuf/cmake/protoc.cmake deleted file mode 100644 index 472b6421b..000000000 --- a/depends/protobuf/cmake/protoc.cmake +++ /dev/null @@ -1,13 +0,0 @@ -set(protoc_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/main.cc -) - -add_executable(protoc ${protoc_files} ${protobuf_version_rc_file}) -target_link_libraries(protoc - libprotoc - libprotobuf -) -add_executable(protobuf::protoc ALIAS protoc) - -set_target_properties(protoc PROPERTIES - VERSION ${protobuf_VERSION}) diff --git a/depends/protobuf/cmake/tests.cmake b/depends/protobuf/cmake/tests.cmake deleted file mode 100644 index 1905673bd..000000000 --- a/depends/protobuf/cmake/tests.cmake +++ /dev/null @@ -1,294 +0,0 @@ -option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF) - -option(protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "") - -option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH - "Using absolute test_plugin path in tests" ON) -mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) - -if (protobuf_USE_EXTERNAL_GTEST) - find_package(GTest REQUIRED) -else() - if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt") - message(FATAL_ERROR - "Cannot find third_party/googletest directory that's needed to " - "build tests. If you use git, make sure you have cloned submodules:\n" - " git submodule update --init --recursive\n" - "If instead you want to skip tests, run cmake with:\n" - " cmake -Dprotobuf_BUILD_TESTS=OFF\n") - endif() - - set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock") - set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest") - include_directories( - ${googlemock_source_dir} - ${googletest_source_dir} - ${googletest_source_dir}/include - ${googlemock_source_dir}/include - ) - - add_library(gmock STATIC - "${googlemock_source_dir}/src/gmock-all.cc" - "${googletest_source_dir}/src/gtest-all.cc" - ) - target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) - add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc") - target_link_libraries(gmock_main gmock) - - add_library(GTest::gmock ALIAS gmock) - add_library(GTest::gmock_main ALIAS gmock_main) -endif() - -set(lite_test_protos - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_unittest.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_lite.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public_lite.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto -) - -set(tests_protos - ${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_large_enum_value.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_proto2_unittest.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_unittest.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_arena.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_custom_options.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_drop_unknown_fields.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_embed_optimize_for.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_empty.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_enormous_descriptor.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_enum.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite_imports_nonlite.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset_wire_format.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_field_presence.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_generic_services.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_optimize_for.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum2.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena_lite.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_lite.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_optional.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_well_known_types.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/anys.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/books.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/default_value.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/default_value_test.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/field_mask.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/maps.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/oneofs.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/proto3.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/struct.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/timestamp_duration.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/wrappers.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_format.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_format_proto3.proto - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer_unittest.proto -) - -macro(compile_proto_file filename) - string(REPLACE .proto .pb.cc pb_file ${filename}) - add_custom_command( - OUTPUT ${pb_file} - DEPENDS ${protobuf_PROTOC_EXE} ${filename} - COMMAND ${protobuf_PROTOC_EXE} ${filename} - --proto_path=${protobuf_SOURCE_DIR}/src - --cpp_out=${protobuf_SOURCE_DIR}/src - --experimental_allow_proto3_optional - ) -endmacro(compile_proto_file) - -set(lite_test_proto_files) -foreach(proto_file ${lite_test_protos}) - compile_proto_file(${proto_file}) - set(lite_test_proto_files ${lite_test_proto_files} ${pb_file}) -endforeach(proto_file) - -set(tests_proto_files) -foreach(proto_file ${tests_protos}) - compile_proto_file(${proto_file}) - set(tests_proto_files ${tests_proto_files} ${pb_file}) -endforeach(proto_file) - -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 -) - -add_library(protobuf-lite-test-common STATIC - ${common_lite_test_files} ${lite_test_proto_files}) -target_link_libraries(protobuf-lite-test-common libprotobuf-lite GTest::gmock) - -set(common_test_files - ${common_lite_test_files} - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_test_util.inc - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_tester.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/test_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.cc -) - -add_library(protobuf-test-common STATIC - ${common_test_files} ${tests_proto_files}) -target_link_libraries(protobuf-test-common libprotobuf GTest::gmock) - -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/arenaz_sampler_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message_size_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/metadata_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/move_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/plugin_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/unittest.inc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/plugin_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/plugin_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/drop_unknown_fields_test.cc - ${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/generated_message_tctable_lite_test.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 - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer_unittest.cc - ${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 - ${protobuf_SOURCE_DIR}/src/google/protobuf/preserve_unknown_enum_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_arena_lite_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_arena_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_lite_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_lite_unittest.inc - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field_reflection_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util_test.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer_unittest.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util_test.cc - ${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 - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.inc -) - -if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) - add_compile_options(-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH="$") -endif() - -if(MINGW) - set_source_files_properties(${tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing") - - # required for tests on MinGW Win64 - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,16777216") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj") - endif() - -endif() - -if(protobuf_TEST_XML_OUTDIR) - if(NOT "${protobuf_TEST_XML_OUTDIR}" MATCHES "[/\\]$") - string(APPEND protobuf_TEST_XML_OUTDIR "/") - endif() - set(protobuf_GTEST_ARGS "--gtest_output=xml:${protobuf_TEST_XML_OUTDIR}") -else() - set(protobuf_GTEST_ARGS) -endif() - -add_executable(tests ${tests_files}) -if (MSVC) - target_compile_options(tests PRIVATE - /wd4146 # unary minus operator applied to unsigned type, result still unsigned - ) -endif() -target_link_libraries(tests protobuf-lite-test-common protobuf-test-common libprotoc libprotobuf GTest::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 -) - -add_executable(test_plugin ${test_plugin_files}) -target_link_libraries(test_plugin libprotoc libprotobuf GTest::gmock) - -set(lite_test_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/lite_unittest.cc -) -add_executable(lite-test ${lite_test_files}) -target_link_libraries(lite-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main) - -add_test(NAME lite-test - COMMAND lite-test ${protobuf_GTEST_ARGS}) - -set(lite_arena_test_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/lite_arena_unittest.cc -) -add_executable(lite-arena-test ${lite_arena_test_files}) -target_link_libraries(lite-arena-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main) - -add_test(NAME lite-arena-test - COMMAND lite-arena-test ${protobuf_GTEST_ARGS}) - -add_custom_target(check - COMMAND tests - DEPENDS tests test_plugin - WORKING_DIRECTORY ${protobuf_SOURCE_DIR}) - -add_test(NAME check - COMMAND tests ${protobuf_GTEST_ARGS} - WORKING_DIRECTORY "${protobuf_SOURCE_DIR}") diff --git a/depends/protobuf/cmake/version.rc.in b/depends/protobuf/cmake/version.rc.in deleted file mode 100644 index f6e7c4a3f..000000000 --- a/depends/protobuf/cmake/version.rc.in +++ /dev/null @@ -1,45 +0,0 @@ -#define VS_FF_DEBUG 0x1L -#define VS_VERSION_INFO 0x1L -#define VS_FFI_FILEFLAGSMASK 0x17L -#define VER_PRIVATEBUILD 0x0L -#define VER_PRERELEASE 0x0L -#define VOS__WINDOWS32 0x4L -#define VFT_DLL 0x2L -#define VFT2_UNKNOWN 0x0L - -#ifndef DEBUG -#define VER_DEBUG 0 -#else -#define VER_DEBUG VS_FF_DEBUG -#endif - - -VS_VERSION_INFO VERSIONINFO - FILEVERSION @protobuf_RC_FILEVERSION@ - PRODUCTVERSION @protobuf_RC_FILEVERSION@ - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS VER_DEBUG - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL -BEGIN - BLOCK "VarFileInfo" - BEGIN - // English language (0x409) and the Windows Unicode codepage (1200) - VALUE "Translation", 0x409, 1200 - END - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "Compiled with @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@\0" - VALUE "ProductVersion", "@protobuf_VERSION@\0" - VALUE "FileVersion", "@protobuf_VERSION@\0" - VALUE "InternalName", "protobuf\0" - VALUE "ProductName", "Protocol Buffers - Google's Data Interchange Format\0" - VALUE "CompanyName", "Google Inc.\0" - VALUE "LegalCopyright", "Copyright 2008 Google Inc. All rights reserved.\0" - VALUE "Licence", "BSD\0" - VALUE "Info", "https://developers.google.com/protocol-buffers/\0" - END - END -END diff --git a/depends/protobuf/config.guess b/depends/protobuf/config.guess deleted file mode 100755 index 7f76b6228..000000000 --- a/depends/protobuf/config.guess +++ /dev/null @@ -1,1754 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2022 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2022-01-09' - -# This file 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 3 of the License, 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 Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess -# -# Please send patches to . - - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX. However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2022 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -# Just in case it came from the environment. -GUESS= - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -tmp= -# shellcheck disable=SC2172 -trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 - -set_cc_for_build() { - # prevent multiple calls if $tmp is already set - test "$tmp" && return 0 - : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039,SC3028 - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } - dummy=$tmp/dummy - case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in - ,,) echo "int x;" > "$dummy.c" - for driver in cc gcc c89 c99 ; do - if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD=$driver - break - fi - done - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; - esac -} - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if test -f /.attbin/uname ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case $UNAME_SYSTEM in -Linux|GNU|GNU/*) - LIBC=unknown - - set_cc_for_build - cat <<-EOF > "$dummy.c" - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #elif defined(__GLIBC__) - LIBC=gnu - #else - #include - /* First heuristic to detect musl libc. */ - #ifdef __DEFINED_va_list - LIBC=musl - #endif - #endif - EOF - cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - eval "$cc_set_libc" - - # Second heuristic to detect musl libc. - if [ "$LIBC" = unknown ] && - command -v ldd >/dev/null && - ldd --version 2>&1 | grep -q ^musl; then - LIBC=musl - fi - - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - if [ "$LIBC" = unknown ]; then - LIBC=gnu - fi - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - echo unknown)` - case $UNAME_MACHINE_ARCH in - aarch64eb) machine=aarch64_be-unknown ;; - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; - *) machine=$UNAME_MACHINE_ARCH-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case $UNAME_MACHINE_ARCH in - earm*) - os=netbsdelf - ;; - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # Determine ABI tags. - case $UNAME_MACHINE_ARCH in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case $UNAME_VERSION in - Debian*) - release='-gnu' - ;; - *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - GUESS=$machine-${os}${release}${abi-} - ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE - ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE - ;; - *:SecBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE - ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE - ;; - *:MidnightBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE - ;; - *:ekkoBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE - ;; - *:SolidBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE - ;; - *:OS108:*:*) - GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE - ;; - macppc:MirBSD:*:*) - GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE - ;; - *:MirBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE - ;; - *:Sortix:*:*) - GUESS=$UNAME_MACHINE-unknown-sortix - ;; - *:Twizzler:*:*) - GUESS=$UNAME_MACHINE-unknown-twizzler - ;; - *:Redox:*:*) - GUESS=$UNAME_MACHINE-unknown-redox - ;; - mips:OSF1:*.*) - GUESS=mips-dec-osf1 - ;; - alpha:OSF1:*:*) - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - trap '' 0 - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case $ALPHA_CPU_TYPE in - "EV4 (21064)") - UNAME_MACHINE=alpha ;; - "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; - "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; - "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; - "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; - "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; - "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; - "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; - "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; - "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; - "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; - "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - GUESS=$UNAME_MACHINE-dec-osf$OSF_REL - ;; - Amiga*:UNIX_System_V:4.0:*) - GUESS=m68k-unknown-sysv4 - ;; - *:[Aa]miga[Oo][Ss]:*:*) - GUESS=$UNAME_MACHINE-unknown-amigaos - ;; - *:[Mm]orph[Oo][Ss]:*:*) - GUESS=$UNAME_MACHINE-unknown-morphos - ;; - *:OS/390:*:*) - GUESS=i370-ibm-openedition - ;; - *:z/VM:*:*) - GUESS=s390-ibm-zvmoe - ;; - *:OS400:*:*) - GUESS=powerpc-ibm-os400 - ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - GUESS=arm-acorn-riscix$UNAME_RELEASE - ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - GUESS=arm-unknown-riscos - ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - GUESS=hppa1.1-hitachi-hiuxmpp - ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - case `(/bin/universe) 2>/dev/null` in - att) GUESS=pyramid-pyramid-sysv3 ;; - *) GUESS=pyramid-pyramid-bsd ;; - esac - ;; - NILE*:*:*:dcosx) - GUESS=pyramid-pyramid-svr4 - ;; - DRS?6000:unix:4.0:6*) - GUESS=sparc-icl-nx6 - ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) GUESS=sparc-icl-nx7 ;; - esac - ;; - s390x:SunOS:*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL - ;; - sun4H:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-hal-solaris2$SUN_REL - ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-sun-solaris2$SUN_REL - ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - GUESS=i386-pc-auroraux$UNAME_RELEASE - ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - set_cc_for_build - SUN_ARCH=i386 - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH=x86_64 - fi - fi - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=$SUN_ARCH-pc-solaris2$SUN_REL - ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-sun-solaris3$SUN_REL - ;; - sun4*:SunOS:*:*) - case `/usr/bin/arch -k` in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` - GUESS=sparc-sun-sunos$SUN_REL - ;; - sun3*:SunOS:*:*) - GUESS=m68k-sun-sunos$UNAME_RELEASE - ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case `/bin/arch` in - sun3) - GUESS=m68k-sun-sunos$UNAME_RELEASE - ;; - sun4) - GUESS=sparc-sun-sunos$UNAME_RELEASE - ;; - esac - ;; - aushp:SunOS:*:*) - GUESS=sparc-auspex-sunos$UNAME_RELEASE - ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - GUESS=m68k-milan-mint$UNAME_RELEASE - ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - GUESS=m68k-hades-mint$UNAME_RELEASE - ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - GUESS=m68k-unknown-mint$UNAME_RELEASE - ;; - m68k:machten:*:*) - GUESS=m68k-apple-machten$UNAME_RELEASE - ;; - powerpc:machten:*:*) - GUESS=powerpc-apple-machten$UNAME_RELEASE - ;; - RISC*:Mach:*:*) - GUESS=mips-dec-mach_bsd4.3 - ;; - RISC*:ULTRIX:*:*) - GUESS=mips-dec-ultrix$UNAME_RELEASE - ;; - VAX*:ULTRIX*:*:*) - GUESS=vax-dec-ultrix$UNAME_RELEASE - ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - GUESS=clipper-intergraph-clix$UNAME_RELEASE - ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && - { echo "$SYSTEM_NAME"; exit; } - GUESS=mips-mips-riscos$UNAME_RELEASE - ;; - Motorola:PowerMAX_OS:*:*) - GUESS=powerpc-motorola-powermax - ;; - Motorola:*:4.3:PL8-*) - GUESS=powerpc-harris-powermax - ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - GUESS=powerpc-harris-powermax - ;; - Night_Hawk:Power_UNIX:*:*) - GUESS=powerpc-harris-powerunix - ;; - m88k:CX/UX:7*:*) - GUESS=m88k-harris-cxux7 - ;; - m88k:*:4*:R4*) - GUESS=m88k-motorola-sysv4 - ;; - m88k:*:3*:R3*) - GUESS=m88k-motorola-sysv3 - ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 - then - if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ - test "$TARGET_BINARY_INTERFACE"x = x - then - GUESS=m88k-dg-dgux$UNAME_RELEASE - else - GUESS=m88k-dg-dguxbcs$UNAME_RELEASE - fi - else - GUESS=i586-dg-dgux$UNAME_RELEASE - fi - ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - GUESS=m88k-dolphin-sysv3 - ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - GUESS=m88k-motorola-sysv3 - ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - GUESS=m88k-tektronix-sysv3 - ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - GUESS=m68k-tektronix-bsd - ;; - *:IRIX*:*:*) - IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` - GUESS=mips-sgi-irix$IRIX_REL - ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id - ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - GUESS=i386-ibm-aix - ;; - ia64:AIX:*:*) - if test -x /usr/bin/oslevel ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=$UNAME_VERSION.$UNAME_RELEASE - fi - GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV - ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` - then - GUESS=$SYSTEM_NAME - else - GUESS=rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - GUESS=rs6000-ibm-aix3.2.4 - else - GUESS=rs6000-ibm-aix3.2 - fi - ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if test -x /usr/bin/lslpp ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` - else - IBM_REV=$UNAME_VERSION.$UNAME_RELEASE - fi - GUESS=$IBM_ARCH-ibm-aix$IBM_REV - ;; - *:AIX:*:*) - GUESS=rs6000-ibm-aix - ;; - ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - GUESS=romp-ibm-bsd4.4 - ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to - ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - GUESS=rs6000-bull-bosx - ;; - DPX/2?00:B.O.S.:*:*) - GUESS=m68k-bull-sysv3 - ;; - 9000/[34]??:4.3bsd:1.*:*) - GUESS=m68k-hp-bsd - ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - GUESS=m68k-hp-bsd4.4 - ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` - case $UNAME_MACHINE in - 9000/31?) HP_ARCH=m68000 ;; - 9000/[34]??) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if test -x /usr/bin/getconf; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case $sc_cpu_version in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case $sc_kernel_bits in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 - esac ;; - esac - fi - if test "$HP_ARCH" = ""; then - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if test "$HP_ARCH" = hppa2.0w - then - set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH=hppa2.0w - else - HP_ARCH=hppa64 - fi - fi - GUESS=$HP_ARCH-hp-hpux$HPUX_REV - ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` - GUESS=ia64-hp-hpux$HPUX_REV - ;; - 3050*:HI-UX:*:*) - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - GUESS=unknown-hitachi-hiuxwe2 - ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - GUESS=hppa1.1-hp-bsd - ;; - 9000/8??:4.3bsd:*:*) - GUESS=hppa1.0-hp-bsd - ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - GUESS=hppa1.0-hp-mpeix - ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - GUESS=hppa1.1-hp-osf - ;; - hp8??:OSF1:*:*) - GUESS=hppa1.0-hp-osf - ;; - i*86:OSF1:*:*) - if test -x /usr/sbin/sysversion ; then - GUESS=$UNAME_MACHINE-unknown-osf1mk - else - GUESS=$UNAME_MACHINE-unknown-osf1 - fi - ;; - parisc*:Lites*:*:*) - GUESS=hppa1.1-hp-lites - ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - GUESS=c1-convex-bsd - ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - GUESS=c34-convex-bsd - ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - GUESS=c38-convex-bsd - ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - GUESS=c4-convex-bsd - ;; - CRAY*Y-MP:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=ymp-cray-unicos$CRAY_REL - ;; - CRAY*[A-Z]90:*:*:*) - echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=t90-cray-unicos$CRAY_REL - ;; - CRAY*T3E:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=alphaev5-cray-unicosmk$CRAY_REL - ;; - CRAY*SV1:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=sv1-cray-unicos$CRAY_REL - ;; - *:UNICOS/mp:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=craynv-cray-unicosmp$CRAY_REL - ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} - ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} - ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE - ;; - sparc*:BSD/OS:*:*) - GUESS=sparc-unknown-bsdi$UNAME_RELEASE - ;; - *:BSD/OS:*:*) - GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE - ;; - arm:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` - set_cc_for_build - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi - else - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf - fi - ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case $UNAME_PROCESSOR in - amd64) - UNAME_PROCESSOR=x86_64 ;; - i386) - UNAME_PROCESSOR=i586 ;; - esac - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL - ;; - i*:CYGWIN*:*) - GUESS=$UNAME_MACHINE-pc-cygwin - ;; - *:MINGW64*:*) - GUESS=$UNAME_MACHINE-pc-mingw64 - ;; - *:MINGW*:*) - GUESS=$UNAME_MACHINE-pc-mingw32 - ;; - *:MSYS*:*) - GUESS=$UNAME_MACHINE-pc-msys - ;; - i*:PW*:*) - GUESS=$UNAME_MACHINE-pc-pw32 - ;; - *:SerenityOS:*:*) - GUESS=$UNAME_MACHINE-pc-serenity - ;; - *:Interix*:*) - case $UNAME_MACHINE in - x86) - GUESS=i586-pc-interix$UNAME_RELEASE - ;; - authenticamd | genuineintel | EM64T) - GUESS=x86_64-unknown-interix$UNAME_RELEASE - ;; - IA64) - GUESS=ia64-unknown-interix$UNAME_RELEASE - ;; - esac ;; - i*:UWIN*:*) - GUESS=$UNAME_MACHINE-pc-uwin - ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - GUESS=x86_64-pc-cygwin - ;; - prep*:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=powerpcle-unknown-solaris2$SUN_REL - ;; - *:GNU:*:*) - # the GNU system - GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` - GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` - GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL - ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` - GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC - ;; - *:Minix:*:*) - GUESS=$UNAME_MACHINE-unknown-minix - ;; - aarch64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - arm*:Linux:*:*) - set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi - else - GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf - fi - fi - ;; - avr32*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - cris:Linux:*:*) - GUESS=$UNAME_MACHINE-axis-linux-$LIBC - ;; - crisv32:Linux:*:*) - GUESS=$UNAME_MACHINE-axis-linux-$LIBC - ;; - e2k:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - frv:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - hexagon:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - i*86:Linux:*:*) - GUESS=$UNAME_MACHINE-pc-linux-$LIBC - ;; - ia64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - k1om:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - m32r*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - m68*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - mips:Linux:*:* | mips64:Linux:*:*) - set_cc_for_build - IS_GLIBC=0 - test x"${LIBC}" = xgnu && IS_GLIBC=1 - sed 's/^ //' << EOF > "$dummy.c" - #undef CPU - #undef mips - #undef mipsel - #undef mips64 - #undef mips64el - #if ${IS_GLIBC} && defined(_ABI64) - LIBCABI=gnuabi64 - #else - #if ${IS_GLIBC} && defined(_ABIN32) - LIBCABI=gnuabin32 - #else - LIBCABI=${LIBC} - #endif - #endif - - #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa64r6 - #else - #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa32r6 - #else - #if defined(__mips64) - CPU=mips64 - #else - CPU=mips - #endif - #endif - #endif - - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - MIPS_ENDIAN=el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - MIPS_ENDIAN= - #else - MIPS_ENDIAN= - #endif - #endif -EOF - cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` - eval "$cc_set_vars" - test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } - ;; - mips64el:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - openrisc*:Linux:*:*) - GUESS=or1k-unknown-linux-$LIBC - ;; - or32:Linux:*:* | or1k*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - padre:Linux:*:*) - GUESS=sparc-unknown-linux-$LIBC - ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - GUESS=hppa64-unknown-linux-$LIBC - ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; - PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; - *) GUESS=hppa-unknown-linux-$LIBC ;; - esac - ;; - ppc64:Linux:*:*) - GUESS=powerpc64-unknown-linux-$LIBC - ;; - ppc:Linux:*:*) - GUESS=powerpc-unknown-linux-$LIBC - ;; - ppc64le:Linux:*:*) - GUESS=powerpc64le-unknown-linux-$LIBC - ;; - ppcle:Linux:*:*) - GUESS=powerpcle-unknown-linux-$LIBC - ;; - riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - s390:Linux:*:* | s390x:Linux:*:*) - GUESS=$UNAME_MACHINE-ibm-linux-$LIBC - ;; - sh64*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - sh*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - tile*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - vax:Linux:*:*) - GUESS=$UNAME_MACHINE-dec-linux-$LIBC - ;; - x86_64:Linux:*:*) - set_cc_for_build - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_X32 >/dev/null - then - LIBCABI=${LIBC}x32 - fi - fi - GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI - ;; - xtensa*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - GUESS=i386-sequent-sysv4 - ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION - ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - GUESS=$UNAME_MACHINE-pc-os2-emx - ;; - i*86:XTS-300:*:STOP) - GUESS=$UNAME_MACHINE-unknown-stop - ;; - i*86:atheos:*:*) - GUESS=$UNAME_MACHINE-unknown-atheos - ;; - i*86:syllable:*:*) - GUESS=$UNAME_MACHINE-pc-syllable - ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - GUESS=i386-unknown-lynxos$UNAME_RELEASE - ;; - i*86:*DOS:*:*) - GUESS=$UNAME_MACHINE-pc-msdosdjgpp - ;; - i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL - else - GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL - fi - ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL - else - GUESS=$UNAME_MACHINE-pc-sysv32 - fi - ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that - # this is a cross-build. - GUESS=i586-pc-msdosdjgpp - ;; - Intel:Mach:3*:*) - GUESS=i386-pc-mach3 - ;; - paragon:*:*:*) - GUESS=i860-intel-osf1 - ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 - fi - ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - GUESS=m68010-convergent-sysv - ;; - mc68k:UNIX:SYSTEM5:3.51m) - GUESS=m68k-convergent-sysv - ;; - M680?0:D-NIX:5.3:*) - GUESS=m68k-diab-dnix - ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - GUESS=m68k-unknown-lynxos$UNAME_RELEASE - ;; - mc68030:UNIX_System_V:4.*:*) - GUESS=m68k-atari-sysv4 - ;; - TSUNAMI:LynxOS:2.*:*) - GUESS=sparc-unknown-lynxos$UNAME_RELEASE - ;; - rs6000:LynxOS:2.*:*) - GUESS=rs6000-unknown-lynxos$UNAME_RELEASE - ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - GUESS=powerpc-unknown-lynxos$UNAME_RELEASE - ;; - SM[BE]S:UNIX_SV:*:*) - GUESS=mips-dde-sysv$UNAME_RELEASE - ;; - RM*:ReliantUNIX-*:*:*) - GUESS=mips-sni-sysv4 - ;; - RM*:SINIX-*:*:*) - GUESS=mips-sni-sysv4 - ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - GUESS=$UNAME_MACHINE-sni-sysv4 - else - GUESS=ns32k-sni-sysv - fi - ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - GUESS=i586-unisys-sysv4 - ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - GUESS=hppa1.1-stratus-sysv4 - ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - GUESS=i860-stratus-sysv4 - ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - GUESS=$UNAME_MACHINE-stratus-vos - ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - GUESS=hppa1.1-stratus-vos - ;; - mc68*:A/UX:*:*) - GUESS=m68k-apple-aux$UNAME_RELEASE - ;; - news*:NEWS-OS:6*:*) - GUESS=mips-sony-newsos6 - ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if test -d /usr/nec; then - GUESS=mips-nec-sysv$UNAME_RELEASE - else - GUESS=mips-unknown-sysv$UNAME_RELEASE - fi - ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - GUESS=powerpc-be-beos - ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - GUESS=powerpc-apple-beos - ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - GUESS=i586-pc-beos - ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - GUESS=i586-pc-haiku - ;; - x86_64:Haiku:*:*) - GUESS=x86_64-unknown-haiku - ;; - SX-4:SUPER-UX:*:*) - GUESS=sx4-nec-superux$UNAME_RELEASE - ;; - SX-5:SUPER-UX:*:*) - GUESS=sx5-nec-superux$UNAME_RELEASE - ;; - SX-6:SUPER-UX:*:*) - GUESS=sx6-nec-superux$UNAME_RELEASE - ;; - SX-7:SUPER-UX:*:*) - GUESS=sx7-nec-superux$UNAME_RELEASE - ;; - SX-8:SUPER-UX:*:*) - GUESS=sx8-nec-superux$UNAME_RELEASE - ;; - SX-8R:SUPER-UX:*:*) - GUESS=sx8r-nec-superux$UNAME_RELEASE - ;; - SX-ACE:SUPER-UX:*:*) - GUESS=sxace-nec-superux$UNAME_RELEASE - ;; - Power*:Rhapsody:*:*) - GUESS=powerpc-apple-rhapsody$UNAME_RELEASE - ;; - *:Rhapsody:*:*) - GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE - ;; - arm64:Darwin:*:*) - GUESS=aarch64-apple-darwin$UNAME_RELEASE - ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - if command -v xcode-select > /dev/null 2> /dev/null && \ - ! xcode-select --print-path > /dev/null 2> /dev/null ; then - # Avoid executing cc if there is no toolchain installed as - # cc will be a stub that puts up a graphical alert - # prompting the user to install developer tools. - CC_FOR_BUILD=no_compiler_found - else - set_cc_for_build - fi - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # uname -m returns i386 or x86_64 - UNAME_PROCESSOR=$UNAME_MACHINE - fi - GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE - ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE - ;; - *:QNX:*:4*) - GUESS=i386-pc-qnx - ;; - NEO-*:NONSTOP_KERNEL:*:*) - GUESS=neo-tandem-nsk$UNAME_RELEASE - ;; - NSE-*:NONSTOP_KERNEL:*:*) - GUESS=nse-tandem-nsk$UNAME_RELEASE - ;; - NSR-*:NONSTOP_KERNEL:*:*) - GUESS=nsr-tandem-nsk$UNAME_RELEASE - ;; - NSV-*:NONSTOP_KERNEL:*:*) - GUESS=nsv-tandem-nsk$UNAME_RELEASE - ;; - NSX-*:NONSTOP_KERNEL:*:*) - GUESS=nsx-tandem-nsk$UNAME_RELEASE - ;; - *:NonStop-UX:*:*) - GUESS=mips-compaq-nonstopux - ;; - BS2000:POSIX*:*:*) - GUESS=bs2000-siemens-sysv - ;; - DS/*:UNIX_System_V:*:*) - GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE - ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "${cputype-}" = 386; then - UNAME_MACHINE=i386 - elif test "x${cputype-}" != x; then - UNAME_MACHINE=$cputype - fi - GUESS=$UNAME_MACHINE-unknown-plan9 - ;; - *:TOPS-10:*:*) - GUESS=pdp10-unknown-tops10 - ;; - *:TENEX:*:*) - GUESS=pdp10-unknown-tenex - ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - GUESS=pdp10-dec-tops20 - ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - GUESS=pdp10-xkl-tops20 - ;; - *:TOPS-20:*:*) - GUESS=pdp10-unknown-tops20 - ;; - *:ITS:*:*) - GUESS=pdp10-unknown-its - ;; - SEI:*:*:SEIUX) - GUESS=mips-sei-seiux$UNAME_RELEASE - ;; - *:DragonFly:*:*) - DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL - ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case $UNAME_MACHINE in - A*) GUESS=alpha-dec-vms ;; - I*) GUESS=ia64-dec-vms ;; - V*) GUESS=vax-dec-vms ;; - esac ;; - *:XENIX:*:SysV) - GUESS=i386-pc-xenix - ;; - i*86:skyos:*:*) - SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` - GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL - ;; - i*86:rdos:*:*) - GUESS=$UNAME_MACHINE-pc-rdos - ;; - i*86:Fiwix:*:*) - GUESS=$UNAME_MACHINE-pc-fiwix - ;; - *:AROS:*:*) - GUESS=$UNAME_MACHINE-unknown-aros - ;; - x86_64:VMkernel:*:*) - GUESS=$UNAME_MACHINE-unknown-esx - ;; - amd64:Isilon\ OneFS:*:*) - GUESS=x86_64-unknown-onefs - ;; - *:Unleashed:*:*) - GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE - ;; -esac - -# Do we have a guess based on uname results? -if test "x$GUESS" != x; then - echo "$GUESS" - exit -fi - -# No uname command or uname output not recognized. -set_cc_for_build -cat > "$dummy.c" < -#include -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#include -#if defined(_SIZE_T_) || defined(SIGLOST) -#include -#endif -#endif -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); -#endif - -#if defined (vax) -#if !defined (ultrix) -#include -#if defined (BSD) -#if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -#else -#if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#endif -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#else -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname un; - uname (&un); - printf ("vax-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname *un; - uname (&un); - printf ("mips-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("mips-dec-ultrix\n"); exit (0); -#endif -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. -test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } - -echo "$0: unable to guess system type" >&2 - -case $UNAME_MACHINE:$UNAME_SYSTEM in - mips:Linux | mips64:Linux) - # If we got here on MIPS GNU/Linux, output extra information. - cat >&2 <&2 <&2 </dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" -EOF -fi - -exit 1 - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/depends/protobuf/config.h.in b/depends/protobuf/config.h.in index dfef8e3d9..7da01520a 100644 --- a/depends/protobuf/config.h.in +++ b/depends/protobuf/config.h.in @@ -1,218 +1,12 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* the name of */ -#undef HASH_MAP_CLASS - -/* the location of or */ -#undef HASH_MAP_H - -/* the namespace of hash_map/hash_set */ -#undef HASH_NAMESPACE - -/* the name of */ -#undef HASH_SET_CLASS - -/* the location of or */ -#undef HASH_SET_H - -/* define if the compiler supports basic C++11 syntax */ -#undef HAVE_CXX11 - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `ftruncate' function. */ -#undef HAVE_FTRUNCATE - -/* define if the compiler has hash_map */ -#undef HAVE_HASH_MAP - -/* define if the compiler has hash_set */ -#undef HAVE_HASH_SET - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the header file. */ -#undef HAVE_MINIX_CONFIG_H - -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - -/* Define if you have POSIX threads libraries and header files. */ -#undef HAVE_PTHREAD - -/* Have PTHREAD_PRIO_INHERIT. */ -#undef HAVE_PTHREAD_PRIO_INHERIT - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCHAR_H - -/* Enable classes using zlib compression. */ -#undef HAVE_ZLIB - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -#undef PTHREAD_CREATE_JOINABLE - -/* Define to 1 if all of the C90 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ -#undef STDC_HEADERS - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable general extensions on macOS. */ -#ifndef _DARWIN_C_SOURCE -# undef _DARWIN_C_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable X/Open compliant socket functions that do not require linking - with -lxnet on HP-UX 11.11. */ -#ifndef _HPUX_ALT_XOPEN_SOCKET_API -# undef _HPUX_ALT_XOPEN_SOCKET_API -#endif -/* Identify the host operating system as Minix. - This macro does not affect the system headers' behavior. - A future release of Autoconf may stop defining this macro. */ -#ifndef _MINIX -# undef _MINIX -#endif -/* Enable general extensions on NetBSD. - Enable NetBSD compatibility extensions on Minix. */ -#ifndef _NETBSD_SOURCE -# undef _NETBSD_SOURCE -#endif -/* Enable OpenBSD compatibility extensions on NetBSD. - Oddly enough, this does nothing on OpenBSD. */ -#ifndef _OPENBSD_SOURCE -# undef _OPENBSD_SOURCE -#endif -/* Define to 1 if needed for POSIX-compatible behavior. */ -#ifndef _POSIX_SOURCE -# undef _POSIX_SOURCE -#endif -/* Define to 2 if needed for POSIX-compatible behavior. */ -#ifndef _POSIX_1_SOURCE -# undef _POSIX_1_SOURCE -#endif -/* Enable POSIX-compatible threading on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ -#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ -#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -# undef __STDC_WANT_IEC_60559_BFP_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ -#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ -# undef __STDC_WANT_IEC_60559_DFP_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ -#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ -# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ -#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ -# undef __STDC_WANT_IEC_60559_TYPES_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ -#ifndef __STDC_WANT_LIB_EXT2__ -# undef __STDC_WANT_LIB_EXT2__ -#endif -/* Enable extensions specified by ISO/IEC 24747:2009. */ -#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ -# undef __STDC_WANT_MATH_SPEC_FUNCS__ -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable X/Open extensions. Define to 500 only if necessary - to make mbstate_t available. */ -#ifndef _XOPEN_SOURCE -# undef _XOPEN_SOURCE -#endif - - -/* Version number of package */ -#undef VERSION +#define HASH_MAP_H @HASH_MAP_H@ +#define HASH_SET_H @HASH_SET_H@ +#define HASH_MAP_CLASS @HASH_MAP_CLASS@ +#define HASH_SET_CLASS @HASH_SET_CLASS@ +#define HASH_NAMESPACE @HASH_NAMESPACE@ +#define HAVE_HASH_MAP @HAVE_HASH_MAP@ +#define HAVE_HASH_SET @HAVE_HASH_SET@ +#define HAVE_PTHREAD @CMAKE_USE_PTHREADS_INIT@ + +/* define if you want to use zlib. See readme.txt for additional + * requirements. */ +#define HAVE_ZLIB 1 diff --git a/depends/protobuf/config.sub b/depends/protobuf/config.sub deleted file mode 100755 index dba16e84c..000000000 --- a/depends/protobuf/config.sub +++ /dev/null @@ -1,1890 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2022 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2022-01-03' - -# This file 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 3 of the License, 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 Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX. However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2022 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo "$1" - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Split fields of configuration type -# shellcheck disable=SC2162 -saved_IFS=$IFS -IFS="-" read field1 field2 field3 field4 <&2 - exit 1 - ;; - *-*-*-*) - basic_machine=$field1-$field2 - basic_os=$field3-$field4 - ;; - *-*-*) - # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two - # parts - maybe_os=$field2-$field3 - case $maybe_os in - nto-qnx* | linux-* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) - basic_machine=$field1 - basic_os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - basic_os=linux-android - ;; - *) - basic_machine=$field1-$field2 - basic_os=$field3 - ;; - esac - ;; - *-*) - # A lone config we happen to match not fitting any pattern - case $field1-$field2 in - decstation-3100) - basic_machine=mips-dec - basic_os= - ;; - *-*) - # Second component is usually, but not always the OS - case $field2 in - # Prevent following clause from handling this valid os - sun*os*) - basic_machine=$field1 - basic_os=$field2 - ;; - zephyr*) - basic_machine=$field1-unknown - basic_os=$field2 - ;; - # Manufacturers - dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ - | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ - | unicom* | ibm* | next | hp | isi* | apollo | altos* \ - | convergent* | ncr* | news | 32* | 3600* | 3100* \ - | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ - | ultra | tti* | harris | dolphin | highlevel | gould \ - | cbm | ns | masscomp | apple | axis | knuth | cray \ - | microblaze* | sim | cisco \ - | oki | wec | wrs | winbond) - basic_machine=$field1-$field2 - basic_os= - ;; - *) - basic_machine=$field1 - basic_os=$field2 - ;; - esac - ;; - esac - ;; - *) - # Convert single-component short-hands not valid as part of - # multi-component configurations. - case $field1 in - 386bsd) - basic_machine=i386-pc - basic_os=bsd - ;; - a29khif) - basic_machine=a29k-amd - basic_os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - basic_os=scout - ;; - alliant) - basic_machine=fx80-alliant - basic_os= - ;; - altos | altos3068) - basic_machine=m68k-altos - basic_os= - ;; - am29k) - basic_machine=a29k-none - basic_os=bsd - ;; - amdahl) - basic_machine=580-amdahl - basic_os=sysv - ;; - amiga) - basic_machine=m68k-unknown - basic_os= - ;; - amigaos | amigados) - basic_machine=m68k-unknown - basic_os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - basic_os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - basic_os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - basic_os=bsd - ;; - aros) - basic_machine=i386-pc - basic_os=aros - ;; - aux) - basic_machine=m68k-apple - basic_os=aux - ;; - balance) - basic_machine=ns32k-sequent - basic_os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - basic_os=linux - ;; - cegcc) - basic_machine=arm-unknown - basic_os=cegcc - ;; - convex-c1) - basic_machine=c1-convex - basic_os=bsd - ;; - convex-c2) - basic_machine=c2-convex - basic_os=bsd - ;; - convex-c32) - basic_machine=c32-convex - basic_os=bsd - ;; - convex-c34) - basic_machine=c34-convex - basic_os=bsd - ;; - convex-c38) - basic_machine=c38-convex - basic_os=bsd - ;; - cray) - basic_machine=j90-cray - basic_os=unicos - ;; - crds | unos) - basic_machine=m68k-crds - basic_os= - ;; - da30) - basic_machine=m68k-da30 - basic_os= - ;; - decstation | pmax | pmin | dec3100 | decstatn) - basic_machine=mips-dec - basic_os= - ;; - delta88) - basic_machine=m88k-motorola - basic_os=sysv3 - ;; - dicos) - basic_machine=i686-pc - basic_os=dicos - ;; - djgpp) - basic_machine=i586-pc - basic_os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - basic_os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - basic_os=ose - ;; - gmicro) - basic_machine=tron-gmicro - basic_os=sysv - ;; - go32) - basic_machine=i386-pc - basic_os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - basic_os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - basic_os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - basic_os=hms - ;; - harris) - basic_machine=m88k-harris - basic_os=sysv3 - ;; - hp300 | hp300hpux) - basic_machine=m68k-hp - basic_os=hpux - ;; - hp300bsd) - basic_machine=m68k-hp - basic_os=bsd - ;; - hppaosf) - basic_machine=hppa1.1-hp - basic_os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - basic_os=proelf - ;; - i386mach) - basic_machine=i386-mach - basic_os=mach - ;; - isi68 | isi) - basic_machine=m68k-isi - basic_os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - basic_os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - basic_os=sysv - ;; - merlin) - basic_machine=ns32k-utek - basic_os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - basic_os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - basic_os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - basic_os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - basic_os=coff - ;; - morphos) - basic_machine=powerpc-unknown - basic_os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - basic_os=moxiebox - ;; - msdos) - basic_machine=i386-pc - basic_os=msdos - ;; - msys) - basic_machine=i686-pc - basic_os=msys - ;; - mvs) - basic_machine=i370-ibm - basic_os=mvs - ;; - nacl) - basic_machine=le32-unknown - basic_os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - basic_os=sysv4 - ;; - netbsd386) - basic_machine=i386-pc - basic_os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - basic_os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - basic_os=newsos - ;; - news1000) - basic_machine=m68030-sony - basic_os=newsos - ;; - necv70) - basic_machine=v70-nec - basic_os=sysv - ;; - nh3000) - basic_machine=m68k-harris - basic_os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - basic_os=cxux - ;; - nindy960) - basic_machine=i960-intel - basic_os=nindy - ;; - mon960) - basic_machine=i960-intel - basic_os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - basic_os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - basic_os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - basic_os=ose - ;; - os68k) - basic_machine=m68k-none - basic_os=os68k - ;; - paragon) - basic_machine=i860-intel - basic_os=osf - ;; - parisc) - basic_machine=hppa-unknown - basic_os=linux - ;; - psp) - basic_machine=mipsallegrexel-sony - basic_os=psp - ;; - pw32) - basic_machine=i586-unknown - basic_os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - basic_os=rdos - ;; - rdos32) - basic_machine=i386-pc - basic_os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - basic_os=coff - ;; - sa29200) - basic_machine=a29k-amd - basic_os=udi - ;; - sei) - basic_machine=mips-sei - basic_os=seiux - ;; - sequent) - basic_machine=i386-sequent - basic_os= - ;; - sps7) - basic_machine=m68k-bull - basic_os=sysv2 - ;; - st2000) - basic_machine=m68k-tandem - basic_os= - ;; - stratus) - basic_machine=i860-stratus - basic_os=sysv4 - ;; - sun2) - basic_machine=m68000-sun - basic_os= - ;; - sun2os3) - basic_machine=m68000-sun - basic_os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - basic_os=sunos4 - ;; - sun3) - basic_machine=m68k-sun - basic_os= - ;; - sun3os3) - basic_machine=m68k-sun - basic_os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - basic_os=sunos4 - ;; - sun4) - basic_machine=sparc-sun - basic_os= - ;; - sun4os3) - basic_machine=sparc-sun - basic_os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - basic_os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - basic_os=solaris2 - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - basic_os= - ;; - sv1) - basic_machine=sv1-cray - basic_os=unicos - ;; - symmetry) - basic_machine=i386-sequent - basic_os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - basic_os=unicos - ;; - t90) - basic_machine=t90-cray - basic_os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - basic_os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - basic_os=tpf - ;; - udi29k) - basic_machine=a29k-amd - basic_os=udi - ;; - ultra3) - basic_machine=a29k-nyu - basic_os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - basic_os=none - ;; - vaxv) - basic_machine=vax-dec - basic_os=sysv - ;; - vms) - basic_machine=vax-dec - basic_os=vms - ;; - vsta) - basic_machine=i386-pc - basic_os=vsta - ;; - vxworks960) - basic_machine=i960-wrs - basic_os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - basic_os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - basic_os=vxworks - ;; - xbox) - basic_machine=i686-pc - basic_os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - basic_os=unicos - ;; - *) - basic_machine=$1 - basic_os= - ;; - esac - ;; -esac - -# Decode 1-component or ad-hoc basic machines -case $basic_machine in - # Here we handle the default manufacturer of certain CPU types. It is in - # some cases the only manufacturer, in others, it is the most popular. - w89k) - cpu=hppa1.1 - vendor=winbond - ;; - op50n) - cpu=hppa1.1 - vendor=oki - ;; - op60c) - cpu=hppa1.1 - vendor=oki - ;; - ibm*) - cpu=i370 - vendor=ibm - ;; - orion105) - cpu=clipper - vendor=highlevel - ;; - mac | mpw | mac-mpw) - cpu=m68k - vendor=apple - ;; - pmac | pmac-mpw) - cpu=powerpc - vendor=apple - ;; - - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - cpu=m68000 - vendor=att - ;; - 3b*) - cpu=we32k - vendor=att - ;; - bluegene*) - cpu=powerpc - vendor=ibm - basic_os=cnk - ;; - decsystem10* | dec10*) - cpu=pdp10 - vendor=dec - basic_os=tops10 - ;; - decsystem20* | dec20*) - cpu=pdp10 - vendor=dec - basic_os=tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - ;; - dpx2*) - cpu=m68k - vendor=bull - basic_os=sysv3 - ;; - encore | umax | mmax) - cpu=ns32k - vendor=encore - ;; - elxsi) - cpu=elxsi - vendor=elxsi - basic_os=${basic_os:-bsd} - ;; - fx2800) - cpu=i860 - vendor=alliant - ;; - genix) - cpu=ns32k - vendor=ns - ;; - h3050r* | hiux*) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - cpu=m68000 - vendor=hp - ;; - hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - i*86v32) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv32 - ;; - i*86v4*) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv4 - ;; - i*86v) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv - ;; - i*86sol2) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=solaris2 - ;; - j90 | j90-cray) - cpu=j90 - vendor=cray - basic_os=${basic_os:-unicos} - ;; - iris | iris4d) - cpu=mips - vendor=sgi - case $basic_os in - irix*) - ;; - *) - basic_os=irix4 - ;; - esac - ;; - miniframe) - cpu=m68000 - vendor=convergent - ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) - cpu=m68k - vendor=atari - basic_os=mint - ;; - news-3600 | risc-news) - cpu=mips - vendor=sony - basic_os=newsos - ;; - next | m*-next) - cpu=m68k - vendor=next - case $basic_os in - openstep*) - ;; - nextstep*) - ;; - ns2*) - basic_os=nextstep2 - ;; - *) - basic_os=nextstep3 - ;; - esac - ;; - np1) - cpu=np1 - vendor=gould - ;; - op50n-* | op60c-*) - cpu=hppa1.1 - vendor=oki - basic_os=proelf - ;; - pa-hitachi) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - pbd) - cpu=sparc - vendor=tti - ;; - pbb) - cpu=m68k - vendor=tti - ;; - pc532) - cpu=ns32k - vendor=pc532 - ;; - pn) - cpu=pn - vendor=gould - ;; - power) - cpu=power - vendor=ibm - ;; - ps2) - cpu=i386 - vendor=ibm - ;; - rm[46]00) - cpu=mips - vendor=siemens - ;; - rtpc | rtpc-*) - cpu=romp - vendor=ibm - ;; - sde) - cpu=mipsisa32 - vendor=sde - basic_os=${basic_os:-elf} - ;; - simso-wrs) - cpu=sparclite - vendor=wrs - basic_os=vxworks - ;; - tower | tower-32) - cpu=m68k - vendor=ncr - ;; - vpp*|vx|vx-*) - cpu=f301 - vendor=fujitsu - ;; - w65) - cpu=w65 - vendor=wdc - ;; - w89k-*) - cpu=hppa1.1 - vendor=winbond - basic_os=proelf - ;; - none) - cpu=none - vendor=none - ;; - leon|leon[3-9]) - cpu=sparc - vendor=$basic_machine - ;; - leon-*|leon[3-9]-*) - cpu=sparc - vendor=`echo "$basic_machine" | sed 's/-.*//'` - ;; - - *-*) - # shellcheck disable=SC2162 - saved_IFS=$IFS - IFS="-" read cpu vendor <&2 - exit 1 - ;; - esac - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $vendor in - digital*) - vendor=dec - ;; - commodore*) - vendor=cbm - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if test x$basic_os != x -then - -# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just -# set os. -case $basic_os in - gnu/linux*) - kernel=linux - os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` - ;; - os2-emx) - kernel=os2 - os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` - ;; - nto-qnx*) - kernel=nto - os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` - ;; - *-*) - # shellcheck disable=SC2162 - saved_IFS=$IFS - IFS="-" read kernel os <&2 - exit 1 - ;; -esac - -# As a final step for OS-related things, validate the OS-kernel combination -# (given a valid OS), if there is a kernel. -case $kernel-$os in - linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ - | linux-musl* | linux-relibc* | linux-uclibc* ) - ;; - uclinux-uclibc* ) - ;; - -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) - # These are just libc implementations, not actual OSes, and thus - # require a kernel. - echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 - exit 1 - ;; - kfreebsd*-gnu* | kopensolaris*-gnu*) - ;; - vxworks-simlinux | vxworks-simwindows | vxworks-spe) - ;; - nto-qnx*) - ;; - os2-emx) - ;; - *-eabi* | *-gnueabi*) - ;; - -*) - # Blank kernel with real OS is always fine. - ;; - *-*) - echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 - exit 1 - ;; -esac - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -case $vendor in - unknown) - case $cpu-$os in - *-riscix*) - vendor=acorn - ;; - *-sunos*) - vendor=sun - ;; - *-cnk* | *-aix*) - vendor=ibm - ;; - *-beos*) - vendor=be - ;; - *-hpux*) - vendor=hp - ;; - *-mpeix*) - vendor=hp - ;; - *-hiux*) - vendor=hitachi - ;; - *-unos*) - vendor=crds - ;; - *-dgux*) - vendor=dg - ;; - *-luna*) - vendor=omron - ;; - *-genix*) - vendor=ns - ;; - *-clix*) - vendor=intergraph - ;; - *-mvs* | *-opened*) - vendor=ibm - ;; - *-os400*) - vendor=ibm - ;; - s390-* | s390x-*) - vendor=ibm - ;; - *-ptx*) - vendor=sequent - ;; - *-tpf*) - vendor=ibm - ;; - *-vxsim* | *-vxworks* | *-windiss*) - vendor=wrs - ;; - *-aux*) - vendor=apple - ;; - *-hms*) - vendor=hitachi - ;; - *-mpw* | *-macos*) - vendor=apple - ;; - *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) - vendor=atari - ;; - *-vos*) - vendor=stratus - ;; - esac - ;; -esac - -echo "$cpu-$vendor-${kernel:+$kernel-}$os" -exit - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/depends/protobuf/configure b/depends/protobuf/configure deleted file mode 100755 index 5f62ba9c8..000000000 --- a/depends/protobuf/configure +++ /dev/null @@ -1,25276 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for Protocol Buffers 3.21.10. -# -# Report bugs to . -# -# -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, -# Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else $as_nop - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. -as_nl=' -' -export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi - -# The user is always right. -if ${PATH_SEPARATOR+false} :; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else \$as_nop - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ) -then : - -else \$as_nop - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -blah=\$(echo \$(echo blah)) -test x\"\$blah\" = xblah || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null -then : - as_have_required=yes -else $as_nop - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null -then : - -else $as_nop - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : - CONFIG_SHELL=$as_shell as_have_required=yes - if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null -then : - break 2 -fi -fi - done;; - esac - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi -fi - - - if test "x$CONFIG_SHELL" != x -then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno -then : - printf "%s\n" "$0: This script requires a shell more modern than all" - printf "%s\n" "$0: the shells that I found on your system." - if test ${ZSH_VERSION+y} ; then - printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" - printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." - else - printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and -$0: protobuf@googlegroups.com about your system, including -$0: any error possibly output before this message. Then -$0: install a modern shell, or manually run the script -$0: under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else $as_nop - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else $as_nop - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - printf "%s\n" "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='Protocol Buffers' -PACKAGE_TARNAME='protobuf' -PACKAGE_VERSION='3.21.10' -PACKAGE_STRING='Protocol Buffers 3.21.10' -PACKAGE_BUGREPORT='protobuf@googlegroups.com' -PACKAGE_URL='' - -ac_unique_file="src/google/protobuf/message.cc" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_STDIO_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_header_cxx_list= -enable_option_checking=no -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -subdirs -LIBLOG_LIBS -OBJC_CONFORMANCE_TEST_FALSE -OBJC_CONFORMANCE_TEST_TRUE -HAVE_PTHREAD_FALSE -HAVE_PTHREAD_TRUE -PTHREAD_CFLAGS -PTHREAD_LIBS -PTHREAD_CC -ax_pthread_config -USE_EXTERNAL_PROTOC_FALSE -USE_EXTERNAL_PROTOC_TRUE -PROTOC -LIBATOMIC_LIBS -HAVE_CXX11 -HAVE_ZLIB_FALSE -HAVE_ZLIB_TRUE -POW_LIB -LIBOBJS -HAVE_LD_VERSION_SCRIPT_FALSE -HAVE_LD_VERSION_SCRIPT_TRUE -LT_SYS_LIBRARY_PATH -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -RANLIB -DLLTOOL -OBJDUMP -FILECMD -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -LIBTOOL -ISAINFO -PROTOBUF_OPT_FLAG -am__fastdepOBJC_FALSE -am__fastdepOBJC_TRUE -OBJCDEPMODE -ac_ct_OBJC -OBJCFLAGS -OBJC -GCC_FALSE -GCC_TRUE -ac_ct_AR -AR -CXXCPPFLAGS_FOR_BUILD -CXXFLAGS_FOR_BUILD -CXXCPP_FOR_BUILD -ac_ct_CXX_FOR_BUILD -CXX_FOR_BUILD -CXXCPP -LDFLAGS_FOR_BUILD -CPPFLAGS_FOR_BUILD -CFLAGS_FOR_BUILD -BUILD_OBJEXT -BUILD_EXEEXT -CPP_FOR_BUILD -ac_ct_CC_FOR_BUILD -CC_FOR_BUILD -CPP -am__fastdepCXX_FALSE -am__fastdepCXX_TRUE -CXXDEPMODE -ac_ct_CXX -CXXFLAGS -CXX -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -CSCOPE -ETAGS -CTAGS -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -DIST_LANG -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -runstatedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL -am__quote' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_maintainer_mode -enable_silent_rules -with_zlib -with_zlib_include -with_zlib_lib -with_protoc -enable_dependency_tracking -enable_64bit_solaris -enable_shared -enable_static -with_pic -enable_fast_install -with_aix_soname -with_gnu_ld -with_sysroot -enable_libtool_lock -' - ac_precious_vars='build_alias -host_alias -target_alias -DIST_LANG -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -CPP -CXXCPP -OBJC -OBJCFLAGS -LT_SYS_LIBRARY_PATH' -ac_subdirs_all='third_party/googletest' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Protocol Buffers 3.21.10 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/protobuf] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Protocol Buffers 3.21.10:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-maintainer-mode - disable make rules and dependencies not useful (and - sometimes confusing) to the casual installer - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - --disable-64bit-solaris Build 64 bit binary on Solaris [default=on] - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-zlib include classes for streaming compressed data in and - out [default=check] - --with-zlib-include=PATH - zlib include directory - --with-zlib-lib=PATH zlib lib directory - --with-protoc=COMMAND use the given protoc command instead of building a - new one when building tests (useful for - cross-compiling) - --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use - both] - --with-aix-soname=aix|svr4|both - shared library versioning (aka "SONAME") variant to - provide on AIX, [default=aix]. - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot[=DIR] Search for dependent libraries within DIR (or the - compiler's sysroot if not specified). - -Some influential environment variables: - DIST_LANG language to include in the distribution package (i.e., make - dist) - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CPP C preprocessor - CXXCPP C++ preprocessor - OBJC Objective C compiler command - OBJCFLAGS Objective C compiler flags - LT_SYS_LIBRARY_PATH - User-defined run-time library search path. - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -Protocol Buffers configure 3.21.10 -generated by GNU Autoconf 2.71 - -Copyright (C) 2021 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_cxx_try_cpp LINENO -# ------------------------ -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_cpp - -# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES -# --------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_cxx_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_cxx_check_header_compile - -# ac_fn_objc_try_compile LINENO -# ----------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_objc_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_objc_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_objc_try_compile - -# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR -# ------------------------------------------------------------------ -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. -ac_fn_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -printf %s "checking whether $as_decl_name is declared... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - eval ac_save_FLAGS=\$$6 - as_fn_append $6 " $5" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - eval $6=\$ac_save_FLAGS - -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_check_decl - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. */ - -#include -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main (void) -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - -# ac_fn_cxx_try_run LINENO -# ------------------------ -# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that -# executables *can* be run. -ac_fn_cxx_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_run - -# ac_fn_cxx_check_func LINENO FUNC VAR -# ------------------------------------ -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_cxx_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. */ - -#include -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main (void) -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_cxx_check_func -ac_configure_args_raw= -for ac_arg -do - case $ac_arg in - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_configure_args_raw " '$ac_arg'" -done - -case $ac_configure_args_raw in - *$as_nl*) - ac_safe_unquote= ;; - *) - ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. - ac_unsafe_a="$ac_unsafe_z#~" - ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" - ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; -esac - -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Protocol Buffers $as_me 3.21.10, which was -generated by GNU Autoconf 2.71. Invocation command line was - - $ $0$ac_configure_args_raw - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - printf "%s\n" "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Sanitize IFS. - IFS=" "" $as_nl" - # Save into config.log some information that might help in debugging. - { - echo - - printf "%s\n" "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - printf "%s\n" "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - printf "%s\n" "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - printf "%s\n" "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - printf "%s\n" "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - printf "%s\n" "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - printf "%s\n" "$as_me: caught signal $ac_signal" - printf "%s\n" "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -printf "%s\n" "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - ac_site_files="$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - ac_site_files="$prefix/share/config.site $prefix/etc/config.site" -else - ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" -fi - -for ac_site_file in $ac_site_files -do - case $ac_site_file in #( - */*) : - ;; #( - *) : - ac_site_file=./$ac_site_file ;; -esac - if test -f "$ac_site_file" && test -r "$ac_site_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -printf "%s\n" "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -printf "%s\n" "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Test code for whether the C compiler supports C89 (global declarations) -ac_c_conftest_c89_globals=' -/* Does the compiler advertise C89 conformance? - Do not test the value of __STDC__, because some compilers set it to 0 - while being otherwise adequately conformant. */ -#if !defined __STDC__ -# error "Compiler does not advertise C89 conformance" -#endif - -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ -struct buf { int x; }; -struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not \xHH hex character constants. - These do not provoke an error unfortunately, instead are silently treated - as an "x". The following induces an error, until -std is added to get - proper ANSI mode. Curiously \x00 != x always comes out true, for an - array size at least. It is necessary to write \x00 == 0 to get something - that is true only with -std. */ -int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) '\''x'\'' -int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), - int, int);' - -# Test code for whether the C compiler supports C89 (body of main). -ac_c_conftest_c89_main=' -ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); -' - -# Test code for whether the C compiler supports C99 (global declarations) -ac_c_conftest_c99_globals=' -// Does the compiler advertise C99 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L -# error "Compiler does not advertise C99 conformance" -#endif - -#include -extern int puts (const char *); -extern int printf (const char *, ...); -extern int dprintf (int, const char *, ...); -extern void *malloc (size_t); - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -// dprintf is used instead of fprintf to avoid needing to declare -// FILE and stderr. -#define debug(...) dprintf (2, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - #error "your preprocessor is broken" -#endif -#if BIG_OK -#else - #error "your preprocessor is broken" -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case '\''s'\'': // string - str = va_arg (args_copy, const char *); - break; - case '\''d'\'': // int - number = va_arg (args_copy, int); - break; - case '\''f'\'': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -' - -# Test code for whether the C compiler supports C99 (body of main). -ac_c_conftest_c99_main=' - // Check bool. - _Bool success = false; - success |= (argc != 0); - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[0] = argv[0][0]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); -' - -# Test code for whether the C compiler supports C11 (global declarations) -ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L -# error "Compiler does not advertise C11 conformance" -#endif - -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; -' - -# Test code for whether the C compiler supports C11 (body of main). -ac_c_conftest_c11_main=' - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - v1.i = 2; - v1.w.k = 5; - ok |= v1.i != 5; -' - -# Test code for whether the C compiler supports C11 (complete). -ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} -${ac_c_conftest_c11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - ${ac_c_conftest_c11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C99 (complete). -ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (complete). -ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - return ok; -} -" - -# Test code for whether the C++ compiler supports C++98 (global declarations) -ac_cxx_conftest_cxx98_globals=' -// Does the compiler advertise C++98 conformance? -#if !defined __cplusplus || __cplusplus < 199711L -# error "Compiler does not advertise C++98 conformance" -#endif - -// These inclusions are to reject old compilers that -// lack the unsuffixed header files. -#include -#include - -// and are *not* freestanding headers in C++98. -extern void assert (int); -namespace std { - extern int strcmp (const char *, const char *); -} - -// Namespaces, exceptions, and templates were all added after "C++ 2.0". -using std::exception; -using std::strcmp; - -namespace { - -void test_exception_syntax() -{ - try { - throw "test"; - } catch (const char *s) { - // Extra parentheses suppress a warning when building autoconf itself, - // due to lint rules shared with more typical C programs. - assert (!(strcmp) (s, "test")); - } -} - -template struct test_template -{ - T const val; - explicit test_template(T t) : val(t) {} - template T add(U u) { return static_cast(u) + val; } -}; - -} // anonymous namespace -' - -# Test code for whether the C++ compiler supports C++98 (body of main) -ac_cxx_conftest_cxx98_main=' - assert (argc); - assert (! argv[0]); -{ - test_exception_syntax (); - test_template tt (2.0); - assert (tt.add (4) == 6.0); - assert (true && !false); -} -' - -# Test code for whether the C++ compiler supports C++11 (global declarations) -ac_cxx_conftest_cxx11_globals=' -// Does the compiler advertise C++ 2011 conformance? -#if !defined __cplusplus || __cplusplus < 201103L -# error "Compiler does not advertise C++11 conformance" -#endif - -namespace cxx11test -{ - constexpr int get_val() { return 20; } - - struct testinit - { - int i; - double d; - }; - - class delegate - { - public: - delegate(int n) : n(n) {} - delegate(): delegate(2354) {} - - virtual int getval() { return this->n; }; - protected: - int n; - }; - - class overridden : public delegate - { - public: - overridden(int n): delegate(n) {} - virtual int getval() override final { return this->n * 2; } - }; - - class nocopy - { - public: - nocopy(int i): i(i) {} - nocopy() = default; - nocopy(const nocopy&) = delete; - nocopy & operator=(const nocopy&) = delete; - private: - int i; - }; - - // for testing lambda expressions - template Ret eval(Fn f, Ret v) - { - return f(v); - } - - // for testing variadic templates and trailing return types - template auto sum(V first) -> V - { - return first; - } - template auto sum(V first, Args... rest) -> V - { - return first + sum(rest...); - } -} -' - -# Test code for whether the C++ compiler supports C++11 (body of main) -ac_cxx_conftest_cxx11_main=' -{ - // Test auto and decltype - auto a1 = 6538; - auto a2 = 48573953.4; - auto a3 = "String literal"; - - int total = 0; - for (auto i = a3; *i; ++i) { total += *i; } - - decltype(a2) a4 = 34895.034; -} -{ - // Test constexpr - short sa[cxx11test::get_val()] = { 0 }; -} -{ - // Test initializer lists - cxx11test::testinit il = { 4323, 435234.23544 }; -} -{ - // Test range-based for - int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, - 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - for (auto &x : array) { x += 23; } -} -{ - // Test lambda expressions - using cxx11test::eval; - assert (eval ([](int x) { return x*2; }, 21) == 42); - double d = 2.0; - assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); - assert (d == 5.0); - assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); - assert (d == 5.0); -} -{ - // Test use of variadic templates - using cxx11test::sum; - auto a = sum(1); - auto b = sum(1, 2); - auto c = sum(1.0, 2.0, 3.0); -} -{ - // Test constructor delegation - cxx11test::delegate d1; - cxx11test::delegate d2(); - cxx11test::delegate d3(45); -} -{ - // Test override and final - cxx11test::overridden o1(55464); -} -{ - // Test nullptr - char *c = nullptr; -} -{ - // Test template brackets - test_template<::test_template> v(test_template(12)); -} -{ - // Unicode literals - char const *utf8 = u8"UTF-8 string \u2500"; - char16_t const *utf16 = u"UTF-8 string \u2500"; - char32_t const *utf32 = U"UTF-32 string \u2500"; -} -' - -# Test code for whether the C compiler supports C++11 (complete). -ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} -${ac_cxx_conftest_cxx11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - ${ac_cxx_conftest_cxx11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C++98 (complete). -ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - return ok; -} -" - -as_fn_append ac_header_cxx_list " stdio.h stdio_h HAVE_STDIO_H" -as_fn_append ac_header_cxx_list " stdlib.h stdlib_h HAVE_STDLIB_H" -as_fn_append ac_header_cxx_list " string.h string_h HAVE_STRING_H" -as_fn_append ac_header_cxx_list " inttypes.h inttypes_h HAVE_INTTYPES_H" -as_fn_append ac_header_cxx_list " stdint.h stdint_h HAVE_STDINT_H" -as_fn_append ac_header_cxx_list " strings.h strings_h HAVE_STRINGS_H" -as_fn_append ac_header_cxx_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" -as_fn_append ac_header_cxx_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" -as_fn_append ac_header_cxx_list " unistd.h unistd_h HAVE_UNISTD_H" -as_fn_append ac_header_cxx_list " wchar.h wchar_h HAVE_WCHAR_H" -as_fn_append ac_header_cxx_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" - -# Auxiliary files required by this configure script. -ac_aux_files="ltmain.sh ar-lib compile missing install-sh config.guess config.sub" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" - break - fi - ac_first_candidate=false - - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 -fi - - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' - and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } - # Check whether --enable-maintainer-mode was given. -if test ${enable_maintainer_mode+y} -then : - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else $as_nop - USE_MAINTAINER_MODE=yes -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } - if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - - -# The config file is generated but not used by the source code, since we only -# need very few of them, e.g. HAVE_PTHREAD and HAVE_ZLIB. Those macros are -# passed down in CXXFLAGS manually in src/Makefile.am -ac_config_headers="$ac_config_headers config.h" - - - - -case "$DIST_LANG" in - "") DIST_LANG=all ;; - all | cpp | csharp | java | python | javanano | objectivec | ruby | php) ;; - *) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "unknown language: $DIST_LANG -See \`config.log' for more details" "$LINENO" 5; } ;; -esac - - -# autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily -# the best choice for libprotobuf. -if test "x${ac_cv_env_CFLAGS_set}" = "x" -then : - CFLAGS="" -fi -if test "x${ac_cv_env_CXXFLAGS_set}" = "x" -then : - CXXFLAGS="" -fi - - - - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -printf %s "checking target system type... " >&6; } -if test ${ac_cv_target+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -printf "%s\n" "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -am__api_version='1.16' - - - # Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -printf %s "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test ${ac_cv_path_install+y} -then : - printf %s "(cached) " >&6 -else $as_nop - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - # Account for fact that we put trailing slashes in our PATH walk. -case $as_dir in #(( - ./ | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test ${ac_cv_path_install+y}; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -printf "%s\n" "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -printf %s "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` - - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - - - if test x"${MISSING+set}" != xset; then - MISSING="\${SHELL} '$am_aux_dir/missing'" -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -printf "%s\n" "$STRIP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -printf "%s\n" "$ac_ct_STRIP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 -printf %s "checking for a race-free mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if test ${ac_cv_path_mkdir+y} -then : - printf %s "(cached) " >&6 -else $as_nop - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue - case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir ('*'coreutils) '* | \ - 'BusyBox '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test ${ac_cv_path_mkdir+y}; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -printf "%s\n" "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AWK+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -printf "%s\n" "$AWK" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval test \${ac_cv_prog_make_${ac_make}_set+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - SET_MAKE= -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# Check whether --enable-silent-rules was given. -if test ${enable_silent_rules+y} -then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -printf %s "checking whether $am_make supports nested variables... " >&6; } -if test ${am_cv_make_support_nested_variables+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if printf "%s\n" 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='protobuf' - VERSION='3.21.10' - - -printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h - - -printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar plaintar pax cpio none' - -# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5 -printf %s "checking whether UID '$am_uid' is supported by ustar format... " >&6; } - if test $am_uid -le $am_max_uid; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - _am_tools=none - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5 -printf %s "checking whether GID '$am_gid' is supported by ustar format... " >&6; } - if test $am_gid -le $am_max_gid; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - _am_tools=none - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 -printf %s "checking how to create a ustar tar archive... " >&6; } - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_ustar-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - { echo "$as_me:$LINENO: $_am_tar --version" >&5 - ($_am_tar --version) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && break - done - am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x ustar -w "$$tardir"' - am__tar_='pax -L -x ustar -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H ustar -L' - am__tar_='find "$tardir" -print | cpio -o -H ustar -L' - am__untar='cpio -i -H ustar -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_ustar}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 - (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - rm -rf conftest.dir - if test -s conftest.tar; then - { echo "$as_me:$LINENO: $am__untar &5 - ($am__untar &5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 - (cat conftest.dir/file) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - grep GrepMe conftest.dir/file >/dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - if test ${am_cv_prog_tar_ustar+y} -then : - printf %s "(cached) " >&6 -else $as_nop - am_cv_prog_tar_ustar=$_am_tool -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 -printf "%s\n" "$am_cv_prog_tar_ustar" >&6; } - - - - - -# Variables for tags utilities; see am/tags.am -if test -z "$CTAGS"; then - CTAGS=ctags -fi - -if test -z "$ETAGS"; then - ETAGS=etags -fi - -if test -z "$CSCOPE"; then - CSCOPE=cscope -fi - - - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - - -# Silent rules enabled: the output is minimal but informative. -# In particular, the warnings from the compiler stick out very clearly. -# To see all logs, use the --disable-silent-rules on configure or via make V=1 -# Check whether --enable-silent-rules was given. -if test ${enable_silent_rules+y} -then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=0;; -esac -am_make=${MAKE-make} -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -printf %s "checking whether $am_make supports nested variables... " >&6; } -if test ${am_cv_make_support_nested_variables+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if printf "%s\n" 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - - - -# Check whether --with-zlib was given. -if test ${with_zlib+y} -then : - withval=$with_zlib; -else $as_nop - with_zlib=check -fi - - - -# Check whether --with-zlib-include was given. -if test ${with_zlib_include+y} -then : - withval=$with_zlib_include; CPPFLAGS="-I$withval $CPPFLAGS" -fi - - - -# Check whether --with-zlib-lib was given. -if test ${with_zlib_lib+y} -then : - withval=$with_zlib_lib; LDFLAGS="-L$withval $LDFLAGS" -fi - - - -# Check whether --with-protoc was given. -if test ${with_protoc+y} -then : - withval=$with_protoc; -else $as_nop - with_protoc=no -fi - - -# Checks for programs. - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -fi - - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -printf %s "checking whether the C compiler works... " >&6; } -ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else $as_nop - ac_file='' -fi -if test -z "$ac_file" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -printf %s "checking for C compiler default output file name... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -printf "%s\n" "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -printf %s "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -printf "%s\n" "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -printf %s "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -printf "%s\n" "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -printf %s "checking for suffix of object files... " >&6; } -if test ${ac_cv_objext+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -printf "%s\n" "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+y} -ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_g=yes -else $as_nop - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c89_program -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -printf %s "checking whether $CC understands -c and -o together... " >&6; } -if test ${am_cv_prog_cc_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } -cat > confinc.mk << 'END' -am__doit: - @echo this is the am__doit target >confinc.out -.PHONY: am__doit -END -am__include="#" -am__quote= -# BSD make does it like this. -echo '.include "confinc.mk" # ignored' > confmf.BSD -# Other make implementations (GNU, Solaris 10, AIX) do it like this. -echo 'include confinc.mk # ignored' > confmf.GNU -_am_result=no -for s in GNU BSD; do - { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 - (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - case $?:`cat confinc.out 2>/dev/null` in #( - '0:this is the am__doit target') : - case $s in #( - BSD) : - am__include='.include' am__quote='"' ;; #( - *) : - am__include='include' am__quote='' ;; -esac ;; #( - *) : - ;; -esac - if test "$am__include" != "#"; then - _am_result="yes ($s style)" - break - fi -done -rm -f confinc.* confmf.* -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -printf "%s\n" "${_am_result}" >&6; } - -# Check whether --enable-dependency-tracking was given. -if test ${enable_dependency_tracking+y} -then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -depcc="$CC" am_compiler_list= - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CC_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - - - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -printf "%s\n" "$CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -printf "%s\n" "$ac_ct_CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+y} -ac_save_CXXFLAGS=$CXXFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -printf %s "checking whether $CXX accepts -g... " >&6; } -if test ${ac_cv_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_g=yes -else $as_nop - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - -else $as_nop - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_11=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program -_ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 -fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_98=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx98=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx98" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx98" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CXX_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test ${ac_cv_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -save_cross_compiling=$cross_compiling -save_ac_tool_prefix=$ac_tool_prefix -cross_compiling=no -ac_tool_prefix= - -ac_ext=c -ac_build_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC_FOR_BUILD"; then - ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC_FOR_BUILD="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD -if test -n "$CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 -printf "%s\n" "$CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC_FOR_BUILD"; then - ac_ct_CC_FOR_BUILD=$CC_FOR_BUILD - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC_FOR_BUILD"; then - ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_ct_CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC_FOR_BUILD="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC_FOR_BUILD=$ac_cv_prog_ac_ct_CC_FOR_BUILD -if test -n "$ac_ct_CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC_FOR_BUILD" >&5 -printf "%s\n" "$ac_ct_CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC_FOR_BUILD" = x; then - CC_FOR_BUILD="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC_FOR_BUILD=$ac_ct_CC_FOR_BUILD - fi -else - CC_FOR_BUILD="$ac_cv_prog_CC_FOR_BUILD" -fi - -if test -z "$CC_FOR_BUILD"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC_FOR_BUILD"; then - ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC_FOR_BUILD="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD -if test -n "$CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 -printf "%s\n" "$CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - fi -fi -if test -z "$CC_FOR_BUILD"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC_FOR_BUILD"; then - ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC_FOR_BUILD="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC_FOR_BUILD - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC_FOR_BUILD to just the basename; use the full file name. - shift - ac_cv_prog_CC_FOR_BUILD="$as_dir$ac_word${1+' '}$@" - fi -fi -fi -fi -CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD -if test -n "$CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 -printf "%s\n" "$CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$CC_FOR_BUILD"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC_FOR_BUILD"; then - ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC_FOR_BUILD="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD -if test -n "$CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 -printf "%s\n" "$CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CC_FOR_BUILD" && break - done -fi -if test -z "$CC_FOR_BUILD"; then - ac_ct_CC_FOR_BUILD=$CC_FOR_BUILD - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC_FOR_BUILD"; then - ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_ct_CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC_FOR_BUILD=$ac_cv_prog_ac_ct_CC_FOR_BUILD -if test -n "$ac_ct_CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC_FOR_BUILD" >&5 -printf "%s\n" "$ac_ct_CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CC_FOR_BUILD" && break -done - - if test "x$ac_ct_CC_FOR_BUILD" = x; then - CC_FOR_BUILD="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC_FOR_BUILD=$ac_ct_CC_FOR_BUILD - fi -fi - -fi -if test -z "$CC_FOR_BUILD"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC_FOR_BUILD"; then - ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC_FOR_BUILD="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD -if test -n "$CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 -printf "%s\n" "$CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC_FOR_BUILD"; then - ac_ct_CC_FOR_BUILD=$CC_FOR_BUILD - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC_FOR_BUILD"; then - ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_ct_CC_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC_FOR_BUILD="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC_FOR_BUILD=$ac_cv_prog_ac_ct_CC_FOR_BUILD -if test -n "$ac_ct_CC_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC_FOR_BUILD" >&5 -printf "%s\n" "$ac_ct_CC_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC_FOR_BUILD" = x; then - CC_FOR_BUILD="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC_FOR_BUILD=$ac_ct_CC_FOR_BUILD - fi -else - CC_FOR_BUILD="$ac_cv_prog_CC_FOR_BUILD" -fi - -fi - - -test -z "$CC_FOR_BUILD" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_build_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS_FOR_BUILD+y} -ac_save_CFLAGS=$CFLAGS_FOR_BUILD -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC_FOR_BUILD accepts -g" >&5 -printf %s "checking whether $CC_FOR_BUILD accepts -g... " >&6; } -if test ${ac_cv_build_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_build_prog_cc_g=no - CFLAGS_FOR_BUILD="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_build_prog_cc_g=yes -else $as_nop - CFLAGS_FOR_BUILD="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS_FOR_BUILD="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_build_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_build_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then - CFLAGS_FOR_BUILD=$ac_save_CFLAGS -elif test $ac_cv_build_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS_FOR_BUILD="-g -O2" - else - CFLAGS_FOR_BUILD="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS_FOR_BUILD="-O2" - else - CFLAGS_FOR_BUILD= - fi -fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC_FOR_BUILD option to enable C11 features" >&5 -printf %s "checking for $CC_FOR_BUILD option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no -ac_save_CC=$CC_FOR_BUILD -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC_FOR_BUILD="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC_FOR_BUILD=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC_FOR_BUILD="$CC_FOR_BUILD $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC_FOR_BUILD option to enable C99 features" >&5 -printf %s "checking for $CC_FOR_BUILD option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC_FOR_BUILD -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC_FOR_BUILD="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC_FOR_BUILD=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC_FOR_BUILD="$CC_FOR_BUILD $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC_FOR_BUILD option to enable C89 features" >&5 -printf %s "checking for $CC_FOR_BUILD option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c89=no -ac_save_CC=$CC_FOR_BUILD -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c89_program -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC_FOR_BUILD="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_build_objext conftest.beam - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC_FOR_BUILD=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC_FOR_BUILD="$CC_FOR_BUILD $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 -fi -fi - -ac_ext=c -ac_build_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=c -ac_build_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC_FOR_BUILD understands -c and -o together" >&5 -printf %s "checking whether $CC_FOR_BUILD understands -c and -o together... " >&6; } -if test ${am_cv_prog_cc_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC_FOR_BUILD -c conftest.$ac_ext -o conftest2.$ac_build_objext" >&5 - ($CC_FOR_BUILD -c conftest.$ac_ext -o conftest2.$ac_build_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_build_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC_FOR_BUILD="$am_aux_dir/compile $CC_FOR_BUILD" -fi -ac_ext=c -ac_build_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC_FOR_BUILD" am_compiler_list= - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CC_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=c -ac_build_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP_FOR_BUILD" && test -d "$CPP_FOR_BUILD"; then - CPP_FOR_BUILD= -fi -if test -z "$CPP_FOR_BUILD"; then - if test ${ac_cv_build_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP_FOR_BUILD in "$CC_FOR_BUILD -E" "$CC_FOR_BUILD -E -traditional-cpp" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_build_prog_CPP=$CPP_FOR_BUILD - -fi - CPP_FOR_BUILD=$ac_cv_build_prog_CPP -else - ac_cv_build_prog_CPP=$CPP_FOR_BUILD -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP_FOR_BUILD" >&5 -printf "%s\n" "$CPP_FOR_BUILD" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP_FOR_BUILD\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_build_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_tool_prefix=$save_ac_tool_prefix -cross_compiling=$save_cross_compiling - - -BUILD_EXEEXT=$ac_build_exeext -BUILD_OBJEXT=$ac_build_objext - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -printf %s "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if test ${ac_cv_prog_CXXCPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CXX needs to be expanded - for CXXCPP in "$CXX -E" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -printf "%s\n" "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -save_cross_compiling=$cross_compiling -save_ac_tool_prefix=$ac_tool_prefix -cross_compiling=no -ac_tool_prefix= - -ac_ext=cpp -ac_cpp='$CXXCPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CXX_FOR_BUILD -c $CXXFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CXX_FOR_BUILD -o conftest$ac_exeext $CXXFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX_FOR_BUILD"; then - if test -n "$CCC"; then - CXX_FOR_BUILD=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CXX_FOR_BUILD"; then - ac_cv_prog_CXX_FOR_BUILD="$CXX_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX_FOR_BUILD="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX_FOR_BUILD=$ac_cv_prog_CXX_FOR_BUILD -if test -n "$CXX_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX_FOR_BUILD" >&5 -printf "%s\n" "$CXX_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CXX_FOR_BUILD" && break - done -fi -if test -z "$CXX_FOR_BUILD"; then - ac_ct_CXX_FOR_BUILD=$CXX_FOR_BUILD - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX_FOR_BUILD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CXX_FOR_BUILD"; then - ac_cv_prog_ac_ct_CXX_FOR_BUILD="$ac_ct_CXX_FOR_BUILD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX_FOR_BUILD="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX_FOR_BUILD=$ac_cv_prog_ac_ct_CXX_FOR_BUILD -if test -n "$ac_ct_CXX_FOR_BUILD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX_FOR_BUILD" >&5 -printf "%s\n" "$ac_ct_CXX_FOR_BUILD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CXX_FOR_BUILD" && break -done - - if test "x$ac_ct_CXX_FOR_BUILD" = x; then - CXX_FOR_BUILD="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX_FOR_BUILD=$ac_ct_CXX_FOR_BUILD - fi -fi - - fi -fi -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_build_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS_FOR_BUILD+y} -ac_save_CXXFLAGS=$CXXFLAGS_FOR_BUILD -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX_FOR_BUILD accepts -g" >&5 -printf %s "checking whether $CXX_FOR_BUILD accepts -g... " >&6; } -if test ${ac_cv_build_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_build_prog_cxx_g=no - CXXFLAGS_FOR_BUILD="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_build_prog_cxx_g=yes -else $as_nop - CXXFLAGS_FOR_BUILD="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - -else $as_nop - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS_FOR_BUILD="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_build_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_build_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then - CXXFLAGS_FOR_BUILD=$ac_save_CXXFLAGS -elif test $ac_cv_build_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS_FOR_BUILD="-g -O2" - else - CXXFLAGS_FOR_BUILD="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS_FOR_BUILD="-O2" - else - CXXFLAGS_FOR_BUILD= - fi -fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX_FOR_BUILD option to enable C++11 features" >&5 -printf %s "checking for $CXX_FOR_BUILD option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_11=no -ac_save_CXX=$CXX_FOR_BUILD -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program -_ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX_FOR_BUILD="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX_FOR_BUILD=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX_FOR_BUILD="$CXX_FOR_BUILD $ac_cv_prog_cxx_cxx11" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 -fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX_FOR_BUILD option to enable C++98 features" >&5 -printf %s "checking for $CXX_FOR_BUILD option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_98=no -ac_save_CXX=$CXX_FOR_BUILD -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX_FOR_BUILD="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx98=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX_FOR_BUILD=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx98" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx98" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX_FOR_BUILD="$CXX_FOR_BUILD $ac_cv_prog_cxx_cxx98" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC -c $CFLAGS $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS_FOR_BUILD $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX_FOR_BUILD" am_compiler_list= - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CXX_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CXX_FOR_BUILD -c $CXXFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CXX_FOR_BUILD -o conftest$ac_exeext $CXXFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -printf %s "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP_FOR_BUILD"; then - if test ${ac_cv_build_prog_CXXCPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CXX needs to be expanded - for CXXCPP_FOR_BUILD in "$CXX_FOR_BUILD -E" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_build_prog_CXXCPP=$CXXCPP_FOR_BUILD - -fi - CXXCPP_FOR_BUILD=$ac_cv_build_prog_CXXCPP -else - ac_cv_build_prog_CXXCPP=$CXXCPP_FOR_BUILD -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP_FOR_BUILD" >&5 -printf "%s\n" "$CXXCPP_FOR_BUILD" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP_FOR_BUILD\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS_FOR_BUILD' -ac_build_compile='$CC -c $CFLAGS $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' -ac_build_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS_FOR_BUILD $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_tool_prefix=$save_ac_tool_prefix -cross_compiling=$save_cross_compiling - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -ac_header= ac_cache= -for ac_item in $ac_header_cxx_list -do - if test $ac_cache; then - ac_fn_cxx_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi -done - - - - - - - - -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes -then : - -printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h - -fi - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test ${ac_cv_safe_to_define___extensions__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_safe_to_define___extensions__=yes -else $as_nop - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 -printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } -if test ${ac_cv_should_define__xopen_source+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_should_define__xopen_source=no - if test $ac_cv_header_wchar_h = yes -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - mbstate_t x; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #define _XOPEN_SOURCE 500 - #include - mbstate_t x; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_should_define__xopen_source=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 -printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } - - printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h - - printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h - - printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h - - printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h - - printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h - - printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h - - printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h - - printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h - - printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h - - if test $ac_cv_header_minix_config_h = yes -then : - MINIX=yes - printf "%s\n" "#define _MINIX 1" >>confdefs.h - - printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h - - printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h - -else $as_nop - MINIX= -fi - if test $ac_cv_safe_to_define___extensions__ = yes -then : - printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h - -fi - if test $ac_cv_should_define__xopen_source = yes -then : - printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h - -fi - - - - - - - - - if test -n "$ac_tool_prefix"; then - for ac_prog in ar lib "link -lib" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar lib "link -lib" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 -printf %s "checking the archiver ($AR) interface... " >&6; } -if test ${am_cv_ar_interface+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - am_cv_ar_interface=ar - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int some_variable = 0; -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 -printf "%s\n" "$am_cv_ar_interface" >&6; } - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - as_fn_error $? "could not determine $AR interface" "$LINENO" 5 - ;; -esac - - if test "$GCC" = yes; then - GCC_TRUE= - GCC_FALSE='#' -else - GCC_TRUE='#' - GCC_FALSE= -fi - # let the Makefile know if we're gcc -case $target_os in #( - darwin*) : - ac_ext=m -ac_cpp='$OBJCPP $CPPFLAGS' -ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_objc_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in gcc objcc objc cc CC clang - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OBJC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$OBJC"; then - ac_cv_prog_OBJC="$OBJC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJC=$ac_cv_prog_OBJC -if test -n "$OBJC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJC" >&5 -printf "%s\n" "$OBJC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$OBJC" && break - done -fi -if test -z "$OBJC"; then - ac_ct_OBJC=$OBJC - for ac_prog in gcc objcc objc cc CC clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OBJC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_OBJC"; then - ac_cv_prog_ac_ct_OBJC="$ac_ct_OBJC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC -if test -n "$ac_ct_OBJC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJC" >&5 -printf "%s\n" "$ac_ct_OBJC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_OBJC" && break -done - - if test "x$ac_ct_OBJC" = x; then - OBJC="gcc" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJC=$ac_ct_OBJC - fi -fi - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Objective C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU Objective C" >&5 -printf %s "checking whether the compiler supports GNU Objective C... " >&6; } -if test ${ac_cv_objc_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_objc_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objc_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_objc_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_objc_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GOBJC=yes -else - GOBJC= -fi -ac_test_OBJCFLAGS=${OBJCFLAGS+y} -ac_save_OBJCFLAGS=$OBJCFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5 -printf %s "checking whether $OBJC accepts -g... " >&6; } -if test ${ac_cv_prog_objc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_objc_werror_flag=$ac_objc_werror_flag - ac_objc_werror_flag=yes - ac_cv_prog_objc_g=no - OBJCFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - ac_cv_prog_objc_g=yes -else $as_nop - OBJCFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - -else $as_nop - ac_objc_werror_flag=$ac_save_objc_werror_flag - OBJCFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - ac_cv_prog_objc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_objc_werror_flag=$ac_save_objc_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_objc_g" >&5 -printf "%s\n" "$ac_cv_prog_objc_g" >&6; } -if test $ac_test_OBJCFLAGS; then - OBJCFLAGS=$ac_save_OBJCFLAGS -elif test $ac_cv_prog_objc_g = yes; then - if test "$GOBJC" = yes; then - OBJCFLAGS="-g -O2" - else - OBJCFLAGS="-g" - fi -else - if test "$GOBJC" = yes; then - OBJCFLAGS="-O2" - else - OBJCFLAGS= - fi -fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$OBJC" am_compiler_list='gcc3 gcc' - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_OBJC_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_OBJC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_OBJC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_OBJC_dependencies_compiler_type=none -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_OBJC_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_OBJC_dependencies_compiler_type" >&6; } -OBJCDEPMODE=depmode=$am_cv_OBJC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_OBJC_dependencies_compiler_type" = gcc3; then - am__fastdepOBJC_TRUE= - am__fastdepOBJC_FALSE='#' -else - am__fastdepOBJC_TRUE='#' - am__fastdepOBJC_FALSE= -fi - - ;; #( - *) : - if false; then - am__fastdepOBJC_TRUE= - am__fastdepOBJC_FALSE='#' -else - am__fastdepOBJC_TRUE='#' - am__fastdepOBJC_FALSE= -fi - ;; -esac - -# test_util.cc takes forever to compile with GCC and optimization turned on. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking C++ compiler flags..." >&5 -printf %s "checking C++ compiler flags...... " >&6; } -if test "x${ac_cv_env_CXXFLAGS_set}" = "x" -then : - - if test "$GCC" = "yes" -then : - - PROTOBUF_OPT_FLAG="-O2" - CXXFLAGS="${CXXFLAGS} -g" - -fi - - # Protocol Buffers contains several checks that are intended to be used only - # for debugging and which might hurt performance. Most users are probably - # end users who don't want these checks, so add -DNDEBUG by default. - CXXFLAGS="$CXXFLAGS -std=c++11 -DNDEBUG" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: use default: $PROTOBUF_OPT_FLAG $CXXFLAGS" >&5 -printf "%s\n" "use default: $PROTOBUF_OPT_FLAG $CXXFLAGS" >&6; } - -else $as_nop - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: use user-supplied: $CXXFLAGS" >&5 -printf "%s\n" "use user-supplied: $CXXFLAGS" >&6; } - -fi - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX options needed to detect all undeclared functions" >&5 -printf %s "checking for $CXX options needed to detect all undeclared functions... " >&6; } -if test ${ac_cv_cxx_undeclared_builtin_options+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_CFLAGS=$CFLAGS - ac_cv_cxx_undeclared_builtin_options='cannot detect' - for ac_arg in '' -fno-builtin; do - CFLAGS="$ac_save_CFLAGS $ac_arg" - # This test program should *not* compile successfully. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -(void) strchr; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - -else $as_nop - # This test program should compile successfully. - # No library function is consistently available on - # freestanding implementations, so test against a dummy - # declaration. Include always-available headers on the - # off chance that they somehow elicit warnings. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -extern void ac_decl (int, char *); - -int -main (void) -{ -(void) ac_decl (0, (char *) 0); - (void) ac_decl; - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - if test x"$ac_arg" = x -then : - ac_cv_cxx_undeclared_builtin_options='none needed' -else $as_nop - ac_cv_cxx_undeclared_builtin_options=$ac_arg -fi - break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - done - CFLAGS=$ac_save_CFLAGS - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_undeclared_builtin_options" >&5 -printf "%s\n" "$ac_cv_cxx_undeclared_builtin_options" >&6; } - case $ac_cv_cxx_undeclared_builtin_options in #( - 'cannot detect') : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot make $CXX report undeclared builtins -See \`config.log' for more details" "$LINENO" 5; } ;; #( - 'none needed') : - ac_cxx_undeclared_builtin_options='' ;; #( - *) : - ac_cxx_undeclared_builtin_options=$ac_cv_cxx_undeclared_builtin_options ;; -esac - - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - ac_fn_check_decl "$LINENO" "__SUNPRO_CC" "ac_cv_have_decl___SUNPRO_CC" "$ac_includes_default" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" -if test "x$ac_cv_have_decl___SUNPRO_CC" = xyes -then : - SUNCC="yes" -else $as_nop - SUNCC="no" -fi - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - # Check whether --enable-64bit-solaris was given. -if test ${enable_64bit_solaris+y} -then : - enableval=$enable_64bit_solaris; ac_enable_64bit="$enableval" -else $as_nop - ac_enable_64bit="yes" -fi - - - if test "$SUNCC" = "yes" -a "x${ac_cv_env_CXXFLAGS_set}" = "x" -then : - - CXXFLAGS="-g0 -xO3 -xlibmil -xdepend -xbuiltin -mt -template=no%extdef ${CXXFLAGS}" - -fi - - case $host_os in - *solaris*) - for ac_prog in isainfo -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ISAINFO+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ISAINFO"; then - ac_cv_prog_ISAINFO="$ISAINFO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ISAINFO="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ISAINFO=$ac_cv_prog_ISAINFO -if test -n "$ISAINFO"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ISAINFO" >&5 -printf "%s\n" "$ISAINFO" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ISAINFO" && break -done -test -n "$ISAINFO" || ISAINFO="no" - - if test "x$ISAINFO" != "xno" -then : - isainfo_b=`${ISAINFO} -b` -else $as_nop - isainfo_b="x" -fi - - if test "$isainfo_b" != "x" -then : - - - isainfo_k=`${ISAINFO} -k` - - if test "x$ac_enable_64bit" = "xyes" -then : - - - if test "x$libdir" = "x\${exec_prefix}/lib" -then : - - libdir="${libdir}/${isainfo_k}" - -fi - - CXXFLAGS="${CXXFLAGS} -m64" - ac_cv_env_CXXFLAGS_set=set - ac_cv_env_CXXFLAGS_value='-m64' - - CFLAGS="${CFLAGS} -m64" - ac_cv_env_CFLAGS_set=set - ac_cv_env_CFLAGS_value='-m64' - - if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes" -then : - - CXXFLAGS="-xmemalign=8s ${CXXFLAGS}" - -fi - -fi - -fi - ;; - esac - - if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes" -then : - - CXXFLAGS="-xregs=no%appl ${CXXFLAGS}" - -fi - - -# Have to do libtool after SUNCC, other wise it "helpfully" adds Crun Cstd -# to the link -case `pwd` in - *\ * | *\ *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4.7' -macro_revision='2.4.7' - - - - - - - - - - - - - - -ltmain=$ac_aux_dir/ltmain.sh - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -printf %s "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case $ECHO in - printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -printf "%s\n" "printf" >&6; } ;; - print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -printf "%s\n" "print -r" >&6; } ;; - *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -printf "%s\n" "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -printf %s "checking for a sed that does not truncate output... " >&6; } -if test ${ac_cv_path_SED+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in sed gsed - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -printf "%s\n" "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -printf %s "checking for fgrep... " >&6; } -if test ${ac_cv_path_FGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in fgrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -printf "%s\n" "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test ${with_gnu_ld+y} -then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else $as_nop - with_gnu_ld=no -fi - -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -printf %s "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -printf %s "checking for GNU ld... " >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -printf %s "checking for non-GNU ld... " >&6; } -fi -if test ${lt_cv_path_LD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -printf %s "checking if the linker ($LD) is GNU ld... " >&6; } -if test ${lt_cv_prog_gnu_ld+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test ${lt_cv_path_NM+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM=$NM -else - lt_nm_to_check=${ac_tool_prefix}nm - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break 2 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break 2 - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS=$lt_save_ifs - done - : ${lt_cv_path_NM=no} -fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -printf "%s\n" "$lt_cv_path_NM" >&6; } -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DUMPBIN+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -printf "%s\n" "$DUMPBIN" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DUMPBIN+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -printf "%s\n" "$ac_ct_DUMPBIN" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test : != "$DUMPBIN"; then - NM=$DUMPBIN - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -printf %s "checking the name lister ($NM) interface... " >&6; } -if test ${lt_cv_nm_interface+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -printf "%s\n" "$lt_cv_nm_interface" >&6; } - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -printf %s "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -printf "%s\n" "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -printf %s "checking the maximum length of command line arguments... " >&6; } -if test ${lt_cv_sys_max_cmd_len+y} -then : - printf %s "(cached) " >&6 -else $as_nop - i=0 - teststring=ABCD - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n "$lt_cv_sys_max_cmd_len"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 -printf "%s\n" "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -printf %s "checking how to convert $build file names to $host format... " >&6; } -if test ${lt_cv_to_host_file_cmd+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -printf %s "checking how to convert $build file names to toolchain format... " >&6; } -if test ${lt_cv_to_tool_file_cmd+y} -then : - printf %s "(cached) " >&6 -else $as_nop - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -printf %s "checking for $LD option to reload object files... " >&6; } -if test ${lt_cv_ld_reload_flag+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_ld_reload_flag='-r' -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test yes != "$GCC"; then - reload_cmds=false - fi - ;; - darwin*) - if test yes = "$GCC"; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. -set dummy ${ac_tool_prefix}file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_FILECMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$FILECMD"; then - ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_FILECMD="${ac_tool_prefix}file" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -FILECMD=$ac_cv_prog_FILECMD -if test -n "$FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 -printf "%s\n" "$FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_FILECMD"; then - ac_ct_FILECMD=$FILECMD - # Extract the first word of "file", so it can be a program name with args. -set dummy file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_FILECMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_FILECMD"; then - ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_FILECMD="file" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD -if test -n "$ac_ct_FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 -printf "%s\n" "$ac_ct_FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_FILECMD" = x; then - FILECMD=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - FILECMD=$ac_ct_FILECMD - fi -else - FILECMD="$ac_cv_prog_FILECMD" -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OBJDUMP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -printf "%s\n" "$OBJDUMP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OBJDUMP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -printf "%s\n" "$ac_ct_OBJDUMP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -printf %s "checking how to recognize dependent libraries... " >&6; } -if test ${lt_cv_deplibs_check_method+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='$FILECMD -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly* | midnightbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=$FILECMD - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=$FILECMD - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=$FILECMD - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -os2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DLLTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -printf "%s\n" "$DLLTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DLLTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -printf "%s\n" "$ac_ct_DLLTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -printf %s "checking how to associate runtime and link libraries... " >&6; } -if test ${lt_cv_sharedlib_from_linklib_cmd+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO - ;; -esac - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} - - - - - - -# Use ARFLAGS variable as AR's operation code to sync the variable naming with -# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have -# higher priority because thats what people were doing historically (setting -# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS -# variable obsoleted/removed. - -test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} -lt_ar_flags=$AR_FLAGS - - - - - - -# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override -# by AR_FLAGS because that was never working and AR_FLAGS is about to die. - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -printf %s "checking for archiver @FILE support... " >&6; } -if test ${lt_cv_ar_at_file+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test 0 -eq "$ac_status"; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test 0 -ne "$ac_status"; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -printf "%s\n" "$lt_cv_ar_at_file" >&6; } - -if test no = "$lt_cv_ar_at_file"; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -printf "%s\n" "$STRIP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -printf "%s\n" "$ac_ct_STRIP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -printf %s "checking command to parse $NM output from $compiler object... " >&6; } -if test ${lt_cv_sys_global_symbol_pipe+y} -then : - printf %s "(cached) " >&6 -else $as_nop - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test ia64 = "$host_cpu"; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" - # Adjust the below global symbol transforms to fixup imported variables. - lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" - lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" - lt_c_name_lib_hook="\ - -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ - -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" -else - # Disable hooks by default. - lt_cv_sys_global_symbol_to_import= - lt_cdecl_hook= - lt_c_name_hook= - lt_c_name_lib_hook= -fi - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ -$lt_cdecl_hook\ -" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ -$lt_c_name_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" - -# Transform an extracted symbol line into symbol name with lib prefix and -# symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ -$lt_c_name_lib_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function, - # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++ or ICC, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ -" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ -" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ -" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ -" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 - if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined __osf__ -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS=conftstm.$ac_objext - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test yes = "$pipe_works"; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -printf "%s\n" "failed" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -printf "%s\n" "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -printf %s "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test ${with_sysroot+y} -then : - withval=$with_sysroot; -else $as_nop - with_sysroot=no -fi - - -lt_sysroot= -case $with_sysroot in #( - yes) - if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -printf "%s\n" "$with_sysroot" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -printf "%s\n" "${lt_sysroot:-no}" >&6; } - - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -printf %s "checking for a working dd... " >&6; } -if test ${ac_cv_path_lt_DD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -: ${lt_DD:=$DD} -if test -z "$lt_DD"; then - ac_path_lt_DD_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in dd - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_lt_DD" || continue -if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: -fi - $ac_path_lt_DD_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_lt_DD"; then - : - fi -else - ac_cv_path_lt_DD=$lt_DD -fi - -rm -f conftest.i conftest2.i conftest.out -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -printf "%s\n" "$ac_cv_path_lt_DD" >&6; } - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -printf %s "checking how to truncate binary pipes... " >&6; } -if test ${lt_cv_truncate_bin+y} -then : - printf %s "(cached) " >&6 -else $as_nop - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -lt_cv_truncate_bin= -if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" -fi -rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -printf "%s\n" "$lt_cv_truncate_bin" >&6; } - - - - - - - -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} - -# Check whether --enable-libtool-lock was given. -if test ${enable_libtool_lock+y} -then : - enableval=$enable_libtool_lock; -fi - -test no = "$enable_libtool_lock" || enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out what ABI is being produced by ac_compile, and set mode - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `$FILECMD conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE=32 - ;; - *ELF-64*) - HPUX_IA64_MODE=64 - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test yes = "$lt_cv_prog_gnu_ld"; then - case `$FILECMD conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `$FILECMD conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -mips64*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - emul=elf - case `$FILECMD conftest.$ac_objext` in - *32-bit*) - emul="${emul}32" - ;; - *64-bit*) - emul="${emul}64" - ;; - esac - case `$FILECMD conftest.$ac_objext` in - *MSB*) - emul="${emul}btsmip" - ;; - *LSB*) - emul="${emul}ltsmip" - ;; - esac - case `$FILECMD conftest.$ac_objext` in - *N32*) - emul="${emul}n32" - ;; - esac - LD="${LD-ld} -m $emul" - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when - # doing 32-bit compilation for a host where ld defaults to 64-bit, or - # vice versa); the common cases where no linker options are needed do - # not appear in the list. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `$FILECMD conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `$FILECMD conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -belf" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -printf %s "checking whether the C compiler needs -belf... " >&6; } -if test ${lt_cv_cc_needs_belf+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - lt_cv_cc_needs_belf=yes -else $as_nop - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } - if test yes != "$lt_cv_cc_needs_belf"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS=$SAVE_CFLAGS - fi - ;; -*-*solaris*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `$FILECMD conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*|x86_64-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD=${LD-ld}_sol2 - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks=$enable_libtool_lock - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_MANIFEST_TOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -printf "%s\n" "$MANIFEST_TOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if test ${lt_cv_path_mainfest_tool+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } -if test yes != "$lt_cv_path_mainfest_tool"; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DSYMUTIL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -printf "%s\n" "$DSYMUTIL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_NMEDIT+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -printf "%s\n" "$NMEDIT" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_NMEDIT+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -printf "%s\n" "$ac_ct_NMEDIT" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LIPO+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -printf "%s\n" "$LIPO" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_LIPO+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LIPO="lipo" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -printf "%s\n" "$ac_ct_LIPO" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -printf "%s\n" "$OTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL="otool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -printf "%s\n" "$ac_ct_OTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OTOOL64+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -printf "%s\n" "$OTOOL64" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OTOOL64+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -printf "%s\n" "$ac_ct_OTOOL64" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -printf %s "checking for -single_module linker flag... " >&6; } -if test ${lt_cv_apple_cc_single_mod+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_apple_cc_single_mod=no - if test -z "$LT_MULTI_MODULE"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test 0 = "$_lt_result"; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -printf %s "checking for -exported_symbols_list linker flag... " >&6; } -if test ${lt_cv_ld_exported_symbols_list+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - lt_cv_ld_exported_symbols_list=yes -else $as_nop - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -printf %s "checking for -force_load linker flag... " >&6; } -if test ${lt_cv_ld_force_load+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 - $AR $AR_FLAGS libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -printf "%s\n" "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in - 10.[012],*|,*powerpc*-darwin[5-8]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - *) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test yes = "$lt_cv_apple_cc_single_mod"; then - _lt_dar_single_mod='$single_module' - fi - if test yes = "$lt_cv_ld_exported_symbols_list"; then - _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' - fi - if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} - -ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes -then : - printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h - -fi - - - -func_stripname_cnf () -{ - case $2 in - .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; - *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; - esac -} # func_stripname_cnf - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test ${enable_shared+y} -then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else $as_nop - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test ${enable_static+y} -then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else $as_nop - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test ${with_pic+y} -then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for lt_pkg in $withval; do - IFS=$lt_save_ifs - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else $as_nop - pic_mode=default -fi - - - - - - - - - # Check whether --enable-fast-install was given. -if test ${enable_fast_install+y} -then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else $as_nop - enable_fast_install=yes -fi - - - - - - - - - shared_archive_member_spec= -case $host,$enable_shared in -power*-*-aix[5-9]*,yes) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -printf %s "checking which variant of shared library versioning to provide... " >&6; } - -# Check whether --with-aix-soname was given. -if test ${with_aix_soname+y} -then : - withval=$with_aix_soname; case $withval in - aix|svr4|both) - ;; - *) - as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname -else $as_nop - if test ${lt_cv_with_aix_soname+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_with_aix_soname=aix -fi - - with_aix_soname=$lt_cv_with_aix_soname -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -printf "%s\n" "$with_aix_soname" >&6; } - if test aix != "$with_aix_soname"; then - # For the AIX way of multilib, we name the shared archive member - # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', - # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. - # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, - # the AIX toolchain works better with OBJECT_MODE set (default 32). - if test 64 = "${OBJECT_MODE-32}"; then - shared_archive_member_spec=shr_64 - else - shared_archive_member_spec=shr - fi - fi - ;; -*) - with_aix_soname=aix - ;; -esac - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -printf %s "checking for objdir... " >&6; } -if test ${lt_cv_objdir+y} -then : - printf %s "(cached) " >&6 -else $as_nop - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -printf "%s\n" "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a '.a' archive for static linking (except MSVC and -# ICC, which need '.lib'). -libext=a - -with_gnu_ld=$lt_cv_prog_gnu_ld - -old_CC=$CC -old_CFLAGS=$CFLAGS - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -func_cc_basename $compiler -cc_basename=$func_cc_basename_result - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -printf %s "checking for ${ac_tool_prefix}file... " >&6; } -if test ${lt_cv_path_MAGIC_CMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/${ac_tool_prefix}file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac -fi - -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -printf "%s\n" "$MAGIC_CMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -printf %s "checking for file... " >&6; } -if test ${lt_cv_path_MAGIC_CMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac -fi - -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -printf "%s\n" "$MAGIC_CMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC=$CC -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test yes = "$GCC"; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test ${lt_cv_prog_compiler_rtti_exceptions+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test yes = "$GCC"; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - lt_prog_compiler_pic='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - case $cc_basename in - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='$wl-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64, which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # flang / f18. f95 an alias for gfortran or flang on Debian - flang* | f18* | f95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | $SED 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -printf %s "checking for $compiler option to produce PIC... " >&6; } -if test ${lt_cv_prog_compiler_pic+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test ${lt_cv_prog_compiler_pic_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } - -if test yes = "$lt_cv_prog_compiler_pic_works"; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test ${lt_cv_prog_compiler_static_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_static_works=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } - -if test yes = "$lt_cv_prog_compiler_static_works"; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links=nottested -if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then - # do not overwrite the value of need_locks provided by the user - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -printf %s "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -printf "%s\n" "$hard_links" >&6; } - if test no = "$hard_links"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ' (' and ')$', so one must not match beginning or - # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', - # as well as any symbol that contains 'd'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++ or Intel C++ Compiler. - if test yes != "$GCC"; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) - with_gnu_ld=yes - ;; - openbsd* | bitrig*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test yes = "$with_gnu_ld"; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test yes = "$lt_use_gnu_ld_interface"; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='$wl' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - export_dynamic_flag_spec='$wl--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='$wl--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - file_list_spec='@' - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test linux-dietlibc = "$host_os"; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test no = "$tmp_diet" - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - nagfor*) # NAGFOR 5.3 - tmp_sharedflag='-Wl,-shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | $SED 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - tcc*) - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - export_dynamic_flag_spec='-rdynamic' - ;; - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test no = "$ld_shlibs"; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test ia64 = "$host_cpu"; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag= - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then - aix_use_runtimelinking=yes - break - fi - done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # traditional, no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - hardcode_direct=no - hardcode_direct_absolute=no - ;; - esac - - if test yes = "$GCC"; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag="$shared_flag "'$wl-G' - fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' - else - # not using gcc - if test ia64 = "$host_cpu"; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' - else - shared_flag='$wl-bM:SRE' - fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' - fi - fi - - export_dynamic_flag_spec='$wl-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if test ${lt_cv_aix_libpath_+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag - else - if test ia64 = "$host_cpu"; then - hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if test ${lt_cv_aix_libpath_+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' $wl-bernotok' - allow_undefined_flag=' $wl-berok' - if test yes = "$with_gnu_ld"; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++ or Intel C++ Compiler. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl* | icl*) - # Native MSVC or ICC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC and ICC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test yes = "$lt_cv_ld_force_load"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag=$_lt_dar_allow_undefined - case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test yes = "$_lt_dar_can_shared"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly* | midnightbsd*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test yes = "$GCC"; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='$wl-E' - ;; - - hpux10*) - if test yes,no = "$GCC,$with_gnu_ld"; then - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test yes,no = "$GCC,$with_gnu_ld"; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -printf %s "checking if $CC understands -b... " >&6; } -if test ${lt_cv_prog_compiler__b+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler__b=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } - -if test yes = "$lt_cv_prog_compiler__b"; then - archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if test ${lt_cv_irix_exported_symbol+y} -then : - printf %s "(cached) " >&6 -else $as_nop - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - lt_cv_irix_exported_symbol=yes -else $as_nop - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } - if test yes = "$lt_cv_irix_exported_symbol"; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' - fi - link_all_deplibs=no - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - linux*) - case $cc_basename in - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - ld_shlibs=yes - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - ;; - esac - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd* | bitrig*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' - else - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - file_list_spec='@' - ;; - - osf3*) - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test yes = "$GCC"; then - wlarc='$wl' - archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='$wl' - archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. GCC discards it without '$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test yes = "$GCC"; then - whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test sequent = "$host_vendor"; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='$wl-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='$wl-z,text' - allow_undefined_flag='$wl-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='$wl-Bexport' - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test sni = "$host_vendor"; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='$wl-Blargedynsym' - ;; - esac - fi - fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -printf "%s\n" "$ld_shlibs" >&6; } -test no = "$ld_shlibs" && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test yes,yes = "$GCC,$enable_shared"; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -printf %s "checking whether -lc should be explicitly linked in... " >&6; } -if test ${lt_cv_archive_cmds_need_lc+y} -then : - printf %s "(cached) " >&6 -else $as_nop - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -printf %s "checking dynamic linker characteristics... " >&6; } - -if test yes = "$GCC"; then - case $host_os in - darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; - *) lt_awk_arg='/^libraries:/' ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; - *) lt_sed_strip_eq='s|=/|/|g' ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary... - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - # ...but if some path component already ends with the multilib dir we assume - # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). - case "$lt_multi_os_dir; $lt_search_path_spec " in - "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) - lt_multi_os_dir= - ;; - esac - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" - elif test -n "$lt_multi_os_dir"; then - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS = " "; FS = "/|\n";} { - lt_foo = ""; - lt_count = 0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo = "/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's|/\([A-Za-z]:\)|\1|g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=.so -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - - - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then - # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a(lib.so.V)' - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='$libname$shared_ext' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl* | *,icl*) - # Native MSVC or ICC - libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec=$LIB - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC and ICC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly* | midnightbsd*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 - fi - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test yes = "$lt_cv_prog_gnu_ld"; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec='-L$libdir' - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if test ${lt_cv_shlibpath_overrides_runpath+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null -then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd* | bitrig*) - version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib - need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -os2*) - libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec; then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -printf "%s\n" "$dynamic_linker" >&6; } -test no = "$dynamic_linker" && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec -fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec -fi - -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -printf %s "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test yes = "$hardcode_automatic"; then - - # We can hardcode non-existent directories. - if test no != "$hardcode_direct" && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && - test no != "$hardcode_minus_L"; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -printf "%s\n" "$hardcode_action" >&6; } - -if test relink = "$hardcode_action" || - test yes = "$inherit_rpath"; then - # Fast installation is not supported - enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test yes != "$enable_dlopen"; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen=load_add_on - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -printf %s "checking for dlopen in -ldl... " >&6; } -if test ${ac_cv_lib_dl_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_dl_dlopen=yes -else $as_nop - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes -then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else $as_nop - - lt_cv_dlopen=dyld - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes -then : - lt_cv_dlopen=shl_load -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -printf %s "checking for shl_load in -ldld... " >&6; } -if test ${ac_cv_lib_dld_shl_load+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main (void) -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_dld_shl_load=yes -else $as_nop - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes -then : - lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else $as_nop - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes -then : - lt_cv_dlopen=dlopen -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -printf %s "checking for dlopen in -ldl... " >&6; } -if test ${ac_cv_lib_dl_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_dl_dlopen=yes -else $as_nop - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes -then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -printf %s "checking for dlopen in -lsvld... " >&6; } -if test ${ac_cv_lib_svld_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_svld_dlopen=yes -else $as_nop - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes -then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -printf %s "checking for dld_link in -ldld... " >&6; } -if test ${ac_cv_lib_dld_dld_link+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main (void) -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_dld_dld_link=yes -else $as_nop - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes -then : - lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else - enable_dlopen=yes - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS=$LDFLAGS - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS=$LIBS - LIBS="$lt_cv_dlopen_libs $LIBS" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -printf %s "checking whether a program can dlopen itself... " >&6; } -if test ${lt_cv_dlopen_self+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test yes = "$cross_compiling"; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -printf "%s\n" "$lt_cv_dlopen_self" >&6; } - - if test yes = "$lt_cv_dlopen_self"; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -printf %s "checking whether a statically linked program can dlopen itself... " >&6; } -if test ${lt_cv_dlopen_self_static+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test yes = "$cross_compiling"; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -printf %s "checking whether stripping libraries is possible... " >&6; } -if test -z "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -else - if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - case $host_os in - darwin*) - # FIXME - insert some real tests, host_os isn't really good enough - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - ;; - freebsd*) - if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi - ;; - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; - esac - fi -fi - - - - - - - - - - - - - # Report what library types will actually be built - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -printf %s "checking if libtool supports shared libraries... " >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -printf "%s\n" "$can_build_shared" >&6; } - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -printf %s "checking whether to build shared libraries... " >&6; } - test no = "$can_build_shared" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test yes = "$enable_shared" && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac - fi - ;; - esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -printf "%s\n" "$enable_shared" >&6; } - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -printf %s "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -printf "%s\n" "$enable_static" >&6; } - - - - -fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -CC=$lt_save_CC - - if test -n "$CXX" && ( test no != "$CXX" && - ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || - (test g++ != "$CXX"))); then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -printf %s "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if test ${ac_cv_prog_CXXCPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CXX needs to be expanded - for CXXCPP in "$CXX -E" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -printf "%s\n" "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -else - _lt_caught_CXX_error=yes -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -compiler_needs_object_CXX=no -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_direct_absolute_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -inherit_rpath_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -reload_flag_CXX=$reload_flag -reload_cmds_CXX=$reload_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_caught_CXX_error"; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - - # save warnings/boilerplate of simple test code - ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - - ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - compiler_CXX=$CC - func_cc_basename $compiler -cc_basename=$func_cc_basename_result - - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test yes = "$GXX"; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' - else - lt_prog_compiler_no_builtin_flag_CXX= - fi - - if test yes = "$GXX"; then - # Set up default GNU C++ configuration - - - -# Check whether --with-gnu-ld was given. -if test ${with_gnu_ld+y} -then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else $as_nop - with_gnu_ld=no -fi - -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -printf %s "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -printf %s "checking for GNU ld... " >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -printf %s "checking for non-GNU ld... " >&6; } -fi -if test ${lt_cv_path_LD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -printf %s "checking if the linker ($LD) is GNU ld... " >&6; } -if test ${lt_cv_prog_gnu_ld+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test yes = "$with_gnu_ld"; then - archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='$wl' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - ld_shlibs_CXX=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix[4-9]*) - if test ia64 = "$host_cpu"; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag= - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - file_list_spec_CXX='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - hardcode_direct_CXX=no - hardcode_direct_absolute_CXX=no - ;; - esac - - if test yes = "$GXX"; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag=$shared_flag' $wl-G' - fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' - else - # not using gcc - if test ia64 = "$host_cpu"; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' - else - shared_flag='$wl-bM:SRE' - fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' - fi - fi - - export_dynamic_flag_spec_CXX='$wl-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - always_export_symbols_CXX=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - # The "-G" linker flag allows undefined symbols. - no_undefined_flag_CXX='-bernotok' - # Determine the default libpath from the value encoded in an empty - # executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if test ${lt_cv_aix_libpath__CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=/usr/lib:/lib - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag - else - if test ia64 = "$host_cpu"; then - hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if test ${lt_cv_aix_libpath__CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=/usr/lib:/lib - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' $wl-bernotok' - allow_undefined_flag_CXX=' $wl-berok' - if test yes = "$with_gnu_ld"; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - fi - archive_cmds_need_lc_CXX=yes - archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared - # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl* | ,icl* | no,icl*) - # Native MSVC or ICC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_CXX=' ' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=yes - file_list_spec_CXX='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' - enable_shared_with_static_runtimes_CXX=yes - # Don't use ranlib - old_postinstall_cmds_CXX='chmod 644 $oldlib' - postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - export_dynamic_flag_spec_CXX='$wl--export-all-symbols' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - - - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - if test yes = "$lt_cv_ld_force_load"; then - whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec_CXX='' - fi - link_all_deplibs_CXX=yes - allow_undefined_flag_CXX=$_lt_dar_allow_undefined - case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test yes = "$_lt_dar_can_shared"; then - output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds_CXX="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" - if test yes != "$lt_cv_apple_cc_single_mod"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" - fi - - else - ld_shlibs_CXX=no - fi - - ;; - - os2*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_minus_L_CXX=yes - allow_undefined_flag_CXX=unsupported - shrext_cmds=.dll - archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes_CXX=yes - file_list_spec_CXX='@' - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - ld_shlibs_CXX=no - ;; - - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - - freebsd* | dragonfly* | midnightbsd*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - - haiku*) - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - link_all_deplibs_CXX=yes - ;; - - hpux9*) - hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='$wl-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test yes = "$GXX"; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - export_dynamic_flag_spec_CXX='$wl-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - interix[3-9]*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - export_dynamic_flag_spec_CXX='$wl-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - hardcode_libdir_separator_CXX=: - inherit_rpath_CXX=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [1-5].* | *pgcpp\ [1-5].*) - prelink_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - old_archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | $SED 5q` in - *Sun\ C*) - # Sun C++ 5.9 - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' - hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object_CXX=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - ld_shlibs_CXX=yes - ;; - - openbsd* | bitrig*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - hardcode_direct_absolute_CXX=yes - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='$wl-E' - whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - ld_shlibs_CXX=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - case $host in - osf3*) - allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' - archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - ;; - *) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ - $RM $lib.exp' - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - ;; - esac - - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test yes,no = "$GXX,$with_gnu_ld"; then - allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' - case $host in - osf3*) - archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - ;; - *) - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test yes,no = "$GXX,$with_gnu_ld"; then - no_undefined_flag_CXX=' $wl-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' - else - # g++ 2.7 appears to require '-G' NOT '-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' - fi - - hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='$wl-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_CXX='$wl-z,text' - allow_undefined_flag_CXX='$wl-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='$wl-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ - '"$old_archive_cmds_CXX" - reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ - '"$reload_cmds_CXX" - ;; - *) - archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -printf "%s\n" "$ld_shlibs_CXX" >&6; } - test no = "$ld_shlibs_CXX" && can_build_shared=no - - GCC_CXX=$GXX - LD_CXX=$LD - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - # Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF - - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; -esac - -if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $prev$p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test x-L = "$p" || - test x-R = "$p"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test no = "$pre_test_object_deps_done"; then - case $prev in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX=$prev$p - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX=$prev$p - else - postdeps_CXX="${postdeps_CXX} $prev$p" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test no = "$pre_test_object_deps_done"; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX=$p - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX=$p - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -case $host_os in -interix[3-9]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - compiler_lib_search_dirs_CXX= -if test -n "${compiler_lib_search_path_CXX}"; then - compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - - - # C++ specific cases for pic, static, wl, etc. - if test yes = "$GXX"; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - lt_prog_compiler_pic_CXX='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic_CXX='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static_CXX='$wl-static' - ;; - esac - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix[4-9]*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly* | midnightbsd*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='$wl-a ${wl}archive' - if test ia64 != "$host_cpu"; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='$wl-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64, which still supported -KPIC. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-qpic' - lt_prog_compiler_static_CXX='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | $SED 5q` in - *Sun\ C*) - # Sun C++ 5.9 - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -printf %s "checking for $compiler option to produce PIC... " >&6; } -if test ${lt_cv_prog_compiler_pic_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } -lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if test ${lt_cv_prog_compiler_pic_works_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works_CXX=yes - fi - fi - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } - -if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test ${lt_cv_prog_compiler_static_works_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_static_works_CXX=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works_CXX=yes - fi - else - lt_cv_prog_compiler_static_works_CXX=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } - -if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then - : -else - lt_prog_compiler_static_CXX= -fi - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - -hard_links=nottested -if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then - # do not overwrite the value of need_locks provided by the user - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -printf %s "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -printf "%s\n" "$hard_links" >&6; } - if test no = "$hard_links"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - case $host_os in - aix[4-9]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX=$ltdll_cmds - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl* | icl*) - exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs_CXX=no - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -printf "%s\n" "$ld_shlibs_CXX" >&6; } -test no = "$ld_shlibs_CXX" && can_build_shared=no - -with_gnu_ld_CXX=$with_gnu_ld - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test yes,yes = "$GCC,$enable_shared"; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -printf %s "checking whether -lc should be explicitly linked in... " >&6; } -if test ${lt_cv_archive_cmds_need_lc_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc_CXX=no - else - lt_cv_archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } - archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -printf %s "checking dynamic linker characteristics... " >&6; } - -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=.so -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - - - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then - # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a(lib.so.V)' - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='$libname$shared_ext' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl* | *,icl*) - # Native MSVC or ICC - libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec=$LIB - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC and ICC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly* | midnightbsd*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 - fi - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test yes = "$lt_cv_prog_gnu_ld"; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if test ${lt_cv_shlibpath_overrides_runpath+y} -then : - printf %s "(cached) " >&6 -else $as_nop - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null -then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd* | bitrig*) - version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib - need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -os2*) - libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec; then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -printf "%s\n" "$dynamic_linker" >&6; } -test no = "$dynamic_linker" && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec -fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec -fi - -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -printf %s "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || - test -n "$runpath_var_CXX" || - test yes = "$hardcode_automatic_CXX"; then - - # We can hardcode non-existent directories. - if test no != "$hardcode_direct_CXX" && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && - test no != "$hardcode_minus_L_CXX"; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -printf "%s\n" "$hardcode_action_CXX" >&6; } - -if test relink = "$hardcode_action_CXX" || - test yes = "$inherit_rpath_CXX"; then - # Fast installation is not supported - enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test yes != "$_lt_caught_CXX_error" - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - -# Check whether the linker supports version scripts -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker supports version scripts" >&5 -printf %s "checking whether the linker supports version scripts... " >&6; } -save_LDFLAGS=$LDFLAGS -LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" -cat > conftest.map <conftest.$ac_ext -/* end confdefs.h. */ -int main() { return 0; } -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - have_ld_version_script=yes; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else $as_nop - have_ld_version_script=no; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LDFLAGS=$save_LDFLAGS - if test "$have_ld_version_script" = "yes"; then - HAVE_LD_VERSION_SCRIPT_TRUE= - HAVE_LD_VERSION_SCRIPT_FALSE='#' -else - HAVE_LD_VERSION_SCRIPT_TRUE='#' - HAVE_LD_VERSION_SCRIPT_FALSE= -fi - - -# Checks for header files. -# Autoupdate added the next two lines to ensure that your configure -# script's behavior did not change. They are probably safe to remove. - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - - -ac_fn_cxx_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" -if test "x$ac_cv_header_fcntl_h" = xyes -then : - printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h - -fi -ac_fn_cxx_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" -if test "x$ac_cv_header_inttypes_h" = xyes -then : - printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h - -fi -ac_fn_cxx_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes -then : - printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h - -fi -ac_fn_cxx_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes -then : - printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h - -fi -ac_fn_cxx_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" -if test "x$ac_cv_header_unistd_h" = xyes -then : - printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h - -fi - - -# Checks for library functions. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -printf %s "checking for working memcmp... " >&6; } -if test ${ac_cv_func_memcmp_working+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - ac_cv_func_memcmp_working=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main (void) -{ - - /* Some versions of memcmp are not 8-bit clean. */ - char c0 = '\100', c1 = '\200', c2 = '\201'; - if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) - return 1; - - /* The Next x86 OpenStep bug shows up only when comparing 16 bytes - or more and with at least one buffer not starting on a 4-byte boundary. - William Lewis provided this test program. */ - { - char foo[21]; - char bar[21]; - int i; - for (i = 0; i < 4; i++) - { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - return 1; - } - return 0; - } - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_run "$LINENO" -then : - ac_cv_func_memcmp_working=yes -else $as_nop - ac_cv_func_memcmp_working=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } -test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in - *" memcmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" - ;; -esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 -printf %s "checking for working strtod... " >&6; } -if test ${ac_cv_func_strtod+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - ac_cv_func_strtod=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -$ac_includes_default -#ifndef strtod -double strtod (); -#endif -int -main (void) -{ - { - /* Some versions of Linux strtod mis-parse strings with leading '+'. */ - char *string = " +69"; - char *term; - double value; - value = strtod (string, &term); - if (value != 69 || term != (string + 4)) - return 1; - } - - { - /* Under Solaris 2.4, strtod returns the wrong value for the - terminating character under some conditions. */ - char *string = "NaN"; - char *term; - strtod (string, &term); - if (term != string && *(term - 1) == 0) - return 1; - } - return 0; -} - -_ACEOF -if ac_fn_cxx_try_run "$LINENO" -then : - ac_cv_func_strtod=yes -else $as_nop - ac_cv_func_strtod=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 -printf "%s\n" "$ac_cv_func_strtod" >&6; } -if test $ac_cv_func_strtod = no; then - case " $LIBOBJS " in - *" strtod.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtod.$ac_objext" - ;; -esac - -ac_fn_cxx_check_func "$LINENO" "pow" "ac_cv_func_pow" -if test "x$ac_cv_func_pow" = xyes -then : - -fi - -if test $ac_cv_func_pow = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 -printf %s "checking for pow in -lm... " >&6; } -if test ${ac_cv_lib_m_pow+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -namespace conftest { - extern "C" int pow (); -} -int -main (void) -{ -return conftest::pow (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - ac_cv_lib_m_pow=yes -else $as_nop - ac_cv_lib_m_pow=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 -printf "%s\n" "$ac_cv_lib_m_pow" >&6; } -if test "x$ac_cv_lib_m_pow" = xyes -then : - POW_LIB=-lm -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 -printf "%s\n" "$as_me: WARNING: cannot find library containing definition of pow" >&2;} -fi - -fi - -fi - -ac_fn_cxx_check_func "$LINENO" "ftruncate" "ac_cv_func_ftruncate" -if test "x$ac_cv_func_ftruncate" = xyes -then : - printf "%s\n" "#define HAVE_FTRUNCATE 1" >>confdefs.h - -fi -ac_fn_cxx_check_func "$LINENO" "memset" "ac_cv_func_memset" -if test "x$ac_cv_func_memset" = xyes -then : - printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h - -fi -ac_fn_cxx_check_func "$LINENO" "mkdir" "ac_cv_func_mkdir" -if test "x$ac_cv_func_mkdir" = xyes -then : - printf "%s\n" "#define HAVE_MKDIR 1" >>confdefs.h - -fi -ac_fn_cxx_check_func "$LINENO" "strchr" "ac_cv_func_strchr" -if test "x$ac_cv_func_strchr" = xyes -then : - printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h - -fi -ac_fn_cxx_check_func "$LINENO" "strerror" "ac_cv_func_strerror" -if test "x$ac_cv_func_strerror" = xyes -then : - printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h - -fi -ac_fn_cxx_check_func "$LINENO" "strtol" "ac_cv_func_strtol" -if test "x$ac_cv_func_strtol" = xyes -then : - printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h - -fi - - -# Check for zlib. -HAVE_ZLIB=0 -if test "$with_zlib" != no -then : - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking zlib version" >&5 -printf %s "checking zlib version... " >&6; } - - # First check the zlib header version. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204) - # error zlib version too old - #endif - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok (1.2.0.4 or later)" >&5 -printf "%s\n" "ok (1.2.0.4 or later)" >&6; } - - # Also need to add -lz to the linker flags and make sure this succeeds. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5 -printf %s "checking for library containing zlibVersion... " >&6; } -if test ${ac_cv_search_zlibVersion+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -namespace conftest { - extern "C" int zlibVersion (); -} -int -main (void) -{ -return conftest::zlibVersion (); - ; - return 0; -} -_ACEOF -for ac_lib in '' z -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_cxx_try_link "$LINENO" -then : - ac_cv_search_zlibVersion=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_zlibVersion+y} -then : - break -fi -done -if test ${ac_cv_search_zlibVersion+y} -then : - -else $as_nop - ac_cv_search_zlibVersion=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5 -printf "%s\n" "$ac_cv_search_zlibVersion" >&6; } -ac_res=$ac_cv_search_zlibVersion -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - - -printf "%s\n" "#define HAVE_ZLIB 1" >>confdefs.h - - HAVE_ZLIB=1 - -else $as_nop - - if test "$with_zlib" != check -then : - - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "--with-zlib was given, but no working zlib library was found -See \`config.log' for more details" "$LINENO" 5; } - -fi - -fi - - -else $as_nop - - if test "$with_zlib" = check -then : - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: headers missing or too old (requires 1.2.0.4)" >&5 -printf "%s\n" "headers missing or too old (requires 1.2.0.4)" >&6; } - -else $as_nop - - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "--with-zlib was given, but zlib headers were not present or were too old (requires 1.2.0.4) -See \`config.log' for more details" "$LINENO" 5; } - -fi - -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - -fi - if test $HAVE_ZLIB = 1; then - HAVE_ZLIB_TRUE= - HAVE_ZLIB_FALSE='#' -else - HAVE_ZLIB_TRUE='#' - HAVE_ZLIB_FALSE= -fi - - -# Add -std=c++11 if necesssary. It is important for us to do this before the -# libatomic check below, since that also depends on C++11. - ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_success=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 -printf %s "checking whether $CXX supports C++11 features by default... " >&6; } -if test ${ax_cv_cxx_compile_cxx11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -#include - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - - namespace test_std_move_and_forward - { - struct message {}; - char foo(message&) { return '\0'; } - int foo(message&&) { return 0; } - - template - void check(Arg&& arg, RT rt) { - static_assert(sizeof(rt) == sizeof(foo(std::forward(arg))), ""); - } - void test() { - message a; - check(a, char()); - check(std::move(a), int()); - } - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - - - -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ax_cv_cxx_compile_cxx11=yes -else $as_nop - ax_cv_cxx_compile_cxx11=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 -printf "%s\n" "$ax_cv_cxx_compile_cxx11" >&6; } - if test x$ax_cv_cxx_compile_cxx11 = xyes; then - ac_success=yes - fi - - - - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 -printf %s "checking whether $CXX supports C++11 features with $switch... " >&6; } -if eval test \${$cachevar+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_CXX="$CXX" - CXX="$CXX $switch" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -#include - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - - namespace test_std_move_and_forward - { - struct message {}; - char foo(message&) { return '\0'; } - int foo(message&&) { return 0; } - - template - void check(Arg&& arg, RT rt) { - static_assert(sizeof(rt) == sizeof(foo(std::forward(arg))), ""); - } - void test() { - message a; - check(a, char()); - check(std::move(a), int()); - } - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - - - -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - eval $cachevar=yes -else $as_nop - eval $cachevar=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CXX="$ac_save_CXX" -fi -eval ac_res=\$$cachevar - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - if test x$ax_cxx_compile_cxx11_required = xtrue; then - if test x$ac_success = xno; then - as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 - fi - fi - if test x$ac_success = xno; then - HAVE_CXX11=0 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 -printf "%s\n" "$as_me: No compiler with C++11 support was found" >&6;} - else - HAVE_CXX11=1 - -printf "%s\n" "#define HAVE_CXX11 1" >>confdefs.h - - fi - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -latomic is needed" >&5 -printf %s "checking whether -latomic is needed... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - std::atomic v; - int main() { - return v; - } - -_ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - STD_ATOMIC_NEED_LIBATOMIC=no -else $as_nop - STD_ATOMIC_NEED_LIBATOMIC=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STD_ATOMIC_NEED_LIBATOMIC" >&5 -printf "%s\n" "$STD_ATOMIC_NEED_LIBATOMIC" >&6; } -if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then - LIBATOMIC_LIBS="-latomic" -fi - - -if test "$with_protoc" != "no" -then : - - PROTOC=$with_protoc - if test "$with_protoc" = "yes" -then : - - # No argument given. Use system protoc. - PROTOC=protoc - -fi - if echo "$PROTOC" | grep -q '^[^/].*/' -then : - - # Does not start with a slash, but contains a slash. So, it's a relative - # path (as opposed to an absolute path or an executable in $PATH). - # Since it will actually be executed from the src directory, prefix with - # the current directory. We also insert $ac_top_build_prefix in case this - # is a nested package and --with-protoc was actually given on the outer - # package's configure script. - PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC - -fi - - -fi - if test "$with_protoc" != "no"; then - USE_EXTERNAL_PROTOC_TRUE= - USE_EXTERNAL_PROTOC_FALSE='#' -else - USE_EXTERNAL_PROTOC_TRUE='#' - USE_EXTERNAL_PROTOC_FALSE= -fi - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on Tru64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - if test "x$PTHREAD_CC" != "x" -then : - CC="$PTHREAD_CC" -fi - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 -printf %s "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char pthread_join (); -int -main (void) -{ -return pthread_join (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ax_pthread_ok=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 -printf "%s\n" "$ax_pthread_ok" >&6; } - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items with a "," contain both -# C compiler flags (before ",") and linker flags (after ","). Other items -# starting with a "-" are C compiler flags, and remaining items are -# library names, except for "none" which indicates that we try without -# any flags at all, and "pthread-config" which is a program returning -# the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 -# (Note: HP C rejects this with "bad form for `-t' option") -# -pthreads: Solaris/gcc (Note: HP C also rejects) -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads and -# -D_REENTRANT too), HP C (must be checked before -lpthread, which -# is present but should not be used directly; and before -mthreads, -# because the compiler interprets this as "-mt" + "-hreads") -# -mthreads: Mingw32/gcc, Lynx/gcc -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case $host_os in - - freebsd*) - - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; - - hpux*) - - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." - - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; - - openedition*) - - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 -printf "%s\n" "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} -fi -rm -rf conftest* - - ;; - - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). - - ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" - ;; -esac - -# Are we compiling with Clang? - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 -printf %s "checking whether $CC is Clang... " >&6; } -if test ${ax_cv_PTHREAD_CLANG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ax_cv_PTHREAD_CLANG=no - # Note that Autoconf sets GCC=yes for Clang as well as GCC - if test "x$GCC" = "xyes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 -then : - ax_cv_PTHREAD_CLANG=yes -fi -rm -rf conftest* - - fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 -printf "%s\n" "$ax_cv_PTHREAD_CLANG" >&6; } -ax_pthread_clang="$ax_cv_PTHREAD_CLANG" - - -# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) - -# Note that for GCC and Clang -pthread generally implies -lpthread, -# except when -nostdlib is passed. -# This is problematic using libtool to build C++ shared libraries with pthread: -# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 -# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 -# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 -# To solve this, first try -pthread together with -lpthread for GCC - -if test "x$GCC" = "xyes" -then : - ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags" -fi - -# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first - -if test "x$ax_pthread_clang" = "xyes" -then : - ax_pthread_flags="-pthread,-lpthread -pthread" -fi - - -# The presence of a feature test macro requesting re-entrant function -# definitions is, on some systems, a strong hint that pthreads support is -# correctly enabled - -case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; - - aix*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; - - *) - ax_pthread_check_macro="--" - ;; -esac -if test "x$ax_pthread_check_macro" = "x--" -then : - ax_pthread_check_cond=0 -else $as_nop - ax_pthread_check_cond="!defined($ax_pthread_check_macro)" -fi - - -if test "x$ax_pthread_ok" = "xno"; then -for ax_pthread_try_flag in $ax_pthread_flags; do - - case $ax_pthread_try_flag in - none) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 -printf %s "checking whether pthreads work without any flags... " >&6; } - ;; - - *,*) - PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` - PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5 -printf %s "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; } - ;; - - -*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 -printf %s "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - - pthread-config) - # Extract the first word of "pthread-config", so it can be a program name with args. -set dummy pthread-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ax_pthread_config+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ax_pthread_config"; then - ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ax_pthread_config="yes" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" -fi -fi -ax_pthread_config=$ac_cv_prog_ax_pthread_config -if test -n "$ax_pthread_config"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 -printf "%s\n" "$ax_pthread_config" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - if test "x$ax_pthread_config" = "xno" -then : - continue -fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 -printf %s "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void *some_global = NULL; - static void routine(void *a) - { - /* To avoid any unused-parameter or - unused-but-set-parameter warning. */ - some_global = a; - } - static void *start_routine(void *a) { return a; } -int -main (void) -{ -pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ax_pthread_ok=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 -printf "%s\n" "$ax_pthread_ok" >&6; } - if test "x$ax_pthread_ok" = "xyes" -then : - break -fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - - -# Clang needs special handling, because older versions handle the -pthread -# option in a rather... idiosyncratic way - -if test "x$ax_pthread_clang" = "xyes"; then - - # Clang takes -pthread; it has never supported any other flag - - # (Note 1: This will need to be revisited if a system that Clang - # supports has POSIX threads in a separate library. This tends not - # to be the way of modern systems, but it's conceivable.) - - # (Note 2: On some systems, notably Darwin, -pthread is not needed - # to get POSIX threads support; the API is always present and - # active. We could reasonably leave PTHREAD_CFLAGS empty. But - # -pthread does define _REENTRANT, and while the Darwin headers - # ignore this macro, third-party headers might not.) - - # However, older versions of Clang make a point of warning the user - # that, in an invocation where only linking and no compilation is - # taking place, the -pthread option has no effect ("argument unused - # during compilation"). They expect -pthread to be passed in only - # when source code is being compiled. - # - # Problem is, this is at odds with the way Automake and most other - # C build frameworks function, which is that the same flags used in - # compilation (CFLAGS) are also used in linking. Many systems - # supported by AX_PTHREAD require exactly this for POSIX threads - # support, and in fact it is often not straightforward to specify a - # flag that is used only in the compilation phase and not in - # linking. Such a scenario is extremely rare in practice. - # - # Even though use of the -pthread flag in linking would only print - # a warning, this can be a nuisance for well-run software projects - # that build with -Werror. So if the active version of Clang has - # this misfeature, we search for an option to squash it. - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 -printf %s "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } -if test ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown - # Create an alternate version of $ac_link that compiles and - # links in two steps (.c -> .o, .o -> exe) instead of one - # (.c -> exe), because the warning occurs only in the second - # step - ax_pthread_save_ac_link="$ac_link" - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - if test "x$ax_pthread_try" = "xunknown" -then : - break -fi - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(void){return 0;} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_link="$ax_pthread_2step_ac_link" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(void){return 0;} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - if test "x$ax_pthread_try" = "x" -then : - ax_pthread_try=no -fi - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 -printf "%s\n" "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } - - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac - -fi # $ax_pthread_clang = yes - - - -# Various other checks: -if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 -printf %s "checking for joinable pthread attribute... " >&6; } -if test ${ax_cv_PTHREAD_JOINABLE_ATTR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -int attr = $ax_pthread_attr; return attr /* ; */ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - done - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 -printf "%s\n" "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } - if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes" -then : - -printf "%s\n" "#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR" >>confdefs.h - - ax_pthread_joinable_attr_defined=yes - -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 -printf %s "checking whether more special flags are required for pthreads... " >&6; } -if test ${ax_cv_PTHREAD_SPECIAL_FLAGS+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 -printf "%s\n" "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } - if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes" -then : - PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 -printf %s "checking for PTHREAD_PRIO_INHERIT... " >&6; } -if test ${ax_cv_PTHREAD_PRIO_INHERIT+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -int i = PTHREAD_PRIO_INHERIT; - return i; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ax_cv_PTHREAD_PRIO_INHERIT=yes -else $as_nop - ax_cv_PTHREAD_PRIO_INHERIT=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 -printf "%s\n" "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } - if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes" -then : - -printf "%s\n" "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h - - ax_pthread_prio_inherit_defined=yes - -fi - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - case "x/$CC" in #( - x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : - #handle absolute path differently from PATH based program lookup - case "x$CC" in #( - x/*) : - if as_fn_executable_p ${CC}_r -then : - PTHREAD_CC="${CC}_r" -fi ;; #( - *) : - for ac_prog in ${CC}_r -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_PTHREAD_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$PTHREAD_CC"; then - ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_PTHREAD_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PTHREAD_CC=$ac_cv_prog_PTHREAD_CC -if test -n "$PTHREAD_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 -printf "%s\n" "$PTHREAD_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$PTHREAD_CC" && break -done -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - ;; -esac ;; #( - *) : - ;; -esac - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - - - - - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test "x$ax_pthread_ok" = "xyes"; then - -printf "%s\n" "#define HAVE_PTHREAD 1" >>confdefs.h - - : -else - ax_pthread_ok=no - -fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - if test "x$ax_pthread_ok" = "xyes"; then - HAVE_PTHREAD_TRUE= - HAVE_PTHREAD_FALSE='#' -else - HAVE_PTHREAD_TRUE='#' - HAVE_PTHREAD_FALSE= -fi - -# We still keep this for improving pbconfig.h for unsupported platforms. - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the location of hash_map" >&5 -printf %s "checking the location of hash_map... " >&6; } - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - ac_cv_cxx_hash_map="" - # First try unordered_map, but not on gcc's before 4.2 -- I've - # seen unexplainable unordered_map bugs with -O2 on older gcc's. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)) - # error GCC too old for unordered_map - #endif - -int -main (void) -{ -/* no program body necessary */ - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - stl_hash_old_gcc=no -else $as_nop - stl_hash_old_gcc=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - for location in unordered_map tr1/unordered_map; do - for namespace in std std::tr1; do - if test -z "$ac_cv_cxx_hash_map" -a "$stl_hash_old_gcc" != yes; then - # Some older gcc's have a buggy tr1, so test a bit of code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$location> -int -main (void) -{ -const ${namespace}::unordered_map t; - return t.find(5) == t.end(); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_cxx_hash_map="<$location>"; - ac_cv_cxx_hash_namespace="$namespace"; - ac_cv_cxx_hash_map_class="unordered_map"; -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - done - done - # Now try hash_map - for location in ext/hash_map hash_map; do - for namespace in __gnu_cxx "" std stdext; do - if test -z "$ac_cv_cxx_hash_map"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$location> -int -main (void) -{ -${namespace}::hash_map t - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_cxx_hash_map="<$location>"; - ac_cv_cxx_hash_namespace="$namespace"; - ac_cv_cxx_hash_map_class="hash_map"; -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - done - done - ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`; - ac_cv_cxx_hash_set_class=`echo "$ac_cv_cxx_hash_map_class" | sed s/map/set/`; - if test -n "$ac_cv_cxx_hash_map"; then - -printf "%s\n" "#define HAVE_HASH_MAP 1" >>confdefs.h - - -printf "%s\n" "#define HAVE_HASH_SET 1" >>confdefs.h - - -printf "%s\n" "#define HASH_MAP_H $ac_cv_cxx_hash_map" >>confdefs.h - - -printf "%s\n" "#define HASH_SET_H $ac_cv_cxx_hash_set" >>confdefs.h - - -printf "%s\n" "#define HASH_NAMESPACE $ac_cv_cxx_hash_namespace" >>confdefs.h - - -printf "%s\n" "#define HASH_MAP_CLASS $ac_cv_cxx_hash_map_class" >>confdefs.h - - -printf "%s\n" "#define HASH_SET_CLASS $ac_cv_cxx_hash_set_class" >>confdefs.h - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_hash_map" >&5 -printf "%s\n" "$ac_cv_cxx_hash_map" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: " >&5 -printf "%s\n" "" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not find an STL hash_map" >&5 -printf "%s\n" "$as_me: WARNING: could not find an STL hash_map" >&2;} - fi - - -# Enable ObjC support for conformance directory on OS X. -OBJC_CONFORMANCE_TEST=0 -case "$target_os" in - darwin*) - OBJC_CONFORMANCE_TEST=1 - ;; -esac - if test $OBJC_CONFORMANCE_TEST = 1; then - OBJC_CONFORMANCE_TEST_TRUE= - OBJC_CONFORMANCE_TEST_FALSE='#' -else - OBJC_CONFORMANCE_TEST_TRUE='#' - OBJC_CONFORMANCE_TEST_FALSE= -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -llog is needed" >&5 -printf %s "checking whether -llog is needed... " >&6; } -ANDROID_TEST=no -case "$target_os" in - *android*) - ANDROID_TEST=yes - ;; -esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ANDROID_TEST" >&5 -printf "%s\n" "$ANDROID_TEST" >&6; } -if test "x$ANDROID_TEST" = xyes; then - LIBLOG_LIBS="-llog" -fi - - -# 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. -export CFLAGS -export CXXFLAGS - - -subdirs="$subdirs third_party/googletest" - - -ac_config_files="$ac_config_files Makefile src/Makefile benchmarks/Makefile conformance/Makefile protobuf.pc protobuf-lite.pc" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -printf "%s\n" "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -printf %s "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 -printf "%s\n" "done" >&6; } - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${GCC_TRUE}" && test -z "${GCC_FALSE}"; then - as_fn_error $? "conditional \"GCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepOBJC_TRUE}" && test -z "${am__fastdepOBJC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepOBJC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepOBJC_TRUE}" && test -z "${am__fastdepOBJC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepOBJC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_LD_VERSION_SCRIPT_TRUE}" && test -z "${HAVE_LD_VERSION_SCRIPT_FALSE}"; then - as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_ZLIB_TRUE}" && test -z "${HAVE_ZLIB_FALSE}"; then - as_fn_error $? "conditional \"HAVE_ZLIB\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_EXTERNAL_PROTOC_TRUE}" && test -z "${USE_EXTERNAL_PROTOC_FALSE}"; then - as_fn_error $? "conditional \"USE_EXTERNAL_PROTOC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_PTHREAD_TRUE}" && test -z "${HAVE_PTHREAD_FALSE}"; then - as_fn_error $? "conditional \"HAVE_PTHREAD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${OBJC_CONFORMANCE_TEST_TRUE}" && test -z "${OBJC_CONFORMANCE_TEST_FALSE}"; then - as_fn_error $? "conditional \"OBJC_CONFORMANCE_TEST\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else $as_nop - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. -as_nl=' -' -export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi - -# The user is always right. -if ${PATH_SEPARATOR+false} :; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - printf "%s\n" "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else $as_nop - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else $as_nop - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by Protocol Buffers $as_me 3.21.10, which was -generated by GNU Autoconf 2.71. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` -ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config='$ac_cs_config_escaped' -ac_cs_version="\\ -Protocol Buffers config.status 3.21.10 -configured by $0, generated by GNU Autoconf 2.71, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2021 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - printf "%s\n" "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - printf "%s\n" "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - printf "%s\n" "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - printf "%s\n" "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' -configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' -predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' -postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' -predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' -postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' -LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' -reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' -reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' -GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' -inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' -link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' -always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' -exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' -predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' -postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' -predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' -postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in SHELL \ -ECHO \ -PATH_SEPARATOR \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -FILECMD \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -DLLTOOL \ -sharedlib_from_linklib_cmd \ -AR \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_import \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -lt_cv_nm_interface \ -nm_file_list_spec \ -lt_cv_truncate_bin \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib \ -compiler_lib_search_dirs \ -predep_objects \ -postdep_objects \ -predeps \ -postdeps \ -compiler_lib_search_path \ -LD_CXX \ -reload_flag_CXX \ -compiler_CXX \ -lt_prog_compiler_no_builtin_flag_CXX \ -lt_prog_compiler_pic_CXX \ -lt_prog_compiler_wl_CXX \ -lt_prog_compiler_static_CXX \ -lt_cv_prog_compiler_c_o_CXX \ -export_dynamic_flag_spec_CXX \ -whole_archive_flag_spec_CXX \ -compiler_needs_object_CXX \ -with_gnu_ld_CXX \ -allow_undefined_flag_CXX \ -no_undefined_flag_CXX \ -hardcode_libdir_flag_spec_CXX \ -hardcode_libdir_separator_CXX \ -exclude_expsyms_CXX \ -include_expsyms_CXX \ -file_list_spec_CXX \ -compiler_lib_search_dirs_CXX \ -predep_objects_CXX \ -postdep_objects_CXX \ -predeps_CXX \ -postdeps_CXX \ -compiler_lib_search_path_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -configure_time_dlsearch_path \ -configure_time_lt_sys_library_path \ -reload_cmds_CXX \ -old_archive_cmds_CXX \ -old_archive_from_new_cmds_CXX \ -old_archive_from_expsyms_cmds_CXX \ -archive_cmds_CXX \ -archive_expsym_cmds_CXX \ -module_cmds_CXX \ -module_expsym_cmds_CXX \ -export_symbols_cmds_CXX \ -prelink_cmds_CXX \ -postlink_cmds_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' - -# See if we are running on zsh, and set the options that allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - RM='$RM' - ofile='$ofile' - - - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "benchmarks/Makefile") CONFIG_FILES="$CONFIG_FILES benchmarks/Makefile" ;; - "conformance/Makefile") CONFIG_FILES="$CONFIG_FILES conformance/Makefile" ;; - "protobuf.pc") CONFIG_FILES="$CONFIG_FILES protobuf.pc" ;; - "protobuf-lite.pc") CONFIG_FILES="$CONFIG_FILES protobuf-lite.pc" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files - test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers - test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -printf "%s\n" "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`printf "%s\n" "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - printf "%s\n" "/* $configure_input */" >&1 \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - printf "%s\n" "/* $configure_input */" >&1 \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -printf "%s\n" "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - # TODO: see whether this extra hack can be removed once we start - # requiring Autoconf 2.70 or later. - case $CONFIG_FILES in #( - *\'*) : - eval set x "$CONFIG_FILES" ;; #( - *) : - set x $CONFIG_FILES ;; #( - *) : - ;; -esac - shift - # Used to flag and report bootstrapping failures. - am_rc=0 - for am_mf - do - # Strip MF so we end up with the name of the file. - am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile which includes - # dependency-tracking related rules and includes. - # Grep'ing the whole file directly is not great: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ - || continue - am_dirpart=`$as_dirname -- "$am_mf" || -$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$am_mf" : 'X\(//\)[^/]' \| \ - X"$am_mf" : 'X\(//\)$' \| \ - X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$am_mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - am_filepart=`$as_basename -- "$am_mf" || -$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ - X"$am_mf" : 'X\(//\)$' \| \ - X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$am_mf" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { echo "$as_me:$LINENO: cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles" >&5 - (cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } || am_rc=$? - done - if test $am_rc -ne 0; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "Something went wrong bootstrapping makefile fragments - 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). -See \`config.log' for more details" "$LINENO" 5; } - fi - { am_dirpart=; unset am_dirpart;} - { am_filepart=; unset am_filepart;} - { am_mf=; unset am_mf;} - { am_rc=; unset am_rc;} - rm -f conftest-deps.mk -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options that allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST - fi - - cfgfile=${ofile}T - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL -# Generated automatically by $as_me ($PACKAGE) $VERSION -# NOTE: Changes made to this file will be lost: look at ltmain.sh. - -# Provide generalized library-building support services. -# Written by Gordon Matzigkeit, 1996 - -# Copyright (C) 2014 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool 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 of of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program or library that is built -# using GNU Libtool, you may include this file under the same -# distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 . - - -# The names of the tagged configurations supported by this script. -available_tags='CXX ' - -# Configured defaults for sys_lib_dlsearch_path munging. -: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shared archive member basename,for filename based shared library versioning on AIX. -shared_archive_member_spec=$shared_archive_member_spec - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The PATH separator for the build system. -PATH_SEPARATOR=$lt_PATH_SEPARATOR - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# A file(cmd) program that detects file types. -FILECMD=$lt_FILECMD - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive (by configure). -lt_ar_flags=$lt_ar_flags - -# Flags to create an archive. -AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm into a list of symbols to manually relocate. -global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# The name lister interface. -nm_interface=$lt_lt_cv_nm_interface - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and where our libraries should be installed. -lt_sysroot=$lt_sysroot - -# Command to truncate a binary pipe. -lt_truncate_bin=$lt_lt_cv_truncate_bin - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Detected run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path - -# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. -configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects -postdep_objects=$lt_postdep_objects -predeps=$lt_predeps -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# ### END LIBTOOL CONFIG - -_LT_EOF - - cat <<'_LT_EOF' >> "$cfgfile" - -# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE - -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} - - -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} - - -# ### END FUNCTIONS SHARED WITH CONFIGURE - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - - -ltmain=$ac_aux_dir/ltmain.sh - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - $SED '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - - cat <<_LT_EOF >> "$ofile" - -# ### BEGIN LIBTOOL TAG CONFIG: CXX - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# How to create reloadable object files. -reload_flag=$lt_reload_flag_CXX -reload_cmds=$lt_reload_cmds_CXX - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds_CXX - -# A language specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU compiler? -with_gcc=$GCC_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object_CXX - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld_CXX - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute_CXX - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath_CXX - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds_CXX - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds_CXX - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec_CXX - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects_CXX -postdep_objects=$lt_postdep_objects_CXX -predeps=$lt_predeps_CXX -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# ### END LIBTOOL TAG CONFIG: CXX -_LT_EOF - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi - -# -# CONFIG_SUBDIRS section. -# -if test "$no_recursion" != yes; then - - # Remove --cache-file, --srcdir, and --disable-option-checking arguments - # so they do not pile up. - ac_sub_configure_args= - ac_prev= - eval "set x $ac_configure_args" - shift - for ac_arg - do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case $ac_arg in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ - | --c=*) - ;; - --config-cache | -C) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - ;; - --disable-option-checking) - ;; - *) - case $ac_arg in - *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_sub_configure_args " '$ac_arg'" ;; - esac - done - - # Always prepend --prefix to ensure using the same prefix - # in subdir configurations. - ac_arg="--prefix=$prefix" - case $ac_arg in - *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" - - # Pass --silent - if test "$silent" = yes; then - ac_sub_configure_args="--silent $ac_sub_configure_args" - fi - - # Always prepend --disable-option-checking to silence warnings, since - # different subdirs can have different --enable and --with options. - ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" - - ac_popdir=`pwd` - for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - test -d "$srcdir/$ac_dir" || continue - - ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 - printf "%s\n" "$ac_msg" >&6 - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - cd "$ac_dir" - - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. - if test -f "$ac_srcdir/configure.gnu"; then - ac_sub_configure=$ac_srcdir/configure.gnu - elif test -f "$ac_srcdir/configure"; then - ac_sub_configure=$ac_srcdir/configure - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 -printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - # Make the cache file name correct relative to the subdirectory. - case $cache_file in - [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; - *) # Relative name. - ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; - esac - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -printf "%s\n" "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} - # The eval makes quoting arguments work. - eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ - --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || - as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 - fi - - cd "$ac_popdir" - done -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - diff --git a/depends/protobuf/configure.ac b/depends/protobuf/configure.ac deleted file mode 100644 index ed0095047..000000000 --- a/depends/protobuf/configure.ac +++ /dev/null @@ -1,247 +0,0 @@ -## Process this file with autoconf to produce configure. -## In general, the safest way to proceed is to run ./autogen.sh - -AC_PREREQ(2.59) - -# Note: If you change the version, you must also update it in: -# * Protobuf.podspec -# * csharp/Google.Protobuf.Tools.nuspec -# * csharp/src/*/AssemblyInfo.cs -# * csharp/src/Google.Protobuf/Google.Protobuf.nuspec -# * java/*/pom.xml -# * python/google/protobuf/__init__.py -# * protoc-artifacts/pom.xml -# * src/google/protobuf/stubs/common.h -# * src/Makefile.am (Update -version-info for LDFLAGS if needed) -# -# In the SVN trunk, the version should always be the next anticipated release -# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed -# the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.21.10],[protobuf@googlegroups.com],[protobuf]) - -AM_MAINTAINER_MODE([enable]) - -AC_CONFIG_SRCDIR(src/google/protobuf/message.cc) -# The config file is generated but not used by the source code, since we only -# need very few of them, e.g. HAVE_PTHREAD and HAVE_ZLIB. Those macros are -# passed down in CXXFLAGS manually in src/Makefile.am -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_MACRO_DIR([m4]) - -AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., make dist)]) -case "$DIST_LANG" in - "") DIST_LANG=all ;; - all | cpp | csharp | java | python | javanano | objectivec | ruby | php) ;; - *) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;; -esac -AC_SUBST(DIST_LANG) - -# autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily -# the best choice for libprotobuf. -AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"], - [CFLAGS=""]) -AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], - [CXXFLAGS=""]) - -AC_CANONICAL_TARGET - -AM_INIT_AUTOMAKE([1.9 tar-ustar subdir-objects]) - -# Silent rules enabled: the output is minimal but informative. -# In particular, the warnings from the compiler stick out very clearly. -# To see all logs, use the --disable-silent-rules on configure or via make V=1 -AM_SILENT_RULES([yes]) - -AC_ARG_WITH([zlib], - [AS_HELP_STRING([--with-zlib], - [include classes for streaming compressed data in and out @<:@default=check@:>@])], - [],[with_zlib=check]) - -AC_ARG_WITH([zlib-include], - [AS_HELP_STRING([--with-zlib-include=PATH], - [zlib include directory])], - [CPPFLAGS="-I$withval $CPPFLAGS"]) - -AC_ARG_WITH([zlib-lib], - [AS_HELP_STRING([--with-zlib-lib=PATH], - [zlib lib directory])], - [LDFLAGS="-L$withval $LDFLAGS"]) - -AC_ARG_WITH([protoc], - [AS_HELP_STRING([--with-protoc=COMMAND], - [use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])], - [],[with_protoc=no]) - -# Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_PROG_CXX_FOR_BUILD -AC_LANG([C++]) -ACX_USE_SYSTEM_EXTENSIONS -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc -AS_CASE([$target_os], [darwin*], [AC_PROG_OBJC], [AM_CONDITIONAL([am__fastdepOBJC], [false])]) - -# test_util.cc takes forever to compile with GCC and optimization turned on. -AC_MSG_CHECKING([C++ compiler flags...]) -AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ - AS_IF([test "$GCC" = "yes"],[ - PROTOBUF_OPT_FLAG="-O2" - CXXFLAGS="${CXXFLAGS} -g" - ]) - - # Protocol Buffers contains several checks that are intended to be used only - # for debugging and which might hurt performance. Most users are probably - # end users who don't want these checks, so add -DNDEBUG by default. - CXXFLAGS="$CXXFLAGS -std=c++11 -DNDEBUG" - - AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS]) -],[ - AC_MSG_RESULT([use user-supplied: $CXXFLAGS]) -]) - -AC_SUBST(PROTOBUF_OPT_FLAG) - -ACX_CHECK_SUNCC - -# Have to do libtool after SUNCC, other wise it "helpfully" adds Crun Cstd -# to the link -AC_PROG_LIBTOOL - -# Check whether the linker supports version scripts -AC_MSG_CHECKING([whether the linker supports version scripts]) -save_LDFLAGS=$LDFLAGS -LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" -cat > conftest.map < - #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204) - # error zlib version too old - #endif - ]], [])], [ - AC_MSG_RESULT([ok (1.2.0.4 or later)]) - - # Also need to add -lz to the linker flags and make sure this succeeds. - AC_SEARCH_LIBS([zlibVersion], [z], [ - AC_DEFINE([HAVE_ZLIB], [1], [Enable classes using zlib compression.]) - HAVE_ZLIB=1 - ], [ - AS_IF([test "$with_zlib" != check], [ - AC_MSG_FAILURE([--with-zlib was given, but no working zlib library was found]) - ]) - ]) - ], [ - AS_IF([test "$with_zlib" = check], [ - AC_MSG_RESULT([headers missing or too old (requires 1.2.0.4)]) - ], [ - AC_MSG_FAILURE([--with-zlib was given, but zlib headers were not present or were too old (requires 1.2.0.4)]) - ]) - ]) -]) -AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1]) - -# Add -std=c++11 if necesssary. It is important for us to do this before the -# libatomic check below, since that also depends on C++11. -AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) - -dnl On some platforms, std::atomic needs a helper library -AC_MSG_CHECKING(whether -latomic is needed) -AC_LINK_IFELSE([AC_LANG_SOURCE([[ - #include - #include - std::atomic v; - int main() { - return v; - } -]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes) -AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC) -if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then - LIBATOMIC_LIBS="-latomic" -fi -AC_SUBST([LIBATOMIC_LIBS]) - -AS_IF([test "$with_protoc" != "no"], [ - PROTOC=$with_protoc - AS_IF([test "$with_protoc" = "yes"], [ - # No argument given. Use system protoc. - PROTOC=protoc - ]) - AS_IF([echo "$PROTOC" | grep -q '^@<:@^/@:>@.*/'], [ - # Does not start with a slash, but contains a slash. So, it's a relative - # path (as opposed to an absolute path or an executable in $PATH). - # Since it will actually be executed from the src directory, prefix with - # the current directory. We also insert $ac_top_build_prefix in case this - # is a nested package and --with-protoc was actually given on the outer - # package's configure script. - PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC - ]) - AC_SUBST([PROTOC]) -]) -AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"]) - -AX_PTHREAD -AM_CONDITIONAL([HAVE_PTHREAD], [test "x$ax_pthread_ok" = "xyes"]) -# We still keep this for improving pbconfig.h for unsupported platforms. -AC_CXX_STL_HASH - -# Enable ObjC support for conformance directory on OS X. -OBJC_CONFORMANCE_TEST=0 -case "$target_os" in - darwin*) - OBJC_CONFORMANCE_TEST=1 - ;; -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. -export CFLAGS -export CXXFLAGS -AC_CONFIG_SUBDIRS([third_party/googletest]) - -AC_CONFIG_FILES([Makefile src/Makefile benchmarks/Makefile conformance/Makefile protobuf.pc protobuf-lite.pc]) -AC_OUTPUT diff --git a/depends/protobuf/src/google/protobuf/compiler/java/generator.h b/depends/protobuf/google/protobuf/compiler/code_generator.cc similarity index 61% rename from depends/protobuf/src/google/protobuf/compiler/java/generator.h rename to depends/protobuf/google/protobuf/compiler/code_generator.cc index bbc71700c..455c239a9 100644 --- a/depends/protobuf/src/google/protobuf/compiler/java/generator.h +++ b/depends/protobuf/google/protobuf/compiler/code_generator.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -31,47 +31,50 @@ // Author: kenton@google.com (Kenton Varda) // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -// -// Generates Java code for a given .proto file. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__ -#include #include -// Must be included last. -#include +#include +#include namespace google { namespace protobuf { namespace compiler { -namespace java { -// CodeGenerator implementation which generates Java code. If you create your -// own protocol compiler binary and you want it to support Java output, you -// can do so by registering an instance of this CodeGenerator with the -// CommandLineInterface in your main() function. -class PROTOC_EXPORT JavaGenerator : public CodeGenerator { - public: - JavaGenerator(); - ~JavaGenerator() override; +CodeGenerator::~CodeGenerator() {} +GeneratorContext::~GeneratorContext() {} + +io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert( + const string& filename, const string& insertion_point) { + GOOGLE_LOG(FATAL) << "This GeneratorContext does not support insertion."; + return NULL; // make compiler happy +} - // implements CodeGenerator ---------------------------------------- - bool Generate(const FileDescriptor* file, const std::string& parameter, - GeneratorContext* context, std::string* error) const override; +void GeneratorContext::ListParsedFiles( + vector* output) { + GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; +} - uint64_t GetSupportedFeatures() const override; +// Parses a set of comma-delimited name/value pairs. +void ParseGeneratorParameter(const string& text, + vector >* output) { + vector parts; + SplitStringUsing(text, ",", &parts); - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator); -}; + for (int i = 0; i < parts.size(); i++) { + string::size_type equals_pos = parts[i].find_first_of('='); + pair value; + if (equals_pos == string::npos) { + value.first = parts[i]; + value.second = ""; + } else { + value.first = parts[i].substr(0, equals_pos); + value.second = parts[i].substr(equals_pos + 1); + } + output->push_back(value); + } +} -} // namespace java } // namespace compiler } // namespace protobuf } // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/code_generator.h b/depends/protobuf/google/protobuf/compiler/code_generator.h similarity index 59% rename from depends/protobuf/src/google/protobuf/compiler/code_generator.h rename to depends/protobuf/google/protobuf/compiler/code_generator.h index 9c0b115cf..252f68d1d 100644 --- a/depends/protobuf/src/google/protobuf/compiler/code_generator.h +++ b/depends/protobuf/google/protobuf/compiler/code_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -38,27 +38,18 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CODE_GENERATOR_H__ #define GOOGLE_PROTOBUF_COMPILER_CODE_GENERATOR_H__ +#include #include -#include #include -#include - -// Must be included last. -#include +#include namespace google { namespace protobuf { -namespace io { -class ZeroCopyOutputStream; -} +namespace io { class ZeroCopyOutputStream; } class FileDescriptor; -class GeneratedCodeInfo; namespace compiler { -class AccessInfoMap; - -class Version; // Defined in this file. class CodeGenerator; @@ -67,7 +58,7 @@ class GeneratorContext; // The abstract interface to a class which generates code implementing a // particular proto file in a particular language. A number of these may // be registered with CommandLineInterface to support various languages. -class PROTOC_EXPORT CodeGenerator { +class LIBPROTOC_EXPORT CodeGenerator { public: inline CodeGenerator() {} virtual ~CodeGenerator(); @@ -75,51 +66,18 @@ class PROTOC_EXPORT CodeGenerator { // Generates code for the given proto file, generating one or more files in // the given output directory. // - // A parameter to be passed to the generator can be specified on the command - // line. This is intended to be used to pass generator specific parameters. - // It is empty if no parameter was given. ParseGeneratorParameter (below), - // can be used to accept multiple parameters within the single parameter - // command line flag. + // A parameter to be passed to the generator can be specified on the + // command line. This is intended to be used by Java and similar languages + // to specify which specific class from the proto file is to be generated, + // though it could have other uses as well. It is empty if no parameter was + // given. // // Returns true if successful. Otherwise, sets *error to a description of // the problem (e.g. "invalid parameter") and returns false. virtual bool Generate(const FileDescriptor* file, - const std::string& parameter, + const string& parameter, GeneratorContext* generator_context, - std::string* error) const = 0; - - // Generates code for all given proto files. - // - // WARNING: The canonical code generator design produces one or two output - // files per input .proto file, and we do not wish to encourage alternate - // designs. - // - // A parameter is given as passed on the command line, as in |Generate()| - // above. - // - // Returns true if successful. Otherwise, sets *error to a description of - // the problem (e.g. "invalid parameter") and returns false. - virtual bool GenerateAll(const std::vector& files, - const std::string& parameter, - 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 - // method can be removed. - virtual bool HasGenerateAll() const { return true; } + string* error) const = 0; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodeGenerator); @@ -129,10 +87,9 @@ class PROTOC_EXPORT CodeGenerator { // abstract interface represents the directory to which the CodeGenerator is // to write and other information about the context in which the Generator // runs. -class PROTOC_EXPORT GeneratorContext { +class LIBPROTOC_EXPORT GeneratorContext { public: - inline GeneratorContext() { - } + inline GeneratorContext() {} virtual ~GeneratorContext(); // Opens the given file, truncating it if it exists, and returns a @@ -145,10 +102,7 @@ class PROTOC_EXPORT GeneratorContext { // generate the files "foo/bar.pb.h" and "foo/bar.pb.cc"; note that // "foo/" is included in these filenames. The filename is not allowed to // contain "." or ".." components. - virtual io::ZeroCopyOutputStream* Open(const std::string& filename) = 0; - - // Similar to Open() but the output will be appended to the file if exists - virtual io::ZeroCopyOutputStream* OpenForAppend(const std::string& filename); + virtual io::ZeroCopyOutputStream* Open(const string& filename) = 0; // Creates a ZeroCopyOutputStream which will insert code into the given file // at the given insertion point. See plugin.proto (plugin.pb.h) for more @@ -157,26 +111,12 @@ class PROTOC_EXPORT GeneratorContext { // // WARNING: This feature is currently EXPERIMENTAL and is subject to change. 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); + const string& filename, const string& insertion_point); // 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. - virtual void ListParsedFiles(std::vector* output); - - // Retrieves the version number of the protocol compiler associated with - // this GeneratorContext. - virtual void GetCompilerVersion(Version* version) const; - + virtual void ListParsedFiles(vector* output); private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratorContext); @@ -189,19 +129,14 @@ typedef GeneratorContext OutputDirectory; // Several code generators treat the parameter argument as holding a // list of options separated by commas. This helper function parses // a set of comma-delimited name/value pairs: e.g., -// "foo=bar,baz,moo=corge" +// "foo=bar,baz,qux=corge" // parses to the pairs: -// ("foo", "bar"), ("baz", ""), ("moo", "corge") -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); +// ("foo", "bar"), ("baz", ""), ("qux", "corge") +extern void ParseGeneratorParameter(const string&, + vector >*); } // namespace compiler } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_CODE_GENERATOR_H__ diff --git a/depends/protobuf/google/protobuf/compiler/command_line_interface.cc b/depends/protobuf/google/protobuf/compiler/command_line_interface.cc new file mode 100644 index 000000000..88850f2cd --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/command_line_interface.cc @@ -0,0 +1,1357 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 +#ifdef _MSC_VER +#include +#include +#else +#include +#endif +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace google { +namespace protobuf { +namespace compiler { + +#if defined(_WIN32) +#define mkdir(name, mode) mkdir(name) +#ifndef W_OK +#define W_OK 02 // not defined by MSVC for whatever reason +#endif +#ifndef F_OK +#define F_OK 00 // not defined by MSVC for whatever reason +#endif +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif +#endif + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 // If this isn't defined, the platform doesn't need it. +#endif +#endif + +namespace { +#if defined(_WIN32) && !defined(__CYGWIN__) +static const char* kPathSeparator = ";"; +#else +static const char* kPathSeparator = ":"; +#endif + +// Returns true if the text looks like a Windows-style absolute path, starting +// with a drive letter. Example: "C:\foo". TODO(kenton): Share this with +// copy in importer.cc? +static bool IsWindowsAbsolutePath(const string& text) { +#if defined(_WIN32) || defined(__CYGWIN__) + return text.size() >= 3 && text[1] == ':' && + isalpha(text[0]) && + (text[2] == '/' || text[2] == '\\') && + text.find_last_of(':') == 1; +#else + return false; +#endif +} + +void SetFdToTextMode(int fd) { +#ifdef _WIN32 + if (_setmode(fd, _O_TEXT) == -1) { + // This should never happen, I think. + GOOGLE_LOG(WARNING) << "_setmode(" << fd << ", _O_TEXT): " << strerror(errno); + } +#endif + // (Text and binary are the same on non-Windows platforms.) +} + +void SetFdToBinaryMode(int fd) { +#ifdef _WIN32 + if (_setmode(fd, _O_BINARY) == -1) { + // This should never happen, I think. + GOOGLE_LOG(WARNING) << "_setmode(" << fd << ", _O_BINARY): " << strerror(errno); + } +#endif + // (Text and binary are the same on non-Windows platforms.) +} + +void AddTrailingSlash(string* path) { + if (!path->empty() && path->at(path->size() - 1) != '/') { + path->push_back('/'); + } +} + +bool VerifyDirectoryExists(const string& path) { + if (path.empty()) return true; + + if (access(path.c_str(), W_OK) == -1) { + cerr << path << ": " << strerror(errno) << endl; + return false; + } else { + return true; + } +} + +// Try to create the parent directory of the given file, creating the parent's +// parent if necessary, and so on. The full file name is actually +// (prefix + filename), but we assume |prefix| already exists and only create +// directories listed in |filename|. +bool TryCreateParentDirectory(const string& prefix, const string& filename) { + // Recursively create parent directories to the output file. + vector parts; + SplitStringUsing(filename, "/", &parts); + string path_so_far = prefix; + for (int i = 0; i < parts.size() - 1; i++) { + path_so_far += parts[i]; + if (mkdir(path_so_far.c_str(), 0777) != 0) { + if (errno != EEXIST) { + cerr << filename << ": while trying to create directory " + << path_so_far << ": " << strerror(errno) << endl; + return false; + } + } + path_so_far += '/'; + } + + return true; +} + +} // namespace + +// A MultiFileErrorCollector that prints errors to stderr. +class CommandLineInterface::ErrorPrinter : public MultiFileErrorCollector, + public io::ErrorCollector { + public: + ErrorPrinter(ErrorFormat format, DiskSourceTree *tree = NULL) + : format_(format), tree_(tree) {} + ~ErrorPrinter() {} + + // implements MultiFileErrorCollector ------------------------------ + void AddError(const string& filename, int line, int column, + const string& message) { + + // Print full path when running under MSVS + string dfile; + if (format_ == CommandLineInterface::ERROR_FORMAT_MSVS && + tree_ != NULL && + tree_->VirtualFileToDiskFile(filename, &dfile)) { + cerr << dfile; + } else { + cerr << filename; + } + + // Users typically expect 1-based line/column numbers, so we add 1 + // to each here. + if (line != -1) { + // Allow for both GCC- and Visual-Studio-compatible output. + switch (format_) { + case CommandLineInterface::ERROR_FORMAT_GCC: + cerr << ":" << (line + 1) << ":" << (column + 1); + break; + case CommandLineInterface::ERROR_FORMAT_MSVS: + cerr << "(" << (line + 1) << ") : error in column=" << (column + 1); + break; + } + } + + cerr << ": " << message << endl; + } + + // implements io::ErrorCollector ----------------------------------- + void AddError(int line, int column, const string& message) { + AddError("input", line, column, message); + } + + private: + const ErrorFormat format_; + DiskSourceTree *tree_; +}; + +// ------------------------------------------------------------------- + +// A GeneratorContext implementation that buffers files in memory, then dumps +// them all to disk on demand. +class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { + public: + GeneratorContextImpl(const vector& parsed_files); + ~GeneratorContextImpl(); + + // Write all files in the directory to disk at the given output location, + // which must end in a '/'. + bool WriteAllToDisk(const string& prefix); + + // Write the contents of this directory to a ZIP-format archive with the + // given name. + bool WriteAllToZip(const string& filename); + + // Add a boilerplate META-INF/MANIFEST.MF file as required by the Java JAR + // format, unless one has already been written. + void AddJarManifest(); + + // implements GeneratorContext -------------------------------------- + io::ZeroCopyOutputStream* Open(const string& filename); + io::ZeroCopyOutputStream* OpenForInsert( + const string& filename, const string& insertion_point); + void ListParsedFiles(vector* output) { + *output = parsed_files_; + } + + private: + friend class MemoryOutputStream; + + // map instead of hash_map so that files are written in order (good when + // writing zips). + map files_; + const vector& parsed_files_; + bool had_error_; +}; + +class CommandLineInterface::MemoryOutputStream + : public io::ZeroCopyOutputStream { + public: + MemoryOutputStream(GeneratorContextImpl* directory, const string& filename); + MemoryOutputStream(GeneratorContextImpl* directory, const string& filename, + const string& insertion_point); + virtual ~MemoryOutputStream(); + + // implements ZeroCopyOutputStream --------------------------------- + virtual bool Next(void** data, int* size) { return inner_->Next(data, size); } + virtual void BackUp(int count) { inner_->BackUp(count); } + virtual int64 ByteCount() const { return inner_->ByteCount(); } + + private: + // Where to insert the string when it's done. + GeneratorContextImpl* directory_; + string filename_; + string insertion_point_; + + // The string we're building. + string data_; + + // StringOutputStream writing to data_. + scoped_ptr inner_; +}; + +// ------------------------------------------------------------------- + +CommandLineInterface::GeneratorContextImpl::GeneratorContextImpl( + const vector& parsed_files) + : parsed_files_(parsed_files), + had_error_(false) { +} + +CommandLineInterface::GeneratorContextImpl::~GeneratorContextImpl() { + STLDeleteValues(&files_); +} + +bool CommandLineInterface::GeneratorContextImpl::WriteAllToDisk( + const string& prefix) { + if (had_error_) { + return false; + } + + if (!VerifyDirectoryExists(prefix)) { + return false; + } + + for (map::const_iterator iter = files_.begin(); + iter != files_.end(); ++iter) { + const string& relative_filename = iter->first; + const char* data = iter->second->data(); + int size = iter->second->size(); + + if (!TryCreateParentDirectory(prefix, relative_filename)) { + return false; + } + string filename = prefix + relative_filename; + + // Create the output file. + int file_descriptor; + do { + file_descriptor = + open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + } while (file_descriptor < 0 && errno == EINTR); + + if (file_descriptor < 0) { + int error = errno; + cerr << filename << ": " << strerror(error); + return false; + } + + // Write the file. + while (size > 0) { + int write_result; + do { + write_result = write(file_descriptor, data, size); + } while (write_result < 0 && errno == EINTR); + + if (write_result <= 0) { + // Write error. + + // FIXME(kenton): According to the man page, if write() returns zero, + // there was no error; write() simply did not write anything. It's + // unclear under what circumstances this might happen, but presumably + // errno won't be set in this case. I am confused as to how such an + // event should be handled. For now I'm treating it as an error, + // since retrying seems like it could lead to an infinite loop. I + // suspect this never actually happens anyway. + + if (write_result < 0) { + int error = errno; + cerr << filename << ": write: " << strerror(error); + } else { + cerr << filename << ": write() returned zero?" << endl; + } + return false; + } + + data += write_result; + size -= write_result; + } + + if (close(file_descriptor) != 0) { + int error = errno; + cerr << filename << ": close: " << strerror(error); + return false; + } + } + + return true; +} + +bool CommandLineInterface::GeneratorContextImpl::WriteAllToZip( + const string& filename) { + if (had_error_) { + return false; + } + + // Create the output file. + int file_descriptor; + do { + file_descriptor = + open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + } while (file_descriptor < 0 && errno == EINTR); + + if (file_descriptor < 0) { + int error = errno; + cerr << filename << ": " << strerror(error); + return false; + } + + // Create the ZipWriter + io::FileOutputStream stream(file_descriptor); + ZipWriter zip_writer(&stream); + + for (map::const_iterator iter = files_.begin(); + iter != files_.end(); ++iter) { + zip_writer.Write(iter->first, *iter->second); + } + + zip_writer.WriteDirectory(); + + if (stream.GetErrno() != 0) { + cerr << filename << ": " << strerror(stream.GetErrno()) << endl; + } + + if (!stream.Close()) { + cerr << filename << ": " << strerror(stream.GetErrno()) << endl; + } + + return true; +} + +void CommandLineInterface::GeneratorContextImpl::AddJarManifest() { + string** map_slot = &files_["META-INF/MANIFEST.MF"]; + if (*map_slot == NULL) { + *map_slot = new string( + "Manifest-Version: 1.0\n" + "Created-By: 1.6.0 (protoc)\n" + "\n"); + } +} + +io::ZeroCopyOutputStream* CommandLineInterface::GeneratorContextImpl::Open( + const string& filename) { + return new MemoryOutputStream(this, filename); +} + +io::ZeroCopyOutputStream* +CommandLineInterface::GeneratorContextImpl::OpenForInsert( + const string& filename, const string& insertion_point) { + return new MemoryOutputStream(this, filename, insertion_point); +} + +// ------------------------------------------------------------------- + +CommandLineInterface::MemoryOutputStream::MemoryOutputStream( + GeneratorContextImpl* directory, const string& filename) + : directory_(directory), + filename_(filename), + inner_(new io::StringOutputStream(&data_)) { +} + +CommandLineInterface::MemoryOutputStream::MemoryOutputStream( + GeneratorContextImpl* directory, const string& filename, + const string& insertion_point) + : directory_(directory), + filename_(filename), + insertion_point_(insertion_point), + inner_(new io::StringOutputStream(&data_)) { +} + +CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { + // Make sure all data has been written. + inner_.reset(); + + // Insert into the directory. + string** map_slot = &directory_->files_[filename_]; + + if (insertion_point_.empty()) { + // This was just a regular Open(). + if (*map_slot != NULL) { + cerr << filename_ << ": Tried to write the same file twice." << endl; + directory_->had_error_ = true; + return; + } + + *map_slot = new string; + (*map_slot)->swap(data_); + } else { + // This was an OpenForInsert(). + + // If the data doens't end with a clean line break, add one. + if (!data_.empty() && data_[data_.size() - 1] != '\n') { + data_.push_back('\n'); + } + + // Find the file we are going to insert into. + if (*map_slot == NULL) { + cerr << filename_ << ": Tried to insert into file that doesn't exist." + << endl; + directory_->had_error_ = true; + return; + } + string* target = *map_slot; + + // Find the insertion point. + string magic_string = strings::Substitute( + "@@protoc_insertion_point($0)", insertion_point_); + string::size_type pos = target->find(magic_string); + + if (pos == string::npos) { + cerr << filename_ << ": insertion point \"" << insertion_point_ + << "\" not found." << endl; + directory_->had_error_ = true; + return; + } + + // Seek backwards to the beginning of the line, which is where we will + // insert the data. Note that this has the effect of pushing the insertion + // point down, so the data is inserted before it. This is intentional + // because it means that multiple insertions at the same point will end + // up in the expected order in the final output. + pos = target->find_last_of('\n', pos); + if (pos == string::npos) { + // Insertion point is on the first line. + pos = 0; + } else { + // Advance to character after '\n'. + ++pos; + } + + // Extract indent. + string indent_(*target, pos, target->find_first_not_of(" \t", pos) - pos); + + if (indent_.empty()) { + // No indent. This makes things easier. + target->insert(pos, data_); + } else { + // Calculate how much space we need. + int indent_size = 0; + for (int i = 0; i < data_.size(); i++) { + if (data_[i] == '\n') indent_size += indent_.size(); + } + + // Make a hole for it. + target->insert(pos, data_.size() + indent_size, '\0'); + + // Now copy in the data. + string::size_type data_pos = 0; + char* target_ptr = string_as_array(target) + pos; + while (data_pos < data_.size()) { + // Copy indent. + memcpy(target_ptr, indent_.data(), indent_.size()); + target_ptr += indent_.size(); + + // Copy line from data_. + // We already guaranteed that data_ ends with a newline (above), so this + // search can't fail. + string::size_type line_length = + data_.find_first_of('\n', data_pos) + 1 - data_pos; + memcpy(target_ptr, data_.data() + data_pos, line_length); + target_ptr += line_length; + data_pos += line_length; + } + + GOOGLE_CHECK_EQ(target_ptr, + string_as_array(target) + pos + data_.size() + indent_size); + } + } +} + +// =================================================================== + +CommandLineInterface::CommandLineInterface() + : mode_(MODE_COMPILE), + error_format_(ERROR_FORMAT_GCC), + imports_in_descriptor_set_(false), + disallow_services_(false), + inputs_are_proto_path_relative_(false) {} +CommandLineInterface::~CommandLineInterface() {} + +void CommandLineInterface::RegisterGenerator(const string& flag_name, + CodeGenerator* generator, + const string& help_text) { + GeneratorInfo info; + info.generator = generator; + info.help_text = help_text; + generators_[flag_name] = info; +} + +void CommandLineInterface::AllowPlugins(const string& exe_name_prefix) { + plugin_prefix_ = exe_name_prefix; +} + +int CommandLineInterface::Run(int argc, const char* const argv[]) { + Clear(); + if (!ParseArguments(argc, argv)) return 1; + + // Set up the source tree. + DiskSourceTree source_tree; + for (int i = 0; i < proto_path_.size(); i++) { + source_tree.MapPath(proto_path_[i].first, proto_path_[i].second); + } + + // Map input files to virtual paths if necessary. + if (!inputs_are_proto_path_relative_) { + if (!MakeInputsBeProtoPathRelative(&source_tree)) { + return 1; + } + } + + // Allocate the Importer. + ErrorPrinter error_collector(error_format_, &source_tree); + Importer importer(&source_tree, &error_collector); + + vector parsed_files; + + // Parse each file. + for (int i = 0; i < input_files_.size(); i++) { + // Import the file. + const FileDescriptor* parsed_file = importer.Import(input_files_[i]); + if (parsed_file == NULL) return 1; + parsed_files.push_back(parsed_file); + + // Enforce --disallow_services. + if (disallow_services_ && parsed_file->service_count() > 0) { + cerr << parsed_file->name() << ": This file contains services, but " + "--disallow_services was used." << endl; + return 1; + } + } + + // We construct a separate GeneratorContext for each output location. Note + // that two code generators may output to the same location, in which case + // they should share a single GeneratorContext so that OpenForInsert() works. + typedef hash_map GeneratorContextMap; + GeneratorContextMap output_directories; + + // Generate output. + if (mode_ == MODE_COMPILE) { + for (int i = 0; i < output_directives_.size(); i++) { + string output_location = output_directives_[i].output_location; + if (!HasSuffixString(output_location, ".zip") && + !HasSuffixString(output_location, ".jar")) { + AddTrailingSlash(&output_location); + } + GeneratorContextImpl** map_slot = &output_directories[output_location]; + + if (*map_slot == NULL) { + // First time we've seen this output location. + *map_slot = new GeneratorContextImpl(parsed_files); + } + + if (!GenerateOutput(parsed_files, output_directives_[i], *map_slot)) { + STLDeleteValues(&output_directories); + return 1; + } + } + } + + // Write all output to disk. + for (GeneratorContextMap::iterator iter = output_directories.begin(); + iter != output_directories.end(); ++iter) { + const string& location = iter->first; + GeneratorContextImpl* directory = iter->second; + if (HasSuffixString(location, "/")) { + if (!directory->WriteAllToDisk(location)) { + STLDeleteValues(&output_directories); + return 1; + } + } else { + if (HasSuffixString(location, ".jar")) { + directory->AddJarManifest(); + } + + if (!directory->WriteAllToZip(location)) { + STLDeleteValues(&output_directories); + return 1; + } + } + } + + STLDeleteValues(&output_directories); + + if (!descriptor_set_name_.empty()) { + if (!WriteDescriptorSet(parsed_files)) { + return 1; + } + } + + if (mode_ == MODE_ENCODE || mode_ == MODE_DECODE) { + if (codec_type_.empty()) { + // HACK: Define an EmptyMessage type to use for decoding. + DescriptorPool pool; + FileDescriptorProto file; + file.set_name("empty_message.proto"); + file.add_message_type()->set_name("EmptyMessage"); + GOOGLE_CHECK(pool.BuildFile(file) != NULL); + codec_type_ = "EmptyMessage"; + if (!EncodeOrDecode(&pool)) { + return 1; + } + } else { + if (!EncodeOrDecode(importer.pool())) { + return 1; + } + } + } + + return 0; +} + +void CommandLineInterface::Clear() { + // Clear all members that are set by Run(). Note that we must not clear + // members which are set by other methods before Run() is called. + executable_name_.clear(); + proto_path_.clear(); + input_files_.clear(); + output_directives_.clear(); + codec_type_.clear(); + descriptor_set_name_.clear(); + + mode_ = MODE_COMPILE; + imports_in_descriptor_set_ = false; + disallow_services_ = false; +} + +bool CommandLineInterface::MakeInputsBeProtoPathRelative( + DiskSourceTree* source_tree) { + for (int i = 0; i < input_files_.size(); i++) { + string virtual_file, shadowing_disk_file; + switch (source_tree->DiskFileToVirtualFile( + input_files_[i], &virtual_file, &shadowing_disk_file)) { + case DiskSourceTree::SUCCESS: + input_files_[i] = virtual_file; + break; + case DiskSourceTree::SHADOWED: + cerr << input_files_[i] << ": Input is shadowed in the --proto_path " + "by \"" << shadowing_disk_file << "\". Either use the latter " + "file as your input or reorder the --proto_path so that the " + "former file's location comes first." << endl; + return false; + case DiskSourceTree::CANNOT_OPEN: + cerr << input_files_[i] << ": " << strerror(errno) << endl; + return false; + case DiskSourceTree::NO_MAPPING: + // First check if the file exists at all. + if (access(input_files_[i].c_str(), F_OK) < 0) { + // File does not even exist. + cerr << input_files_[i] << ": " << strerror(ENOENT) << endl; + } else { + cerr << input_files_[i] << ": File does not reside within any path " + "specified using --proto_path (or -I). You must specify a " + "--proto_path which encompasses this file. Note that the " + "proto_path must be an exact prefix of the .proto file " + "names -- protoc is too dumb to figure out when two paths " + "(e.g. absolute and relative) are equivalent (it's harder " + "than you think)." << endl; + } + return false; + } + } + + return true; +} + +bool CommandLineInterface::ParseArguments(int argc, const char* const argv[]) { + executable_name_ = argv[0]; + + // Iterate through all arguments and parse them. + for (int i = 1; i < argc; i++) { + string name, value; + + if (ParseArgument(argv[i], &name, &value)) { + // Returned true => Use the next argument as the flag value. + if (i + 1 == argc || argv[i+1][0] == '-') { + cerr << "Missing value for flag: " << name << endl; + if (name == "--decode") { + cerr << "To decode an unknown message, use --decode_raw." << endl; + } + return false; + } else { + ++i; + value = argv[i]; + } + } + + if (!InterpretArgument(name, value)) return false; + } + + // If no --proto_path was given, use the current working directory. + if (proto_path_.empty()) { + proto_path_.push_back(make_pair("", ".")); + } + + // Check some errror cases. + bool decoding_raw = (mode_ == MODE_DECODE) && codec_type_.empty(); + if (decoding_raw && !input_files_.empty()) { + cerr << "When using --decode_raw, no input files should be given." << endl; + return false; + } else if (!decoding_raw && input_files_.empty()) { + cerr << "Missing input file." << endl; + return false; + } + if (mode_ == MODE_COMPILE && output_directives_.empty() && + descriptor_set_name_.empty()) { + cerr << "Missing output directives." << endl; + return false; + } + if (imports_in_descriptor_set_ && descriptor_set_name_.empty()) { + cerr << "--include_imports only makes sense when combined with " + "--descriptor_set_out." << endl; + } + + return true; +} + +bool CommandLineInterface::ParseArgument(const char* arg, + string* name, string* value) { + bool parsed_value = false; + + if (arg[0] != '-') { + // Not a flag. + name->clear(); + parsed_value = true; + *value = arg; + } else if (arg[1] == '-') { + // Two dashes: Multi-character name, with '=' separating name and + // value. + const char* equals_pos = strchr(arg, '='); + if (equals_pos != NULL) { + *name = string(arg, equals_pos - arg); + *value = equals_pos + 1; + parsed_value = true; + } else { + *name = arg; + } + } else { + // One dash: One-character name, all subsequent characters are the + // value. + if (arg[1] == '\0') { + // arg is just "-". We treat this as an input file, except that at + // present this will just lead to a "file not found" error. + name->clear(); + *value = arg; + parsed_value = true; + } else { + *name = string(arg, 2); + *value = arg + 2; + parsed_value = !value->empty(); + } + } + + // Need to return true iff the next arg should be used as the value for this + // one, false otherwise. + + if (parsed_value) { + // We already parsed a value for this flag. + return false; + } + + if (*name == "-h" || *name == "--help" || + *name == "--disallow_services" || + *name == "--include_imports" || + *name == "--version" || + *name == "--decode_raw") { + // 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. + return false; + } + + // Next argument is the flag value. + return true; +} + +bool CommandLineInterface::InterpretArgument(const string& name, + const string& value) { + if (name.empty()) { + // Not a flag. Just a filename. + if (value.empty()) { + cerr << "You seem to have passed an empty string as one of the " + "arguments to " << executable_name_ << ". This is actually " + "sort of hard to do. Congrats. Unfortunately it is not valid " + "input so the program is going to die now." << endl; + return false; + } + + input_files_.push_back(value); + + } else if (name == "-I" || name == "--proto_path") { + // Java's -classpath (and some other languages) delimits path components + // with colons. Let's accept that syntax too just to make things more + // intuitive. + vector parts; + SplitStringUsing(value, kPathSeparator, &parts); + + for (int i = 0; i < parts.size(); i++) { + string virtual_path; + string disk_path; + + int equals_pos = parts[i].find_first_of('='); + if (equals_pos == string::npos) { + virtual_path = ""; + disk_path = parts[i]; + } else { + virtual_path = parts[i].substr(0, equals_pos); + disk_path = parts[i].substr(equals_pos + 1); + } + + if (disk_path.empty()) { + cerr << "--proto_path passed empty directory name. (Use \".\" for " + "current directory.)" << endl; + return false; + } + + // Make sure disk path exists, warn otherwise. + if (access(disk_path.c_str(), F_OK) < 0) { + cerr << disk_path << ": warning: directory does not exist." << endl; + } + + proto_path_.push_back(pair(virtual_path, disk_path)); + } + + } else if (name == "-o" || name == "--descriptor_set_out") { + if (!descriptor_set_name_.empty()) { + cerr << name << " may only be passed once." << endl; + return false; + } + if (value.empty()) { + cerr << name << " requires a non-empty value." << endl; + return false; + } + if (mode_ != MODE_COMPILE) { + cerr << "Cannot use --encode or --decode and generate descriptors at the " + "same time." << endl; + return false; + } + descriptor_set_name_ = value; + + } else if (name == "--include_imports") { + if (imports_in_descriptor_set_) { + cerr << name << " may only be passed once." << endl; + return false; + } + imports_in_descriptor_set_ = true; + + } else if (name == "-h" || name == "--help") { + PrintHelpText(); + return false; // Exit without running compiler. + + } else if (name == "--version") { + if (!version_info_.empty()) { + cout << version_info_ << endl; + } + cout << "libprotoc " + << protobuf::internal::VersionString(GOOGLE_PROTOBUF_VERSION) + << endl; + return false; // Exit without running compiler. + + } else if (name == "--disallow_services") { + disallow_services_ = true; + + } else if (name == "--encode" || name == "--decode" || + name == "--decode_raw") { + if (mode_ != MODE_COMPILE) { + cerr << "Only one of --encode and --decode can be specified." << endl; + return false; + } + if (!output_directives_.empty() || !descriptor_set_name_.empty()) { + cerr << "Cannot use " << name + << " and generate code or descriptors at the same time." << endl; + return false; + } + + mode_ = (name == "--encode") ? MODE_ENCODE : MODE_DECODE; + + if (value.empty() && name != "--decode_raw") { + cerr << "Type name for " << name << " cannot be blank." << endl; + if (name == "--decode") { + cerr << "To decode an unknown message, use --decode_raw." << endl; + } + return false; + } else if (!value.empty() && name == "--decode_raw") { + cerr << "--decode_raw does not take a parameter." << endl; + return false; + } + + codec_type_ = value; + + } else if (name == "--error_format") { + if (value == "gcc") { + error_format_ = ERROR_FORMAT_GCC; + } else if (value == "msvs") { + error_format_ = ERROR_FORMAT_MSVS; + } else { + cerr << "Unknown error format: " << value << endl; + return false; + } + + } else if (name == "--plugin") { + if (plugin_prefix_.empty()) { + cerr << "This compiler does not support plugins." << endl; + return false; + } + + string name; + string path; + + string::size_type equals_pos = value.find_first_of('='); + if (equals_pos == string::npos) { + // Use the basename of the file. + string::size_type slash_pos = value.find_last_of('/'); + if (slash_pos == string::npos) { + name = value; + } else { + name = value.substr(slash_pos + 1); + } + path = value; + } else { + name = value.substr(0, equals_pos); + path = value.substr(equals_pos + 1); + } + + plugins_[name] = path; + + } else { + // Some other flag. Look it up in the generators list. + const GeneratorInfo* generator_info = FindOrNull(generators_, name); + if (generator_info == NULL && + (plugin_prefix_.empty() || !HasSuffixString(name, "_out"))) { + cerr << "Unknown flag: " << name << endl; + return false; + } + + // It's an output flag. Add it to the output directives. + if (mode_ != MODE_COMPILE) { + cerr << "Cannot use --encode or --decode and generate code at the " + "same time." << endl; + return false; + } + + OutputDirective directive; + directive.name = name; + if (generator_info == NULL) { + directive.generator = NULL; + } else { + directive.generator = generator_info->generator; + } + + // Split value at ':' to separate the generator parameter from the + // filename. However, avoid doing this if the colon is part of a valid + // Windows-style absolute path. + string::size_type colon_pos = value.find_first_of(':'); + if (colon_pos == string::npos || IsWindowsAbsolutePath(value)) { + directive.output_location = value; + } else { + directive.parameter = value.substr(0, colon_pos); + directive.output_location = value.substr(colon_pos + 1); + } + + output_directives_.push_back(directive); + } + + return true; +} + +void CommandLineInterface::PrintHelpText() { + // Sorry for indentation here; line wrapping would be uglier. + cerr << +"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" +" --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" +" -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" +" --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)." << endl; + if (!plugin_prefix_.empty()) { + cerr << +" --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." << endl; + } + + for (GeneratorMap::iterator iter = generators_.begin(); + iter != generators_.end(); ++iter) { + // 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. + cerr << " " << iter->first << "=OUT_DIR " + << string(19 - iter->first.size(), ' ') // Spaces for alignment. + << iter->second.help_text << endl; + } +} + +bool CommandLineInterface::GenerateOutput( + const vector& parsed_files, + const OutputDirective& output_directive, + GeneratorContext* generator_context) { + // Call the generator. + string error; + if (output_directive.generator == NULL) { + // This is a plugin. + GOOGLE_CHECK(HasPrefixString(output_directive.name, "--") && + HasSuffixString(output_directive.name, "_out")) + << "Bad name for plugin generator: " << output_directive.name; + + // Strip the "--" and "_out" and add the plugin prefix. + string plugin_name = plugin_prefix_ + "gen-" + + output_directive.name.substr(2, output_directive.name.size() - 6); + + if (!GeneratePluginOutput(parsed_files, plugin_name, + output_directive.parameter, + generator_context, &error)) { + cerr << output_directive.name << ": " << error << endl; + return false; + } + } else { + // Regular generator. + for (int i = 0; i < parsed_files.size(); i++) { + if (!output_directive.generator->Generate( + parsed_files[i], output_directive.parameter, + generator_context, &error)) { + // Generator returned an error. + cerr << output_directive.name << ": " << parsed_files[i]->name() << ": " + << error << endl; + return false; + } + } + } + + return true; +} + +bool CommandLineInterface::GeneratePluginOutput( + const vector& parsed_files, + const string& plugin_name, + const string& parameter, + GeneratorContext* generator_context, + string* error) { + CodeGeneratorRequest request; + CodeGeneratorResponse response; + + // Build the request. + if (!parameter.empty()) { + request.set_parameter(parameter); + } + + set already_seen; + for (int i = 0; i < parsed_files.size(); i++) { + request.add_file_to_generate(parsed_files[i]->name()); + GetTransitiveDependencies(parsed_files[i], &already_seen, + request.mutable_proto_file()); + } + + // Invoke the plugin. + Subprocess subprocess; + + if (plugins_.count(plugin_name) > 0) { + subprocess.Start(plugins_[plugin_name], Subprocess::EXACT_NAME); + } else { + subprocess.Start(plugin_name, Subprocess::SEARCH_PATH); + } + + string communicate_error; + if (!subprocess.Communicate(request, &response, &communicate_error)) { + *error = strings::Substitute("$0: $1", plugin_name, communicate_error); + return false; + } + + // Write the files. We do this even if there was a generator error in order + // to match the behavior of a compiled-in generator. + scoped_ptr current_output; + for (int i = 0; i < response.file_size(); i++) { + const CodeGeneratorResponse::File& output_file = response.file(i); + + if (!output_file.insertion_point().empty()) { + // Open a file for insert. + // 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( + output_file.name(), output_file.insertion_point())); + } 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 + // before the new one is opened. + current_output.reset(); + current_output.reset(generator_context->Open(output_file.name())); + } else if (current_output == NULL) { + *error = strings::Substitute( + "$0: First file chunk returned by plugin did not specify a file name.", + plugin_name); + return false; + } + + // Use CodedOutputStream for convenience; otherwise we'd need to provide + // our own buffer-copying loop. + io::CodedOutputStream writer(current_output.get()); + writer.WriteString(output_file.content()); + } + + // Check for errors. + if (!response.error().empty()) { + // Generator returned an error. + *error = response.error(); + return false; + } + + return true; +} + +bool CommandLineInterface::EncodeOrDecode(const DescriptorPool* pool) { + // Look up the type. + const Descriptor* type = pool->FindMessageTypeByName(codec_type_); + if (type == NULL) { + cerr << "Type not defined: " << codec_type_ << endl; + return false; + } + + DynamicMessageFactory dynamic_factory(pool); + scoped_ptr message(dynamic_factory.GetPrototype(type)->New()); + + if (mode_ == MODE_ENCODE) { + SetFdToTextMode(STDIN_FILENO); + SetFdToBinaryMode(STDOUT_FILENO); + } else { + SetFdToBinaryMode(STDIN_FILENO); + SetFdToTextMode(STDOUT_FILENO); + } + + io::FileInputStream in(STDIN_FILENO); + io::FileOutputStream out(STDOUT_FILENO); + + if (mode_ == MODE_ENCODE) { + // Input is text. + ErrorPrinter error_collector(error_format_); + TextFormat::Parser parser; + parser.RecordErrorsTo(&error_collector); + parser.AllowPartialMessage(true); + + if (!parser.Parse(&in, message.get())) { + cerr << "Failed to parse input." << endl; + return false; + } + } else { + // Input is binary. + if (!message->ParsePartialFromZeroCopyStream(&in)) { + cerr << "Failed to parse input." << endl; + return false; + } + } + + if (!message->IsInitialized()) { + cerr << "warning: Input message is missing required fields: " + << message->InitializationErrorString() << endl; + } + + if (mode_ == MODE_ENCODE) { + // Output is binary. + if (!message->SerializePartialToZeroCopyStream(&out)) { + cerr << "output: I/O error." << endl; + return false; + } + } else { + // Output is text. + if (!TextFormat::Print(*message, &out)) { + cerr << "output: I/O error." << endl; + return false; + } + } + + return true; +} + +bool CommandLineInterface::WriteDescriptorSet( + const vector parsed_files) { + FileDescriptorSet file_set; + + if (imports_in_descriptor_set_) { + set already_seen; + for (int i = 0; i < parsed_files.size(); i++) { + GetTransitiveDependencies( + parsed_files[i], &already_seen, file_set.mutable_file()); + } + } else { + for (int i = 0; i < parsed_files.size(); i++) { + parsed_files[i]->CopyTo(file_set.add_file()); + } + } + + int fd; + do { + fd = open(descriptor_set_name_.c_str(), + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + } while (fd < 0 && errno == EINTR); + + if (fd < 0) { + perror(descriptor_set_name_.c_str()); + return false; + } + + io::FileOutputStream out(fd); + if (!file_set.SerializeToZeroCopyStream(&out)) { + cerr << descriptor_set_name_ << ": " << strerror(out.GetErrno()) << endl; + out.Close(); + return false; + } + if (!out.Close()) { + cerr << descriptor_set_name_ << ": " << strerror(out.GetErrno()) << endl; + return false; + } + + return true; +} + +void CommandLineInterface::GetTransitiveDependencies( + const FileDescriptor* file, + set* already_seen, + RepeatedPtrField* output) { + if (!already_seen->insert(file).second) { + // Already saw this file. Skip. + return; + } + + // Add all dependencies. + for (int i = 0; i < file->dependency_count(); i++) { + GetTransitiveDependencies(file->dependency(i), already_seen, output); + } + + // Add this file. + file->CopyTo(output->Add()); +} + + +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/command_line_interface.h b/depends/protobuf/google/protobuf/compiler/command_line_interface.h new file mode 100644 index 000000000..0b507d801 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/command_line_interface.h @@ -0,0 +1,318 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Implements the Protocol Compiler front-end such that it may be reused by +// custom compilers written to support other languages. + +#ifndef GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ +#define GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ + +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { + +class FileDescriptor; // descriptor.h +class DescriptorPool; // descriptor.h +class FileDescriptorProto; // descriptor.pb.h +template class RepeatedPtrField; // repeated_field.h + +namespace compiler { + +class CodeGenerator; // code_generator.h +class GeneratorContext; // code_generator.h +class DiskSourceTree; // importer.h + +// This class implements the command-line interface to the protocol compiler. +// It is designed to make it very easy to create a custom protocol compiler +// supporting the languages of your choice. For example, if you wanted to +// create a custom protocol compiler binary which includes both the regular +// C++ support plus support for your own custom output "Foo", you would +// write a class "FooGenerator" which implements the CodeGenerator interface, +// then write a main() procedure like this: +// +// int main(int argc, char* argv[]) { +// google::protobuf::compiler::CommandLineInterface cli; +// +// // Support generation of C++ source and headers. +// google::protobuf::compiler::cpp::CppGenerator cpp_generator; +// cli.RegisterGenerator("--cpp_out", &cpp_generator, +// "Generate C++ source and header."); +// +// // Support generation of Foo code. +// FooGenerator foo_generator; +// cli.RegisterGenerator("--foo_out", &foo_generator, +// "Generate Foo file."); +// +// return cli.Run(argc, argv); +// } +// +// The compiler is invoked with syntax like: +// protoc --cpp_out=outdir --foo_out=outdir --proto_path=src src/foo.proto +// +// For a full description of the command-line syntax, invoke it with --help. +class LIBPROTOC_EXPORT CommandLineInterface { + public: + CommandLineInterface(); + ~CommandLineInterface(); + + // Register a code generator for a language. + // + // Parameters: + // * flag_name: The command-line flag used to specify an output file of + // this type. The name must start with a '-'. If the name is longer + // than one letter, it must start with two '-'s. + // * generator: The CodeGenerator which will be called to generate files + // of this type. + // * help_text: Text describing this flag in the --help output. + // + // Some generators accept extra parameters. You can specify this parameter + // on the command-line by placing it before the output directory, separated + // by a colon: + // protoc --foo_out=enable_bar:outdir + // The text before the colon is passed to CodeGenerator::Generate() as the + // "parameter". + void RegisterGenerator(const string& flag_name, + CodeGenerator* generator, + const string& help_text); + + // Enables "plugins". In this mode, if a command-line flag ends with "_out" + // but does not match any registered generator, the compiler will attempt to + // find a "plugin" to implement the generator. Plugins are just executables. + // They should live somewhere in the PATH. + // + // The compiler determines the executable name to search for by concatenating + // exe_name_prefix with the unrecognized flag name, removing "_out". So, for + // example, if exe_name_prefix is "protoc-" and you pass the flag --foo_out, + // the compiler will try to run the program "protoc-foo". + // + // The plugin program should implement the following usage: + // plugin [--out=OUTDIR] [--parameter=PARAMETER] PROTO_FILES < DESCRIPTORS + // --out indicates the output directory (as passed to the --foo_out + // parameter); if omitted, the current directory should be used. --parameter + // gives the generator parameter, if any was provided. The PROTO_FILES list + // the .proto files which were given on the compiler command-line; these are + // the files for which the plugin is expected to generate output code. + // Finally, DESCRIPTORS is an encoded FileDescriptorSet (as defined in + // descriptor.proto). This is piped to the plugin's stdin. The set will + // include descriptors for all the files listed in PROTO_FILES as well as + // all files that they import. The plugin MUST NOT attempt to read the + // PROTO_FILES directly -- it must use the FileDescriptorSet. + // + // The plugin should generate whatever files are necessary, as code generators + // normally do. It should write the names of all files it generates to + // stdout. The names should be relative to the output directory, NOT absolute + // names or relative to the current directory. If any errors occur, error + // messages should be written to stderr. If an error is fatal, the plugin + // should exit with a non-zero exit code. + void AllowPlugins(const string& exe_name_prefix); + + // Run the Protocol Compiler with the given command-line parameters. + // Returns the error code which should be returned by main(). + // + // It may not be safe to call Run() in a multi-threaded environment because + // it calls strerror(). I'm not sure why you'd want to do this anyway. + int Run(int argc, const char* const argv[]); + + // Call SetInputsAreCwdRelative(true) if the input files given on the command + // line should be interpreted relative to the proto import path specified + // using --proto_path or -I flags. Otherwise, input file names will be + // interpreted relative to the current working directory (or as absolute + // paths if they start with '/'), though they must still reside inside + // a directory given by --proto_path or the compiler will fail. The latter + // mode is generally more intuitive and easier to use, especially e.g. when + // defining implicit rules in Makefiles. + void SetInputsAreProtoPathRelative(bool enable) { + inputs_are_proto_path_relative_ = enable; + } + + // Provides some text which will be printed when the --version flag is + // used. The version of libprotoc will also be printed on the next line + // after this text. + void SetVersionInfo(const string& text) { + version_info_ = text; + } + + + private: + // ----------------------------------------------------------------- + + class ErrorPrinter; + class GeneratorContextImpl; + class MemoryOutputStream; + + // Clear state from previous Run(). + void Clear(); + + // Remaps each file in input_files_ so that it is relative to one of the + // directories in proto_path_. Returns false if an error occurred. This + // is only used if inputs_are_proto_path_relative_ is false. + bool MakeInputsBeProtoPathRelative( + DiskSourceTree* source_tree); + + // Parse all command-line arguments. + bool ParseArguments(int argc, const char* const argv[]); + + // Parses a command-line argument into a name/value pair. Returns + // true if the next argument in the argv should be used as the value, + // false otherwise. + // + // Exmaples: + // "-Isrc/protos" -> + // name = "-I", value = "src/protos" + // "--cpp_out=src/foo.pb2.cc" -> + // name = "--cpp_out", value = "src/foo.pb2.cc" + // "foo.proto" -> + // name = "", value = "foo.proto" + bool ParseArgument(const char* arg, string* name, string* value); + + // Interprets arguments parsed with ParseArgument. + bool InterpretArgument(const string& name, const string& value); + + // Print the --help text to stderr. + void PrintHelpText(); + + // Generate the given output file from the given input. + struct OutputDirective; // see below + bool GenerateOutput(const vector& parsed_files, + const OutputDirective& output_directive, + GeneratorContext* generator_context); + bool GeneratePluginOutput(const vector& parsed_files, + const string& plugin_name, + const string& parameter, + GeneratorContext* generator_context, + string* error); + + // Implements --encode and --decode. + bool EncodeOrDecode(const DescriptorPool* pool); + + // Implements the --descriptor_set_out option. + bool WriteDescriptorSet(const vector parsed_files); + + // Get all transitive dependencies of the given file (including the file + // itself), adding them to the given list of FileDescriptorProtos. The + // protos will be ordered such that every file is listed before any file that + // depends on it, so that you can call DescriptorPool::BuildFile() on them + // in order. Any files in *already_seen will not be added, and each file + // added will be inserted into *already_seen. + static void GetTransitiveDependencies( + const FileDescriptor* file, + set* already_seen, + RepeatedPtrField* output); + + // ----------------------------------------------------------------- + + // The name of the executable as invoked (i.e. argv[0]). + string executable_name_; + + // Version info set with SetVersionInfo(). + string version_info_; + + // Map from flag names to registered generators. + struct GeneratorInfo { + CodeGenerator* generator; + string help_text; + }; + typedef map GeneratorMap; + GeneratorMap generators_; + + // See AllowPlugins(). If this is empty, plugins aren't allowed. + string plugin_prefix_; + + // Maps specific plugin names to files. When executing a plugin, this map + // is searched first to find the plugin executable. If not found here, the + // PATH (or other OS-specific search strategy) is searched. + map plugins_; + + // Stuff parsed from command line. + enum Mode { + MODE_COMPILE, // Normal mode: parse .proto files and compile them. + MODE_ENCODE, // --encode: read text from stdin, write binary to stdout. + MODE_DECODE // --decode: read binary from stdin, write text to stdout. + }; + + Mode mode_; + + enum ErrorFormat { + ERROR_FORMAT_GCC, // GCC error output format (default). + ERROR_FORMAT_MSVS // Visual Studio output (--error_format=msvs). + }; + + ErrorFormat error_format_; + + vector > proto_path_; // Search path for proto files. + vector input_files_; // Names of the input proto files. + + // output_directives_ lists all the files we are supposed to output and what + // generator to use for each. + struct OutputDirective { + string name; // E.g. "--foo_out" + CodeGenerator* generator; // NULL for plugins + string parameter; + string output_location; + }; + vector output_directives_; + + // When using --encode or --decode, this names the type we are encoding or + // decoding. (Empty string indicates --decode_raw.) + string codec_type_; + + // If --descriptor_set_out was given, this is the filename to which the + // FileDescriptorSet should be written. Otherwise, empty. + string descriptor_set_name_; + + // True if --include_imports was given, meaning that we should + // write all transitive dependencies to the DescriptorSet. Otherwise, only + // the .proto files listed on the command-line are added. + bool imports_in_descriptor_set_; + + // Was the --disallow_services flag used? + bool disallow_services_; + + // See SetInputsAreProtoPathRelative(). + bool inputs_are_proto_path_relative_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CommandLineInterface); +}; + +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum.cc new file mode 100644 index 000000000..76d2b7985 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum.cc @@ -0,0 +1,258 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, + const string& dllexport_decl) + : descriptor_(descriptor), + classname_(ClassName(descriptor, false)), + dllexport_decl_(dllexport_decl) { +} + +EnumGenerator::~EnumGenerator() {} + +void EnumGenerator::GenerateDefinition(io::Printer* printer) { + map vars; + vars["classname"] = classname_; + vars["short_name"] = descriptor_->name(); + + printer->Print(vars, "enum $classname$ {\n"); + printer->Indent(); + + const EnumValueDescriptor* min_value = descriptor_->value(0); + const EnumValueDescriptor* max_value = descriptor_->value(0); + + for (int i = 0; i < descriptor_->value_count(); i++) { + vars["name"] = descriptor_->value(i)->name(); + vars["number"] = SimpleItoa(descriptor_->value(i)->number()); + vars["prefix"] = (descriptor_->containing_type() == NULL) ? + "" : classname_ + "_"; + + if (i > 0) printer->Print(",\n"); + printer->Print(vars, "$prefix$$name$ = $number$"); + + if (descriptor_->value(i)->number() < min_value->number()) { + min_value = descriptor_->value(i); + } + if (descriptor_->value(i)->number() > max_value->number()) { + max_value = descriptor_->value(i); + } + } + + printer->Outdent(); + printer->Print("\n};\n"); + + vars["min_name"] = min_value->name(); + vars["max_name"] = max_value->name(); + + if (dllexport_decl_.empty()) { + vars["dllexport"] = ""; + } else { + vars["dllexport"] = dllexport_decl_ + " "; + } + + printer->Print(vars, + "$dllexport$bool $classname$_IsValid(int value);\n" + "const $classname$ $prefix$$short_name$_MIN = $prefix$$min_name$;\n" + "const $classname$ $prefix$$short_name$_MAX = $prefix$$max_name$;\n" + "const int $prefix$$short_name$_ARRAYSIZE = $prefix$$short_name$_MAX + 1;\n" + "\n"); + + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print(vars, + "$dllexport$const ::google::protobuf::EnumDescriptor* $classname$_descriptor();\n"); + // The _Name and _Parse methods + printer->Print(vars, + "inline const ::std::string& $classname$_Name($classname$ value) {\n" + " return ::google::protobuf::internal::NameOfEnum(\n" + " $classname$_descriptor(), value);\n" + "}\n"); + printer->Print(vars, + "inline bool $classname$_Parse(\n" + " const ::std::string& name, $classname$* value) {\n" + " return ::google::protobuf::internal::ParseNamedEnum<$classname$>(\n" + " $classname$_descriptor(), name, value);\n" + "}\n"); + } +} + +void EnumGenerator:: +GenerateGetEnumDescriptorSpecializations(io::Printer* printer) { + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print( + "template <>\n" + "inline const EnumDescriptor* GetEnumDescriptor< $classname$>() {\n" + " return $classname$_descriptor();\n" + "}\n", + "classname", ClassName(descriptor_, true)); + } +} + +void EnumGenerator::GenerateSymbolImports(io::Printer* printer) { + map vars; + vars["nested_name"] = descriptor_->name(); + vars["classname"] = classname_; + printer->Print(vars, "typedef $classname$ $nested_name$;\n"); + + for (int j = 0; j < descriptor_->value_count(); j++) { + vars["tag"] = descriptor_->value(j)->name(); + printer->Print(vars, + "static const $nested_name$ $tag$ = $classname$_$tag$;\n"); + } + + printer->Print(vars, + "static inline bool $nested_name$_IsValid(int value) {\n" + " return $classname$_IsValid(value);\n" + "}\n" + "static const $nested_name$ $nested_name$_MIN =\n" + " $classname$_$nested_name$_MIN;\n" + "static const $nested_name$ $nested_name$_MAX =\n" + " $classname$_$nested_name$_MAX;\n" + "static const int $nested_name$_ARRAYSIZE =\n" + " $classname$_$nested_name$_ARRAYSIZE;\n"); + + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print(vars, + "static inline const ::google::protobuf::EnumDescriptor*\n" + "$nested_name$_descriptor() {\n" + " return $classname$_descriptor();\n" + "}\n"); + printer->Print(vars, + "static inline const ::std::string& $nested_name$_Name($nested_name$ value) {\n" + " return $classname$_Name(value);\n" + "}\n"); + printer->Print(vars, + "static inline bool $nested_name$_Parse(const ::std::string& name,\n" + " $nested_name$* value) {\n" + " return $classname$_Parse(name, value);\n" + "}\n"); + } +} + +void EnumGenerator::GenerateDescriptorInitializer( + io::Printer* printer, int index) { + map vars; + vars["classname"] = classname_; + vars["index"] = SimpleItoa(index); + + if (descriptor_->containing_type() == NULL) { + printer->Print(vars, + "$classname$_descriptor_ = file->enum_type($index$);\n"); + } else { + vars["parent"] = ClassName(descriptor_->containing_type(), false); + printer->Print(vars, + "$classname$_descriptor_ = $parent$_descriptor_->enum_type($index$);\n"); + } +} + +void EnumGenerator::GenerateMethods(io::Printer* printer) { + map vars; + vars["classname"] = classname_; + + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print(vars, + "const ::google::protobuf::EnumDescriptor* $classname$_descriptor() {\n" + " protobuf_AssignDescriptorsOnce();\n" + " return $classname$_descriptor_;\n" + "}\n"); + } + + printer->Print(vars, + "bool $classname$_IsValid(int value) {\n" + " switch(value) {\n"); + + // Multiple values may have the same number. Make sure we only cover + // each number once by first constructing a set containing all valid + // numbers, then printing a case statement for each element. + + set numbers; + for (int j = 0; j < descriptor_->value_count(); j++) { + const EnumValueDescriptor* value = descriptor_->value(j); + numbers.insert(value->number()); + } + + for (set::iterator iter = numbers.begin(); + iter != numbers.end(); ++iter) { + printer->Print( + " case $number$:\n", + "number", SimpleItoa(*iter)); + } + + printer->Print(vars, + " return true;\n" + " default:\n" + " return false;\n" + " }\n" + "}\n" + "\n"); + + if (descriptor_->containing_type() != NULL) { + // We need to "define" the static constants which were declared in the + // header, to give the linker a place to put them. Or at least the C++ + // standard says we have to. MSVC actually insists tha we do _not_ define + // them again in the .cc file. + printer->Print("#ifndef _MSC_VER\n"); + + vars["parent"] = ClassName(descriptor_->containing_type(), false); + vars["nested_name"] = descriptor_->name(); + for (int i = 0; i < descriptor_->value_count(); i++) { + vars["value"] = descriptor_->value(i)->name(); + printer->Print(vars, + "const $classname$ $parent$::$value$;\n"); + } + printer->Print(vars, + "const $classname$ $parent$::$nested_name$_MIN;\n" + "const $classname$ $parent$::$nested_name$_MAX;\n" + "const int $parent$::$nested_name$_ARRAYSIZE;\n"); + + printer->Print("#endif // _MSC_VER\n"); + } +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/enum.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum.h similarity index 78% rename from depends/protobuf/src/google/protobuf/compiler/cpp/enum.h rename to depends/protobuf/google/protobuf/compiler/cpp/cpp_enum.h index 610d4fc70..58f7721ec 100644 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/enum.h +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -35,22 +35,16 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__ -#include -#include #include - #include -#include namespace google { namespace protobuf { -namespace io { -class Printer; // printer.h + namespace io { + class Printer; // printer.h + } } -} // namespace protobuf -} // namespace google -namespace google { namespace protobuf { namespace compiler { namespace cpp { @@ -58,11 +52,12 @@ namespace cpp { class EnumGenerator { public: // See generator.cc for the meaning of dllexport_decl. - EnumGenerator(const EnumDescriptor* descriptor, - const std::map& vars, - const Options& options); + explicit EnumGenerator(const EnumDescriptor* descriptor, + const string& dllexport_decl); ~EnumGenerator(); + // Header stuff. + // Generate header code defining the enum. This code should be placed // within the enum's package namespace, but NOT within any class, even for // nested enums. @@ -76,31 +71,29 @@ class EnumGenerator { // symbols (e.g. the enum type name, all its values, etc.) into the class's // namespace. This should be placed inside the class definition in the // header. - void GenerateSymbolImports(io::Printer* printer) const; + void GenerateSymbolImports(io::Printer* printer); // Source file stuff. + // Generate code that initializes the global variable storing the enum's + // descriptor. + void GenerateDescriptorInitializer(io::Printer* printer, int index); + // Generate non-inline methods related to the enum, such as IsValidValue(). - // Goes in the .cc file. EnumDescriptors are stored in an array, idx is - // the index in this array that corresponds with this enum. - void GenerateMethods(int idx, io::Printer* printer); + // Goes in the .cc file. + void GenerateMethods(io::Printer* printer); private: const EnumDescriptor* descriptor_; - const std::string classname_; - const Options& options_; - // whether to generate the *_ARRAYSIZE constant. - const bool generate_array_size_; - - std::map variables_; + string classname_; + string dllexport_decl_; - friend class FileGenerator; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); }; } // namespace cpp } // namespace compiler } // namespace protobuf -} // namespace google +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum_field.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum_field.cc new file mode 100644 index 000000000..a369f4178 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -0,0 +1,361 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 SetEnumVariables(const FieldDescriptor* descriptor, + map* variables) { + SetCommonFieldVariables(descriptor, variables); + const EnumValueDescriptor* default_value = descriptor->default_value_enum(); + (*variables)["type"] = ClassName(descriptor->enum_type(), true); + (*variables)["default"] = SimpleItoa(default_value->number()); +} + +} // namespace + +// =================================================================== + +EnumFieldGenerator:: +EnumFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetEnumVariables(descriptor, &variables_); +} + +EnumFieldGenerator::~EnumFieldGenerator() {} + +void EnumFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, "int $name$_;\n"); +} + +void EnumFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $name$() const$deprecation$;\n" + "inline void set_$name$($type$ value)$deprecation$;\n"); +} + +void EnumFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$() const {\n" + " return static_cast< $type$ >($name$_);\n" + "}\n" + "inline void $classname$::set_$name$($type$ value) {\n" + " GOOGLE_DCHECK($type$_IsValid(value));\n" + " set_has_$name$();\n" + " $name$_ = value;\n" + "}\n"); +} + +void EnumFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_ = $default$;\n"); +} + +void EnumFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "set_$name$(from.$name$());\n"); +} + +void EnumFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "std::swap($name$_, other->$name$_);\n"); +} + +void EnumFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_ = $default$;\n"); +} + +void EnumFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + printer->Print(variables_, + "int value;\n" + "DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" + " int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n" + " input, &value)));\n" + "if ($type$_IsValid(value)) {\n" + " set_$name$(static_cast< $type$ >(value));\n"); + if (HasUnknownFields(descriptor_->file())) { + printer->Print(variables_, + "} else {\n" + " mutable_unknown_fields()->AddVarint($number$, value);\n"); + } + printer->Print(variables_, + "}\n"); +} + +void EnumFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::internal::WireFormatLite::WriteEnum(\n" + " $number$, this->$name$(), output);\n"); +} + +void EnumFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + printer->Print(variables_, + "target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(\n" + " $number$, this->$name$(), target);\n"); +} + +void EnumFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "total_size += $tag_size$ +\n" + " ::google::protobuf::internal::WireFormatLite::EnumSize(this->$name$());\n"); +} + +// =================================================================== + +RepeatedEnumFieldGenerator:: +RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetEnumVariables(descriptor, &variables_); +} + +RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() {} + +void RepeatedEnumFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::RepeatedField $name$_;\n"); + if (descriptor_->options().packed() && HasGeneratedMethods(descriptor_->file())) { + printer->Print(variables_, + "mutable int _$name$_cached_byte_size_;\n"); + } +} + +void RepeatedEnumFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $name$(int index) const$deprecation$;\n" + "inline void set_$name$(int index, $type$ value)$deprecation$;\n" + "inline void add_$name$($type$ value)$deprecation$;\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedField& $name$() const$deprecation$;\n" + "inline ::google::protobuf::RepeatedField* mutable_$name$()$deprecation$;\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$(int index) const {\n" + " return static_cast< $type$ >($name$_.Get(index));\n" + "}\n" + "inline void $classname$::set_$name$(int index, $type$ value) {\n" + " GOOGLE_DCHECK($type$_IsValid(value));\n" + " $name$_.Set(index, value);\n" + "}\n" + "inline void $classname$::add_$name$($type$ value) {\n" + " GOOGLE_DCHECK($type$_IsValid(value));\n" + " $name$_.Add(value);\n" + "}\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedField&\n" + "$classname$::$name$() const {\n" + " return $name$_;\n" + "}\n" + "inline ::google::protobuf::RepeatedField*\n" + "$classname$::mutable_$name$() {\n" + " return &$name$_;\n" + "}\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Clear();\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Swap(&other->$name$_);\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + // Not needed for repeated fields. +} + +void RepeatedEnumFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + // Don't use ReadRepeatedPrimitive here so that the enum can be validated. + printer->Print(variables_, + "int value;\n" + "DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" + " int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n" + " input, &value)));\n" + "if ($type$_IsValid(value)) {\n" + " add_$name$(static_cast< $type$ >(value));\n"); + if (HasUnknownFields(descriptor_->file())) { + printer->Print(variables_, + "} else {\n" + " mutable_unknown_fields()->AddVarint($number$, value);\n"); + } + printer->Print("}\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { + if (!descriptor_->options().packed()) { + // We use a non-inlined implementation in this case, since this path will + // rarely be executed. + printer->Print(variables_, + "DO_((::google::protobuf::internal::WireFormatLite::ReadPackedEnumNoInline(\n" + " input,\n" + " &$type$_IsValid,\n" + " this->mutable_$name$())));\n"); + } else { + printer->Print(variables_, + "::google::protobuf::uint32 length;\n" + "DO_(input->ReadVarint32(&length));\n" + "::google::protobuf::io::CodedInputStream::Limit limit = " + "input->PushLimit(length);\n" + "while (input->BytesUntilLimit() > 0) {\n" + " int value;\n" + " DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" + " int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n" + " input, &value)));\n" + " if ($type$_IsValid(value)) {\n" + " add_$name$(static_cast< $type$ >(value));\n" + " }\n" + "}\n" + "input->PopLimit(limit);\n"); + } +} + +void RepeatedEnumFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + if (descriptor_->options().packed()) { + // Write the tag and the size. + printer->Print(variables_, + "if (this->$name$_size() > 0) {\n" + " ::google::protobuf::internal::WireFormatLite::WriteTag(\n" + " $number$,\n" + " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" + " output);\n" + " output->WriteVarint32(_$name$_cached_byte_size_);\n" + "}\n"); + } + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n"); + if (descriptor_->options().packed()) { + printer->Print(variables_, + " ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(\n" + " this->$name$(i), output);\n"); + } else { + printer->Print(variables_, + " ::google::protobuf::internal::WireFormatLite::WriteEnum(\n" + " $number$, this->$name$(i), output);\n"); + } + printer->Print("}\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + if (descriptor_->options().packed()) { + // Write the tag and the size. + printer->Print(variables_, + "if (this->$name$_size() > 0) {\n" + " target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(\n" + " $number$,\n" + " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" + " target);\n" + " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(" + " _$name$_cached_byte_size_, target);\n" + "}\n"); + } + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n"); + if (descriptor_->options().packed()) { + printer->Print(variables_, + " target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(\n" + " this->$name$(i), target);\n"); + } else { + printer->Print(variables_, + " target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(\n" + " $number$, this->$name$(i), target);\n"); + } + printer->Print("}\n"); +} + +void RepeatedEnumFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "{\n" + " int data_size = 0;\n"); + printer->Indent(); + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n" + " data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(\n" + " this->$name$(i));\n" + "}\n"); + + if (descriptor_->options().packed()) { + printer->Print(variables_, + "if (data_size > 0) {\n" + " total_size += $tag_size$ +\n" + " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n" + "}\n" + "_$name$_cached_byte_size_ = data_size;\n" + "total_size += data_size;\n"); + } else { + printer->Print(variables_, + "total_size += $tag_size$ * this->$name$_size() + data_size;\n"); + } + printer->Outdent(); + printer->Print("}\n"); +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum_field.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum_field.h new file mode 100644 index 000000000..0793430c1 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_enum_field.h @@ -0,0 +1,103 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +class EnumFieldGenerator : public FieldGenerator { + public: + explicit EnumFieldGenerator(const FieldDescriptor* descriptor); + ~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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); +}; + +class RepeatedEnumFieldGenerator : public FieldGenerator { + public: + explicit RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor); + ~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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_extension.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_extension.cc new file mode 100644 index 000000000..658a7077b --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_extension.cc @@ -0,0 +1,210 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +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. +string ExtendeeClassName(const FieldDescriptor* descriptor) { + const Descriptor* extendee = descriptor->containing_type(); + return ClassName(extendee, true); +} + +} // anonymous namespace + +ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, + const string& dllexport_decl) + : descriptor_(descriptor), + dllexport_decl_(dllexport_decl) { + // Construct type_traits_. + if (descriptor_->is_repeated()) { + type_traits_ = "Repeated"; + } + + switch (descriptor_->cpp_type()) { + case FieldDescriptor::CPPTYPE_ENUM: + type_traits_.append("EnumTypeTraits< "); + type_traits_.append(ClassName(descriptor_->enum_type(), true)); + type_traits_.append(", "); + type_traits_.append(ClassName(descriptor_->enum_type(), true)); + type_traits_.append("_IsValid>"); + break; + case FieldDescriptor::CPPTYPE_STRING: + type_traits_.append("StringTypeTraits"); + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + type_traits_.append("MessageTypeTraits< "); + type_traits_.append(ClassName(descriptor_->message_type(), true)); + type_traits_.append(" >"); + break; + default: + type_traits_.append("PrimitiveTypeTraits< "); + type_traits_.append(PrimitiveTypeName(descriptor_->cpp_type())); + type_traits_.append(" >"); + break; + } +} + +ExtensionGenerator::~ExtensionGenerator() {} + +void ExtensionGenerator::GenerateDeclaration(io::Printer* printer) { + map vars; + vars["extendee" ] = ExtendeeClassName(descriptor_); + vars["number" ] = SimpleItoa(descriptor_->number()); + vars["type_traits" ] = type_traits_; + vars["name" ] = descriptor_->name(); + vars["field_type" ] = SimpleItoa(static_cast(descriptor_->type())); + vars["packed" ] = descriptor_->options().packed() ? "true" : "false"; + vars["constant_name"] = FieldConstantName(descriptor_); + + // If this is a class member, it needs to be declared "static". Otherwise, + // it needs to be "extern". In the latter case, it also needs the DLL + // export/import specifier. + if (descriptor_->extension_scope() == NULL) { + vars["qualifier"] = "extern"; + if (!dllexport_decl_.empty()) { + vars["qualifier"] = dllexport_decl_ + " " + vars["qualifier"]; + } + } else { + vars["qualifier"] = "static"; + } + + printer->Print(vars, + "static const int $constant_name$ = $number$;\n" + "$qualifier$ ::google::protobuf::internal::ExtensionIdentifier< $extendee$,\n" + " ::google::protobuf::internal::$type_traits$, $field_type$, $packed$ >\n" + " $name$;\n" + ); + +} + +void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { + // If this is a class member, it needs to be declared in its class scope. + string scope = (descriptor_->extension_scope() == NULL) ? "" : + ClassName(descriptor_->extension_scope(), false) + "::"; + string name = scope + descriptor_->name(); + + map vars; + vars["extendee" ] = ExtendeeClassName(descriptor_); + vars["type_traits" ] = type_traits_; + vars["name" ] = name; + vars["constant_name"] = FieldConstantName(descriptor_); + vars["default" ] = DefaultValue(descriptor_); + vars["field_type" ] = SimpleItoa(static_cast(descriptor_->type())); + vars["packed" ] = descriptor_->options().packed() ? "true" : "false"; + vars["scope" ] = scope; + + if (descriptor_->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { + // We need to declare a global string which will contain the default value. + // We cannot declare it at class scope because that would require exposing + // it in the header which would be annoying for other reasons. So we + // replace :: with _ in the name and declare it as a global. + string global_name = StringReplace(name, "::", "_", true); + vars["global_name"] = global_name; + printer->Print(vars, + "const ::std::string $global_name$_default($default$);\n"); + + // Update the default to refer to the string global. + vars["default"] = global_name + "_default"; + } + + // Likewise, class members need to declare the field constant variable. + if (descriptor_->extension_scope() != NULL) { + printer->Print(vars, + "#ifndef _MSC_VER\n" + "const int $scope$$constant_name$;\n" + "#endif\n"); + } + + printer->Print(vars, + "::google::protobuf::internal::ExtensionIdentifier< $extendee$,\n" + " ::google::protobuf::internal::$type_traits$, $field_type$, $packed$ >\n" + " $name$($constant_name$, $default$);\n"); +} + +void ExtensionGenerator::GenerateRegistration(io::Printer* printer) { + map vars; + vars["extendee" ] = ExtendeeClassName(descriptor_); + vars["number" ] = SimpleItoa(descriptor_->number()); + vars["field_type" ] = SimpleItoa(static_cast(descriptor_->type())); + vars["is_repeated"] = descriptor_->is_repeated() ? "true" : "false"; + vars["is_packed" ] = (descriptor_->is_repeated() && + descriptor_->options().packed()) + ? "true" : "false"; + + switch (descriptor_->cpp_type()) { + case FieldDescriptor::CPPTYPE_ENUM: + printer->Print(vars, + "::google::protobuf::internal::ExtensionSet::RegisterEnumExtension(\n" + " &$extendee$::default_instance(),\n" + " $number$, $field_type$, $is_repeated$, $is_packed$,\n"); + printer->Print( + " &$type$_IsValid);\n", + "type", ClassName(descriptor_->enum_type(), true)); + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + printer->Print(vars, + "::google::protobuf::internal::ExtensionSet::RegisterMessageExtension(\n" + " &$extendee$::default_instance(),\n" + " $number$, $field_type$, $is_repeated$, $is_packed$,\n"); + printer->Print( + " &$type$::default_instance());\n", + "type", ClassName(descriptor_->message_type(), true)); + break; + default: + printer->Print(vars, + "::google::protobuf::internal::ExtensionSet::RegisterExtension(\n" + " &$extendee$::default_instance(),\n" + " $number$, $field_type$, $is_repeated$, $is_packed$);\n"); + break; + } +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/extension.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_extension.h similarity index 81% rename from depends/protobuf/src/google/protobuf/compiler/cpp/extension.h rename to depends/protobuf/google/protobuf/compiler/cpp/cpp_extension.h index 282931fa4..3068b0914 100644 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/extension.h +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_extension.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -35,28 +35,21 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__ -#include #include - #include -#include namespace google { namespace protobuf { -class FieldDescriptor; // descriptor.h -namespace io { -class Printer; // printer.h + class FieldDescriptor; // descriptor.h + namespace io { + class Printer; // printer.h + } } -} // namespace protobuf -} // namespace google -namespace google { 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. @@ -64,25 +57,22 @@ class ExtensionGenerator { public: // See generator.cc for the meaning of dllexport_decl. explicit ExtensionGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer); + const string& dllexport_decl); ~ExtensionGenerator(); // Header stuff. - void GenerateDeclaration(io::Printer* printer) const; + void GenerateDeclaration(io::Printer* printer); // Source file stuff. void GenerateDefinition(io::Printer* printer); - bool IsScoped() const; + // Generate code to register the extension. + void GenerateRegistration(io::Printer* printer); private: const FieldDescriptor* descriptor_; - std::string type_traits_; - Options options_; - MessageSCCAnalyzer* scc_analyzer_; - - std::map variables_; + string type_traits_; + string dllexport_decl_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); }; @@ -90,6 +80,6 @@ class ExtensionGenerator { } // namespace cpp } // namespace compiler } // namespace protobuf -} // namespace google +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_field.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_field.cc new file mode 100644 index 000000000..103cac4a9 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_field.cc @@ -0,0 +1,139 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +using internal::WireFormat; + +void SetCommonFieldVariables(const FieldDescriptor* descriptor, + map* variables) { + (*variables)["name"] = FieldName(descriptor); + (*variables)["index"] = SimpleItoa(descriptor->index()); + (*variables)["number"] = SimpleItoa(descriptor->number()); + (*variables)["classname"] = ClassName(FieldScope(descriptor), false); + (*variables)["declared_type"] = DeclaredTypeMethodName(descriptor->type()); + + (*variables)["tag_size"] = SimpleItoa( + WireFormat::TagSize(descriptor->number(), descriptor->type())); + (*variables)["deprecation"] = descriptor->options().deprecated() + ? " PROTOBUF_DEPRECATED" : ""; + +} + +FieldGenerator::~FieldGenerator() {} + +void FieldGenerator:: +GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { + // Reaching here indicates a bug. Cases are: + // - This FieldGenerator should support packing, but this method should be + // overridden. + // - This FieldGenerator doesn't support packing, and this method should + // never have been called. + GOOGLE_LOG(FATAL) << "GenerateMergeFromCodedStreamWithPacking() " + << "called on field generator that does not support packing."; + +} + +FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor) + : descriptor_(descriptor), + field_generators_( + new scoped_ptr[descriptor->field_count()]) { + // Construct all the FieldGenerators. + for (int i = 0; i < descriptor->field_count(); i++) { + field_generators_[i].reset(MakeGenerator(descriptor->field(i))); + } +} + +FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field) { + if (field->is_repeated()) { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_MESSAGE: + return new RepeatedMessageFieldGenerator(field); + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // RepeatedStringFieldGenerator handles unknown ctypes. + case FieldOptions::STRING: + return new RepeatedStringFieldGenerator(field); + } + case FieldDescriptor::CPPTYPE_ENUM: + return new RepeatedEnumFieldGenerator(field); + default: + return new RepeatedPrimitiveFieldGenerator(field); + } + } else { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_MESSAGE: + return new MessageFieldGenerator(field); + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // StringFieldGenerator handles unknown ctypes. + case FieldOptions::STRING: + return new StringFieldGenerator(field); + } + case FieldDescriptor::CPPTYPE_ENUM: + return new EnumFieldGenerator(field); + default: + return new PrimitiveFieldGenerator(field); + } + } +} + +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/depends/protobuf/google/protobuf/compiler/cpp/cpp_field.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_field.h new file mode 100644 index 000000000..c303a3378 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_field.h @@ -0,0 +1,167 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ + +#include +#include + +#include +#include + +namespace google { +namespace protobuf { + namespace io { + class Printer; // printer.h + } +} + +namespace protobuf { +namespace compiler { +namespace cpp { + +// Helper function: set variables in the map that are the same for all +// field code generators. +// ['name', 'index', 'number', 'classname', 'declared_type', 'tag_size', +// 'deprecation']. +void SetCommonFieldVariables(const FieldDescriptor* descriptor, + map* variables); + +class FieldGenerator { + public: + FieldGenerator() {} + virtual ~FieldGenerator(); + + // Generate lines of code declaring members fields of the message class + // needed to represent this field. These are placed inside the message + // class. + virtual void GeneratePrivateMembers(io::Printer* printer) const = 0; + + // Generate prototypes for all of the accessor functions related to this + // field. These are placed inside the class definition. + virtual void GenerateAccessorDeclarations(io::Printer* printer) const = 0; + + // Generate inline definitions of accessor functions for this field. + // These are placed inside the header after all class definitions. + virtual void GenerateInlineAccessorDefinitions( + io::Printer* printer) const = 0; + + // Generate definitions of accessors that aren't inlined. These are + // placed somewhere in the .cc file. + // Most field types don't need this, so the default implementation is empty. + virtual void GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const {} + + // Generate lines of code (statements, not declarations) which clear the + // field. This is used to define the clear_$name$() method as well as + // the Clear() method for the whole message. + virtual void GenerateClearingCode(io::Printer* printer) const = 0; + + // Generate lines of code (statements, not declarations) which merges the + // contents of the field from the current message to the target message, + // which is stored in the generated code variable "from". + // This is used to fill in the MergeFrom method for the whole message. + // Details of this usage can be found in message.cc under the + // GenerateMergeFrom method. + virtual void GenerateMergingCode(io::Printer* printer) const = 0; + + // Generate lines of code (statements, not declarations) which swaps + // this field and the corresponding field of another message, which + // is stored in the generated code variable "other". This is used to + // define the Swap method. Details of usage can be found in + // message.cc under the GenerateSwap method. + virtual void GenerateSwappingCode(io::Printer* printer) const = 0; + + // Generate initialization code for private members declared by + // GeneratePrivateMembers(). These go into the message class's SharedCtor() + // method, invoked by each of the generated constructors. + virtual void GenerateConstructorCode(io::Printer* printer) const = 0; + + // Generate any code that needs to go in the class's SharedDtor() method, + // invoked by the destructor. + // Most field types don't need this, so the default implementation is empty. + virtual void GenerateDestructorCode(io::Printer* printer) const {} + + // Generate lines to decode this field, which will be placed inside the + // message's MergeFromCodedStream() method. + virtual void GenerateMergeFromCodedStream(io::Printer* printer) const = 0; + + // Generate lines to decode this field from a packed value, which will be + // placed inside the message's MergeFromCodedStream() method. + virtual void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) + const; + + // Generate lines to serialize this field, which are placed within the + // message's SerializeWithCachedSizes() method. + virtual void GenerateSerializeWithCachedSizes(io::Printer* printer) const = 0; + + // Generate lines to serialize this field directly to the array "target", + // which are placed within the message's SerializeWithCachedSizesToArray() + // method. This must also advance "target" past the written bytes. + virtual void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const = 0; + + // Generate lines to compute the serialized size of this field, which + // are placed in the message's ByteSize() method. + virtual void GenerateByteSize(io::Printer* printer) const = 0; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); +}; + +// Convenience class which constructs FieldGenerators for a Descriptor. +class FieldGeneratorMap { + public: + explicit FieldGeneratorMap(const Descriptor* descriptor); + ~FieldGeneratorMap(); + + const FieldGenerator& get(const FieldDescriptor* field) const; + + private: + const Descriptor* descriptor_; + scoped_array > field_generators_; + + static FieldGenerator* MakeGenerator(const FieldDescriptor* field); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); +}; + + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_file.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_file.cc new file mode 100644 index 000000000..312ebc86d --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_file.cc @@ -0,0 +1,611 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +// =================================================================== + +FileGenerator::FileGenerator(const FileDescriptor* file, + const string& dllexport_decl) + : file_(file), + message_generators_( + new scoped_ptr[file->message_type_count()]), + enum_generators_( + new scoped_ptr[file->enum_type_count()]), + service_generators_( + new scoped_ptr[file->service_count()]), + extension_generators_( + new scoped_ptr[file->extension_count()]), + dllexport_decl_(dllexport_decl) { + + for (int i = 0; i < file->message_type_count(); i++) { + message_generators_[i].reset( + new MessageGenerator(file->message_type(i), dllexport_decl)); + } + + for (int i = 0; i < file->enum_type_count(); i++) { + enum_generators_[i].reset( + new EnumGenerator(file->enum_type(i), dllexport_decl)); + } + + for (int i = 0; i < file->service_count(); i++) { + service_generators_[i].reset( + new ServiceGenerator(file->service(i), dllexport_decl)); + } + + for (int i = 0; i < file->extension_count(); i++) { + extension_generators_[i].reset( + new ExtensionGenerator(file->extension(i), dllexport_decl)); + } + + SplitStringUsing(file_->package(), ".", &package_parts_); +} + +FileGenerator::~FileGenerator() {} + +void FileGenerator::GenerateHeader(io::Printer* printer) { + string filename_identifier = FilenameIdentifier(file_->name()); + + // Generate top of header. + printer->Print( + "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" + "// source: $filename$\n" + "\n" + "#ifndef PROTOBUF_$filename_identifier$__INCLUDED\n" + "#define PROTOBUF_$filename_identifier$__INCLUDED\n" + "\n" + "#include \n" + "\n", + "filename", file_->name(), + "filename_identifier", filename_identifier); + + printer->Print( + "#include \n" + "\n"); + + // Verify the protobuf library header version is compatible with the protoc + // version before going any further. + printer->Print( + "#if GOOGLE_PROTOBUF_VERSION < $min_header_version$\n" + "#error This file was generated by a newer version of protoc which is\n" + "#error incompatible with your Protocol Buffer headers. Please update\n" + "#error your headers.\n" + "#endif\n" + "#if $protoc_version$ < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION\n" + "#error This file was generated by an older version of protoc which is\n" + "#error incompatible with your Protocol Buffer headers. Please\n" + "#error regenerate this file with a newer version of protoc.\n" + "#endif\n" + "\n", + "min_header_version", + SimpleItoa(protobuf::internal::kMinHeaderVersionForProtoc), + "protoc_version", SimpleItoa(GOOGLE_PROTOBUF_VERSION)); + + // OK, it's now safe to #include other files. + printer->Print( + "#include \n" + "#include \n" + "#include \n"); + + if (HasDescriptorMethods(file_)) { + printer->Print( + "#include \n"); + } + + if (HasGenericServices(file_)) { + printer->Print( + "#include \n"); + } + + + for (int i = 0; i < file_->dependency_count(); i++) { + printer->Print( + "#include \"$dependency$.pb.h\"\n", + "dependency", StripProto(file_->dependency(i)->name())); + } + + printer->Print( + "// @@protoc_insertion_point(includes)\n"); + + // Open namespace. + GenerateNamespaceOpeners(printer); + + // Forward-declare the AddDescriptors, AssignDescriptors, and ShutdownFile + // functions, so that we can declare them to be friends of each class. + printer->Print( + "\n" + "// Internal implementation detail -- do not call these.\n" + "void $dllexport_decl$ $adddescriptorsname$();\n", + "adddescriptorsname", GlobalAddDescriptorsName(file_->name()), + "dllexport_decl", dllexport_decl_); + + printer->Print( + // Note that we don't put dllexport_decl on these because they are only + // called by the .pb.cc file in which they are defined. + "void $assigndescriptorsname$();\n" + "void $shutdownfilename$();\n" + "\n", + "assigndescriptorsname", GlobalAssignDescriptorsName(file_->name()), + "shutdownfilename", GlobalShutdownFileName(file_->name())); + + // Generate forward declarations of classes. + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateForwardDeclaration(printer); + } + + printer->Print("\n"); + + // Generate enum definitions. + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateEnumDefinitions(printer); + } + for (int i = 0; i < file_->enum_type_count(); i++) { + enum_generators_[i]->GenerateDefinition(printer); + } + + printer->Print(kThickSeparator); + printer->Print("\n"); + + // Generate class definitions. + for (int i = 0; i < file_->message_type_count(); i++) { + if (i > 0) { + printer->Print("\n"); + printer->Print(kThinSeparator); + printer->Print("\n"); + } + message_generators_[i]->GenerateClassDefinition(printer); + } + + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + + if (HasGenericServices(file_)) { + // Generate service definitions. + for (int i = 0; i < file_->service_count(); i++) { + if (i > 0) { + printer->Print("\n"); + printer->Print(kThinSeparator); + printer->Print("\n"); + } + service_generators_[i]->GenerateDeclarations(printer); + } + + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + } + + // Declare extension identifiers. + for (int i = 0; i < file_->extension_count(); i++) { + extension_generators_[i]->GenerateDeclaration(printer); + } + + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + + // Generate class inline methods. + for (int i = 0; i < file_->message_type_count(); i++) { + if (i > 0) { + printer->Print(kThinSeparator); + printer->Print("\n"); + } + message_generators_[i]->GenerateInlineMethods(printer); + } + + printer->Print( + "\n" + "// @@protoc_insertion_point(namespace_scope)\n"); + + // Close up namespace. + GenerateNamespaceClosers(printer); + + // Emit GetEnumDescriptor specializations into google::protobuf namespace: + if (HasDescriptorMethods(file_)) { + // The SWIG conditional is to avoid a null-pointer dereference + // (bug 1984964) in swig-1.3.21 resulting from the following syntax: + // namespace X { void Y(); } + // which appears in GetEnumDescriptor() specializations. + printer->Print( + "\n" + "#ifndef SWIG\n" + "namespace google {\nnamespace protobuf {\n" + "\n"); + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateGetEnumDescriptorSpecializations(printer); + } + for (int i = 0; i < file_->enum_type_count(); i++) { + enum_generators_[i]->GenerateGetEnumDescriptorSpecializations(printer); + } + printer->Print( + "\n" + "} // namespace google\n} // namespace protobuf\n" + "#endif // SWIG\n"); + } + + printer->Print( + "\n" + "// @@protoc_insertion_point(global_scope)\n" + "\n"); + + printer->Print( + "#endif // PROTOBUF_$filename_identifier$__INCLUDED\n", + "filename_identifier", filename_identifier); +} + +void FileGenerator::GenerateSource(io::Printer* printer) { + printer->Print( + "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" + "\n" + + // The generated code calls accessors that might be deprecated. We don't + // want the compiler to warn in generated code. + "#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION\n" + "#include \"$basename$.pb.h\"\n" + "\n" + "#include \n" // for swap() + "\n" + "#include \n" + "#include \n" + "#include \n", + "basename", StripProto(file_->name())); + + if (HasDescriptorMethods(file_)) { + printer->Print( + "#include \n" + "#include \n" + "#include \n"); + } + + printer->Print( + "// @@protoc_insertion_point(includes)\n"); + + GenerateNamespaceOpeners(printer); + + if (HasDescriptorMethods(file_)) { + printer->Print( + "\n" + "namespace {\n" + "\n"); + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateDescriptorDeclarations(printer); + } + for (int i = 0; i < file_->enum_type_count(); i++) { + printer->Print( + "const ::google::protobuf::EnumDescriptor* $name$_descriptor_ = NULL;\n", + "name", ClassName(file_->enum_type(i), false)); + } + + if (HasGenericServices(file_)) { + for (int i = 0; i < file_->service_count(); i++) { + printer->Print( + "const ::google::protobuf::ServiceDescriptor* $name$_descriptor_ = NULL;\n", + "name", file_->service(i)->name()); + } + } + + printer->Print( + "\n" + "} // namespace\n" + "\n"); + } + + // Define our externally-visible BuildDescriptors() function. (For the lite + // library, all this does is initialize default instances.) + GenerateBuildDescriptors(printer); + + // Generate enums. + for (int i = 0; i < file_->enum_type_count(); i++) { + enum_generators_[i]->GenerateMethods(printer); + } + + // Generate classes. + for (int i = 0; i < file_->message_type_count(); i++) { + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + message_generators_[i]->GenerateClassMethods(printer); + } + + if (HasGenericServices(file_)) { + // Generate services. + for (int i = 0; i < file_->service_count(); i++) { + if (i == 0) printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + service_generators_[i]->GenerateImplementation(printer); + } + } + + // Define extensions. + for (int i = 0; i < file_->extension_count(); i++) { + extension_generators_[i]->GenerateDefinition(printer); + } + + printer->Print( + "\n" + "// @@protoc_insertion_point(namespace_scope)\n"); + + GenerateNamespaceClosers(printer); + + printer->Print( + "\n" + "// @@protoc_insertion_point(global_scope)\n"); +} + +void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { + // AddDescriptors() is a file-level procedure which adds the encoded + // FileDescriptorProto for this .proto file to the global DescriptorPool + // for generated files (DescriptorPool::generated_pool()). It always runs + // at static initialization time, so all files will be registered before + // main() starts. This procedure also constructs default instances and + // registers extensions. + // + // Its sibling, AssignDescriptors(), actually pulls the compiled + // FileDescriptor from the DescriptorPool and uses it to populate all of + // the global variables which store pointers to the descriptor objects. + // It also constructs the reflection objects. It is called the first time + // anyone calls descriptor() or GetReflection() on one of the types defined + // in the file. + + // In optimize_for = LITE_RUNTIME mode, we don't generate AssignDescriptors() + // and we only use AddDescriptors() to allocate default instances. + if (HasDescriptorMethods(file_)) { + printer->Print( + "\n" + "void $assigndescriptorsname$() {\n", + "assigndescriptorsname", GlobalAssignDescriptorsName(file_->name())); + printer->Indent(); + + // Make sure the file has found its way into the pool. If a descriptor + // is requested *during* static init then AddDescriptors() may not have + // been called yet, so we call it manually. Note that it's fine if + // AddDescriptors() is called multiple times. + printer->Print( + "$adddescriptorsname$();\n", + "adddescriptorsname", GlobalAddDescriptorsName(file_->name())); + + // Get the file's descriptor from the pool. + printer->Print( + "const ::google::protobuf::FileDescriptor* file =\n" + " ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(\n" + " \"$filename$\");\n" + // Note that this GOOGLE_CHECK is necessary to prevent a warning about "file" + // being unused when compiling an empty .proto file. + "GOOGLE_CHECK(file != NULL);\n", + "filename", file_->name()); + + // Go through all the stuff defined in this file and generated code to + // assign the global descriptor pointers based on the file descriptor. + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateDescriptorInitializer(printer, i); + } + for (int i = 0; i < file_->enum_type_count(); i++) { + enum_generators_[i]->GenerateDescriptorInitializer(printer, i); + } + if (HasGenericServices(file_)) { + for (int i = 0; i < file_->service_count(); i++) { + service_generators_[i]->GenerateDescriptorInitializer(printer, i); + } + } + + printer->Outdent(); + printer->Print( + "}\n" + "\n"); + + // --------------------------------------------------------------- + + // protobuf_AssignDescriptorsOnce(): The first time it is called, calls + // AssignDescriptors(). All later times, waits for the first call to + // complete and then returns. + printer->Print( + "namespace {\n" + "\n" + "GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);\n" + "inline void protobuf_AssignDescriptorsOnce() {\n" + " ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,\n" + " &$assigndescriptorsname$);\n" + "}\n" + "\n", + "assigndescriptorsname", GlobalAssignDescriptorsName(file_->name())); + + // protobuf_RegisterTypes(): Calls + // MessageFactory::InternalRegisterGeneratedType() for each message type. + printer->Print( + "void protobuf_RegisterTypes(const ::std::string&) {\n" + " protobuf_AssignDescriptorsOnce();\n"); + printer->Indent(); + + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateTypeRegistrations(printer); + } + + printer->Outdent(); + printer->Print( + "}\n" + "\n" + "} // namespace\n"); + } + + // ----------------------------------------------------------------- + + // ShutdownFile(): Deletes descriptors, default instances, etc. on shutdown. + printer->Print( + "\n" + "void $shutdownfilename$() {\n", + "shutdownfilename", GlobalShutdownFileName(file_->name())); + printer->Indent(); + + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateShutdownCode(printer); + } + + printer->Outdent(); + printer->Print( + "}\n"); + + // ----------------------------------------------------------------- + + // Now generate the AddDescriptors() function. + printer->Print( + "\n" + "void $adddescriptorsname$() {\n" + // We don't need any special synchronization here because this code is + // called at static init time before any threads exist. + " static bool already_here = false;\n" + " if (already_here) return;\n" + " already_here = true;\n" + " GOOGLE_PROTOBUF_VERIFY_VERSION;\n" + "\n", + "adddescriptorsname", GlobalAddDescriptorsName(file_->name())); + printer->Indent(); + + // Call the AddDescriptors() methods for all of our dependencies, to make + // sure they get added first. + for (int i = 0; i < file_->dependency_count(); i++) { + const FileDescriptor* dependency = file_->dependency(i); + // Print the namespace prefix for the dependency. + vector dependency_package_parts; + SplitStringUsing(dependency->package(), ".", &dependency_package_parts); + printer->Print("::"); + for (int i = 0; i < dependency_package_parts.size(); i++) { + printer->Print("$name$::", + "name", dependency_package_parts[i]); + } + // Call its AddDescriptors function. + printer->Print( + "$name$();\n", + "name", GlobalAddDescriptorsName(dependency->name())); + } + + if (HasDescriptorMethods(file_)) { + // Embed the descriptor. We simply serialize the entire FileDescriptorProto + // and embed it as a string literal, which is parsed and built into real + // descriptors at initialization time. + FileDescriptorProto file_proto; + file_->CopyTo(&file_proto); + string file_data; + file_proto.SerializeToString(&file_data); + + printer->Print( + "::google::protobuf::DescriptorPool::InternalAddGeneratedFile("); + + // Only write 40 bytes per line. + static const int kBytesPerLine = 40; + for (int i = 0; i < file_data.size(); i += kBytesPerLine) { + printer->Print("\n \"$data$\"", + "data", EscapeTrigraphs(CEscape(file_data.substr(i, kBytesPerLine)))); + } + printer->Print( + ", $size$);\n", + "size", SimpleItoa(file_data.size())); + + // Call MessageFactory::InternalRegisterGeneratedFile(). + printer->Print( + "::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(\n" + " \"$filename$\", &protobuf_RegisterTypes);\n", + "filename", file_->name()); + } + + // Allocate and initialize default instances. This can't be done lazily + // since default instances are returned by simple accessors and are used with + // extensions. Speaking of which, we also register extensions at this time. + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateDefaultInstanceAllocator(printer); + } + for (int i = 0; i < file_->extension_count(); i++) { + extension_generators_[i]->GenerateRegistration(printer); + } + for (int i = 0; i < file_->message_type_count(); i++) { + message_generators_[i]->GenerateDefaultInstanceInitializer(printer); + } + + printer->Print( + "::google::protobuf::internal::OnShutdown(&$shutdownfilename$);\n", + "shutdownfilename", GlobalShutdownFileName(file_->name())); + + printer->Outdent(); + + printer->Print( + "}\n" + "\n" + "// Force AddDescriptors() to be called at static initialization time.\n" + "struct StaticDescriptorInitializer_$filename$ {\n" + " StaticDescriptorInitializer_$filename$() {\n" + " $adddescriptorsname$();\n" + " }\n" + "} static_descriptor_initializer_$filename$_;\n" + "\n", + "adddescriptorsname", GlobalAddDescriptorsName(file_->name()), + "filename", FilenameIdentifier(file_->name())); +} + +void FileGenerator::GenerateNamespaceOpeners(io::Printer* printer) { + if (package_parts_.size() > 0) printer->Print("\n"); + + for (int i = 0; i < package_parts_.size(); i++) { + printer->Print("namespace $part$ {\n", + "part", package_parts_[i]); + } +} + +void FileGenerator::GenerateNamespaceClosers(io::Printer* printer) { + if (package_parts_.size() > 0) printer->Print("\n"); + + for (int i = package_parts_.size() - 1; i >= 0; i--) { + printer->Print("} // namespace $part$\n", + "part", package_parts_[i]); + } +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_file.h similarity index 54% rename from depends/protobuf/src/google/protobuf/compiler/java/enum.h rename to depends/protobuf/google/protobuf/compiler/cpp/cpp_file.h index 0a2c363b5..b4e012857 100644 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum.h +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_file.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -32,69 +32,67 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ #include #include -#include +#include +#include namespace google { namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h + class FileDescriptor; // descriptor.h + namespace io { + class Printer; // printer.h + } } -} // namespace protobuf -} // namespace google -namespace google { namespace protobuf { namespace compiler { -namespace java { +namespace cpp { + +class EnumGenerator; // enum.h +class MessageGenerator; // message.h +class ServiceGenerator; // service.h +class ExtensionGenerator; // extension.h -class EnumGenerator { +class FileGenerator { public: - EnumGenerator(const EnumDescriptor* descriptor, bool immutable_api, - Context* context); - ~EnumGenerator(); + // See generator.cc for the meaning of dllexport_decl. + explicit FileGenerator(const FileDescriptor* file, + const string& dllexport_decl); + ~FileGenerator(); - void Generate(io::Printer* printer); + void GenerateHeader(io::Printer* printer); + void GenerateSource(io::Printer* printer); private: - const EnumDescriptor* descriptor_; + // Generate the BuildDescriptors() procedure, which builds all descriptors + // for types defined in the file. + void GenerateBuildDescriptors(io::Printer* printer); - // The proto language allows multiple enum constants to have the same - // numeric value. Java, however, does not allow multiple enum constants to - // be considered equivalent. We treat the first defined constant for any - // given numeric value as "canonical" and the rest as aliases of that - // canonical value. - std::vector canonical_values_; + void GenerateNamespaceOpeners(io::Printer* printer); + void GenerateNamespaceClosers(io::Printer* printer); - struct Alias { - const EnumValueDescriptor* value; - const EnumValueDescriptor* canonical_value; - }; - std::vector aliases_; + const FileDescriptor* file_; - bool immutable_api_; + scoped_array > message_generators_; + scoped_array > enum_generators_; + scoped_array > service_generators_; + scoped_array > extension_generators_; - Context* context_; - ClassNameResolver* name_resolver_; + // E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}. + vector package_parts_; - bool CanUseEnumValues(); + string dllexport_decl_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); }; -} // namespace java +} // namespace cpp } // namespace compiler } // namespace protobuf -} // namespace google -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_generator.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_generator.cc new file mode 100644 index 000000000..bb84e2ab4 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_generator.cc @@ -0,0 +1,122 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +CppGenerator::CppGenerator() {} +CppGenerator::~CppGenerator() {} + +bool CppGenerator::Generate(const FileDescriptor* file, + const string& parameter, + GeneratorContext* generator_context, + string* error) const { + vector > options; + ParseGeneratorParameter(parameter, &options); + + // ----------------------------------------------------------------- + // parse generator options + + // TODO(kenton): If we ever have more options, we may want to create a + // class that encapsulates them which we can pass down to all the + // generator classes. Currently we pass dllexport_decl down to all of + // them via the constructors, but we don't want to have to add another + // constructor parameter for every option. + + // If the dllexport_decl option is passed to the compiler, we need to write + // it in front of every symbol that should be exported if this .proto is + // compiled into a Windows DLL. E.g., if the user invokes the protocol + // compiler as: + // protoc --cpp_out=dllexport_decl=FOO_EXPORT:outdir foo.proto + // then we'll define classes like this: + // class FOO_EXPORT Foo { + // ... + // } + // FOO_EXPORT is a macro which should expand to __declspec(dllexport) or + // __declspec(dllimport) depending on what is being compiled. + string dllexport_decl; + + for (int i = 0; i < options.size(); i++) { + if (options[i].first == "dllexport_decl") { + dllexport_decl = options[i].second; + } else { + *error = "Unknown generator option: " + options[i].first; + return false; + } + } + + // ----------------------------------------------------------------- + + + string basename = StripProto(file->name()); + basename.append(".pb"); + + FileGenerator file_generator(file, dllexport_decl); + + // Generate header. + { + scoped_ptr output( + generator_context->Open(basename + ".h")); + io::Printer printer(output.get(), '$'); + file_generator.GenerateHeader(&printer); + } + + // Generate cc file. + { + scoped_ptr output( + generator_context->Open(basename + ".cc")); + io::Printer printer(output.get(), '$'); + file_generator.GenerateSource(&printer); + } + + return true; +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_generator.h similarity index 67% rename from depends/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.h rename to depends/protobuf/google/protobuf/compiler/cpp/cpp_generator.h index f41f9b835..a90e84d7b 100644 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.h +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -28,43 +28,45 @@ // (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 C# code for a given .proto file. +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// Generates C++ code for a given .proto file. -#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__ #include - #include -#include - namespace google { namespace protobuf { namespace compiler { -namespace csharp { +namespace cpp { -// CodeGenerator implementation which generates a C# source file and +// CodeGenerator implementation which generates a C++ source file and // header. If you create your own protocol compiler binary and you want -// it to support C# output, you can do so by registering an instance of this +// it to support C++ 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 { +class LIBPROTOC_EXPORT CppGenerator : public CodeGenerator { public: - Generator(); - ~Generator(); - bool Generate( - const FileDescriptor* file, - const std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const override; - uint64_t GetSupportedFeatures() const override; + CppGenerator(); + ~CppGenerator(); + + // implements CodeGenerator ---------------------------------------- + bool Generate(const FileDescriptor* file, + const string& parameter, + GeneratorContext* generator_context, + string* error) const; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CppGenerator); }; -} // namespace csharp +} // namespace cpp } // namespace compiler } // namespace protobuf -} // namespace google -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_helpers.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_helpers.cc new file mode 100644 index 000000000..25b05a85f --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -0,0 +1,347 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +namespace { + +string DotsToUnderscores(const string& name) { + return StringReplace(name, ".", "_", true); +} + +string DotsToColons(const string& name) { + return StringReplace(name, ".", "::", true); +} + +const char* const kKeywordList[] = { + "and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", + "catch", "char", "class", "compl", "const", "const_cast", "continue", + "default", "delete", "do", "double", "dynamic_cast", "else", "enum", + "explicit", "extern", "false", "float", "for", "friend", "goto", "if", + "inline", "int", "long", "mutable", "namespace", "new", "not", "not_eq", + "operator", "or", "or_eq", "private", "protected", "public", "register", + "reinterpret_cast", "return", "short", "signed", "sizeof", "static", + "static_cast", "struct", "switch", "template", "this", "throw", "true", "try", + "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", + "void", "volatile", "wchar_t", "while", "xor", "xor_eq" +}; + +hash_set MakeKeywordsMap() { + hash_set result; + for (int i = 0; i < GOOGLE_ARRAYSIZE(kKeywordList); i++) { + result.insert(kKeywordList[i]); + } + return result; +} + +hash_set kKeywords = MakeKeywordsMap(); + +string UnderscoresToCamelCase(const string& input, bool cap_next_letter) { + 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') { + if (cap_next_letter) { + result += input[i] + ('A' - 'a'); + } else { + result += input[i]; + } + cap_next_letter = false; + } else if ('A' <= input[i] && input[i] <= 'Z') { + // Capital letters are left as-is. + result += input[i]; + cap_next_letter = false; + } else if ('0' <= input[i] && input[i] <= '9') { + result += input[i]; + cap_next_letter = true; + } else { + cap_next_letter = true; + } + } + return result; +} + +} // namespace + +const char kThickSeparator[] = + "// ===================================================================\n"; +const char kThinSeparator[] = + "// -------------------------------------------------------------------\n"; + +string ClassName(const Descriptor* descriptor, bool qualified) { + + // Find "outer", the descriptor of the top-level message in which + // "descriptor" is embedded. + const Descriptor* outer = descriptor; + while (outer->containing_type() != NULL) outer = outer->containing_type(); + + const string& outer_name = outer->full_name(); + string inner_name = descriptor->full_name().substr(outer_name.size()); + + if (qualified) { + return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name); + } else { + return outer->name() + DotsToUnderscores(inner_name); + } +} + +string ClassName(const EnumDescriptor* enum_descriptor, bool qualified) { + if (enum_descriptor->containing_type() == NULL) { + if (qualified) { + return DotsToColons(enum_descriptor->full_name()); + } else { + return enum_descriptor->name(); + } + } else { + string result = ClassName(enum_descriptor->containing_type(), qualified); + result += '_'; + result += enum_descriptor->name(); + return result; + } +} + + +string SuperClassName(const Descriptor* descriptor) { + return HasDescriptorMethods(descriptor->file()) ? + "::google::protobuf::Message" : "::google::protobuf::MessageLite"; +} + +string FieldName(const FieldDescriptor* field) { + string result = field->name(); + LowerString(&result); + if (kKeywords.count(result) > 0) { + result.append("_"); + } + return result; +} + +string FieldConstantName(const FieldDescriptor *field) { + string field_name = UnderscoresToCamelCase(field->name(), true); + string result = "k" + field_name + "FieldNumber"; + + if (!field->is_extension() && + field->containing_type()->FindFieldByCamelcaseName( + field->camelcase_name()) != field) { + // This field's camelcase name is not unique. As a hack, add the field + // number to the constant name. This makes the constant rather useless, + // but what can we do? + result += "_" + SimpleItoa(field->number()); + } + + return result; +} + +string FieldMessageTypeName(const FieldDescriptor* field) { + // Note: The Google-internal version of Protocol Buffers uses this function + // as a hook point for hacks to support legacy code. + return ClassName(field->message_type(), true); +} + +string StripProto(const string& filename) { + if (HasSuffixString(filename, ".protodevel")) { + return StripSuffixString(filename, ".protodevel"); + } else { + return StripSuffixString(filename, ".proto"); + } +} + +const char* PrimitiveTypeName(FieldDescriptor::CppType type) { + switch (type) { + case FieldDescriptor::CPPTYPE_INT32 : return "::google::protobuf::int32"; + case FieldDescriptor::CPPTYPE_INT64 : return "::google::protobuf::int64"; + case FieldDescriptor::CPPTYPE_UINT32 : return "::google::protobuf::uint32"; + case FieldDescriptor::CPPTYPE_UINT64 : return "::google::protobuf::uint64"; + case FieldDescriptor::CPPTYPE_DOUBLE : return "double"; + case FieldDescriptor::CPPTYPE_FLOAT : return "float"; + case FieldDescriptor::CPPTYPE_BOOL : return "bool"; + case FieldDescriptor::CPPTYPE_ENUM : return "int"; + case FieldDescriptor::CPPTYPE_STRING : return "::std::string"; + case FieldDescriptor::CPPTYPE_MESSAGE: return NULL; + + // No default because we want the compiler to complain if any new + // CppTypes are added. + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return NULL; +} + +const char* DeclaredTypeMethodName(FieldDescriptor::Type type) { + switch (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_FLOAT : return "Float"; + case FieldDescriptor::TYPE_DOUBLE : return "Double"; + + 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_GROUP : return "Group"; + case FieldDescriptor::TYPE_MESSAGE : return "Message"; + + // No default because we want the compiler to complain if any new + // types are added. + } + GOOGLE_LOG(FATAL) << "Can't get here."; + return ""; +} + +string DefaultValue(const FieldDescriptor* field) { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: + return SimpleItoa(field->default_value_int32()); + case FieldDescriptor::CPPTYPE_UINT32: + return SimpleItoa(field->default_value_uint32()) + "u"; + case FieldDescriptor::CPPTYPE_INT64: + return "GOOGLE_LONGLONG(" + SimpleItoa(field->default_value_int64()) + ")"; + case FieldDescriptor::CPPTYPE_UINT64: + return "GOOGLE_ULONGLONG(" + SimpleItoa(field->default_value_uint64())+ ")"; + case FieldDescriptor::CPPTYPE_DOUBLE: { + double value = field->default_value_double(); + if (value == numeric_limits::infinity()) { + return "::google::protobuf::internal::Infinity()"; + } else if (value == -numeric_limits::infinity()) { + return "-::google::protobuf::internal::Infinity()"; + } else if (value != value) { + return "::google::protobuf::internal::NaN()"; + } else { + return SimpleDtoa(value); + } + } + case FieldDescriptor::CPPTYPE_FLOAT: + { + float value = field->default_value_float(); + if (value == numeric_limits::infinity()) { + return "static_cast(::google::protobuf::internal::Infinity())"; + } else if (value == -numeric_limits::infinity()) { + return "static_cast(-::google::protobuf::internal::Infinity())"; + } else if (value != value) { + return "static_cast(::google::protobuf::internal::NaN())"; + } else { + string float_value = SimpleFtoa(value); + // If floating point value contains a period (.) or an exponent + // (either E or e), then append suffix 'f' to make it a float + // literal. + if (float_value.find_first_of(".eE") != string::npos) { + float_value.push_back('f'); + } + return float_value; + } + } + case FieldDescriptor::CPPTYPE_BOOL: + return field->default_value_bool() ? "true" : "false"; + case FieldDescriptor::CPPTYPE_ENUM: + // Lazy: Generate a static_cast because we don't have a helper function + // that constructs the full name of an enum value. + return strings::Substitute( + "static_cast< $0 >($1)", + ClassName(field->enum_type(), true), + field->default_value_enum()->number()); + case FieldDescriptor::CPPTYPE_STRING: + return "\"" + EscapeTrigraphs(CEscape(field->default_value_string())) + + "\""; + case FieldDescriptor::CPPTYPE_MESSAGE: + return FieldMessageTypeName(field) + "::default_instance()"; + } + // Can't actually get here; make compiler happy. (We could add a default + // case above but then we wouldn't get the nice compiler warning when a + // new type is added.) + GOOGLE_LOG(FATAL) << "Can't get here."; + return ""; +} + +// Convert a file name into a valid identifier. +string FilenameIdentifier(const string& filename) { + string result; + for (int i = 0; i < filename.size(); i++) { + if (ascii_isalnum(filename[i])) { + result.push_back(filename[i]); + } else { + // Not alphanumeric. To avoid any possibility of name conflicts we + // use the hex code for the character. + result.push_back('_'); + char buffer[kFastToBufferSize]; + result.append(FastHexToBuffer(static_cast(filename[i]), buffer)); + } + } + return result; +} + +// Return the name of the AddDescriptors() function for a given file. +string GlobalAddDescriptorsName(const string& filename) { + return "protobuf_AddDesc_" + FilenameIdentifier(filename); +} + +// Return the name of the AssignDescriptors() function for a given file. +string GlobalAssignDescriptorsName(const string& filename) { + return "protobuf_AssignDesc_" + FilenameIdentifier(filename); +} + +// Return the name of the ShutdownFile() function for a given file. +string GlobalShutdownFileName(const string& filename) { + return "protobuf_ShutdownFile_" + FilenameIdentifier(filename); +} + +// Escape C++ trigraphs by escaping question marks to \? +string EscapeTrigraphs(const string& to_escape) { + return StringReplace(to_escape, "?", "\\?", true); +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_helpers.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_helpers.h new file mode 100644 index 000000000..b13d53bef --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_helpers.h @@ -0,0 +1,159 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +// Commonly-used separator comments. Thick is a line of '=', thin is a line +// of '-'. +extern const char kThickSeparator[]; +extern const char kThinSeparator[]; + +// Returns the non-nested type name for the given type. If "qualified" is +// true, prefix the type with the full namespace. For example, if you had: +// package foo.bar; +// message Baz { message Qux {} } +// Then the qualified ClassName for Qux would be: +// ::foo::bar::Baz_Qux +// While the non-qualified version would be: +// Baz_Qux +string ClassName(const Descriptor* descriptor, bool qualified); +string ClassName(const EnumDescriptor* enum_descriptor, bool qualified); + +string SuperClassName(const Descriptor* descriptor); + +// 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(). +string FieldName(const FieldDescriptor* field); + +// Get the unqualified name that should be used for a field's field +// number constant. +string FieldConstantName(const FieldDescriptor *field); + +// Returns the scope where the field was defined (for extensions, this is +// different from the message type to which the field applies). +inline const Descriptor* FieldScope(const FieldDescriptor* field) { + return field->is_extension() ? + field->extension_scope() : field->containing_type(); +} + +// Returns the fully-qualified type name field->message_type(). Usually this +// is just ClassName(field->message_type(), true); +string FieldMessageTypeName(const FieldDescriptor* field); + +// Strips ".proto" or ".protodevel" from the end of a filename. +string StripProto(const string& filename); + +// Get the C++ type name for a primitive type (e.g. "double", "::google::protobuf::int32", etc.). +// Note: non-built-in type names will be qualified, meaning they will start +// with a ::. If you are using the type as a template parameter, you will +// need to insure there is a space between the < and the ::, because the +// ridiculous C++ standard defines "<:" to be a synonym for "[". +const char* PrimitiveTypeName(FieldDescriptor::CppType type); + +// Get the declared type name in CamelCase format, as is used e.g. for the +// methods of WireFormat. For example, TYPE_INT32 becomes "Int32". +const char* DeclaredTypeMethodName(FieldDescriptor::Type type); + +// Get code that evaluates to the field's default value. +string DefaultValue(const FieldDescriptor* field); + +// Convert a file name into a valid identifier. +string FilenameIdentifier(const string& filename); + +// Return the name of the AddDescriptors() function for a given file. +string GlobalAddDescriptorsName(const string& filename); + +// Return the name of the AssignDescriptors() function for a given file. +string GlobalAssignDescriptorsName(const string& filename); + +// Return the name of the ShutdownFile() function for a given file. +string GlobalShutdownFileName(const string& filename); + +// Escape C++ trigraphs by escaping question marks to \? +string EscapeTrigraphs(const string& to_escape); + +// Do message classes in this file keep track of unknown fields? +inline bool HasUnknownFields(const FileDescriptor *file) { + return file->options().optimize_for() != FileOptions::LITE_RUNTIME; +} + +// Does this file have generated parsing, serialization, and other +// standard methods for which reflection-based fallback implementations exist? +inline bool HasGeneratedMethods(const FileDescriptor *file) { + return file->options().optimize_for() != FileOptions::CODE_SIZE; +} + +// Do message classes in this file have descriptor and refelction methods? +inline bool HasDescriptorMethods(const FileDescriptor *file) { + return file->options().optimize_for() != FileOptions::LITE_RUNTIME; +} + +// Should we generate generic services for this file? +inline bool HasGenericServices(const FileDescriptor *file) { + return file->service_count() > 0 && + file->options().optimize_for() != FileOptions::LITE_RUNTIME && + file->options().cc_generic_services(); +} + +// Should string fields in this file verify that their contents are UTF-8? +inline bool HasUtf8Verification(const FileDescriptor* file) { + return file->options().optimize_for() != FileOptions::LITE_RUNTIME; +} + +// Should we generate a separate, super-optimized code path for serializing to +// flat arrays? We don't do this in Lite mode because we'd rather reduce code +// size. +inline bool HasFastArraySerialization(const FileDescriptor* file) { + return file->options().optimize_for() == FileOptions::SPEED; +} + + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_message.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message.cc new file mode 100644 index 000000000..c4e6fb2c8 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message.cc @@ -0,0 +1,1933 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +using internal::WireFormat; +using internal::WireFormatLite; + +namespace { + +void PrintFieldComment(io::Printer* printer, const FieldDescriptor* field) { + // Print the field's proto-syntax definition as a comment. We don't want to + // print group bodies so we cut off after the first line. + string def = field->DebugString(); + printer->Print("// $def$\n", + "def", def.substr(0, def.find_first_of('\n'))); +} + +struct FieldOrderingByNumber { + inline bool operator()(const FieldDescriptor* a, + const FieldDescriptor* b) const { + return a->number() < b->number(); + } +}; + +const char* kWireTypeNames[] = { + "VARINT", + "FIXED64", + "LENGTH_DELIMITED", + "START_GROUP", + "END_GROUP", + "FIXED32", +}; + +// Sort the fields of the given Descriptor by number into a new[]'d array +// and return it. +const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor) { + const FieldDescriptor** fields = + new const FieldDescriptor*[descriptor->field_count()]; + for (int i = 0; i < descriptor->field_count(); i++) { + fields[i] = descriptor->field(i); + } + sort(fields, fields + descriptor->field_count(), + FieldOrderingByNumber()); + return fields; +} + +// Functor for sorting extension ranges by their "start" field number. +struct ExtensionRangeSorter { + bool operator()(const Descriptor::ExtensionRange* left, + const Descriptor::ExtensionRange* right) const { + return left->start < right->start; + } +}; + +// Returns true if the message type has any required fields. If it doesn't, +// we can optimize out calls to its IsInitialized() method. +// +// already_seen is used to avoid checking the same type multiple times +// (and also to protect against recursion). +static bool HasRequiredFields( + const Descriptor* type, + hash_set* already_seen) { + if (already_seen->count(type) > 0) { + // Since the first occurrence of a required field causes the whole + // function to return true, we can assume that if the type is already + // in the cache it didn't have any required fields. + return false; + } + already_seen->insert(type); + + // If the type has extensions, an extension with message type could contain + // required fields, so we have to be conservative and assume such an + // extension exists. + if (type->extension_range_count() > 0) return true; + + for (int i = 0; i < type->field_count(); i++) { + const FieldDescriptor* field = type->field(i); + if (field->is_required()) { + return true; + } + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (HasRequiredFields(field->message_type(), already_seen)) { + return true; + } + } + } + + return false; +} + +static bool HasRequiredFields(const Descriptor* type) { + hash_set already_seen; + return HasRequiredFields(type, &already_seen); +} + +// This 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 +// 64-bit pointers. +int EstimateAlignmentSize(const FieldDescriptor* field) { + if (field == NULL) return 0; + if (field->is_repeated()) return 8; + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_BOOL: + return 1; + + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_UINT32: + case FieldDescriptor::CPPTYPE_ENUM: + case FieldDescriptor::CPPTYPE_FLOAT: + return 4; + + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT64: + case FieldDescriptor::CPPTYPE_DOUBLE: + case FieldDescriptor::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_MESSAGE: + return 8; + } + GOOGLE_LOG(FATAL) << "Can't get here."; + return -1; // Make compiler happy. +} + +// FieldGroup is just a helper for OptimizePadding below. It holds a vector of +// fields that are grouped together because they have compatible alignment, and +// a preferred location in the final field ordering. +class FieldGroup { + public: + FieldGroup() + : preferred_location_(0) {} + + // A group with a single field. + FieldGroup(float preferred_location, const FieldDescriptor* field) + : preferred_location_(preferred_location), + fields_(1, field) {} + + // Append the fields in 'other' to this group. + void Append(const FieldGroup& other) { + if (other.fields_.empty()) { + return; + } + // Preferred location is the average among all the fields, so we weight by + // the number of fields on each FieldGroup object. + preferred_location_ = + (preferred_location_ * fields_.size() + + (other.preferred_location_ * other.fields_.size())) / + (fields_.size() + other.fields_.size()); + fields_.insert(fields_.end(), other.fields_.begin(), other.fields_.end()); + } + + void SetPreferredLocation(float location) { preferred_location_ = location; } + const vector& fields() const { return fields_; } + + // FieldGroup objects sort by their preferred location. + bool operator<(const FieldGroup& other) const { + return preferred_location_ < other.preferred_location_; + } + + private: + // "preferred_location_" is an estimate of where this group should go in the + // final list of fields. We compute this by taking the average index of each + // field in this group in the original ordering of fields. This is very + // approximate, but should put this group close to where its member fields + // originally went. + float preferred_location_; + vector fields_; + // We rely on the default copy constructor and operator= so this type can be + // used in a vector. +}; + +// Reorder 'fields' so that if the fields are output into a c++ class in the new +// order, the alignment padding is minimized. We try to do this while keeping +// each field as close as possible to its original position so that we don't +// reduce cache locality much for function that access each field in order. +void OptimizePadding(vector* fields) { + // First divide fields into those that align to 1 byte, 4 bytes or 8 bytes. + vector aligned_to_1, aligned_to_4, aligned_to_8; + for (int i = 0; i < fields->size(); ++i) { + switch (EstimateAlignmentSize((*fields)[i])) { + case 1: aligned_to_1.push_back(FieldGroup(i, (*fields)[i])); break; + case 4: aligned_to_4.push_back(FieldGroup(i, (*fields)[i])); break; + case 8: aligned_to_8.push_back(FieldGroup(i, (*fields)[i])); break; + default: + GOOGLE_LOG(FATAL) << "Unknown alignment size."; + } + } + + // Now group fields aligned to 1 byte into sets of 4, and treat those like a + // single field aligned to 4 bytes. + for (int i = 0; i < aligned_to_1.size(); i += 4) { + FieldGroup field_group; + for (int j = i; j < aligned_to_1.size() && j < i + 4; ++j) { + field_group.Append(aligned_to_1[j]); + } + aligned_to_4.push_back(field_group); + } + // Sort by preferred location to keep fields as close to their original + // location as possible. + sort(aligned_to_4.begin(), aligned_to_4.end()); + + // Now group fields aligned to 4 bytes (or the 4-field groups created above) + // into pairs, and treat those like a single field aligned to 8 bytes. + for (int i = 0; i < aligned_to_4.size(); i += 2) { + FieldGroup field_group; + for (int j = i; j < aligned_to_4.size() && j < i + 2; ++j) { + field_group.Append(aligned_to_4[j]); + } + if (i == aligned_to_4.size() - 1) { + // Move incomplete 4-byte block to the end. + field_group.SetPreferredLocation(fields->size() + 1); + } + aligned_to_8.push_back(field_group); + } + // Sort by preferred location to keep fields as close to their original + // location as possible. + sort(aligned_to_8.begin(), aligned_to_8.end()); + + // Now pull out all the FieldDescriptors in order. + fields->clear(); + for (int i = 0; i < aligned_to_8.size(); ++i) { + fields->insert(fields->end(), + aligned_to_8[i].fields().begin(), + aligned_to_8[i].fields().end()); + } +} + +} + +// =================================================================== + +MessageGenerator::MessageGenerator(const Descriptor* descriptor, + const string& dllexport_decl) + : descriptor_(descriptor), + classname_(ClassName(descriptor, false)), + dllexport_decl_(dllexport_decl), + field_generators_(descriptor), + nested_generators_(new scoped_ptr[ + descriptor->nested_type_count()]), + enum_generators_(new scoped_ptr[ + descriptor->enum_type_count()]), + extension_generators_(new scoped_ptr[ + descriptor->extension_count()]) { + + for (int i = 0; i < descriptor->nested_type_count(); i++) { + nested_generators_[i].reset( + new MessageGenerator(descriptor->nested_type(i), dllexport_decl)); + } + + for (int i = 0; i < descriptor->enum_type_count(); i++) { + enum_generators_[i].reset( + new EnumGenerator(descriptor->enum_type(i), dllexport_decl)); + } + + for (int i = 0; i < descriptor->extension_count(); i++) { + extension_generators_[i].reset( + new ExtensionGenerator(descriptor->extension(i), dllexport_decl)); + } +} + +MessageGenerator::~MessageGenerator() {} + +void MessageGenerator:: +GenerateForwardDeclaration(io::Printer* printer) { + printer->Print("class $classname$;\n", + "classname", classname_); + + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateForwardDeclaration(printer); + } +} + +void MessageGenerator:: +GenerateEnumDefinitions(io::Printer* printer) { + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateEnumDefinitions(printer); + } + + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + enum_generators_[i]->GenerateDefinition(printer); + } +} + +void MessageGenerator:: +GenerateGetEnumDescriptorSpecializations(io::Printer* printer) { + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateGetEnumDescriptorSpecializations(printer); + } + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + enum_generators_[i]->GenerateGetEnumDescriptorSpecializations(printer); + } +} + +void MessageGenerator:: +GenerateFieldAccessorDeclarations(io::Printer* printer) { + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + PrintFieldComment(printer, field); + + map vars; + SetCommonFieldVariables(field, &vars); + vars["constant_name"] = FieldConstantName(field); + + if (field->is_repeated()) { + printer->Print(vars, "inline int $name$_size() const$deprecation$;\n"); + } else { + printer->Print(vars, "inline bool has_$name$() const$deprecation$;\n"); + } + + printer->Print(vars, "inline void clear_$name$()$deprecation$;\n"); + printer->Print(vars, "static const int $constant_name$ = $number$;\n"); + + // Generate type-specific accessor declarations. + field_generators_.get(field).GenerateAccessorDeclarations(printer); + + printer->Print("\n"); + } + + 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. + printer->Print( + "GOOGLE_PROTOBUF_EXTENSION_ACCESSORS($classname$)\n", + "classname", classname_); + } +} + +void MessageGenerator:: +GenerateFieldAccessorDefinitions(io::Printer* printer) { + printer->Print("// $classname$\n\n", "classname", classname_); + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + PrintFieldComment(printer, field); + + map vars; + SetCommonFieldVariables(field, &vars); + + // Generate has_$name$() or $name$_size(). + if (field->is_repeated()) { + printer->Print(vars, + "inline int $classname$::$name$_size() const {\n" + " return $name$_.size();\n" + "}\n"); + } else { + // Singular field. + char buffer[kFastToBufferSize]; + vars["has_array_index"] = SimpleItoa(field->index() / 32); + vars["has_mask"] = FastHex32ToBuffer(1u << (field->index() % 32), buffer); + printer->Print(vars, + "inline bool $classname$::has_$name$() const {\n" + " return (_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n" + "}\n" + "inline void $classname$::set_has_$name$() {\n" + " _has_bits_[$has_array_index$] |= 0x$has_mask$u;\n" + "}\n" + "inline void $classname$::clear_has_$name$() {\n" + " _has_bits_[$has_array_index$] &= ~0x$has_mask$u;\n" + "}\n" + ); + } + + // Generate clear_$name$() + printer->Print(vars, + "inline void $classname$::clear_$name$() {\n"); + + printer->Indent(); + field_generators_.get(field).GenerateClearingCode(printer); + printer->Outdent(); + + if (!field->is_repeated()) { + printer->Print(vars, + " clear_has_$name$();\n"); + } + + printer->Print("}\n"); + + // Generate type-specific accessors. + field_generators_.get(field).GenerateInlineAccessorDefinitions(printer); + + printer->Print("\n"); + } +} + +void MessageGenerator:: +GenerateClassDefinition(io::Printer* printer) { + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateClassDefinition(printer); + printer->Print("\n"); + printer->Print(kThinSeparator); + printer->Print("\n"); + } + + map vars; + vars["classname"] = classname_; + vars["field_count"] = SimpleItoa(descriptor_->field_count()); + if (dllexport_decl_.empty()) { + vars["dllexport"] = ""; + } else { + vars["dllexport"] = dllexport_decl_ + " "; + } + vars["superclass"] = SuperClassName(descriptor_); + + printer->Print(vars, + "class $dllexport$$classname$ : public $superclass$ {\n" + " public:\n"); + printer->Indent(); + + printer->Print(vars, + "$classname$();\n" + "virtual ~$classname$();\n" + "\n" + "$classname$(const $classname$& from);\n" + "\n" + "inline $classname$& operator=(const $classname$& from) {\n" + " CopyFrom(from);\n" + " return *this;\n" + "}\n" + "\n"); + + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + "inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {\n" + " return _unknown_fields_;\n" + "}\n" + "\n" + "inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {\n" + " return &_unknown_fields_;\n" + "}\n" + "\n"); + } + + // Only generate this member if it's not disabled. + if (HasDescriptorMethods(descriptor_->file()) && + !descriptor_->options().no_standard_descriptor_accessor()) { + printer->Print(vars, + "static const ::google::protobuf::Descriptor* descriptor();\n"); + } + + printer->Print(vars, + "static const $classname$& default_instance();\n" + "\n"); + + + printer->Print(vars, + "void Swap($classname$* other);\n" + "\n" + "// implements Message ----------------------------------------------\n" + "\n" + "$classname$* New() const;\n"); + + if (HasGeneratedMethods(descriptor_->file())) { + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print(vars, + "void CopyFrom(const ::google::protobuf::Message& from);\n" + "void MergeFrom(const ::google::protobuf::Message& from);\n"); + } else { + printer->Print(vars, + "void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);\n"); + } + + printer->Print(vars, + "void CopyFrom(const $classname$& from);\n" + "void MergeFrom(const $classname$& from);\n" + "void Clear();\n" + "bool IsInitialized() const;\n" + "\n" + "int ByteSize() const;\n" + "bool MergePartialFromCodedStream(\n" + " ::google::protobuf::io::CodedInputStream* input);\n" + "void SerializeWithCachedSizes(\n" + " ::google::protobuf::io::CodedOutputStream* output) const;\n"); + if (HasFastArraySerialization(descriptor_->file())) { + printer->Print( + "::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;\n"); + } + } + + printer->Print(vars, + "int GetCachedSize() const { return _cached_size_; }\n" + "private:\n" + "void SharedCtor();\n" + "void SharedDtor();\n" + "void SetCachedSize(int size) const;\n" + "public:\n" + "\n"); + + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print( + "::google::protobuf::Metadata GetMetadata() const;\n" + "\n"); + } else { + printer->Print( + "::std::string GetTypeName() const;\n" + "\n"); + } + + printer->Print( + "// nested types ----------------------------------------------------\n" + "\n"); + + // Import all nested message classes into this class's scope with typedefs. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + const Descriptor* nested_type = descriptor_->nested_type(i); + printer->Print("typedef $nested_full_name$ $nested_name$;\n", + "nested_name", nested_type->name(), + "nested_full_name", ClassName(nested_type, false)); + } + + if (descriptor_->nested_type_count() > 0) { + printer->Print("\n"); + } + + // Import all nested enums and their values into this class's scope with + // typedefs and constants. + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + enum_generators_[i]->GenerateSymbolImports(printer); + printer->Print("\n"); + } + + printer->Print( + "// accessors -------------------------------------------------------\n" + "\n"); + + // Generate accessor methods for all fields. + GenerateFieldAccessorDeclarations(printer); + + // Declare extension identifiers. + for (int i = 0; i < descriptor_->extension_count(); i++) { + extension_generators_[i]->GenerateDeclaration(printer); + } + + + printer->Print( + "// @@protoc_insertion_point(class_scope:$full_name$)\n", + "full_name", descriptor_->full_name()); + + // Generate private members. + printer->Outdent(); + printer->Print(" private:\n"); + printer->Indent(); + + for (int i = 0; i < descriptor_->field_count(); i++) { + if (!descriptor_->field(i)->is_repeated()) { + printer->Print( + "inline void set_has_$name$();\n", + "name", FieldName(descriptor_->field(i))); + printer->Print( + "inline void clear_has_$name$();\n", + "name", FieldName(descriptor_->field(i))); + } + } + printer->Print("\n"); + + // To minimize padding, data members are divided into three sections: + // (1) members assumed to align to 8 bytes + // (2) members corresponding to message fields, re-ordered to optimize + // alignment. + // (3) members assumed to align to 4 bytes. + + // Members assumed to align to 8 bytes: + + if (descriptor_->extension_range_count() > 0) { + printer->Print( + "::google::protobuf::internal::ExtensionSet _extensions_;\n" + "\n"); + } + + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + "::google::protobuf::UnknownFieldSet _unknown_fields_;\n" + "\n"); + } + + // Field members: + + vector fields; + for (int i = 0; i < descriptor_->field_count(); i++) { + fields.push_back(descriptor_->field(i)); + } + OptimizePadding(&fields); + for (int i = 0; i < fields.size(); ++i) { + field_generators_.get(fields[i]).GeneratePrivateMembers(printer); + } + + // Members assumed to align to 4 bytes: + + // TODO(kenton): Make _cached_size_ an atomic when C++ supports it. + printer->Print( + "\n" + "mutable int _cached_size_;\n"); + + // Generate _has_bits_. + if (descriptor_->field_count() > 0) { + printer->Print(vars, + "::google::protobuf::uint32 _has_bits_[($field_count$ + 31) / 32];\n" + "\n"); + } else { + // 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. + printer->Print( + "::google::protobuf::uint32 _has_bits_[1];\n" + "\n"); + } + + // Declare AddDescriptors(), BuildDescriptors(), and ShutdownFile() as + // friends so that they can access private static variables like + // default_instance_ and reflection_. + printer->Print( + "friend void $dllexport_decl$ $adddescriptorsname$();\n", + "dllexport_decl", dllexport_decl_, + "adddescriptorsname", + GlobalAddDescriptorsName(descriptor_->file()->name())); + printer->Print( + "friend void $assigndescriptorsname$();\n" + "friend void $shutdownfilename$();\n" + "\n", + "assigndescriptorsname", + GlobalAssignDescriptorsName(descriptor_->file()->name()), + "shutdownfilename", GlobalShutdownFileName(descriptor_->file()->name())); + + printer->Print( + "void InitAsDefaultInstance();\n" + "static $classname$* default_instance_;\n", + "classname", classname_); + + printer->Outdent(); + printer->Print(vars, "};"); +} + +void MessageGenerator:: +GenerateInlineMethods(io::Printer* printer) { + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateInlineMethods(printer); + printer->Print(kThinSeparator); + printer->Print("\n"); + } + + GenerateFieldAccessorDefinitions(printer); +} + +void MessageGenerator:: +GenerateDescriptorDeclarations(io::Printer* printer) { + printer->Print( + "const ::google::protobuf::Descriptor* $name$_descriptor_ = NULL;\n" + "const ::google::protobuf::internal::GeneratedMessageReflection*\n" + " $name$_reflection_ = NULL;\n", + "name", classname_); + + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateDescriptorDeclarations(printer); + } + + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + printer->Print( + "const ::google::protobuf::EnumDescriptor* $name$_descriptor_ = NULL;\n", + "name", ClassName(descriptor_->enum_type(i), false)); + } +} + +void MessageGenerator:: +GenerateDescriptorInitializer(io::Printer* printer, int index) { + // TODO(kenton): Passing the index to this method is redundant; just use + // descriptor_->index() instead. + map vars; + vars["classname"] = classname_; + vars["index"] = SimpleItoa(index); + + // Obtain the descriptor from the parent's descriptor. + if (descriptor_->containing_type() == NULL) { + printer->Print(vars, + "$classname$_descriptor_ = file->message_type($index$);\n"); + } else { + vars["parent"] = ClassName(descriptor_->containing_type(), false); + printer->Print(vars, + "$classname$_descriptor_ = " + "$parent$_descriptor_->nested_type($index$);\n"); + } + + // Generate the offsets. + GenerateOffsets(printer); + + // Construct the reflection object. + printer->Print(vars, + "$classname$_reflection_ =\n" + " new ::google::protobuf::internal::GeneratedMessageReflection(\n" + " $classname$_descriptor_,\n" + " $classname$::default_instance_,\n" + " $classname$_offsets_,\n" + " GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, _has_bits_[0]),\n" + " GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(" + "$classname$, _unknown_fields_),\n"); + if (descriptor_->extension_range_count() > 0) { + printer->Print(vars, + " GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(" + "$classname$, _extensions_),\n"); + } else { + // No extensions. + printer->Print(vars, + " -1,\n"); + } + printer->Print(vars, + " ::google::protobuf::DescriptorPool::generated_pool(),\n" + " ::google::protobuf::MessageFactory::generated_factory(),\n" + " sizeof($classname$));\n"); + + // Handle nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateDescriptorInitializer(printer, i); + } + + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + enum_generators_[i]->GenerateDescriptorInitializer(printer, i); + } +} + +void MessageGenerator:: +GenerateTypeRegistrations(io::Printer* printer) { + // Register this message type with the message factory. + printer->Print( + "::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(\n" + " $classname$_descriptor_, &$classname$::default_instance());\n", + "classname", classname_); + + // Handle nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateTypeRegistrations(printer); + } +} + +void MessageGenerator:: +GenerateDefaultInstanceAllocator(io::Printer* printer) { + // Construct the default instance. We can't call InitAsDefaultInstance() yet + // because we need to make sure all default instances that this one might + // depend on are constructed first. + printer->Print( + "$classname$::default_instance_ = new $classname$();\n", + "classname", classname_); + + // Handle nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateDefaultInstanceAllocator(printer); + } + +} + +void MessageGenerator:: +GenerateDefaultInstanceInitializer(io::Printer* printer) { + printer->Print( + "$classname$::default_instance_->InitAsDefaultInstance();\n", + "classname", classname_); + + // Register extensions. + for (int i = 0; i < descriptor_->extension_count(); i++) { + extension_generators_[i]->GenerateRegistration(printer); + } + + // Handle nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateDefaultInstanceInitializer(printer); + } +} + +void MessageGenerator:: +GenerateShutdownCode(io::Printer* printer) { + printer->Print( + "delete $classname$::default_instance_;\n", + "classname", classname_); + + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print( + "delete $classname$_reflection_;\n", + "classname", classname_); + } + + // Handle nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateShutdownCode(printer); + } +} + +void MessageGenerator:: +GenerateClassMethods(io::Printer* printer) { + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + enum_generators_[i]->GenerateMethods(printer); + } + + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + nested_generators_[i]->GenerateClassMethods(printer); + printer->Print("\n"); + printer->Print(kThinSeparator); + printer->Print("\n"); + } + + // Generate non-inline field definitions. + for (int i = 0; i < descriptor_->field_count(); i++) { + field_generators_.get(descriptor_->field(i)) + .GenerateNonInlineAccessorDefinitions(printer); + } + + // Generate field number constants. + printer->Print("#ifndef _MSC_VER\n"); + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor *field = descriptor_->field(i); + printer->Print( + "const int $classname$::$constant_name$;\n", + "classname", ClassName(FieldScope(field), false), + "constant_name", FieldConstantName(field)); + } + printer->Print( + "#endif // !_MSC_VER\n" + "\n"); + + // Define extension identifiers. + for (int i = 0; i < descriptor_->extension_count(); i++) { + extension_generators_[i]->GenerateDefinition(printer); + } + + GenerateStructors(printer); + printer->Print("\n"); + + if (HasGeneratedMethods(descriptor_->file())) { + GenerateClear(printer); + printer->Print("\n"); + + GenerateMergeFromCodedStream(printer); + printer->Print("\n"); + + GenerateSerializeWithCachedSizes(printer); + printer->Print("\n"); + + if (HasFastArraySerialization(descriptor_->file())) { + GenerateSerializeWithCachedSizesToArray(printer); + printer->Print("\n"); + } + + GenerateByteSize(printer); + printer->Print("\n"); + + GenerateMergeFrom(printer); + printer->Print("\n"); + + GenerateCopyFrom(printer); + printer->Print("\n"); + + GenerateIsInitialized(printer); + printer->Print("\n"); + } + + GenerateSwap(printer); + printer->Print("\n"); + + if (HasDescriptorMethods(descriptor_->file())) { + printer->Print( + "::google::protobuf::Metadata $classname$::GetMetadata() const {\n" + " protobuf_AssignDescriptorsOnce();\n" + " ::google::protobuf::Metadata metadata;\n" + " metadata.descriptor = $classname$_descriptor_;\n" + " metadata.reflection = $classname$_reflection_;\n" + " return metadata;\n" + "}\n" + "\n", + "classname", classname_); + } else { + printer->Print( + "::std::string $classname$::GetTypeName() const {\n" + " return \"$type_name$\";\n" + "}\n" + "\n", + "classname", classname_, + "type_name", descriptor_->full_name()); + } + +} + +void MessageGenerator:: +GenerateOffsets(io::Printer* printer) { + printer->Print( + "static const int $classname$_offsets_[$field_count$] = {\n", + "classname", classname_, + "field_count", SimpleItoa(max(1, descriptor_->field_count()))); + printer->Indent(); + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + printer->Print( + "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, $name$_),\n", + "classname", classname_, + "name", FieldName(field)); + } + + printer->Outdent(); + printer->Print("};\n"); +} + +void MessageGenerator:: +GenerateSharedConstructorCode(io::Printer* printer) { + printer->Print( + "void $classname$::SharedCtor() {\n", + "classname", classname_); + printer->Indent(); + + printer->Print( + "_cached_size_ = 0;\n"); + + for (int i = 0; i < descriptor_->field_count(); i++) { + field_generators_.get(descriptor_->field(i)) + .GenerateConstructorCode(printer); + } + + printer->Print( + "::memset(_has_bits_, 0, sizeof(_has_bits_));\n"); + + printer->Outdent(); + printer->Print("}\n\n"); +} + +void MessageGenerator:: +GenerateSharedDestructorCode(io::Printer* printer) { + printer->Print( + "void $classname$::SharedDtor() {\n", + "classname", classname_); + printer->Indent(); + // Write the destructors for each field. + for (int i = 0; i < descriptor_->field_count(); i++) { + field_generators_.get(descriptor_->field(i)) + .GenerateDestructorCode(printer); + } + + printer->Print( + "if (this != default_instance_) {\n"); + + // We need to delete all embedded messages. + // TODO(kenton): If we make unset messages point at default instances + // instead of NULL, then it would make sense to move this code into + // MessageFieldGenerator::GenerateDestructorCode(). + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (!field->is_repeated() && + field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + printer->Print(" delete $name$_;\n", + "name", FieldName(field)); + } + } + + printer->Outdent(); + printer->Print( + " }\n" + "}\n" + "\n"); +} + +void MessageGenerator:: +GenerateStructors(io::Printer* printer) { + string superclass = SuperClassName(descriptor_); + + // Generate the default constructor. + printer->Print( + "$classname$::$classname$()\n" + " : $superclass$() {\n" + " SharedCtor();\n" + "}\n", + "classname", classname_, + "superclass", superclass); + + printer->Print( + "\n" + "void $classname$::InitAsDefaultInstance() {\n", + "classname", classname_); + + // 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 (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (!field->is_repeated() && + field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + printer->Print( + " $name$_ = const_cast< $type$*>(&$type$::default_instance());\n", + "name", FieldName(field), + "type", FieldMessageTypeName(field)); + } + } + printer->Print( + "}\n" + "\n"); + + // Generate the copy constructor. + printer->Print( + "$classname$::$classname$(const $classname$& from)\n" + " : $superclass$() {\n" + " SharedCtor();\n" + " MergeFrom(from);\n" + "}\n" + "\n", + "classname", classname_, + "superclass", superclass); + + // Generate the shared constructor code. + GenerateSharedConstructorCode(printer); + + // Generate the destructor. + printer->Print( + "$classname$::~$classname$() {\n" + " SharedDtor();\n" + "}\n" + "\n", + "classname", classname_); + + // Generate the shared destructor code. + GenerateSharedDestructorCode(printer); + + // Generate SetCachedSize. + printer->Print( + "void $classname$::SetCachedSize(int size) const {\n" + " GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" + " _cached_size_ = size;\n" + " GOOGLE_SAFE_CONCURRENT_WRITES_END();\n" + "}\n", + "classname", classname_); + + // Only generate this member if it's not disabled. + if (HasDescriptorMethods(descriptor_->file()) && + !descriptor_->options().no_standard_descriptor_accessor()) { + printer->Print( + "const ::google::protobuf::Descriptor* $classname$::descriptor() {\n" + " protobuf_AssignDescriptorsOnce();\n" + " return $classname$_descriptor_;\n" + "}\n" + "\n", + "classname", classname_, + "adddescriptorsname", + GlobalAddDescriptorsName(descriptor_->file()->name())); + } + + printer->Print( + "const $classname$& $classname$::default_instance() {\n" + " if (default_instance_ == NULL) $adddescriptorsname$();" + " return *default_instance_;\n" + "}\n" + "\n" + "$classname$* $classname$::default_instance_ = NULL;\n" + "\n" + "$classname$* $classname$::New() const {\n" + " return new $classname$;\n" + "}\n", + "classname", classname_, + "adddescriptorsname", + GlobalAddDescriptorsName(descriptor_->file()->name())); + +} + +void MessageGenerator:: +GenerateClear(io::Printer* printer) { + printer->Print("void $classname$::Clear() {\n", + "classname", classname_); + printer->Indent(); + + int last_index = -1; + + if (descriptor_->extension_range_count() > 0) { + printer->Print("_extensions_.Clear();\n"); + } + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (!field->is_repeated()) { + // We can use the fact that _has_bits_ is a giant bitfield to our + // advantage: We can check up to 32 bits at a time for equality to + // zero, and skip the whole range if so. This can improve the speed + // of Clear() for messages which contain a very large number of + // optional fields of which only a few are used at a time. Here, + // we've chosen to check 8 bits at a time rather than 32. + if (i / 8 != last_index / 8 || last_index < 0) { + if (last_index >= 0) { + printer->Outdent(); + printer->Print("}\n"); + } + printer->Print( + "if (_has_bits_[$index$ / 32] & (0xffu << ($index$ % 32))) {\n", + "index", SimpleItoa(field->index())); + printer->Indent(); + } + last_index = i; + + // 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; + + if (should_check_bit) { + printer->Print( + "if (has_$name$()) {\n", + "name", FieldName(field)); + printer->Indent(); + } + + field_generators_.get(field).GenerateClearingCode(printer); + + if (should_check_bit) { + printer->Outdent(); + printer->Print("}\n"); + } + } + } + + if (last_index >= 0) { + printer->Outdent(); + printer->Print("}\n"); + } + + // Repeated fields don't use _has_bits_ so we clear them in a separate + // pass. + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (field->is_repeated()) { + field_generators_.get(field).GenerateClearingCode(printer); + } + } + + printer->Print( + "::memset(_has_bits_, 0, sizeof(_has_bits_));\n"); + + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + "mutable_unknown_fields()->Clear();\n"); + } + + printer->Outdent(); + printer->Print("}\n"); +} + +void MessageGenerator:: +GenerateSwap(io::Printer* printer) { + // Generate the Swap member function. + printer->Print("void $classname$::Swap($classname$* other) {\n", + "classname", classname_); + printer->Indent(); + printer->Print("if (other != this) {\n"); + printer->Indent(); + + if (HasGeneratedMethods(descriptor_->file())) { + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + field_generators_.get(field).GenerateSwappingCode(printer); + } + + for (int i = 0; i < (descriptor_->field_count() + 31) / 32; ++i) { + printer->Print("std::swap(_has_bits_[$i$], other->_has_bits_[$i$]);\n", + "i", SimpleItoa(i)); + } + + if (HasUnknownFields(descriptor_->file())) { + printer->Print("_unknown_fields_.Swap(&other->_unknown_fields_);\n"); + } + printer->Print("std::swap(_cached_size_, other->_cached_size_);\n"); + if (descriptor_->extension_range_count() > 0) { + printer->Print("_extensions_.Swap(&other->_extensions_);\n"); + } + } else { + printer->Print("GetReflection()->Swap(this, other);"); + } + + printer->Outdent(); + printer->Print("}\n"); + printer->Outdent(); + printer->Print("}\n"); +} + +void MessageGenerator:: +GenerateMergeFrom(io::Printer* printer) { + if (HasDescriptorMethods(descriptor_->file())) { + // Generate the generalized MergeFrom (aka that which takes in the Message + // base class as a parameter). + printer->Print( + "void $classname$::MergeFrom(const ::google::protobuf::Message& from) {\n" + " GOOGLE_CHECK_NE(&from, this);\n", + "classname", classname_); + printer->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. + printer->Print( + "const $classname$* source =\n" + " ::google::protobuf::internal::dynamic_cast_if_available(\n" + " &from);\n" + "if (source == NULL) {\n" + " ::google::protobuf::internal::ReflectionOps::Merge(from, this);\n" + "} else {\n" + " MergeFrom(*source);\n" + "}\n", + "classname", classname_); + + printer->Outdent(); + printer->Print("}\n\n"); + } else { + // Generate CheckTypeAndMergeFrom(). + printer->Print( + "void $classname$::CheckTypeAndMergeFrom(\n" + " const ::google::protobuf::MessageLite& from) {\n" + " MergeFrom(*::google::protobuf::down_cast(&from));\n" + "}\n" + "\n", + "classname", classname_); + } + + // Generate the class-specific MergeFrom, which avoids the GOOGLE_CHECK and cast. + printer->Print( + "void $classname$::MergeFrom(const $classname$& from) {\n" + " GOOGLE_CHECK_NE(&from, this);\n", + "classname", classname_); + printer->Indent(); + + // Merge Repeated fields. These fields do not require a + // check as we can simply iterate over them. + for (int i = 0; i < descriptor_->field_count(); ++i) { + const FieldDescriptor* field = descriptor_->field(i); + + if (field->is_repeated()) { + field_generators_.get(field).GenerateMergingCode(printer); + } + } + + // Merge Optional and Required fields (after a _has_bit check). + int last_index = -1; + + for (int i = 0; i < descriptor_->field_count(); ++i) { + const FieldDescriptor* field = descriptor_->field(i); + + if (!field->is_repeated()) { + // See above in GenerateClear for an explanation of this. + if (i / 8 != last_index / 8 || last_index < 0) { + if (last_index >= 0) { + printer->Outdent(); + printer->Print("}\n"); + } + printer->Print( + "if (from._has_bits_[$index$ / 32] & (0xffu << ($index$ % 32))) {\n", + "index", SimpleItoa(field->index())); + printer->Indent(); + } + + last_index = i; + + printer->Print( + "if (from.has_$name$()) {\n", + "name", FieldName(field)); + printer->Indent(); + + field_generators_.get(field).GenerateMergingCode(printer); + + printer->Outdent(); + printer->Print("}\n"); + } + } + + if (last_index >= 0) { + printer->Outdent(); + printer->Print("}\n"); + } + + if (descriptor_->extension_range_count() > 0) { + printer->Print("_extensions_.MergeFrom(from._extensions_);\n"); + } + + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + "mutable_unknown_fields()->MergeFrom(from.unknown_fields());\n"); + } + + printer->Outdent(); + printer->Print("}\n"); +} + +void MessageGenerator:: +GenerateCopyFrom(io::Printer* printer) { + if (HasDescriptorMethods(descriptor_->file())) { + // Generate the generalized CopyFrom (aka that which takes in the Message + // base class as a parameter). + printer->Print( + "void $classname$::CopyFrom(const ::google::protobuf::Message& from) {\n", + "classname", classname_); + printer->Indent(); + + printer->Print( + "if (&from == this) return;\n" + "Clear();\n" + "MergeFrom(from);\n"); + + printer->Outdent(); + printer->Print("}\n\n"); + } + + // Generate the class-specific CopyFrom. + printer->Print( + "void $classname$::CopyFrom(const $classname$& from) {\n", + "classname", classname_); + printer->Indent(); + + printer->Print( + "if (&from == this) return;\n" + "Clear();\n" + "MergeFrom(from);\n"); + + printer->Outdent(); + printer->Print("}\n"); +} + +void MessageGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) { + if (descriptor_->options().message_set_wire_format()) { + // Special-case MessageSet. + printer->Print( + "bool $classname$::MergePartialFromCodedStream(\n" + " ::google::protobuf::io::CodedInputStream* input) {\n" + " return _extensions_.ParseMessageSet(input, default_instance_,\n" + " mutable_unknown_fields());\n" + "}\n", + "classname", classname_); + return; + } + + printer->Print( + "bool $classname$::MergePartialFromCodedStream(\n" + " ::google::protobuf::io::CodedInputStream* input) {\n" + "#define DO_(EXPRESSION) if (!(EXPRESSION)) return false\n" + " ::google::protobuf::uint32 tag;\n" + " while ((tag = input->ReadTag()) != 0) {\n", + "classname", classname_); + + printer->Indent(); + printer->Indent(); + + if (descriptor_->field_count() > 0) { + // We don't even want to print the switch() if we have no fields because + // MSVC dislikes switch() statements that contain only a default value. + + // Note: If we just switched on the tag rather than the field number, we + // could avoid the need for the if() to check the wire type at the beginning + // of each case. However, this is actually a bit slower in practice as it + // creates a jump table that is 8x larger and sparser, and meanwhile the + // if()s are highly predictable. + printer->Print( + "switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {\n"); + + printer->Indent(); + + scoped_array ordered_fields( + SortFieldsByNumber(descriptor_)); + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = ordered_fields[i]; + + PrintFieldComment(printer, field); + + printer->Print( + "case $number$: {\n", + "number", SimpleItoa(field->number())); + printer->Indent(); + const FieldGenerator& field_generator = field_generators_.get(field); + + // Emit code to parse the common, expected case. + printer->Print( + "if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==\n" + " ::google::protobuf::internal::WireFormatLite::WIRETYPE_$wiretype$) {\n", + "wiretype", kWireTypeNames[WireFormat::WireTypeForField(field)]); + + if (i > 0 || (field->is_repeated() && !field->options().packed())) { + printer->Print( + " parse_$name$:\n", + "name", field->name()); + } + + printer->Indent(); + if (field->options().packed()) { + field_generator.GenerateMergeFromCodedStreamWithPacking(printer); + } else { + field_generator.GenerateMergeFromCodedStream(printer); + } + printer->Outdent(); + + // Emit code to parse unexpectedly packed or unpacked values. + if (field->is_packable() && field->options().packed()) { + printer->Print( + "} else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)\n" + " == ::google::protobuf::internal::WireFormatLite::\n" + " WIRETYPE_$wiretype$) {\n", + "wiretype", + kWireTypeNames[WireFormat::WireTypeForFieldType(field->type())]); + printer->Indent(); + field_generator.GenerateMergeFromCodedStream(printer); + printer->Outdent(); + } else if (field->is_packable() && !field->options().packed()) { + printer->Print( + "} else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)\n" + " == ::google::protobuf::internal::WireFormatLite::\n" + " WIRETYPE_LENGTH_DELIMITED) {\n"); + printer->Indent(); + field_generator.GenerateMergeFromCodedStreamWithPacking(printer); + printer->Outdent(); + } + + printer->Print( + "} else {\n" + " goto handle_uninterpreted;\n" + "}\n"); + + // switch() is slow since it can't be predicted well. Insert some if()s + // here that attempt to predict the next tag. + if (field->is_repeated() && !field->options().packed()) { + // Expect repeats of this field. + printer->Print( + "if (input->ExpectTag($tag$)) goto parse_$name$;\n", + "tag", SimpleItoa(WireFormat::MakeTag(field)), + "name", field->name()); + } + + if (i + 1 < descriptor_->field_count()) { + // Expect the next field in order. + const FieldDescriptor* next_field = ordered_fields[i + 1]; + printer->Print( + "if (input->ExpectTag($next_tag$)) goto parse_$next_name$;\n", + "next_tag", SimpleItoa(WireFormat::MakeTag(next_field)), + "next_name", next_field->name()); + } else { + // Expect EOF. + // TODO(kenton): Expect group end-tag? + printer->Print( + "if (input->ExpectAtEnd()) return true;\n"); + } + + printer->Print( + "break;\n"); + + printer->Outdent(); + printer->Print("}\n\n"); + } + + printer->Print( + "default: {\n" + "handle_uninterpreted:\n"); + printer->Indent(); + } + + // Is this an end-group tag? If so, this must be the end of the message. + printer->Print( + "if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==\n" + " ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {\n" + " return true;\n" + "}\n"); + + // Handle extension ranges. + if (descriptor_->extension_range_count() > 0) { + printer->Print( + "if ("); + for (int i = 0; i < descriptor_->extension_range_count(); i++) { + const Descriptor::ExtensionRange* range = + descriptor_->extension_range(i); + if (i > 0) printer->Print(" ||\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) { + printer->Print( + "($start$u <= tag)", + "start", SimpleItoa(start_tag)); + } else { + printer->Print( + "($start$u <= tag && tag < $end$u)", + "start", SimpleItoa(start_tag), + "end", SimpleItoa(end_tag)); + } + } + printer->Print(") {\n"); + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + " DO_(_extensions_.ParseField(tag, input, default_instance_,\n" + " mutable_unknown_fields()));\n"); + } else { + printer->Print( + " DO_(_extensions_.ParseField(tag, input, default_instance_));\n"); + } + printer->Print( + " continue;\n" + "}\n"); + } + + // We really don't recognize this tag. Skip it. + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + "DO_(::google::protobuf::internal::WireFormat::SkipField(\n" + " input, tag, mutable_unknown_fields()));\n"); + } else { + printer->Print( + "DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));\n"); + } + + if (descriptor_->field_count() > 0) { + printer->Print("break;\n"); + printer->Outdent(); + printer->Print("}\n"); // default: + printer->Outdent(); + printer->Print("}\n"); // switch + } + + printer->Outdent(); + printer->Outdent(); + printer->Print( + " }\n" // while + " return true;\n" + "#undef DO_\n" + "}\n"); +} + +void MessageGenerator::GenerateSerializeOneField( + io::Printer* printer, const FieldDescriptor* field, bool to_array) { + PrintFieldComment(printer, field); + + if (!field->is_repeated()) { + printer->Print( + "if (has_$name$()) {\n", + "name", FieldName(field)); + printer->Indent(); + } + + if (to_array) { + field_generators_.get(field).GenerateSerializeWithCachedSizesToArray( + printer); + } else { + field_generators_.get(field).GenerateSerializeWithCachedSizes(printer); + } + + if (!field->is_repeated()) { + printer->Outdent(); + printer->Print("}\n"); + } + printer->Print("\n"); +} + +void MessageGenerator::GenerateSerializeOneExtensionRange( + io::Printer* printer, const Descriptor::ExtensionRange* range, + bool to_array) { + map vars; + vars["start"] = SimpleItoa(range->start); + vars["end"] = SimpleItoa(range->end); + printer->Print(vars, + "// Extension range [$start$, $end$)\n"); + if (to_array) { + printer->Print(vars, + "target = _extensions_.SerializeWithCachedSizesToArray(\n" + " $start$, $end$, target);\n\n"); + } else { + printer->Print(vars, + "_extensions_.SerializeWithCachedSizes(\n" + " $start$, $end$, output);\n\n"); + } +} + +void MessageGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) { + if (descriptor_->options().message_set_wire_format()) { + // Special-case MessageSet. + printer->Print( + "void $classname$::SerializeWithCachedSizes(\n" + " ::google::protobuf::io::CodedOutputStream* output) const {\n" + " _extensions_.SerializeMessageSetWithCachedSizes(output);\n", + "classname", classname_); + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + " ::google::protobuf::internal::WireFormat::SerializeUnknownMessageSetItems(\n" + " unknown_fields(), output);\n"); + } + printer->Print( + "}\n"); + return; + } + + printer->Print( + "void $classname$::SerializeWithCachedSizes(\n" + " ::google::protobuf::io::CodedOutputStream* output) const {\n", + "classname", classname_); + printer->Indent(); + + GenerateSerializeWithCachedSizesBody(printer, false); + + printer->Outdent(); + printer->Print( + "}\n"); +} + +void MessageGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) { + if (descriptor_->options().message_set_wire_format()) { + // Special-case MessageSet. + printer->Print( + "::google::protobuf::uint8* $classname$::SerializeWithCachedSizesToArray(\n" + " ::google::protobuf::uint8* target) const {\n" + " target =\n" + " _extensions_.SerializeMessageSetWithCachedSizesToArray(target);\n", + "classname", classname_); + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + " target = ::google::protobuf::internal::WireFormat::\n" + " SerializeUnknownMessageSetItemsToArray(\n" + " unknown_fields(), target);\n"); + } + printer->Print( + " return target;\n" + "}\n"); + return; + } + + printer->Print( + "::google::protobuf::uint8* $classname$::SerializeWithCachedSizesToArray(\n" + " ::google::protobuf::uint8* target) const {\n", + "classname", classname_); + printer->Indent(); + + GenerateSerializeWithCachedSizesBody(printer, true); + + printer->Outdent(); + printer->Print( + " return target;\n" + "}\n"); +} + +void MessageGenerator:: +GenerateSerializeWithCachedSizesBody(io::Printer* printer, bool to_array) { + scoped_array ordered_fields( + SortFieldsByNumber(descriptor_)); + + vector sorted_extensions; + for (int i = 0; i < descriptor_->extension_range_count(); ++i) { + sorted_extensions.push_back(descriptor_->extension_range(i)); + } + sort(sorted_extensions.begin(), sorted_extensions.end(), + ExtensionRangeSorter()); + + // Merge the fields and the extension ranges, both sorted by field number. + int i, j; + for (i = 0, j = 0; + i < descriptor_->field_count() || j < sorted_extensions.size(); + ) { + if (i == descriptor_->field_count()) { + GenerateSerializeOneExtensionRange(printer, + sorted_extensions[j++], + to_array); + } else if (j == sorted_extensions.size()) { + GenerateSerializeOneField(printer, ordered_fields[i++], to_array); + } else if (ordered_fields[i]->number() < sorted_extensions[j]->start) { + GenerateSerializeOneField(printer, ordered_fields[i++], to_array); + } else { + GenerateSerializeOneExtensionRange(printer, + sorted_extensions[j++], + to_array); + } + } + + if (HasUnknownFields(descriptor_->file())) { + printer->Print("if (!unknown_fields().empty()) {\n"); + printer->Indent(); + if (to_array) { + printer->Print( + "target = " + "::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(\n" + " unknown_fields(), target);\n"); + } else { + printer->Print( + "::google::protobuf::internal::WireFormat::SerializeUnknownFields(\n" + " unknown_fields(), output);\n"); + } + printer->Outdent(); + + printer->Print( + "}\n"); + } +} + +void MessageGenerator:: +GenerateByteSize(io::Printer* printer) { + if (descriptor_->options().message_set_wire_format()) { + // Special-case MessageSet. + printer->Print( + "int $classname$::ByteSize() const {\n" + " int total_size = _extensions_.MessageSetByteSize();\n", + "classname", classname_); + if (HasUnknownFields(descriptor_->file())) { + printer->Print( + " total_size += ::google::protobuf::internal::WireFormat::\n" + " ComputeUnknownMessageSetItemsSize(unknown_fields());\n"); + } + printer->Print( + " GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" + " _cached_size_ = total_size;\n" + " GOOGLE_SAFE_CONCURRENT_WRITES_END();\n" + " return total_size;\n" + "}\n"); + return; + } + + printer->Print( + "int $classname$::ByteSize() const {\n", + "classname", classname_); + printer->Indent(); + printer->Print( + "int total_size = 0;\n" + "\n"); + + int last_index = -1; + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (!field->is_repeated()) { + // See above in GenerateClear for an explanation of this. + // TODO(kenton): Share code? Unclear how to do so without + // over-engineering. + if ((i / 8) != (last_index / 8) || + last_index < 0) { + if (last_index >= 0) { + printer->Outdent(); + printer->Print("}\n"); + } + printer->Print( + "if (_has_bits_[$index$ / 32] & (0xffu << ($index$ % 32))) {\n", + "index", SimpleItoa(field->index())); + printer->Indent(); + } + last_index = i; + + PrintFieldComment(printer, field); + + printer->Print( + "if (has_$name$()) {\n", + "name", FieldName(field)); + printer->Indent(); + + field_generators_.get(field).GenerateByteSize(printer); + + printer->Outdent(); + printer->Print( + "}\n" + "\n"); + } + } + + if (last_index >= 0) { + printer->Outdent(); + printer->Print("}\n"); + } + + // Repeated fields don't use _has_bits_ so we count them in a separate + // pass. + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (field->is_repeated()) { + PrintFieldComment(printer, field); + field_generators_.get(field).GenerateByteSize(printer); + printer->Print("\n"); + } + } + + if (descriptor_->extension_range_count() > 0) { + printer->Print( + "total_size += _extensions_.ByteSize();\n" + "\n"); + } + + if (HasUnknownFields(descriptor_->file())) { + printer->Print("if (!unknown_fields().empty()) {\n"); + printer->Indent(); + printer->Print( + "total_size +=\n" + " ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(\n" + " unknown_fields());\n"); + printer->Outdent(); + printer->Print("}\n"); + } + + // We update _cached_size_ even though this is a const method. In theory, + // this is not thread-compatible, because concurrent writes have undefined + // results. In practice, since any concurrent writes will be writing the + // exact same value, it works on all common processors. In a future version + // of C++, _cached_size_ should be made into an atomic. + printer->Print( + "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" + "_cached_size_ = total_size;\n" + "GOOGLE_SAFE_CONCURRENT_WRITES_END();\n" + "return total_size;\n"); + + printer->Outdent(); + printer->Print("}\n"); +} + +void MessageGenerator:: +GenerateIsInitialized(io::Printer* printer) { + printer->Print( + "bool $classname$::IsInitialized() const {\n", + "classname", classname_); + printer->Indent(); + + // Check that all required fields in this message are set. We can do this + // most efficiently by checking 32 "has bits" at a time. + int has_bits_array_size = (descriptor_->field_count() + 31) / 32; + for (int i = 0; i < has_bits_array_size; i++) { + uint32 mask = 0; + for (int bit = 0; bit < 32; bit++) { + int index = i * 32 + bit; + if (index >= descriptor_->field_count()) break; + const FieldDescriptor* field = descriptor_->field(index); + + if (field->is_required()) { + mask |= 1 << bit; + } + } + + if (mask != 0) { + char buffer[kFastToBufferSize]; + printer->Print( + "if ((_has_bits_[$i$] & 0x$mask$) != 0x$mask$) return false;\n", + "i", SimpleItoa(i), + "mask", FastHex32ToBuffer(mask, buffer)); + } + } + + // Now check that all embedded messages are initialized. + printer->Print("\n"); + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + HasRequiredFields(field->message_type())) { + if (field->is_repeated()) { + printer->Print( + "for (int i = 0; i < $name$_size(); i++) {\n" + " if (!this->$name$(i).IsInitialized()) return false;\n" + "}\n", + "name", FieldName(field)); + } else { + printer->Print( + "if (has_$name$()) {\n" + " if (!this->$name$().IsInitialized()) return false;\n" + "}\n", + "name", FieldName(field)); + } + } + } + + if (descriptor_->extension_range_count() > 0) { + printer->Print( + "\n" + "if (!_extensions_.IsInitialized()) return false;"); + } + + printer->Outdent(); + printer->Print( + " return true;\n" + "}\n"); +} + + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_message.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message.h new file mode 100644 index 000000000..04778f6d1 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message.h @@ -0,0 +1,170 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { + namespace io { + class Printer; // printer.h + } +} + +namespace protobuf { +namespace compiler { +namespace cpp { + +class EnumGenerator; // enum.h +class ExtensionGenerator; // extension.h + +class MessageGenerator { + public: + // See generator.cc for the meaning of dllexport_decl. + explicit MessageGenerator(const Descriptor* descriptor, + const string& dllexport_decl); + ~MessageGenerator(); + + // Header stuff. + + // Generate foward declarations for this class and all its nested types. + void GenerateForwardDeclaration(io::Printer* printer); + + // Generate definitions of all nested enums (must come before class + // definitions because those classes use the enums definitions). + void GenerateEnumDefinitions(io::Printer* printer); + + // Generate specializations of GetEnumDescriptor(). + // Precondition: in ::google::protobuf namespace. + void GenerateGetEnumDescriptorSpecializations(io::Printer* printer); + + // Generate definitions for this class and all its nested types. + void GenerateClassDefinition(io::Printer* printer); + + // Generate definitions of inline methods (placed at the end of the header + // file). + void GenerateInlineMethods(io::Printer* printer); + + // Source file stuff. + + // Generate code which declares all the global descriptor pointers which + // will be initialized by the methods below. + void GenerateDescriptorDeclarations(io::Printer* printer); + + // Generate code that initializes the global variable storing the message's + // descriptor. + void GenerateDescriptorInitializer(io::Printer* printer, int index); + + // Generate code that calls MessageFactory::InternalRegisterGeneratedMessage() + // for all types. + void GenerateTypeRegistrations(io::Printer* printer); + + // Generates code that allocates the message's default instance. + void GenerateDefaultInstanceAllocator(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); + + // Generates code that should be run when ShutdownProtobufLibrary() is called, + // to delete all dynamically-allocated objects. + void GenerateShutdownCode(io::Printer* printer); + + // Generate all non-inline methods for this class. + void GenerateClassMethods(io::Printer* printer); + + private: + // Generate declarations and definitions of accessors for fields. + void GenerateFieldAccessorDeclarations(io::Printer* printer); + void GenerateFieldAccessorDefinitions(io::Printer* printer); + + // Generate the field offsets array. + void GenerateOffsets(io::Printer* printer); + + // Generate constructors and destructor. + void GenerateStructors(io::Printer* printer); + + // The compiler typically generates multiple copies of each constructor and + // destructor: http://gcc.gnu.org/bugs.html#nonbugs_cxx + // Placing common code in a separate method reduces the generated code size. + // + // Generate the shared constructor code. + void GenerateSharedConstructorCode(io::Printer* printer); + // Generate the shared destructor code. + void GenerateSharedDestructorCode(io::Printer* printer); + + // Generate standard Message methods. + void GenerateClear(io::Printer* printer); + void GenerateMergeFromCodedStream(io::Printer* printer); + void GenerateSerializeWithCachedSizes(io::Printer* printer); + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer); + void GenerateSerializeWithCachedSizesBody(io::Printer* printer, + bool to_array); + void GenerateByteSize(io::Printer* printer); + void GenerateMergeFrom(io::Printer* printer); + void GenerateCopyFrom(io::Printer* printer); + void GenerateSwap(io::Printer* printer); + void GenerateIsInitialized(io::Printer* printer); + + // Helpers for GenerateSerializeWithCachedSizes(). + void GenerateSerializeOneField(io::Printer* printer, + const FieldDescriptor* field, + bool unbounded); + void GenerateSerializeOneExtensionRange( + io::Printer* printer, const Descriptor::ExtensionRange* range, + bool unbounded); + + + const Descriptor* descriptor_; + string classname_; + string dllexport_decl_; + FieldGeneratorMap field_generators_; + scoped_array > nested_generators_; + scoped_array > enum_generators_; + scoped_array > extension_generators_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_message_field.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message_field.cc new file mode 100644 index 000000000..23e75b87d --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -0,0 +1,277 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +namespace { + +void SetMessageVariables(const FieldDescriptor* descriptor, + map* variables) { + SetCommonFieldVariables(descriptor, variables); + (*variables)["type"] = FieldMessageTypeName(descriptor); + (*variables)["stream_writer"] = (*variables)["declared_type"] + + (HasFastArraySerialization(descriptor->message_type()->file()) ? + "MaybeToArray" : + ""); +} + +} // namespace + +// =================================================================== + +MessageFieldGenerator:: +MessageFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetMessageVariables(descriptor, &variables_); +} + +MessageFieldGenerator::~MessageFieldGenerator() {} + +void MessageFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, "$type$* $name$_;\n"); +} + +void MessageFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + printer->Print(variables_, + "inline const $type$& $name$() const$deprecation$;\n" + "inline $type$* mutable_$name$()$deprecation$;\n" + "inline $type$* release_$name$()$deprecation$;\n"); +} + +void MessageFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline const $type$& $classname$::$name$() const {\n" + " return $name$_ != NULL ? *$name$_ : *default_instance_->$name$_;\n" + "}\n" + "inline $type$* $classname$::mutable_$name$() {\n" + " set_has_$name$();\n" + " if ($name$_ == NULL) $name$_ = new $type$;\n" + " return $name$_;\n" + "}\n" + "inline $type$* $classname$::release_$name$() {\n" + " clear_has_$name$();\n" + " $type$* temp = $name$_;\n" + " $name$_ = NULL;\n" + " return temp;\n" + "}\n"); +} + +void MessageFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, + "if ($name$_ != NULL) $name$_->$type$::Clear();\n"); +} + +void MessageFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, + "mutable_$name$()->$type$::MergeFrom(from.$name$());\n"); +} + +void MessageFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "std::swap($name$_, other->$name$_);\n"); +} + +void MessageFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_ = NULL;\n"); +} + +void MessageFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(\n" + " input, mutable_$name$()));\n"); + } else { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::ReadGroupNoVirtual(\n" + " $number$, input, mutable_$name$()));\n"); + } +} + +void MessageFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n" + " $number$, this->$name$(), output);\n"); +} + +void MessageFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + printer->Print(variables_, + "target = ::google::protobuf::internal::WireFormatLite::\n" + " Write$declared_type$NoVirtualToArray(\n" + " $number$, this->$name$(), target);\n"); +} + +void MessageFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "total_size += $tag_size$ +\n" + " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n" + " this->$name$());\n"); +} + +// =================================================================== + +RepeatedMessageFieldGenerator:: +RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetMessageVariables(descriptor, &variables_); +} + +RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} + +void RepeatedMessageFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::RepeatedPtrField< $type$ > $name$_;\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + printer->Print(variables_, + "inline const $type$& $name$(int index) const$deprecation$;\n" + "inline $type$* mutable_$name$(int index)$deprecation$;\n" + "inline $type$* add_$name$()$deprecation$;\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n" + " $name$() const$deprecation$;\n" + "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n" + " mutable_$name$()$deprecation$;\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline const $type$& $classname$::$name$(int index) const {\n" + " return $name$_.Get(index);\n" + "}\n" + "inline $type$* $classname$::mutable_$name$(int index) {\n" + " return $name$_.Mutable(index);\n" + "}\n" + "inline $type$* $classname$::add_$name$() {\n" + " return $name$_.Add();\n" + "}\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n" + "$classname$::$name$() const {\n" + " return $name$_;\n" + "}\n" + "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n" + "$classname$::mutable_$name$() {\n" + " return &$name$_;\n" + "}\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Clear();\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Swap(&other->$name$_);\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + // Not needed for repeated fields. +} + +void RepeatedMessageFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(\n" + " input, add_$name$()));\n"); + } else { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::ReadGroupNoVirtual(\n" + " $number$, input, add_$name$()));\n"); + } +} + +void RepeatedMessageFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n" + " ::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n" + " $number$, this->$name$(i), output);\n" + "}\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n" + " target = ::google::protobuf::internal::WireFormatLite::\n" + " Write$declared_type$NoVirtualToArray(\n" + " $number$, this->$name$(i), target);\n" + "}\n"); +} + +void RepeatedMessageFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "total_size += $tag_size$ * this->$name$_size();\n" + "for (int i = 0; i < this->$name$_size(); i++) {\n" + " total_size +=\n" + " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n" + " this->$name$(i));\n" + "}\n"); +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_message_field.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message_field.h new file mode 100644 index 000000000..f5147278b --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_message_field.h @@ -0,0 +1,102 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +class MessageFieldGenerator : public FieldGenerator { + public: + explicit MessageFieldGenerator(const FieldDescriptor* descriptor); + ~MessageFieldGenerator(); + + // 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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); +}; + +class RepeatedMessageFieldGenerator : public FieldGenerator { + public: + explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor); + ~RepeatedMessageFieldGenerator(); + + // 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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_primitive_field.cc new file mode 100644 index 000000000..5e8df0f49 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -0,0 +1,382 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 { + +using internal::WireFormatLite; + +namespace { + +// For encodings with fixed sizes, returns that size in bytes. Otherwise +// returns -1. +int FixedSize(FieldDescriptor::Type type) { + switch (type) { + case FieldDescriptor::TYPE_INT32 : return -1; + case FieldDescriptor::TYPE_INT64 : return -1; + case FieldDescriptor::TYPE_UINT32 : return -1; + case FieldDescriptor::TYPE_UINT64 : return -1; + case FieldDescriptor::TYPE_SINT32 : return -1; + case FieldDescriptor::TYPE_SINT64 : return -1; + case FieldDescriptor::TYPE_FIXED32 : return WireFormatLite::kFixed32Size; + case FieldDescriptor::TYPE_FIXED64 : return WireFormatLite::kFixed64Size; + case FieldDescriptor::TYPE_SFIXED32: return WireFormatLite::kSFixed32Size; + case FieldDescriptor::TYPE_SFIXED64: return WireFormatLite::kSFixed64Size; + case FieldDescriptor::TYPE_FLOAT : return WireFormatLite::kFloatSize; + case FieldDescriptor::TYPE_DOUBLE : return WireFormatLite::kDoubleSize; + + case FieldDescriptor::TYPE_BOOL : return WireFormatLite::kBoolSize; + case FieldDescriptor::TYPE_ENUM : return -1; + + case FieldDescriptor::TYPE_STRING : return -1; + case FieldDescriptor::TYPE_BYTES : return -1; + case FieldDescriptor::TYPE_GROUP : return -1; + case FieldDescriptor::TYPE_MESSAGE : return -1; + + // No default because we want the compiler to complain if any new + // types are added. + } + GOOGLE_LOG(FATAL) << "Can't get here."; + return -1; +} + +void SetPrimitiveVariables(const FieldDescriptor* descriptor, + map* variables) { + SetCommonFieldVariables(descriptor, variables); + (*variables)["type"] = PrimitiveTypeName(descriptor->cpp_type()); + (*variables)["default"] = DefaultValue(descriptor); + (*variables)["tag"] = SimpleItoa(internal::WireFormat::MakeTag(descriptor)); + int fixed_size = FixedSize(descriptor->type()); + if (fixed_size != -1) { + (*variables)["fixed_size"] = SimpleItoa(fixed_size); + } + (*variables)["wire_format_field_type"] = + "::google::protobuf::internal::WireFormatLite::" + FieldDescriptorProto_Type_Name( + static_cast(descriptor->type())); +} + +} // namespace + +// =================================================================== + +PrimitiveFieldGenerator:: +PrimitiveFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetPrimitiveVariables(descriptor, &variables_); +} + +PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {} + +void PrimitiveFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, "$type$ $name$_;\n"); +} + +void PrimitiveFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $name$() const$deprecation$;\n" + "inline void set_$name$($type$ value)$deprecation$;\n"); +} + +void PrimitiveFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$() const {\n" + " return $name$_;\n" + "}\n" + "inline void $classname$::set_$name$($type$ value) {\n" + " set_has_$name$();\n" + " $name$_ = value;\n" + "}\n"); +} + +void PrimitiveFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_ = $default$;\n"); +} + +void PrimitiveFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "set_$name$(from.$name$());\n"); +} + +void PrimitiveFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "std::swap($name$_, other->$name$_);\n"); +} + +void PrimitiveFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_ = $default$;\n"); +} + +void PrimitiveFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + printer->Print(variables_, + "DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" + " $type$, $wire_format_field_type$>(\n" + " input, &$name$_)));\n" + "set_has_$name$();\n"); +} + +void PrimitiveFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::internal::WireFormatLite::Write$declared_type$(" + "$number$, this->$name$(), output);\n"); +} + +void PrimitiveFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + printer->Print(variables_, + "target = ::google::protobuf::internal::WireFormatLite::Write$declared_type$ToArray(" + "$number$, this->$name$(), target);\n"); +} + +void PrimitiveFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + int fixed_size = FixedSize(descriptor_->type()); + if (fixed_size == -1) { + printer->Print(variables_, + "total_size += $tag_size$ +\n" + " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n" + " this->$name$());\n"); + } else { + printer->Print(variables_, + "total_size += $tag_size$ + $fixed_size$;\n"); + } +} + +// =================================================================== + +RepeatedPrimitiveFieldGenerator:: +RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetPrimitiveVariables(descriptor, &variables_); + + if (descriptor->options().packed()) { + variables_["packed_reader"] = "ReadPackedPrimitive"; + variables_["repeated_reader"] = "ReadRepeatedPrimitiveNoInline"; + } else { + variables_["packed_reader"] = "ReadPackedPrimitiveNoInline"; + variables_["repeated_reader"] = "ReadRepeatedPrimitive"; + } +} + +RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() {} + +void RepeatedPrimitiveFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::RepeatedField< $type$ > $name$_;\n"); + if (descriptor_->options().packed() && HasGeneratedMethods(descriptor_->file())) { + printer->Print(variables_, + "mutable int _$name$_cached_byte_size_;\n"); + } +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $name$(int index) const$deprecation$;\n" + "inline void set_$name$(int index, $type$ value)$deprecation$;\n" + "inline void add_$name$($type$ value)$deprecation$;\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedField< $type$ >&\n" + " $name$() const$deprecation$;\n" + "inline ::google::protobuf::RepeatedField< $type$ >*\n" + " mutable_$name$()$deprecation$;\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$(int index) const {\n" + " return $name$_.Get(index);\n" + "}\n" + "inline void $classname$::set_$name$(int index, $type$ value) {\n" + " $name$_.Set(index, value);\n" + "}\n" + "inline void $classname$::add_$name$($type$ value) {\n" + " $name$_.Add(value);\n" + "}\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedField< $type$ >&\n" + "$classname$::$name$() const {\n" + " return $name$_;\n" + "}\n" + "inline ::google::protobuf::RepeatedField< $type$ >*\n" + "$classname$::mutable_$name$() {\n" + " return &$name$_;\n" + "}\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Clear();\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Swap(&other->$name$_);\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + // Not needed for repeated fields. +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + printer->Print(variables_, + "DO_((::google::protobuf::internal::WireFormatLite::$repeated_reader$<\n" + " $type$, $wire_format_field_type$>(\n" + " $tag_size$, $tag$, input, this->mutable_$name$())));\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { + printer->Print(variables_, + "DO_((::google::protobuf::internal::WireFormatLite::$packed_reader$<\n" + " $type$, $wire_format_field_type$>(\n" + " input, this->mutable_$name$())));\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + if (descriptor_->options().packed()) { + // Write the tag and the size. + printer->Print(variables_, + "if (this->$name$_size() > 0) {\n" + " ::google::protobuf::internal::WireFormatLite::WriteTag(" + "$number$, " + "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, " + "output);\n" + " output->WriteVarint32(_$name$_cached_byte_size_);\n" + "}\n"); + } + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n"); + if (descriptor_->options().packed()) { + printer->Print(variables_, + " ::google::protobuf::internal::WireFormatLite::Write$declared_type$NoTag(\n" + " this->$name$(i), output);\n"); + } else { + printer->Print(variables_, + " ::google::protobuf::internal::WireFormatLite::Write$declared_type$(\n" + " $number$, this->$name$(i), output);\n"); + } + printer->Print("}\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + if (descriptor_->options().packed()) { + // Write the tag and the size. + printer->Print(variables_, + "if (this->$name$_size() > 0) {\n" + " target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(\n" + " $number$,\n" + " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" + " target);\n" + " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n" + " _$name$_cached_byte_size_, target);\n" + "}\n"); + } + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n"); + if (descriptor_->options().packed()) { + printer->Print(variables_, + " target = ::google::protobuf::internal::WireFormatLite::\n" + " Write$declared_type$NoTagToArray(this->$name$(i), target);\n"); + } else { + printer->Print(variables_, + " target = ::google::protobuf::internal::WireFormatLite::\n" + " Write$declared_type$ToArray($number$, this->$name$(i), target);\n"); + } + printer->Print("}\n"); +} + +void RepeatedPrimitiveFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "{\n" + " int data_size = 0;\n"); + printer->Indent(); + int fixed_size = FixedSize(descriptor_->type()); + if (fixed_size == -1) { + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n" + " data_size += ::google::protobuf::internal::WireFormatLite::\n" + " $declared_type$Size(this->$name$(i));\n" + "}\n"); + } else { + printer->Print(variables_, + "data_size = $fixed_size$ * this->$name$_size();\n"); + } + + if (descriptor_->options().packed()) { + printer->Print(variables_, + "if (data_size > 0) {\n" + " total_size += $tag_size$ +\n" + " ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n" + "}\n" + "_$name$_cached_byte_size_ = data_size;\n" + "total_size += data_size;\n"); + } else { + printer->Print(variables_, + "total_size += $tag_size$ * this->$name$_size() + data_size;\n"); + } + printer->Outdent(); + printer->Print("}\n"); +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_primitive_field.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_primitive_field.h new file mode 100644 index 000000000..8fcd74ae5 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_primitive_field.h @@ -0,0 +1,103 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +class PrimitiveFieldGenerator : public FieldGenerator { + public: + explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor); + ~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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); +}; + +class RepeatedPrimitiveFieldGenerator : public FieldGenerator { + public: + explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor); + ~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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_service.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_service.cc new file mode 100644 index 000000000..c28256835 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_service.cc @@ -0,0 +1,334 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +ServiceGenerator::ServiceGenerator(const ServiceDescriptor* descriptor, + const string& dllexport_decl) + : descriptor_(descriptor) { + vars_["classname"] = descriptor_->name(); + vars_["full_name"] = descriptor_->full_name(); + if (dllexport_decl.empty()) { + vars_["dllexport"] = ""; + } else { + vars_["dllexport"] = dllexport_decl + " "; + } +} + +ServiceGenerator::~ServiceGenerator() {} + +void ServiceGenerator::GenerateDeclarations(io::Printer* printer) { + // Forward-declare the stub type. + printer->Print(vars_, + "class $classname$_Stub;\n" + "\n"); + + GenerateInterface(printer); + GenerateStubDefinition(printer); +} + +void ServiceGenerator::GenerateInterface(io::Printer* printer) { + printer->Print(vars_, + "class $dllexport$$classname$ : public ::google::protobuf::Service {\n" + " protected:\n" + " // This class should be treated as an abstract interface.\n" + " inline $classname$() {};\n" + " public:\n" + " virtual ~$classname$();\n"); + printer->Indent(); + + printer->Print(vars_, + "\n" + "typedef $classname$_Stub Stub;\n" + "\n" + "static const ::google::protobuf::ServiceDescriptor* descriptor();\n" + "\n"); + + GenerateMethodSignatures(VIRTUAL, printer); + + printer->Print( + "\n" + "// implements Service ----------------------------------------------\n" + "\n" + "const ::google::protobuf::ServiceDescriptor* GetDescriptor();\n" + "void CallMethod(const ::google::protobuf::MethodDescriptor* method,\n" + " ::google::protobuf::RpcController* controller,\n" + " const ::google::protobuf::Message* request,\n" + " ::google::protobuf::Message* response,\n" + " ::google::protobuf::Closure* done);\n" + "const ::google::protobuf::Message& GetRequestPrototype(\n" + " const ::google::protobuf::MethodDescriptor* method) const;\n" + "const ::google::protobuf::Message& GetResponsePrototype(\n" + " const ::google::protobuf::MethodDescriptor* method) const;\n"); + + printer->Outdent(); + printer->Print(vars_, + "\n" + " private:\n" + " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($classname$);\n" + "};\n" + "\n"); +} + +void ServiceGenerator::GenerateStubDefinition(io::Printer* printer) { + printer->Print(vars_, + "class $dllexport$$classname$_Stub : public $classname$ {\n" + " public:\n"); + + printer->Indent(); + + printer->Print(vars_, + "$classname$_Stub(::google::protobuf::RpcChannel* channel);\n" + "$classname$_Stub(::google::protobuf::RpcChannel* channel,\n" + " ::google::protobuf::Service::ChannelOwnership ownership);\n" + "~$classname$_Stub();\n" + "\n" + "inline ::google::protobuf::RpcChannel* channel() { return channel_; }\n" + "\n" + "// implements $classname$ ------------------------------------------\n" + "\n"); + + GenerateMethodSignatures(NON_VIRTUAL, printer); + + printer->Outdent(); + printer->Print(vars_, + " private:\n" + " ::google::protobuf::RpcChannel* channel_;\n" + " bool owns_channel_;\n" + " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($classname$_Stub);\n" + "};\n" + "\n"); +} + +void ServiceGenerator::GenerateMethodSignatures( + VirtualOrNon virtual_or_non, io::Printer* printer) { + for (int i = 0; i < descriptor_->method_count(); i++) { + const MethodDescriptor* method = descriptor_->method(i); + map sub_vars; + sub_vars["name"] = method->name(); + sub_vars["input_type"] = ClassName(method->input_type(), true); + sub_vars["output_type"] = ClassName(method->output_type(), true); + sub_vars["virtual"] = virtual_or_non == VIRTUAL ? "virtual " : ""; + + printer->Print(sub_vars, + "$virtual$void $name$(::google::protobuf::RpcController* controller,\n" + " const $input_type$* request,\n" + " $output_type$* response,\n" + " ::google::protobuf::Closure* done);\n"); + } +} + +// =================================================================== + +void ServiceGenerator::GenerateDescriptorInitializer( + io::Printer* printer, int index) { + map vars; + vars["classname"] = descriptor_->name(); + vars["index"] = SimpleItoa(index); + + printer->Print(vars, + "$classname$_descriptor_ = file->service($index$);\n"); +} + +// =================================================================== + +void ServiceGenerator::GenerateImplementation(io::Printer* printer) { + printer->Print(vars_, + "$classname$::~$classname$() {}\n" + "\n" + "const ::google::protobuf::ServiceDescriptor* $classname$::descriptor() {\n" + " protobuf_AssignDescriptorsOnce();\n" + " return $classname$_descriptor_;\n" + "}\n" + "\n" + "const ::google::protobuf::ServiceDescriptor* $classname$::GetDescriptor() {\n" + " protobuf_AssignDescriptorsOnce();\n" + " return $classname$_descriptor_;\n" + "}\n" + "\n"); + + // Generate methods of the interface. + GenerateNotImplementedMethods(printer); + GenerateCallMethod(printer); + GenerateGetPrototype(REQUEST, printer); + GenerateGetPrototype(RESPONSE, printer); + + // Generate stub implementation. + printer->Print(vars_, + "$classname$_Stub::$classname$_Stub(::google::protobuf::RpcChannel* channel)\n" + " : channel_(channel), owns_channel_(false) {}\n" + "$classname$_Stub::$classname$_Stub(\n" + " ::google::protobuf::RpcChannel* channel,\n" + " ::google::protobuf::Service::ChannelOwnership ownership)\n" + " : channel_(channel),\n" + " owns_channel_(ownership == ::google::protobuf::Service::STUB_OWNS_CHANNEL) {}\n" + "$classname$_Stub::~$classname$_Stub() {\n" + " if (owns_channel_) delete channel_;\n" + "}\n" + "\n"); + + GenerateStubMethods(printer); +} + +void ServiceGenerator::GenerateNotImplementedMethods(io::Printer* printer) { + for (int i = 0; i < descriptor_->method_count(); i++) { + const MethodDescriptor* method = descriptor_->method(i); + map sub_vars; + sub_vars["classname"] = descriptor_->name(); + sub_vars["name"] = method->name(); + sub_vars["index"] = SimpleItoa(i); + sub_vars["input_type"] = ClassName(method->input_type(), true); + sub_vars["output_type"] = ClassName(method->output_type(), true); + + printer->Print(sub_vars, + "void $classname$::$name$(::google::protobuf::RpcController* controller,\n" + " const $input_type$*,\n" + " $output_type$*,\n" + " ::google::protobuf::Closure* done) {\n" + " controller->SetFailed(\"Method $name$() not implemented.\");\n" + " done->Run();\n" + "}\n" + "\n"); + } +} + +void ServiceGenerator::GenerateCallMethod(io::Printer* printer) { + printer->Print(vars_, + "void $classname$::CallMethod(const ::google::protobuf::MethodDescriptor* method,\n" + " ::google::protobuf::RpcController* controller,\n" + " const ::google::protobuf::Message* request,\n" + " ::google::protobuf::Message* response,\n" + " ::google::protobuf::Closure* done) {\n" + " GOOGLE_DCHECK_EQ(method->service(), $classname$_descriptor_);\n" + " switch(method->index()) {\n"); + + for (int i = 0; i < descriptor_->method_count(); i++) { + const MethodDescriptor* method = descriptor_->method(i); + map sub_vars; + sub_vars["name"] = method->name(); + sub_vars["index"] = SimpleItoa(i); + sub_vars["input_type"] = ClassName(method->input_type(), true); + sub_vars["output_type"] = ClassName(method->output_type(), true); + + // Note: down_cast does not work here because it only works on pointers, + // not references. + printer->Print(sub_vars, + " case $index$:\n" + " $name$(controller,\n" + " ::google::protobuf::down_cast(request),\n" + " ::google::protobuf::down_cast< $output_type$*>(response),\n" + " done);\n" + " break;\n"); + } + + printer->Print(vars_, + " default:\n" + " GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";\n" + " break;\n" + " }\n" + "}\n" + "\n"); +} + +void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which, + io::Printer* printer) { + if (which == REQUEST) { + printer->Print(vars_, + "const ::google::protobuf::Message& $classname$::GetRequestPrototype(\n"); + } else { + printer->Print(vars_, + "const ::google::protobuf::Message& $classname$::GetResponsePrototype(\n"); + } + + printer->Print(vars_, + " const ::google::protobuf::MethodDescriptor* method) const {\n" + " GOOGLE_DCHECK_EQ(method->service(), descriptor());\n" + " switch(method->index()) {\n"); + + for (int i = 0; i < descriptor_->method_count(); i++) { + const MethodDescriptor* method = descriptor_->method(i); + const Descriptor* type = + (which == REQUEST) ? method->input_type() : method->output_type(); + + map sub_vars; + sub_vars["index"] = SimpleItoa(i); + sub_vars["type"] = ClassName(type, true); + + printer->Print(sub_vars, + " case $index$:\n" + " return $type$::default_instance();\n"); + } + + printer->Print(vars_, + " default:\n" + " GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";\n" + " return *reinterpret_cast< ::google::protobuf::Message*>(NULL);\n" + " }\n" + "}\n" + "\n"); +} + +void ServiceGenerator::GenerateStubMethods(io::Printer* printer) { + for (int i = 0; i < descriptor_->method_count(); i++) { + const MethodDescriptor* method = descriptor_->method(i); + map sub_vars; + sub_vars["classname"] = descriptor_->name(); + sub_vars["name"] = method->name(); + sub_vars["index"] = SimpleItoa(i); + sub_vars["input_type"] = ClassName(method->input_type(), true); + sub_vars["output_type"] = ClassName(method->output_type(), true); + + printer->Print(sub_vars, + "void $classname$_Stub::$name$(::google::protobuf::RpcController* controller,\n" + " const $input_type$* request,\n" + " $output_type$* response,\n" + " ::google::protobuf::Closure* done) {\n" + " channel_->CallMethod(descriptor()->method($index$),\n" + " controller, request, response, done);\n" + "}\n"); + } +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/service.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_service.h similarity index 87% rename from depends/protobuf/src/google/protobuf/compiler/cpp/service.h rename to depends/protobuf/google/protobuf/compiler/cpp/cpp_service.h index b3bd2d7d7..10e9dd3cd 100644 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/service.h +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_service.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,19 +37,16 @@ #include #include - +#include #include -#include namespace google { namespace protobuf { -namespace io { -class Printer; // printer.h + namespace io { + class Printer; // printer.h + } } -} // namespace protobuf -} // namespace google -namespace google { namespace protobuf { namespace compiler { namespace cpp { @@ -58,8 +55,7 @@ class ServiceGenerator { public: // See generator.cc for the meaning of dllexport_decl. explicit ServiceGenerator(const ServiceDescriptor* descriptor, - const std::map& vars, - const Options& options); + const string& dllexport_decl); ~ServiceGenerator(); // Header stuff. @@ -70,8 +66,11 @@ class ServiceGenerator { // Source file stuff. - // Generate implementations of everything declared by - // GenerateDeclarations(). + // Generate code that initializes the global variable storing the service's + // descriptor. + void GenerateDescriptorInitializer(io::Printer* printer, int index); + + // Generate implementations of everything declared by GenerateDeclarations(). void GenerateImplementation(io::Printer* printer); private: @@ -106,18 +105,14 @@ class ServiceGenerator { void GenerateStubMethods(io::Printer* printer); const ServiceDescriptor* descriptor_; - std::map vars_; - const Options& options_; - - int index_in_metadata_; + map vars_; - friend class FileGenerator; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator); }; } // namespace cpp } // namespace compiler } // namespace protobuf -} // namespace google +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_CPP_SERVICE_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_string_field.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_string_field.cc new file mode 100644 index 000000000..8d611b690 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -0,0 +1,453 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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, + map* variables) { + SetCommonFieldVariables(descriptor, variables); + (*variables)["default"] = DefaultValue(descriptor); + (*variables)["default_variable"] = descriptor->default_value_string().empty() + ? "::google::protobuf::internal::kEmptyString" + : "_default_" + FieldName(descriptor) + "_"; + (*variables)["pointer_type"] = + descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char"; +} + +} // namespace + +// =================================================================== + +StringFieldGenerator:: +StringFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetStringVariables(descriptor, &variables_); +} + +StringFieldGenerator::~StringFieldGenerator() {} + +void StringFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, "::std::string* $name$_;\n"); + if (!descriptor_->default_value_string().empty()) { + printer->Print(variables_, "static const ::std::string $default_variable$;\n"); + } +} + +void StringFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + // 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. + if (descriptor_->options().ctype() != FieldOptions::STRING) { + printer->Outdent(); + printer->Print( + " private:\n" + " // Hidden due to unknown ctype option.\n"); + printer->Indent(); + } + + printer->Print(variables_, + "inline const ::std::string& $name$() const$deprecation$;\n" + "inline void set_$name$(const ::std::string& value)$deprecation$;\n" + "inline void set_$name$(const char* value)$deprecation$;\n" + "inline void set_$name$(const $pointer_type$* value, size_t size)" + "$deprecation$;\n" + "inline ::std::string* mutable_$name$()$deprecation$;\n" + "inline ::std::string* release_$name$()$deprecation$;\n"); + + if (descriptor_->options().ctype() != FieldOptions::STRING) { + printer->Outdent(); + printer->Print(" public:\n"); + printer->Indent(); + } +} + +void StringFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline const ::std::string& $classname$::$name$() const {\n" + " return *$name$_;\n" + "}\n" + "inline void $classname$::set_$name$(const ::std::string& value) {\n" + " set_has_$name$();\n" + " if ($name$_ == &$default_variable$) {\n" + " $name$_ = new ::std::string;\n" + " }\n" + " $name$_->assign(value);\n" + "}\n" + "inline void $classname$::set_$name$(const char* value) {\n" + " set_has_$name$();\n" + " if ($name$_ == &$default_variable$) {\n" + " $name$_ = new ::std::string;\n" + " }\n" + " $name$_->assign(value);\n" + "}\n" + "inline " + "void $classname$::set_$name$(const $pointer_type$* value, size_t size) {\n" + " set_has_$name$();\n" + " if ($name$_ == &$default_variable$) {\n" + " $name$_ = new ::std::string;\n" + " }\n" + " $name$_->assign(reinterpret_cast(value), size);\n" + "}\n" + "inline ::std::string* $classname$::mutable_$name$() {\n" + " set_has_$name$();\n" + " if ($name$_ == &$default_variable$) {\n"); + if (descriptor_->default_value_string().empty()) { + printer->Print(variables_, + " $name$_ = new ::std::string;\n"); + } else { + printer->Print(variables_, + " $name$_ = new ::std::string($default_variable$);\n"); + } + printer->Print(variables_, + " }\n" + " return $name$_;\n" + "}\n" + "inline ::std::string* $classname$::release_$name$() {\n" + " clear_has_$name$();\n" + " if ($name$_ == &$default_variable$) {\n" + " return NULL;\n" + " } else {\n" + " ::std::string* temp = $name$_;\n" + " $name$_ = const_cast< ::std::string*>(&$default_variable$);\n" + " return temp;\n" + " }\n" + "}\n"); +} + +void StringFieldGenerator:: +GenerateNonInlineAccessorDefinitions(io::Printer* printer) const { + if (!descriptor_->default_value_string().empty()) { + printer->Print(variables_, + "const ::std::string $classname$::$default_variable$($default$);\n"); + } +} + +void StringFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + if (descriptor_->default_value_string().empty()) { + printer->Print(variables_, + "if ($name$_ != &$default_variable$) {\n" + " $name$_->clear();\n" + "}\n"); + } else { + printer->Print(variables_, + "if ($name$_ != &$default_variable$) {\n" + " $name$_->assign($default_variable$);\n" + "}\n"); + } +} + +void StringFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "set_$name$(from.$name$());\n"); +} + +void StringFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "std::swap($name$_, other->$name$_);\n"); +} + +void StringFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + printer->Print(variables_, + "$name$_ = const_cast< ::std::string*>(&$default_variable$);\n"); +} + +void StringFieldGenerator:: +GenerateDestructorCode(io::Printer* printer) const { + printer->Print(variables_, + "if ($name$_ != &$default_variable$) {\n" + " delete $name$_;\n" + "}\n"); +} + +void StringFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::Read$declared_type$(\n" + " input, this->mutable_$name$()));\n"); + if (HasUtf8Verification(descriptor_->file()) && + descriptor_->type() == FieldDescriptor::TYPE_STRING) { + printer->Print(variables_, + "::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" + " this->$name$().data(), this->$name$().length(),\n" + " ::google::protobuf::internal::WireFormat::PARSE);\n"); + } +} + +void StringFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + if (HasUtf8Verification(descriptor_->file()) && + descriptor_->type() == FieldDescriptor::TYPE_STRING) { + printer->Print(variables_, + "::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" + " this->$name$().data(), this->$name$().length(),\n" + " ::google::protobuf::internal::WireFormat::SERIALIZE);\n"); + } + printer->Print(variables_, + "::google::protobuf::internal::WireFormatLite::Write$declared_type$(\n" + " $number$, this->$name$(), output);\n"); +} + +void StringFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + if (HasUtf8Verification(descriptor_->file()) && + descriptor_->type() == FieldDescriptor::TYPE_STRING) { + printer->Print(variables_, + "::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" + " this->$name$().data(), this->$name$().length(),\n" + " ::google::protobuf::internal::WireFormat::SERIALIZE);\n"); + } + printer->Print(variables_, + "target =\n" + " ::google::protobuf::internal::WireFormatLite::Write$declared_type$ToArray(\n" + " $number$, this->$name$(), target);\n"); +} + +void StringFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "total_size += $tag_size$ +\n" + " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n" + " this->$name$());\n"); +} + +// =================================================================== + +RepeatedStringFieldGenerator:: +RepeatedStringFieldGenerator(const FieldDescriptor* descriptor) + : descriptor_(descriptor) { + SetStringVariables(descriptor, &variables_); +} + +RepeatedStringFieldGenerator::~RepeatedStringFieldGenerator() {} + +void RepeatedStringFieldGenerator:: +GeneratePrivateMembers(io::Printer* printer) const { + printer->Print(variables_, + "::google::protobuf::RepeatedPtrField< ::std::string> $name$_;\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateAccessorDeclarations(io::Printer* printer) const { + // See comment above about unknown ctypes. + if (descriptor_->options().ctype() != FieldOptions::STRING) { + printer->Outdent(); + printer->Print( + " private:\n" + " // Hidden due to unknown ctype option.\n"); + printer->Indent(); + } + + printer->Print(variables_, + "inline const ::std::string& $name$(int index) const$deprecation$;\n" + "inline ::std::string* mutable_$name$(int index)$deprecation$;\n" + "inline void set_$name$(int index, const ::std::string& value)$deprecation$;\n" + "inline void set_$name$(int index, const char* value)$deprecation$;\n" + "inline " + "void set_$name$(int index, const $pointer_type$* value, size_t size)" + "$deprecation$;\n" + "inline ::std::string* add_$name$()$deprecation$;\n" + "inline void add_$name$(const ::std::string& value)$deprecation$;\n" + "inline void add_$name$(const char* value)$deprecation$;\n" + "inline void add_$name$(const $pointer_type$* value, size_t size)" + "$deprecation$;\n"); + + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedPtrField< ::std::string>& $name$() const" + "$deprecation$;\n" + "inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_$name$()" + "$deprecation$;\n"); + + if (descriptor_->options().ctype() != FieldOptions::STRING) { + printer->Outdent(); + printer->Print(" public:\n"); + printer->Indent(); + } +} + +void RepeatedStringFieldGenerator:: +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline const ::std::string& $classname$::$name$(int index) const {\n" + " return $name$_.Get(index);\n" + "}\n" + "inline ::std::string* $classname$::mutable_$name$(int index) {\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" + "}\n" + "inline void $classname$::set_$name$(int index, const char* value) {\n" + " $name$_.Mutable(index)->assign(value);\n" + "}\n" + "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" + "}\n" + "inline ::std::string* $classname$::add_$name$() {\n" + " return $name$_.Add();\n" + "}\n" + "inline void $classname$::add_$name$(const ::std::string& value) {\n" + " $name$_.Add()->assign(value);\n" + "}\n" + "inline void $classname$::add_$name$(const char* value) {\n" + " $name$_.Add()->assign(value);\n" + "}\n" + "inline void " + "$classname$::add_$name$(const $pointer_type$* value, size_t size) {\n" + " $name$_.Add()->assign(reinterpret_cast(value), size);\n" + "}\n"); + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedPtrField< ::std::string>&\n" + "$classname$::$name$() const {\n" + " return $name$_;\n" + "}\n" + "inline ::google::protobuf::RepeatedPtrField< ::std::string>*\n" + "$classname$::mutable_$name$() {\n" + " return &$name$_;\n" + "}\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateClearingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Clear();\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateMergingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateSwappingCode(io::Printer* printer) const { + printer->Print(variables_, "$name$_.Swap(&other->$name$_);\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateConstructorCode(io::Printer* printer) const { + // Not needed for repeated fields. +} + +void RepeatedStringFieldGenerator:: +GenerateMergeFromCodedStream(io::Printer* printer) const { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::Read$declared_type$(\n" + " input, this->add_$name$()));\n"); + if (HasUtf8Verification(descriptor_->file()) && + descriptor_->type() == FieldDescriptor::TYPE_STRING) { + printer->Print(variables_, + "::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" + " this->$name$(0).data(), this->$name$(0).length(),\n" + " ::google::protobuf::internal::WireFormat::PARSE);\n"); + } +} + +void RepeatedStringFieldGenerator:: +GenerateSerializeWithCachedSizes(io::Printer* printer) const { + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n"); + if (HasUtf8Verification(descriptor_->file()) && + descriptor_->type() == FieldDescriptor::TYPE_STRING) { + printer->Print(variables_, + "::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" + " this->$name$(i).data(), this->$name$(i).length(),\n" + " ::google::protobuf::internal::WireFormat::SERIALIZE);\n"); + } + printer->Print(variables_, + " ::google::protobuf::internal::WireFormatLite::Write$declared_type$(\n" + " $number$, this->$name$(i), output);\n" + "}\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { + printer->Print(variables_, + "for (int i = 0; i < this->$name$_size(); i++) {\n"); + if (HasUtf8Verification(descriptor_->file()) && + descriptor_->type() == FieldDescriptor::TYPE_STRING) { + printer->Print(variables_, + " ::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" + " this->$name$(i).data(), this->$name$(i).length(),\n" + " ::google::protobuf::internal::WireFormat::SERIALIZE);\n"); + } + printer->Print(variables_, + " target = ::google::protobuf::internal::WireFormatLite::\n" + " Write$declared_type$ToArray($number$, this->$name$(i), target);\n" + "}\n"); +} + +void RepeatedStringFieldGenerator:: +GenerateByteSize(io::Printer* printer) const { + printer->Print(variables_, + "total_size += $tag_size$ * this->$name$_size();\n" + "for (int i = 0; i < this->$name$_size(); i++) {\n" + " total_size += ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n" + " this->$name$(i));\n" + "}\n"); +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_string_field.h b/depends/protobuf/google/protobuf/compiler/cpp/cpp_string_field.h new file mode 100644 index 000000000..7f45107de --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_string_field.h @@ -0,0 +1,104 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_STRING_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_STRING_FIELD_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +class StringFieldGenerator : public FieldGenerator { + public: + explicit StringFieldGenerator(const FieldDescriptor* descriptor); + ~StringFieldGenerator(); + + // 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 GenerateClearingCode(io::Printer* printer) const; + void GenerateMergingCode(io::Printer* printer) const; + void GenerateSwappingCode(io::Printer* printer) const; + void GenerateConstructorCode(io::Printer* printer) const; + void GenerateDestructorCode(io::Printer* printer) const; + void GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); +}; + +class RepeatedStringFieldGenerator : public FieldGenerator { + public: + explicit RepeatedStringFieldGenerator(const FieldDescriptor* descriptor); + ~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 GenerateMergeFromCodedStream(io::Printer* printer) const; + void GenerateSerializeWithCachedSizes(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; + void GenerateByteSize(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + map variables_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedStringFieldGenerator); +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_STRING_FIELD_H__ diff --git a/depends/protobuf/google/protobuf/compiler/cpp/cpp_unittest.cc b/depends/protobuf/google/protobuf/compiler/cpp/cpp_unittest.cc new file mode 100644 index 000000000..301a7ce67 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/cpp/cpp_unittest.cc @@ -0,0 +1,1281 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// To test the code generator, we actually use it to generate code for +// google/protobuf/unittest.proto, then test that. This means that we +// are actually testing the parser and other parts of the system at the same +// time, and that problems in the generator may show up as compile-time errors +// rather than unittest failures, which may be surprising. However, testing +// the output of the C++ generator directly would be very hard. We can't very +// well just check it against golden files since those files would have to be +// updated for any small change; such a test would be very brittle and probably +// not very helpful. What we really want to test is that the code compiles +// correctly and produces the interfaces we expect, which is why this test +// is written this way. + +#include + +#include +#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 { + +// Can't use an anonymous namespace here due to brokenness of Tru64 compiler. +namespace cpp_unittest { + + +class MockErrorCollector : public MultiFileErrorCollector { + public: + MockErrorCollector() {} + ~MockErrorCollector() {} + + string text_; + + // implements ErrorCollector --------------------------------------- + void AddError(const string& filename, int line, int column, + const string& message) { + strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", + filename, line, column, message); + } +}; + +#ifndef PROTOBUF_TEST_NO_DESCRIPTORS + +// Test that generated code has proper descriptors: +// Parse a descriptor directly (using google::protobuf::compiler::Importer) and +// compare it to the one that was produced by generated code. +TEST(GeneratedDescriptorTest, IdenticalDescriptors) { + const FileDescriptor* generated_descriptor = + unittest::TestAllTypes::descriptor()->file(); + + // Set up the Importer. + MockErrorCollector error_collector; + DiskSourceTree source_tree; + source_tree.MapPath("", TestSourceDir()); + Importer importer(&source_tree, &error_collector); + + // Import (parse) unittest.proto. + const FileDescriptor* parsed_descriptor = + importer.Import("google/protobuf/unittest.proto"); + EXPECT_EQ("", error_collector.text_); + ASSERT_TRUE(parsed_descriptor != NULL); + + // Test that descriptors are generated correctly by converting them to + // FileDescriptorProtos and comparing. + FileDescriptorProto generated_decsriptor_proto, parsed_descriptor_proto; + generated_descriptor->CopyTo(&generated_decsriptor_proto); + parsed_descriptor->CopyTo(&parsed_descriptor_proto); + + EXPECT_EQ(parsed_descriptor_proto.DebugString(), + generated_decsriptor_proto.DebugString()); +} + +#endif // !PROTOBUF_TEST_NO_DESCRIPTORS + +// =================================================================== + +TEST(GeneratedMessageTest, Defaults) { + // Check that all default values are set correctly in the initial message. + unittest::TestAllTypes message; + + TestUtil::ExpectClear(message); + + // Messages should return pointers to default instances until first use. + // (This is not checked by ExpectClear() since it is not actually true after + // the fields have been set and then cleared.) + EXPECT_EQ(&unittest::TestAllTypes::OptionalGroup::default_instance(), + &message.optionalgroup()); + EXPECT_EQ(&unittest::TestAllTypes::NestedMessage::default_instance(), + &message.optional_nested_message()); + EXPECT_EQ(&unittest::ForeignMessage::default_instance(), + &message.optional_foreign_message()); + EXPECT_EQ(&unittest_import::ImportMessage::default_instance(), + &message.optional_import_message()); +} + +TEST(GeneratedMessageTest, FloatingPointDefaults) { + const unittest::TestExtremeDefaultValues& extreme_default = + unittest::TestExtremeDefaultValues::default_instance(); + + EXPECT_EQ(0.0f, extreme_default.zero_float()); + EXPECT_EQ(1.0f, extreme_default.one_float()); + EXPECT_EQ(1.5f, extreme_default.small_float()); + EXPECT_EQ(-1.0f, extreme_default.negative_one_float()); + EXPECT_EQ(-1.5f, extreme_default.negative_float()); + EXPECT_EQ(2.0e8f, extreme_default.large_float()); + EXPECT_EQ(-8e-28f, extreme_default.small_negative_float()); + EXPECT_EQ(numeric_limits::infinity(), + extreme_default.inf_double()); + EXPECT_EQ(-numeric_limits::infinity(), + extreme_default.neg_inf_double()); + EXPECT_TRUE(extreme_default.nan_double() != extreme_default.nan_double()); + EXPECT_EQ(numeric_limits::infinity(), + extreme_default.inf_float()); + EXPECT_EQ(-numeric_limits::infinity(), + extreme_default.neg_inf_float()); + EXPECT_TRUE(extreme_default.nan_float() != extreme_default.nan_float()); +} + +TEST(GeneratedMessageTest, Trigraph) { + const unittest::TestExtremeDefaultValues& extreme_default = + unittest::TestExtremeDefaultValues::default_instance(); + + EXPECT_EQ("? ? ?? ?? ??? ?\?/ ?\?-", extreme_default.cpp_trigraph()); +} + +TEST(GeneratedMessageTest, Accessors) { + // Set every field to a unique value then go back and check all those + // values. + unittest::TestAllTypes message; + + TestUtil::SetAllFields(&message); + TestUtil::ExpectAllFieldsSet(message); + + TestUtil::ModifyRepeatedFields(&message); + TestUtil::ExpectRepeatedFieldsModified(message); +} + +TEST(GeneratedMessageTest, MutableStringDefault) { + // mutable_foo() for a string should return a string initialized to its + // default value. + unittest::TestAllTypes message; + + EXPECT_EQ("hello", *message.mutable_default_string()); + + // Note that the first time we call mutable_foo(), we get a newly-allocated + // string, but if we clear it and call it again, we get the same object again. + // We should verify that it has its default value in both cases. + message.set_default_string("blah"); + message.Clear(); + + EXPECT_EQ("hello", *message.mutable_default_string()); +} + +TEST(GeneratedMessageTest, ReleaseString) { + // Check that release_foo() starts out NULL, and gives us a value + // that we can delete after it's been set. + unittest::TestAllTypes message; + + EXPECT_EQ(NULL, message.release_default_string()); + EXPECT_FALSE(message.has_default_string()); + EXPECT_EQ("hello", message.default_string()); + + message.set_default_string("blah"); + EXPECT_TRUE(message.has_default_string()); + string* str = message.release_default_string(); + EXPECT_FALSE(message.has_default_string()); + ASSERT_TRUE(str != NULL); + EXPECT_EQ("blah", *str); + delete str; + + EXPECT_EQ(NULL, message.release_default_string()); + EXPECT_FALSE(message.has_default_string()); + EXPECT_EQ("hello", message.default_string()); +} + +TEST(GeneratedMessageTest, ReleaseMessage) { + // Check that release_foo() starts out NULL, and gives us a value + // that we can delete after it's been set. + unittest::TestAllTypes message; + + EXPECT_EQ(NULL, message.release_optional_nested_message()); + EXPECT_FALSE(message.has_optional_nested_message()); + + message.mutable_optional_nested_message()->set_bb(1); + unittest::TestAllTypes::NestedMessage* nest = + message.release_optional_nested_message(); + EXPECT_FALSE(message.has_optional_nested_message()); + ASSERT_TRUE(nest != NULL); + EXPECT_EQ(1, nest->bb()); + delete nest; + + EXPECT_EQ(NULL, message.release_optional_nested_message()); + EXPECT_FALSE(message.has_optional_nested_message()); +} + +TEST(GeneratedMessageTest, Clear) { + // Set every field to a unique value, clear the message, then check that + // it is cleared. + unittest::TestAllTypes message; + + TestUtil::SetAllFields(&message); + message.Clear(); + TestUtil::ExpectClear(message); + + // Unlike with the defaults test, we do NOT expect that requesting embedded + // messages will return a pointer to the default instance. Instead, they + // should return the objects that were created when mutable_blah() was + // called. + EXPECT_NE(&unittest::TestAllTypes::OptionalGroup::default_instance(), + &message.optionalgroup()); + EXPECT_NE(&unittest::TestAllTypes::NestedMessage::default_instance(), + &message.optional_nested_message()); + EXPECT_NE(&unittest::ForeignMessage::default_instance(), + &message.optional_foreign_message()); + EXPECT_NE(&unittest_import::ImportMessage::default_instance(), + &message.optional_import_message()); +} + +TEST(GeneratedMessageTest, EmbeddedNullsInBytesCharStar) { + unittest::TestAllTypes message; + + const char* value = "\0lalala\0\0"; + message.set_optional_bytes(value, 9); + ASSERT_EQ(9, message.optional_bytes().size()); + EXPECT_EQ(0, memcmp(value, message.optional_bytes().data(), 9)); + + message.add_repeated_bytes(value, 9); + ASSERT_EQ(9, message.repeated_bytes(0).size()); + EXPECT_EQ(0, memcmp(value, message.repeated_bytes(0).data(), 9)); +} + +TEST(GeneratedMessageTest, ClearOneField) { + // Set every field to a unique value, then clear one value and insure that + // only that one value is cleared. + unittest::TestAllTypes message; + + TestUtil::SetAllFields(&message); + int64 original_value = message.optional_int64(); + + // Clear the field and make sure it shows up as cleared. + message.clear_optional_int64(); + EXPECT_FALSE(message.has_optional_int64()); + EXPECT_EQ(0, message.optional_int64()); + + // Other adjacent fields should not be cleared. + EXPECT_TRUE(message.has_optional_int32()); + EXPECT_TRUE(message.has_optional_uint32()); + + // Make sure if we set it again, then all fields are set. + message.set_optional_int64(original_value); + TestUtil::ExpectAllFieldsSet(message); +} + +TEST(GeneratedMessageTest, StringCharStarLength) { + // Verify that we can use a char*,length to set one of the string fields. + unittest::TestAllTypes message; + message.set_optional_string("abcdef", 3); + EXPECT_EQ("abc", message.optional_string()); + + // Verify that we can use a char*,length to add to a repeated string field. + message.add_repeated_string("abcdef", 3); + EXPECT_EQ(1, message.repeated_string_size()); + EXPECT_EQ("abc", message.repeated_string(0)); + + // Verify that we can use a char*,length to set a repeated string field. + message.set_repeated_string(0, "wxyz", 2); + EXPECT_EQ("wx", message.repeated_string(0)); +} + + +TEST(GeneratedMessageTest, CopyFrom) { + unittest::TestAllTypes message1, message2; + + TestUtil::SetAllFields(&message1); + message2.CopyFrom(message1); + TestUtil::ExpectAllFieldsSet(message2); + + // Copying from self should be a no-op. + message2.CopyFrom(message2); + TestUtil::ExpectAllFieldsSet(message2); +} + + +TEST(GeneratedMessageTest, SwapWithEmpty) { + unittest::TestAllTypes message1, message2; + TestUtil::SetAllFields(&message1); + + TestUtil::ExpectAllFieldsSet(message1); + TestUtil::ExpectClear(message2); + message1.Swap(&message2); + TestUtil::ExpectAllFieldsSet(message2); + TestUtil::ExpectClear(message1); +} + +TEST(GeneratedMessageTest, SwapWithSelf) { + unittest::TestAllTypes message; + TestUtil::SetAllFields(&message); + TestUtil::ExpectAllFieldsSet(message); + message.Swap(&message); + TestUtil::ExpectAllFieldsSet(message); +} + +TEST(GeneratedMessageTest, SwapWithOther) { + unittest::TestAllTypes message1, message2; + + message1.set_optional_int32(123); + message1.set_optional_string("abc"); + message1.mutable_optional_nested_message()->set_bb(1); + message1.set_optional_nested_enum(unittest::TestAllTypes::FOO); + message1.add_repeated_int32(1); + message1.add_repeated_int32(2); + message1.add_repeated_string("a"); + message1.add_repeated_string("b"); + message1.add_repeated_nested_message()->set_bb(7); + message1.add_repeated_nested_message()->set_bb(8); + message1.add_repeated_nested_enum(unittest::TestAllTypes::FOO); + message1.add_repeated_nested_enum(unittest::TestAllTypes::BAR); + + message2.set_optional_int32(456); + message2.set_optional_string("def"); + message2.mutable_optional_nested_message()->set_bb(2); + message2.set_optional_nested_enum(unittest::TestAllTypes::BAR); + message2.add_repeated_int32(3); + message2.add_repeated_string("c"); + message2.add_repeated_nested_message()->set_bb(9); + message2.add_repeated_nested_enum(unittest::TestAllTypes::BAZ); + + message1.Swap(&message2); + + EXPECT_EQ(456, message1.optional_int32()); + EXPECT_EQ("def", message1.optional_string()); + EXPECT_EQ(2, message1.optional_nested_message().bb()); + EXPECT_EQ(unittest::TestAllTypes::BAR, message1.optional_nested_enum()); + ASSERT_EQ(1, message1.repeated_int32_size()); + EXPECT_EQ(3, message1.repeated_int32(0)); + ASSERT_EQ(1, message1.repeated_string_size()); + EXPECT_EQ("c", message1.repeated_string(0)); + ASSERT_EQ(1, message1.repeated_nested_message_size()); + EXPECT_EQ(9, message1.repeated_nested_message(0).bb()); + ASSERT_EQ(1, message1.repeated_nested_enum_size()); + EXPECT_EQ(unittest::TestAllTypes::BAZ, message1.repeated_nested_enum(0)); + + EXPECT_EQ(123, message2.optional_int32()); + EXPECT_EQ("abc", message2.optional_string()); + EXPECT_EQ(1, message2.optional_nested_message().bb()); + EXPECT_EQ(unittest::TestAllTypes::FOO, message2.optional_nested_enum()); + ASSERT_EQ(2, message2.repeated_int32_size()); + EXPECT_EQ(1, message2.repeated_int32(0)); + EXPECT_EQ(2, message2.repeated_int32(1)); + ASSERT_EQ(2, message2.repeated_string_size()); + EXPECT_EQ("a", message2.repeated_string(0)); + EXPECT_EQ("b", message2.repeated_string(1)); + ASSERT_EQ(2, message2.repeated_nested_message_size()); + EXPECT_EQ(7, message2.repeated_nested_message(0).bb()); + EXPECT_EQ(8, message2.repeated_nested_message(1).bb()); + ASSERT_EQ(2, message2.repeated_nested_enum_size()); + EXPECT_EQ(unittest::TestAllTypes::FOO, message2.repeated_nested_enum(0)); + EXPECT_EQ(unittest::TestAllTypes::BAR, message2.repeated_nested_enum(1)); +} + +TEST(GeneratedMessageTest, CopyConstructor) { + unittest::TestAllTypes message1; + TestUtil::SetAllFields(&message1); + + unittest::TestAllTypes message2(message1); + TestUtil::ExpectAllFieldsSet(message2); +} + +TEST(GeneratedMessageTest, CopyAssignmentOperator) { + unittest::TestAllTypes message1; + TestUtil::SetAllFields(&message1); + + unittest::TestAllTypes message2; + message2 = message1; + TestUtil::ExpectAllFieldsSet(message2); + + // Make sure that self-assignment does something sane. + message2.operator=(message2); + TestUtil::ExpectAllFieldsSet(message2); +} + +TEST(GeneratedMessageTest, UpcastCopyFrom) { + // Test the CopyFrom method that takes in the generic const Message& + // parameter. + unittest::TestAllTypes message1, message2; + + TestUtil::SetAllFields(&message1); + + const Message* source = implicit_cast(&message1); + message2.CopyFrom(*source); + + TestUtil::ExpectAllFieldsSet(message2); +} + +#ifndef PROTOBUF_TEST_NO_DESCRIPTORS + +TEST(GeneratedMessageTest, DynamicMessageCopyFrom) { + // Test copying from a DynamicMessage, which must fall back to using + // reflection. + unittest::TestAllTypes message2; + + // Construct a new version of the dynamic message via the factory. + DynamicMessageFactory factory; + scoped_ptr message1; + message1.reset(factory.GetPrototype( + unittest::TestAllTypes::descriptor())->New()); + + TestUtil::ReflectionTester reflection_tester( + unittest::TestAllTypes::descriptor()); + reflection_tester.SetAllFieldsViaReflection(message1.get()); + + message2.CopyFrom(*message1); + + TestUtil::ExpectAllFieldsSet(message2); +} + +#endif // !PROTOBUF_TEST_NO_DESCRIPTORS + +TEST(GeneratedMessageTest, NonEmptyMergeFrom) { + // Test merging with a non-empty message. Code is a modified form + // of that found in google/protobuf/reflection_ops_unittest.cc. + unittest::TestAllTypes message1, message2; + + TestUtil::SetAllFields(&message1); + + // This field will test merging into an empty spot. + message2.set_optional_int32(message1.optional_int32()); + message1.clear_optional_int32(); + + // This tests overwriting. + message2.set_optional_string(message1.optional_string()); + message1.set_optional_string("something else"); + + // This tests concatenating. + message2.add_repeated_int32(message1.repeated_int32(1)); + int32 i = message1.repeated_int32(0); + message1.clear_repeated_int32(); + message1.add_repeated_int32(i); + + message1.MergeFrom(message2); + + TestUtil::ExpectAllFieldsSet(message1); +} + +#ifdef GTEST_HAS_DEATH_TEST + +TEST(GeneratedMessageTest, MergeFromSelf) { + unittest::TestAllTypes message; + EXPECT_DEATH(message.MergeFrom(message), "&from"); + EXPECT_DEATH(message.MergeFrom(implicit_cast(message)), + "&from"); +} + +#endif // GTEST_HAS_DEATH_TEST + +// Test the generated SerializeWithCachedSizesToArray(), +TEST(GeneratedMessageTest, SerializationToArray) { + unittest::TestAllTypes message1, message2; + string data; + TestUtil::SetAllFields(&message1); + int size = message1.ByteSize(); + data.resize(size); + uint8* start = reinterpret_cast(string_as_array(&data)); + uint8* end = message1.SerializeWithCachedSizesToArray(start); + EXPECT_EQ(size, end - start); + EXPECT_TRUE(message2.ParseFromString(data)); + TestUtil::ExpectAllFieldsSet(message2); + +} + +TEST(GeneratedMessageTest, PackedFieldsSerializationToArray) { + unittest::TestPackedTypes packed_message1, packed_message2; + string packed_data; + TestUtil::SetPackedFields(&packed_message1); + int packed_size = packed_message1.ByteSize(); + packed_data.resize(packed_size); + uint8* start = reinterpret_cast(string_as_array(&packed_data)); + uint8* end = packed_message1.SerializeWithCachedSizesToArray(start); + EXPECT_EQ(packed_size, end - start); + EXPECT_TRUE(packed_message2.ParseFromString(packed_data)); + TestUtil::ExpectPackedFieldsSet(packed_message2); +} + +// Test the generated SerializeWithCachedSizes() by forcing the buffer to write +// one byte at a time. +TEST(GeneratedMessageTest, SerializationToStream) { + unittest::TestAllTypes message1, message2; + TestUtil::SetAllFields(&message1); + int size = message1.ByteSize(); + string data; + data.resize(size); + { + // Allow the output stream to buffer only one byte at a time. + io::ArrayOutputStream array_stream(string_as_array(&data), size, 1); + io::CodedOutputStream output_stream(&array_stream); + message1.SerializeWithCachedSizes(&output_stream); + EXPECT_FALSE(output_stream.HadError()); + EXPECT_EQ(size, output_stream.ByteCount()); + } + EXPECT_TRUE(message2.ParseFromString(data)); + TestUtil::ExpectAllFieldsSet(message2); + +} + +TEST(GeneratedMessageTest, PackedFieldsSerializationToStream) { + unittest::TestPackedTypes message1, message2; + TestUtil::SetPackedFields(&message1); + int size = message1.ByteSize(); + string data; + data.resize(size); + { + // Allow the output stream to buffer only one byte at a time. + io::ArrayOutputStream array_stream(string_as_array(&data), size, 1); + io::CodedOutputStream output_stream(&array_stream); + message1.SerializeWithCachedSizes(&output_stream); + EXPECT_FALSE(output_stream.HadError()); + EXPECT_EQ(size, output_stream.ByteCount()); + } + EXPECT_TRUE(message2.ParseFromString(data)); + TestUtil::ExpectPackedFieldsSet(message2); +} + + +TEST(GeneratedMessageTest, Required) { + // Test that IsInitialized() returns false if required fields are missing. + unittest::TestRequired message; + + EXPECT_FALSE(message.IsInitialized()); + message.set_a(1); + EXPECT_FALSE(message.IsInitialized()); + message.set_b(2); + EXPECT_FALSE(message.IsInitialized()); + message.set_c(3); + EXPECT_TRUE(message.IsInitialized()); +} + +TEST(GeneratedMessageTest, RequiredForeign) { + // Test that IsInitialized() returns false if required fields in nested + // messages are missing. + unittest::TestRequiredForeign message; + + EXPECT_TRUE(message.IsInitialized()); + + message.mutable_optional_message(); + EXPECT_FALSE(message.IsInitialized()); + + message.mutable_optional_message()->set_a(1); + message.mutable_optional_message()->set_b(2); + message.mutable_optional_message()->set_c(3); + EXPECT_TRUE(message.IsInitialized()); + + message.add_repeated_message(); + EXPECT_FALSE(message.IsInitialized()); + + message.mutable_repeated_message(0)->set_a(1); + message.mutable_repeated_message(0)->set_b(2); + message.mutable_repeated_message(0)->set_c(3); + EXPECT_TRUE(message.IsInitialized()); +} + +TEST(GeneratedMessageTest, ForeignNested) { + // Test that TestAllTypes::NestedMessage can be embedded directly into + // another message. + unittest::TestForeignNested message; + + // If this compiles and runs without crashing, it must work. We have + // nothing more to test. + unittest::TestAllTypes::NestedMessage* nested = + message.mutable_foreign_nested(); + nested->set_bb(1); +} + +TEST(GeneratedMessageTest, ReallyLargeTagNumber) { + // Test that really large tag numbers don't break anything. + unittest::TestReallyLargeTagNumber message1, message2; + string data; + + // For the most part, if this compiles and runs then we're probably good. + // (The most likely cause for failure would be if something were attempting + // to allocate a lookup table of some sort using tag numbers as the index.) + // We'll try serializing just for fun. + message1.set_a(1234); + message1.set_bb(5678); + message1.SerializeToString(&data); + EXPECT_TRUE(message2.ParseFromString(data)); + EXPECT_EQ(1234, message2.a()); + EXPECT_EQ(5678, message2.bb()); +} + +TEST(GeneratedMessageTest, MutualRecursion) { + // Test that mutually-recursive message types work. + unittest::TestMutualRecursionA message; + unittest::TestMutualRecursionA* nested = message.mutable_bb()->mutable_a(); + unittest::TestMutualRecursionA* nested2 = nested->mutable_bb()->mutable_a(); + + // Again, if the above compiles and runs, that's all we really have to + // test, but just for run we'll check that the system didn't somehow come + // up with a pointer loop... + EXPECT_NE(&message, nested); + EXPECT_NE(&message, nested2); + EXPECT_NE(nested, nested2); +} + +TEST(GeneratedMessageTest, CamelCaseFieldNames) { + // This test is mainly checking that the following compiles, which verifies + // that the field names were coerced to lower-case. + // + // Protocol buffers standard style is to use lowercase-with-underscores for + // field names. Some old proto1 .protos unfortunately used camel-case field + // names. In proto1, these names were forced to lower-case. So, we do the + // same thing in proto2. + + unittest::TestCamelCaseFieldNames message; + + message.set_primitivefield(2); + message.set_stringfield("foo"); + message.set_enumfield(unittest::FOREIGN_FOO); + message.mutable_messagefield()->set_c(6); + + message.add_repeatedprimitivefield(8); + message.add_repeatedstringfield("qux"); + message.add_repeatedenumfield(unittest::FOREIGN_BAR); + message.add_repeatedmessagefield()->set_c(15); + + EXPECT_EQ(2, message.primitivefield()); + EXPECT_EQ("foo", message.stringfield()); + EXPECT_EQ(unittest::FOREIGN_FOO, message.enumfield()); + EXPECT_EQ(6, message.messagefield().c()); + + EXPECT_EQ(8, message.repeatedprimitivefield(0)); + EXPECT_EQ("qux", message.repeatedstringfield(0)); + EXPECT_EQ(unittest::FOREIGN_BAR, message.repeatedenumfield(0)); + EXPECT_EQ(15, message.repeatedmessagefield(0).c()); +} + +TEST(GeneratedMessageTest, TestConflictingSymbolNames) { + // test_bad_identifiers.proto successfully compiled, then it works. The + // following is just a token usage to insure that the code is, in fact, + // being compiled and linked. + + protobuf_unittest::TestConflictingSymbolNames message; + message.set_uint32(1); + EXPECT_EQ(3, message.ByteSize()); + + message.set_friend_(5); + EXPECT_EQ(5, message.friend_()); +} + +#ifndef PROTOBUF_TEST_NO_DESCRIPTORS + +TEST(GeneratedMessageTest, TestOptimizedForSize) { + // We rely on the tests in reflection_ops_unittest and wire_format_unittest + // to really test that reflection-based methods work. Here we are mostly + // just making sure that TestOptimizedForSize actually builds and seems to + // function. + + protobuf_unittest::TestOptimizedForSize message, message2; + message.set_i(1); + message.mutable_msg()->set_c(2); + message2.CopyFrom(message); + EXPECT_EQ(1, message2.i()); + EXPECT_EQ(2, message2.msg().c()); +} + +TEST(GeneratedMessageTest, TestEmbedOptimizedForSize) { + // Verifies that something optimized for speed can contain something optimized + // for size. + + protobuf_unittest::TestEmbedOptimizedForSize message, message2; + message.mutable_optional_message()->set_i(1); + message.add_repeated_message()->mutable_msg()->set_c(2); + string data; + message.SerializeToString(&data); + ASSERT_TRUE(message2.ParseFromString(data)); + EXPECT_EQ(1, message2.optional_message().i()); + EXPECT_EQ(2, message2.repeated_message(0).msg().c()); +} + +TEST(GeneratedMessageTest, TestSpaceUsed) { + unittest::TestAllTypes message1; + // sizeof provides a lower bound on SpaceUsed(). + EXPECT_LE(sizeof(unittest::TestAllTypes), message1.SpaceUsed()); + const int empty_message_size = message1.SpaceUsed(); + + // Setting primitive types shouldn't affect the space used. + message1.set_optional_int32(123); + message1.set_optional_int64(12345); + message1.set_optional_uint32(123); + message1.set_optional_uint64(12345); + EXPECT_EQ(empty_message_size, message1.SpaceUsed()); + + // On some STL implementations, setting the string to a small value should + // only increase SpaceUsed() by the size of a string object, though this is + // not true everywhere. + message1.set_optional_string("abc"); + EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsed()); + + // Setting a string to a value larger than the string object itself should + // increase SpaceUsed(), because it cannot store the value internally. + message1.set_optional_string(string(sizeof(string) + 1, 'x')); + int min_expected_increase = message1.optional_string().capacity() + + sizeof(string); + EXPECT_LE(empty_message_size + min_expected_increase, + message1.SpaceUsed()); + + int previous_size = message1.SpaceUsed(); + // Adding an optional message should increase the size by the size of the + // nested message type. NestedMessage is simple enough (1 int field) that it + // is equal to sizeof(NestedMessage) + message1.mutable_optional_nested_message(); + ASSERT_EQ(sizeof(unittest::TestAllTypes::NestedMessage), + message1.optional_nested_message().SpaceUsed()); + EXPECT_EQ(previous_size + + sizeof(unittest::TestAllTypes::NestedMessage), + message1.SpaceUsed()); +} + +#endif // !PROTOBUF_TEST_NO_DESCRIPTORS + + +TEST(GeneratedMessageTest, FieldConstantValues) { + unittest::TestRequired message; + EXPECT_EQ(unittest::TestAllTypes_NestedMessage::kBbFieldNumber, 1); + EXPECT_EQ(unittest::TestAllTypes::kOptionalInt32FieldNumber, 1); + EXPECT_EQ(unittest::TestAllTypes::kOptionalgroupFieldNumber, 16); + EXPECT_EQ(unittest::TestAllTypes::kOptionalNestedMessageFieldNumber, 18); + EXPECT_EQ(unittest::TestAllTypes::kOptionalNestedEnumFieldNumber, 21); + EXPECT_EQ(unittest::TestAllTypes::kRepeatedInt32FieldNumber, 31); + EXPECT_EQ(unittest::TestAllTypes::kRepeatedgroupFieldNumber, 46); + EXPECT_EQ(unittest::TestAllTypes::kRepeatedNestedMessageFieldNumber, 48); + EXPECT_EQ(unittest::TestAllTypes::kRepeatedNestedEnumFieldNumber, 51); +} + +TEST(GeneratedMessageTest, ExtensionConstantValues) { + EXPECT_EQ(unittest::TestRequired::kSingleFieldNumber, 1000); + EXPECT_EQ(unittest::TestRequired::kMultiFieldNumber, 1001); + EXPECT_EQ(unittest::kOptionalInt32ExtensionFieldNumber, 1); + EXPECT_EQ(unittest::kOptionalgroupExtensionFieldNumber, 16); + EXPECT_EQ(unittest::kOptionalNestedMessageExtensionFieldNumber, 18); + EXPECT_EQ(unittest::kOptionalNestedEnumExtensionFieldNumber, 21); + EXPECT_EQ(unittest::kRepeatedInt32ExtensionFieldNumber, 31); + EXPECT_EQ(unittest::kRepeatedgroupExtensionFieldNumber, 46); + EXPECT_EQ(unittest::kRepeatedNestedMessageExtensionFieldNumber, 48); + EXPECT_EQ(unittest::kRepeatedNestedEnumExtensionFieldNumber, 51); +} + +// =================================================================== + +TEST(GeneratedEnumTest, EnumValuesAsSwitchCases) { + // Test that our nested enum values can be used as switch cases. This test + // doesn't actually do anything, the proof that it works is that it + // compiles. + int i =0; + unittest::TestAllTypes::NestedEnum a = unittest::TestAllTypes::BAR; + switch (a) { + case unittest::TestAllTypes::FOO: + i = 1; + break; + case unittest::TestAllTypes::BAR: + i = 2; + break; + case unittest::TestAllTypes::BAZ: + i = 3; + break; + // no default case: We want to make sure the compiler recognizes that + // all cases are covered. (GCC warns if you do not cover all cases of + // an enum in a switch.) + } + + // Token check just for fun. + EXPECT_EQ(2, i); +} + +TEST(GeneratedEnumTest, IsValidValue) { + // Test enum IsValidValue. + EXPECT_TRUE(unittest::TestAllTypes::NestedEnum_IsValid(1)); + EXPECT_TRUE(unittest::TestAllTypes::NestedEnum_IsValid(2)); + EXPECT_TRUE(unittest::TestAllTypes::NestedEnum_IsValid(3)); + + EXPECT_FALSE(unittest::TestAllTypes::NestedEnum_IsValid(0)); + EXPECT_FALSE(unittest::TestAllTypes::NestedEnum_IsValid(4)); + + // Make sure it also works when there are dups. + EXPECT_TRUE(unittest::TestEnumWithDupValue_IsValid(1)); + EXPECT_TRUE(unittest::TestEnumWithDupValue_IsValid(2)); + EXPECT_TRUE(unittest::TestEnumWithDupValue_IsValid(3)); + + EXPECT_FALSE(unittest::TestEnumWithDupValue_IsValid(0)); + EXPECT_FALSE(unittest::TestEnumWithDupValue_IsValid(4)); +} + +TEST(GeneratedEnumTest, MinAndMax) { + EXPECT_EQ(unittest::TestAllTypes::FOO, + unittest::TestAllTypes::NestedEnum_MIN); + EXPECT_EQ(unittest::TestAllTypes::BAZ, + unittest::TestAllTypes::NestedEnum_MAX); + EXPECT_EQ(4, unittest::TestAllTypes::NestedEnum_ARRAYSIZE); + + EXPECT_EQ(unittest::FOREIGN_FOO, unittest::ForeignEnum_MIN); + EXPECT_EQ(unittest::FOREIGN_BAZ, unittest::ForeignEnum_MAX); + EXPECT_EQ(7, unittest::ForeignEnum_ARRAYSIZE); + + EXPECT_EQ(1, unittest::TestEnumWithDupValue_MIN); + EXPECT_EQ(3, unittest::TestEnumWithDupValue_MAX); + EXPECT_EQ(4, unittest::TestEnumWithDupValue_ARRAYSIZE); + + EXPECT_EQ(unittest::SPARSE_E, unittest::TestSparseEnum_MIN); + EXPECT_EQ(unittest::SPARSE_C, unittest::TestSparseEnum_MAX); + EXPECT_EQ(12589235, unittest::TestSparseEnum_ARRAYSIZE); + + // Make sure we can take the address of _MIN, _MAX and _ARRAYSIZE. + void* null_pointer = 0; // NULL may be integer-type, not pointer-type. + EXPECT_NE(null_pointer, &unittest::TestAllTypes::NestedEnum_MIN); + EXPECT_NE(null_pointer, &unittest::TestAllTypes::NestedEnum_MAX); + EXPECT_NE(null_pointer, &unittest::TestAllTypes::NestedEnum_ARRAYSIZE); + + EXPECT_NE(null_pointer, &unittest::ForeignEnum_MIN); + EXPECT_NE(null_pointer, &unittest::ForeignEnum_MAX); + EXPECT_NE(null_pointer, &unittest::ForeignEnum_ARRAYSIZE); + + // Make sure we can use _MIN, _MAX and _ARRAYSIZE as switch cases. + switch (unittest::SPARSE_A) { + case unittest::TestSparseEnum_MIN: + case unittest::TestSparseEnum_MAX: + case unittest::TestSparseEnum_ARRAYSIZE: + break; + default: + break; + } +} + +#ifndef PROTOBUF_TEST_NO_DESCRIPTORS + +TEST(GeneratedEnumTest, Name) { + // "Names" in the presence of dup values are a bit arbitrary. + EXPECT_EQ("FOO1", unittest::TestEnumWithDupValue_Name(unittest::FOO1)); + EXPECT_EQ("FOO1", unittest::TestEnumWithDupValue_Name(unittest::FOO2)); + + EXPECT_EQ("SPARSE_A", unittest::TestSparseEnum_Name(unittest::SPARSE_A)); + EXPECT_EQ("SPARSE_B", unittest::TestSparseEnum_Name(unittest::SPARSE_B)); + EXPECT_EQ("SPARSE_C", unittest::TestSparseEnum_Name(unittest::SPARSE_C)); + EXPECT_EQ("SPARSE_D", unittest::TestSparseEnum_Name(unittest::SPARSE_D)); + EXPECT_EQ("SPARSE_E", unittest::TestSparseEnum_Name(unittest::SPARSE_E)); + EXPECT_EQ("SPARSE_F", unittest::TestSparseEnum_Name(unittest::SPARSE_F)); + EXPECT_EQ("SPARSE_G", unittest::TestSparseEnum_Name(unittest::SPARSE_G)); +} + +TEST(GeneratedEnumTest, Parse) { + unittest::TestEnumWithDupValue dup_value = unittest::FOO1; + EXPECT_TRUE(unittest::TestEnumWithDupValue_Parse("FOO1", &dup_value)); + EXPECT_EQ(unittest::FOO1, dup_value); + EXPECT_TRUE(unittest::TestEnumWithDupValue_Parse("FOO2", &dup_value)); + EXPECT_EQ(unittest::FOO2, dup_value); + EXPECT_FALSE(unittest::TestEnumWithDupValue_Parse("FOO", &dup_value)); +} + +TEST(GeneratedEnumTest, GetEnumDescriptor) { + EXPECT_EQ(unittest::TestAllTypes::NestedEnum_descriptor(), + GetEnumDescriptor()); + EXPECT_EQ(unittest::ForeignEnum_descriptor(), + GetEnumDescriptor()); + EXPECT_EQ(unittest::TestEnumWithDupValue_descriptor(), + GetEnumDescriptor()); + EXPECT_EQ(unittest::TestSparseEnum_descriptor(), + GetEnumDescriptor()); +} + +#endif // PROTOBUF_TEST_NO_DESCRIPTORS + +// =================================================================== + +#ifndef PROTOBUF_TEST_NO_DESCRIPTORS + +// Support code for testing services. +class GeneratedServiceTest : public testing::Test { + protected: + class MockTestService : public unittest::TestService { + public: + MockTestService() + : called_(false), + method_(""), + controller_(NULL), + request_(NULL), + response_(NULL), + done_(NULL) {} + + ~MockTestService() {} + + void Reset() { called_ = false; } + + // implements TestService ---------------------------------------- + + void Foo(RpcController* controller, + const unittest::FooRequest* request, + unittest::FooResponse* response, + Closure* done) { + ASSERT_FALSE(called_); + called_ = true; + method_ = "Foo"; + controller_ = controller; + request_ = request; + response_ = response; + done_ = done; + } + + void Bar(RpcController* controller, + const unittest::BarRequest* request, + unittest::BarResponse* response, + Closure* done) { + ASSERT_FALSE(called_); + called_ = true; + method_ = "Bar"; + controller_ = controller; + request_ = request; + response_ = response; + done_ = done; + } + + // --------------------------------------------------------------- + + bool called_; + string method_; + RpcController* controller_; + const Message* request_; + Message* response_; + Closure* done_; + }; + + class MockRpcChannel : public RpcChannel { + public: + MockRpcChannel() + : called_(false), + method_(NULL), + controller_(NULL), + request_(NULL), + response_(NULL), + done_(NULL), + destroyed_(NULL) {} + + ~MockRpcChannel() { + if (destroyed_ != NULL) *destroyed_ = true; + } + + void Reset() { called_ = false; } + + // implements TestService ---------------------------------------- + + void CallMethod(const MethodDescriptor* method, + RpcController* controller, + const Message* request, + Message* response, + Closure* done) { + ASSERT_FALSE(called_); + called_ = true; + method_ = method; + controller_ = controller; + request_ = request; + response_ = response; + done_ = done; + } + + // --------------------------------------------------------------- + + bool called_; + const MethodDescriptor* method_; + RpcController* controller_; + const Message* request_; + Message* response_; + Closure* done_; + bool* destroyed_; + }; + + class MockController : public RpcController { + public: + void Reset() { + ADD_FAILURE() << "Reset() not expected during this test."; + } + bool Failed() const { + ADD_FAILURE() << "Failed() not expected during this test."; + return false; + } + string ErrorText() const { + ADD_FAILURE() << "ErrorText() not expected during this test."; + return ""; + } + void StartCancel() { + ADD_FAILURE() << "StartCancel() not expected during this test."; + } + void SetFailed(const string& reason) { + ADD_FAILURE() << "SetFailed() not expected during this test."; + } + bool IsCanceled() const { + ADD_FAILURE() << "IsCanceled() not expected during this test."; + return false; + } + void NotifyOnCancel(Closure* callback) { + ADD_FAILURE() << "NotifyOnCancel() not expected during this test."; + } + }; + + GeneratedServiceTest() + : descriptor_(unittest::TestService::descriptor()), + foo_(descriptor_->FindMethodByName("Foo")), + bar_(descriptor_->FindMethodByName("Bar")), + stub_(&mock_channel_), + done_(NewPermanentCallback(&DoNothing)) {} + + virtual void SetUp() { + ASSERT_TRUE(foo_ != NULL); + ASSERT_TRUE(bar_ != NULL); + } + + const ServiceDescriptor* descriptor_; + const MethodDescriptor* foo_; + const MethodDescriptor* bar_; + + MockTestService mock_service_; + MockController mock_controller_; + + MockRpcChannel mock_channel_; + unittest::TestService::Stub stub_; + + // Just so we don't have to re-define these with every test. + unittest::FooRequest foo_request_; + unittest::FooResponse foo_response_; + unittest::BarRequest bar_request_; + unittest::BarResponse bar_response_; + scoped_ptr done_; +}; + +TEST_F(GeneratedServiceTest, GetDescriptor) { + // Test that GetDescriptor() works. + + EXPECT_EQ(descriptor_, mock_service_.GetDescriptor()); +} + +TEST_F(GeneratedServiceTest, GetChannel) { + EXPECT_EQ(&mock_channel_, stub_.channel()); +} + +TEST_F(GeneratedServiceTest, OwnsChannel) { + MockRpcChannel* channel = new MockRpcChannel; + bool destroyed = false; + channel->destroyed_ = &destroyed; + + { + unittest::TestService::Stub owning_stub(channel, + Service::STUB_OWNS_CHANNEL); + EXPECT_FALSE(destroyed); + } + + EXPECT_TRUE(destroyed); +} + +TEST_F(GeneratedServiceTest, CallMethod) { + // Test that CallMethod() works. + + // Call Foo() via CallMethod(). + mock_service_.CallMethod(foo_, &mock_controller_, + &foo_request_, &foo_response_, done_.get()); + + ASSERT_TRUE(mock_service_.called_); + + EXPECT_EQ("Foo" , mock_service_.method_ ); + EXPECT_EQ(&mock_controller_, mock_service_.controller_); + EXPECT_EQ(&foo_request_ , mock_service_.request_ ); + EXPECT_EQ(&foo_response_ , mock_service_.response_ ); + EXPECT_EQ(done_.get() , mock_service_.done_ ); + + // Try again, but call Bar() instead. + mock_service_.Reset(); + mock_service_.CallMethod(bar_, &mock_controller_, + &bar_request_, &bar_response_, done_.get()); + + ASSERT_TRUE(mock_service_.called_); + EXPECT_EQ("Bar", mock_service_.method_); +} + +TEST_F(GeneratedServiceTest, CallMethodTypeFailure) { + // Verify death if we call Foo() with Bar's message types. + +#ifdef GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet + EXPECT_DEBUG_DEATH( + mock_service_.CallMethod(foo_, &mock_controller_, + &foo_request_, &bar_response_, done_.get()), + "dynamic_cast"); + + mock_service_.Reset(); + EXPECT_DEBUG_DEATH( + mock_service_.CallMethod(foo_, &mock_controller_, + &bar_request_, &foo_response_, done_.get()), + "dynamic_cast"); +#endif // GTEST_HAS_DEATH_TEST +} + +TEST_F(GeneratedServiceTest, GetPrototypes) { + // Test Get{Request,Response}Prototype() methods. + + EXPECT_EQ(&unittest::FooRequest::default_instance(), + &mock_service_.GetRequestPrototype(foo_)); + EXPECT_EQ(&unittest::BarRequest::default_instance(), + &mock_service_.GetRequestPrototype(bar_)); + + EXPECT_EQ(&unittest::FooResponse::default_instance(), + &mock_service_.GetResponsePrototype(foo_)); + EXPECT_EQ(&unittest::BarResponse::default_instance(), + &mock_service_.GetResponsePrototype(bar_)); +} + +TEST_F(GeneratedServiceTest, Stub) { + // Test that the stub class works. + + // Call Foo() via the stub. + stub_.Foo(&mock_controller_, &foo_request_, &foo_response_, done_.get()); + + ASSERT_TRUE(mock_channel_.called_); + + EXPECT_EQ(foo_ , mock_channel_.method_ ); + EXPECT_EQ(&mock_controller_, mock_channel_.controller_); + EXPECT_EQ(&foo_request_ , mock_channel_.request_ ); + EXPECT_EQ(&foo_response_ , mock_channel_.response_ ); + EXPECT_EQ(done_.get() , mock_channel_.done_ ); + + // Call Bar() via the stub. + mock_channel_.Reset(); + stub_.Bar(&mock_controller_, &bar_request_, &bar_response_, done_.get()); + + ASSERT_TRUE(mock_channel_.called_); + EXPECT_EQ(bar_, mock_channel_.method_); +} + +TEST_F(GeneratedServiceTest, NotImplemented) { + // Test that failing to implement a method of a service causes it to fail + // with a "not implemented" error message. + + // A service which doesn't implement any methods. + class UnimplementedService : public unittest::TestService { + public: + UnimplementedService() {} + }; + + UnimplementedService unimplemented_service; + + // And a controller which expects to get a "not implemented" error. + class ExpectUnimplementedController : public MockController { + public: + ExpectUnimplementedController() : called_(false) {} + + void SetFailed(const string& reason) { + EXPECT_FALSE(called_); + called_ = true; + EXPECT_EQ("Method Foo() not implemented.", reason); + } + + bool called_; + }; + + ExpectUnimplementedController controller; + + // Call Foo. + unimplemented_service.Foo(&controller, &foo_request_, &foo_response_, + done_.get()); + + EXPECT_TRUE(controller.called_); +} + +} // namespace cpp_unittest +} // namespace cpp +} // namespace compiler + +namespace no_generic_services_test { + // Verify that no class called "TestService" was defined in + // unittest_no_generic_services.pb.h by defining a different type by the same + // name. If such a service was generated, this will not compile. + struct TestService { + int i; + }; +} + +namespace compiler { +namespace cpp { +namespace cpp_unittest { + +TEST_F(GeneratedServiceTest, NoGenericServices) { + // Verify that non-services in unittest_no_generic_services.proto were + // generated. + no_generic_services_test::TestMessage message; + message.set_a(1); + message.SetExtension(no_generic_services_test::test_extension, 123); + no_generic_services_test::TestEnum e = no_generic_services_test::FOO; + EXPECT_EQ(e, 1); + + // Verify that a ServiceDescriptor is generated for the service even if the + // class itself is not. + const FileDescriptor* file = + no_generic_services_test::TestMessage::descriptor()->file(); + + ASSERT_EQ(1, file->service_count()); + EXPECT_EQ("TestService", file->service(0)->name()); + ASSERT_EQ(1, file->service(0)->method_count()); + EXPECT_EQ("Foo", file->service(0)->method(0)->name()); +} + +#endif // !PROTOBUF_TEST_NO_DESCRIPTORS + +// =================================================================== + +// This test must run last. It verifies that descriptors were or were not +// initialized depending on whether PROTOBUF_TEST_NO_DESCRIPTORS was defined. +// When this is defined, we skip all tests which are expected to trigger +// descriptor initialization. This verifies that everything else still works +// if descriptors are not initialized. +TEST(DescriptorInitializationTest, Initialized) { +#ifdef PROTOBUF_TEST_NO_DESCRIPTORS + bool should_have_descriptors = false; +#else + bool should_have_descriptors = true; +#endif + + EXPECT_EQ(should_have_descriptors, + DescriptorPool::generated_pool()->InternalIsFileLoaded( + "google/protobuf/unittest.proto")); +} + +} // namespace cpp_unittest + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/importer.cc b/depends/protobuf/google/protobuf/compiler/importer.cc similarity index 61% rename from depends/protobuf/src/google/protobuf/compiler/importer.cc rename to depends/protobuf/google/protobuf/compiler/importer.cc index f1e26f8bd..422f759f2 100644 --- a/depends/protobuf/src/google/protobuf/compiler/importer.cc +++ b/depends/protobuf/google/protobuf/compiler/importer.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,47 +33,44 @@ // Sanjay Ghemawat, Jeff Dean, and others. #ifdef _MSC_VER -#include +#include #else #include #endif -#include -#include -#include #include +#include +#include +#include #include -#include #include + #include #include #include #include -#include - -#ifdef _WIN32 -#include -#endif namespace google { namespace protobuf { namespace compiler { #ifdef _WIN32 -// DO NOT include , instead create functions in io_win32.{h,cc} and import -// them like we do below. -using google::protobuf::io::win32::access; -using google::protobuf::io::win32::open; +#ifndef F_OK +#define F_OK 00 // not defined by MSVC for whatever reason +#endif +#include #endif // Returns true if the text looks like a Windows-style absolute path, starting // with a drive letter. Example: "C:\foo". TODO(kenton): Share this with // copy in command_line_interface.cc? -static bool IsWindowsAbsolutePath(const std::string& text) { +static bool IsWindowsAbsolutePath(const string& text) { #if defined(_WIN32) || defined(__CYGWIN__) - return text.size() >= 3 && text[1] == ':' && isalpha(text[0]) && - (text[2] == '/' || text[2] == '\\') && text.find_last_of(':') == 1; + return text.size() >= 3 && text[1] == ':' && + isalpha(text[0]) && + (text[2] == '/' || text[2] == '\\') && + text.find_last_of(':') == 1; #else return false; #endif @@ -88,25 +85,25 @@ MultiFileErrorCollector::~MultiFileErrorCollector() {} class SourceTreeDescriptorDatabase::SingleFileErrorCollector : public io::ErrorCollector { public: - SingleFileErrorCollector(const std::string& filename, + SingleFileErrorCollector(const string& filename, MultiFileErrorCollector* multi_file_error_collector) - : filename_(filename), - multi_file_error_collector_(multi_file_error_collector), - had_errors_(false) {} - ~SingleFileErrorCollector() override {} + : filename_(filename), + multi_file_error_collector_(multi_file_error_collector), + had_errors_(false) {} + ~SingleFileErrorCollector() {} bool had_errors() { return had_errors_; } // implements ErrorCollector --------------------------------------- - void AddError(int line, int column, const std::string& message) override { - if (multi_file_error_collector_ != nullptr) { + void AddError(int line, int column, const string& message) { + if (multi_file_error_collector_ != NULL) { multi_file_error_collector_->AddError(filename_, line, column, message); } had_errors_ = true; } private: - std::string filename_; + string filename_; MultiFileErrorCollector* multi_file_error_collector_; bool had_errors_; }; @@ -115,33 +112,19 @@ class SourceTreeDescriptorDatabase::SingleFileErrorCollector SourceTreeDescriptorDatabase::SourceTreeDescriptorDatabase( SourceTree* source_tree) - : source_tree_(source_tree), - fallback_database_(nullptr), - error_collector_(nullptr), - using_validation_error_collector_(false), - validation_error_collector_(this) {} - -SourceTreeDescriptorDatabase::SourceTreeDescriptorDatabase( - SourceTree* source_tree, DescriptorDatabase* fallback_database) - : source_tree_(source_tree), - fallback_database_(fallback_database), - error_collector_(nullptr), - using_validation_error_collector_(false), - validation_error_collector_(this) {} + : source_tree_(source_tree), + error_collector_(NULL), + using_validation_error_collector_(false), + validation_error_collector_(this) {} SourceTreeDescriptorDatabase::~SourceTreeDescriptorDatabase() {} -bool SourceTreeDescriptorDatabase::FindFileByName(const std::string& filename, - FileDescriptorProto* output) { - std::unique_ptr input(source_tree_->Open(filename)); - if (input == nullptr) { - if (fallback_database_ != nullptr && - fallback_database_->FindFileByName(filename, output)) { - return true; - } - if (error_collector_ != nullptr) { - error_collector_->AddError(filename, -1, 0, - source_tree_->GetLastErrorMessage()); +bool SourceTreeDescriptorDatabase::FindFileByName( + const string& filename, FileDescriptorProto* output) { + scoped_ptr input(source_tree_->Open(filename)); + if (input == NULL) { + if (error_collector_ != NULL) { + error_collector_->AddError(filename, -1, 0, "File not found."); } return false; } @@ -151,7 +134,7 @@ bool SourceTreeDescriptorDatabase::FindFileByName(const std::string& filename, io::Tokenizer tokenizer(input.get(), &file_error_collector); Parser parser; - if (error_collector_ != nullptr) { + if (error_collector_ != NULL) { parser.RecordErrorsTo(&file_error_collector); } if (using_validation_error_collector_) { @@ -160,16 +143,17 @@ bool SourceTreeDescriptorDatabase::FindFileByName(const std::string& filename, // Parse it. output->set_name(filename); - return parser.Parse(&tokenizer, output) && !file_error_collector.had_errors(); + return parser.Parse(&tokenizer, output) && + !file_error_collector.had_errors(); } bool SourceTreeDescriptorDatabase::FindFileContainingSymbol( - const std::string& symbol_name, FileDescriptorProto* output) { + const string& symbol_name, FileDescriptorProto* output) { return false; } bool SourceTreeDescriptorDatabase::FindFileContainingExtension( - const std::string& containing_type, int field_number, + const string& containing_type, int field_number, FileDescriptorProto* output) { return false; } @@ -177,81 +161,49 @@ bool SourceTreeDescriptorDatabase::FindFileContainingExtension( // ------------------------------------------------------------------- SourceTreeDescriptorDatabase::ValidationErrorCollector:: - ValidationErrorCollector(SourceTreeDescriptorDatabase* owner) - : owner_(owner) {} +ValidationErrorCollector(SourceTreeDescriptorDatabase* owner) + : owner_(owner) {} SourceTreeDescriptorDatabase::ValidationErrorCollector:: - ~ValidationErrorCollector() {} +~ValidationErrorCollector() {} void SourceTreeDescriptorDatabase::ValidationErrorCollector::AddError( - const std::string& filename, const std::string& element_name, - const Message* descriptor, ErrorLocation location, - const std::string& message) { - if (owner_->error_collector_ == nullptr) return; + const string& filename, + const string& element_name, + const Message* descriptor, + ErrorLocation location, + const string& message) { + if (owner_->error_collector_ == NULL) return; int line, column; - if (location == DescriptorPool::ErrorCollector::IMPORT) { - owner_->source_locations_.FindImport(descriptor, element_name, &line, - &column); - } else { - owner_->source_locations_.Find(descriptor, location, &line, &column); - } + owner_->source_locations_.Find(descriptor, location, &line, &column); owner_->error_collector_->AddError(filename, line, column, message); } -void SourceTreeDescriptorDatabase::ValidationErrorCollector::AddWarning( - const std::string& filename, const std::string& element_name, - const Message* descriptor, ErrorLocation location, - const std::string& message) { - if (owner_->error_collector_ == nullptr) return; - - int line, column; - if (location == DescriptorPool::ErrorCollector::IMPORT) { - owner_->source_locations_.FindImport(descriptor, element_name, &line, - &column); - } else { - owner_->source_locations_.Find(descriptor, location, &line, &column); - } - owner_->error_collector_->AddWarning(filename, line, column, message); -} - // =================================================================== Importer::Importer(SourceTree* source_tree, MultiFileErrorCollector* error_collector) - : database_(source_tree), - pool_(&database_, database_.GetValidationErrorCollector()) { - pool_.EnforceWeakDependencies(true); + : database_(source_tree), + pool_(&database_, database_.GetValidationErrorCollector()) { database_.RecordErrorsTo(error_collector); } Importer::~Importer() {} -const FileDescriptor* Importer::Import(const std::string& filename) { +const FileDescriptor* Importer::Import(const string& filename) { return pool_.FindFileByName(filename); } -void Importer::AddUnusedImportTrackFile(const std::string& file_name, - bool is_error) { - pool_.AddUnusedImportTrackFile(file_name, is_error); -} - -void Importer::ClearUnusedImportTrackFiles() { - pool_.ClearUnusedImportTrackFiles(); -} - - // =================================================================== SourceTree::~SourceTree() {} -std::string SourceTree::GetLastErrorMessage() { return "File not found."; } - DiskSourceTree::DiskSourceTree() {} DiskSourceTree::~DiskSourceTree() {} -static inline char LastChar(const std::string& str) { +static inline char LastChar(const string& str) { return str[str.size() - 1]; } @@ -274,7 +226,7 @@ static inline char LastChar(const std::string& str) { // then if foo/bar is a symbolic link, foo/bar/baz.proto will canonicalize // to a path which does not appear to be under foo, and thus the compiler // will complain that baz.proto is not inside the --proto_path. -static std::string CanonicalizePath(std::string path) { +static string CanonicalizePath(string path) { #ifdef _WIN32 // The Win32 API accepts forward slashes as a path delimiter even though // backslashes are standard. Let's avoid confusion and use only forward @@ -287,32 +239,34 @@ static std::string CanonicalizePath(std::string path) { } #endif - std::vector canonical_parts; - std::vector parts = Split( - path, "/", true); // Note: Removes empty parts. - for (const std::string& part : parts) { - if (part == ".") { + vector parts; + vector canonical_parts; + SplitStringUsing(path, "/", &parts); // Note: Removes empty parts. + for (int i = 0; i < parts.size(); i++) { + if (parts[i] == ".") { // Ignore. } else { - canonical_parts.push_back(part); + canonical_parts.push_back(parts[i]); } } - std::string result = Join(canonical_parts, "/"); + string result = JoinStrings(canonical_parts, "/"); if (!path.empty() && path[0] == '/') { // Restore leading slash. result = '/' + result; } - if (!path.empty() && LastChar(path) == '/' && !result.empty() && - LastChar(result) != '/') { + if (!path.empty() && LastChar(path) == '/' && + !result.empty() && LastChar(result) != '/') { // Restore trailing slash. result += '/'; } return result; } -static inline bool ContainsParentReference(const std::string& path) { - return path == ".." || HasPrefixString(path, "../") || - HasSuffixString(path, "/..") || path.find("/../") != std::string::npos; +static inline bool ContainsParentReference(const string& path) { + return path == ".." || + HasPrefixString(path, "../") || + HasSuffixString(path, "/..") || + path.find("/../") != string::npos; } // Maps a file from an old location to a new one. Typically, old_prefix is @@ -332,16 +286,18 @@ static inline bool ContainsParentReference(const std::string& path) { // assert(!ApplyMapping("foo/bar", "baz", "qux", &result)); // assert(!ApplyMapping("foo/bar", "baz", "qux", &result)); // assert(!ApplyMapping("foobar", "foo", "baz", &result)); -static bool ApplyMapping(const std::string& filename, - const std::string& old_prefix, - const std::string& new_prefix, std::string* result) { +static bool ApplyMapping(const string& filename, + const string& old_prefix, + const string& new_prefix, + string* result) { if (old_prefix.empty()) { // old_prefix matches any relative path. if (ContainsParentReference(filename)) { // We do not allow the file name to use "..". return false; } - if (HasPrefixString(filename, "/") || IsWindowsAbsolutePath(filename)) { + if (HasPrefixString(filename, "/") || + IsWindowsAbsolutePath(filename)) { // This is an absolute path, so it isn't matched by the empty string. return false; } @@ -370,7 +326,7 @@ static bool ApplyMapping(const std::string& filename, if (after_prefix_start != -1) { // Yep. So the prefixes are directories and the filename is a file // inside them. - std::string after_prefix = filename.substr(after_prefix_start); + string after_prefix = filename.substr(after_prefix_start); if (ContainsParentReference(after_prefix)) { // We do not allow the file name to use "..". return false; @@ -386,17 +342,18 @@ static bool ApplyMapping(const std::string& filename, return false; } -void DiskSourceTree::MapPath(const std::string& virtual_path, - const std::string& disk_path) { +void DiskSourceTree::MapPath(const string& virtual_path, + const string& disk_path) { mappings_.push_back(Mapping(virtual_path, CanonicalizePath(disk_path))); } DiskSourceTree::DiskFileToVirtualFileResult -DiskSourceTree::DiskFileToVirtualFile(const std::string& disk_file, - std::string* virtual_file, - std::string* shadowing_disk_file) { +DiskSourceTree::DiskFileToVirtualFile( + const string& disk_file, + string* virtual_file, + string* shadowing_disk_file) { int mapping_index = -1; - std::string canonical_disk_file = CanonicalizePath(disk_file); + string canonical_disk_file = CanonicalizePath(disk_file); for (int i = 0; i < mappings_.size(); i++) { // Apply the mapping in reverse. @@ -428,49 +385,43 @@ DiskSourceTree::DiskFileToVirtualFile(const std::string& disk_file, // Verify that we can open the file. Note that this also has the side-effect // of verifying that we are not canonicalizing away any non-existent // directories. - std::unique_ptr stream(OpenDiskFile(disk_file)); - if (stream == nullptr) { + scoped_ptr stream(OpenDiskFile(disk_file)); + if (stream == NULL) { return CANNOT_OPEN; } return SUCCESS; } -bool DiskSourceTree::VirtualFileToDiskFile(const std::string& virtual_file, - std::string* disk_file) { - std::unique_ptr stream( - OpenVirtualFile(virtual_file, disk_file)); - return stream != nullptr; -} - -io::ZeroCopyInputStream* DiskSourceTree::Open(const std::string& filename) { - return OpenVirtualFile(filename, nullptr); +bool DiskSourceTree::VirtualFileToDiskFile(const string& virtual_file, + string* disk_file) { + scoped_ptr stream(OpenVirtualFile(virtual_file, + disk_file)); + return stream != NULL; } -std::string DiskSourceTree::GetLastErrorMessage() { - return last_error_message_; +io::ZeroCopyInputStream* DiskSourceTree::Open(const string& filename) { + return OpenVirtualFile(filename, NULL); } io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile( - const std::string& virtual_file, std::string* disk_file) { + const string& virtual_file, + string* disk_file) { if (virtual_file != CanonicalizePath(virtual_file) || ContainsParentReference(virtual_file)) { // We do not allow importing of paths containing things like ".." or // consecutive slashes since the compiler expects files to be uniquely // identified by file name. - last_error_message_ = - "Backslashes, consecutive slashes, \".\", or \"..\" " - "are not allowed in the virtual path"; - return nullptr; + return NULL; } - for (const auto& mapping : mappings_) { - std::string temp_disk_file; - if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path, - &temp_disk_file)) { + for (int i = 0; i < mappings_.size(); i++) { + string temp_disk_file; + if (ApplyMapping(virtual_file, mappings_[i].virtual_path, + mappings_[i].disk_path, &temp_disk_file)) { io::ZeroCopyInputStream* stream = OpenDiskFile(temp_disk_file); - if (stream != nullptr) { - if (disk_file != nullptr) { + if (stream != NULL) { + if (disk_file != NULL) { *disk_file = temp_disk_file; } return stream; @@ -478,34 +429,18 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile( if (errno == EACCES) { // The file exists but is not readable. - last_error_message_ = - "Read access is denied for file: " + temp_disk_file; - return nullptr; + // TODO(kenton): Find a way to report this more nicely. + GOOGLE_LOG(WARNING) << "Read access is denied for file: " << temp_disk_file; + return NULL; } } } - last_error_message_ = "File not found."; - return nullptr; + + return NULL; } 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 nullptr; - } -#else - if (ret == 0 && S_ISDIR(sb.st_mode)) { - last_error_message_ = "Input file is a directory."; - return nullptr; - } -#endif + const string& filename) { int file_descriptor; do { file_descriptor = open(filename.c_str(), O_RDONLY); @@ -515,7 +450,7 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenDiskFile( result->SetCloseOnDelete(true); return result; } else { - return nullptr; + return NULL; } } diff --git a/depends/protobuf/src/google/protobuf/compiler/importer.h b/depends/protobuf/google/protobuf/compiler/importer.h similarity index 72% rename from depends/protobuf/src/google/protobuf/compiler/importer.h rename to depends/protobuf/google/protobuf/compiler/importer.h index 2fb88b923..7a2efc297 100644 --- a/depends/protobuf/src/google/protobuf/compiler/importer.h +++ b/depends/protobuf/google/protobuf/compiler/importer.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,24 +37,18 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_IMPORTER_H__ #define GOOGLE_PROTOBUF_COMPILER_IMPORTER_H__ -#include #include -#include #include - -#include +#include +#include #include #include - -// Must be included last. -#include +#include namespace google { namespace protobuf { -namespace io { -class ZeroCopyInputStream; -} +namespace io { class ZeroCopyInputStream; } namespace compiler { @@ -79,15 +73,10 @@ class DiskSourceTree; // // Note: This class does not implement FindFileContainingSymbol() or // FindFileContainingExtension(); these will always return false. -class PROTOBUF_EXPORT SourceTreeDescriptorDatabase : public DescriptorDatabase { +class LIBPROTOBUF_EXPORT SourceTreeDescriptorDatabase : public DescriptorDatabase { public: SourceTreeDescriptorDatabase(SourceTree* source_tree); - - // If non-NULL, fallback_database will be checked if a file doesn't exist in - // the specified source_tree. - SourceTreeDescriptorDatabase(SourceTree* source_tree, - DescriptorDatabase* fallback_database); - ~SourceTreeDescriptorDatabase() override; + ~SourceTreeDescriptorDatabase(); // Instructs the SourceTreeDescriptorDatabase to report any parse errors // to the given MultiFileErrorCollector. This should be called before @@ -107,36 +96,30 @@ class PROTOBUF_EXPORT SourceTreeDescriptorDatabase : public DescriptorDatabase { } // implements DescriptorDatabase ----------------------------------- - bool FindFileByName(const std::string& filename, - FileDescriptorProto* output) override; - bool FindFileContainingSymbol(const std::string& symbol_name, - FileDescriptorProto* output) override; - bool FindFileContainingExtension(const std::string& containing_type, + bool FindFileByName(const string& filename, FileDescriptorProto* output); + bool FindFileContainingSymbol(const string& symbol_name, + FileDescriptorProto* output); + bool FindFileContainingExtension(const string& containing_type, int field_number, - FileDescriptorProto* output) override; + FileDescriptorProto* output); private: class SingleFileErrorCollector; SourceTree* source_tree_; - DescriptorDatabase* fallback_database_; MultiFileErrorCollector* error_collector_; - class PROTOBUF_EXPORT ValidationErrorCollector - : public DescriptorPool::ErrorCollector { + class LIBPROTOBUF_EXPORT ValidationErrorCollector : public DescriptorPool::ErrorCollector { public: ValidationErrorCollector(SourceTreeDescriptorDatabase* owner); - ~ValidationErrorCollector() override; + ~ValidationErrorCollector(); // implements ErrorCollector --------------------------------------- - void AddError(const std::string& filename, const std::string& element_name, - const Message* descriptor, ErrorLocation location, - const std::string& message) override; - - void AddWarning(const std::string& filename, - const std::string& element_name, const Message* descriptor, - ErrorLocation location, - const std::string& message) override; + void AddError(const string& filename, + const string& element_name, + const Message* descriptor, + ErrorLocation location, + const string& message); private: SourceTreeDescriptorDatabase* owner_; @@ -156,9 +139,10 @@ class PROTOBUF_EXPORT SourceTreeDescriptorDatabase : public DescriptorDatabase { // You may find that SourceTreeDescriptorDatabase is more flexible. // // TODO(kenton): I feel like this class is not well-named. -class PROTOBUF_EXPORT Importer { +class LIBPROTOBUF_EXPORT Importer { public: - Importer(SourceTree* source_tree, MultiFileErrorCollector* error_collector); + Importer(SourceTree* source_tree, + MultiFileErrorCollector* error_collector); ~Importer(); // Import the given file and build a FileDescriptor representing it. If @@ -174,16 +158,13 @@ class PROTOBUF_EXPORT Importer { // you want to see errors for the same files repeatedly, you can use a // separate Importer object to import each one (but use the same // DescriptorPool so that they can be cross-linked). - const FileDescriptor* Import(const std::string& filename); + const FileDescriptor* Import(const string& filename); // The DescriptorPool in which all imported FileDescriptors and their // contents are stored. - inline const DescriptorPool* pool() const { return &pool_; } - - void AddUnusedImportTrackFile(const std::string& file_name, - bool is_error = false); - void ClearUnusedImportTrackFiles(); - + inline const DescriptorPool* pool() const { + return &pool_; + } private: SourceTreeDescriptorDatabase database_; @@ -194,18 +175,15 @@ class PROTOBUF_EXPORT Importer { // If the importer encounters problems while trying to import the proto files, // it reports them to a MultiFileErrorCollector. -class PROTOBUF_EXPORT MultiFileErrorCollector { +class LIBPROTOBUF_EXPORT MultiFileErrorCollector { public: inline MultiFileErrorCollector() {} virtual ~MultiFileErrorCollector(); // Line and column numbers are zero-based. A line number of -1 indicates // an error with the entire file (e.g. "not found"). - 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 AddError(const string& filename, int line, int column, + const string& message) = 0; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MultiFileErrorCollector); @@ -215,7 +193,7 @@ class PROTOBUF_EXPORT MultiFileErrorCollector { // Used by the default implementation of Importer to resolve import statements // Most users will probably want to use the DiskSourceTree implementation, // below. -class PROTOBUF_EXPORT SourceTree { +class LIBPROTOBUF_EXPORT SourceTree { public: inline SourceTree() {} virtual ~SourceTree(); @@ -224,14 +202,7 @@ class PROTOBUF_EXPORT SourceTree { // found. The caller takes ownership of the returned object. The filename // must be a path relative to the root of the source tree and must not // contain "." or ".." components. - virtual io::ZeroCopyInputStream* Open(const std::string& filename) = 0; - - // If Open() returns NULL, calling this method immediately will return an - // description of the error. - // Subclasses should implement this method and return a meaningful value for - // better error reporting. - // TODO(xiaofeng): change this to a pure virtual function. - virtual std::string GetLastErrorMessage(); + virtual io::ZeroCopyInputStream* Open(const string& filename) = 0; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SourceTree); @@ -240,10 +211,10 @@ class PROTOBUF_EXPORT SourceTree { // An implementation of SourceTree which loads files from locations on disk. // Multiple mappings can be set up to map locations in the DiskSourceTree to // locations in the physical filesystem. -class PROTOBUF_EXPORT DiskSourceTree : public SourceTree { +class LIBPROTOBUF_EXPORT DiskSourceTree : public SourceTree { public: DiskSourceTree(); - ~DiskSourceTree() override; + ~DiskSourceTree(); // Map a path on disk to a location in the SourceTree. The path may be // either a file or a directory. If it is a directory, the entire tree @@ -257,11 +228,11 @@ 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 successfully. + // returning the first one that opens successfuly. // // disk_path may be an absolute path or relative to the current directory, // just like a path you'd pass to open(). - void MapPath(const std::string& virtual_path, const std::string& disk_path); + void MapPath(const string& virtual_path, const string& disk_path); // Return type for DiskFileToVirtualFile(). enum DiskFileToVirtualFileResult { @@ -291,48 +262,42 @@ class PROTOBUF_EXPORT DiskSourceTree : public SourceTree { // it is not useful. // * NO_MAPPING: Indicates that no mapping was found which contains this // file. - DiskFileToVirtualFileResult DiskFileToVirtualFile( - const std::string& disk_file, std::string* virtual_file, - std::string* shadowing_disk_file); + DiskFileToVirtualFileResult + DiskFileToVirtualFile(const string& disk_file, + string* virtual_file, + string* shadowing_disk_file); // Given a virtual path, find the path to the file on disk. // Return true and update disk_file with the on-disk path if the file exists. // Return false and leave disk_file untouched if the file doesn't exist. - bool VirtualFileToDiskFile(const std::string& virtual_file, - std::string* disk_file); + bool VirtualFileToDiskFile(const string& virtual_file, string* disk_file); // implements SourceTree ------------------------------------------- - io::ZeroCopyInputStream* Open(const std::string& filename) override; - - std::string GetLastErrorMessage() override; + io::ZeroCopyInputStream* Open(const string& filename); private: struct Mapping { - std::string virtual_path; - std::string disk_path; + string virtual_path; + string disk_path; - inline Mapping(const std::string& virtual_path_param, - const std::string& disk_path_param) - : virtual_path(virtual_path_param), disk_path(disk_path_param) {} + inline Mapping(const string& virtual_path, const string& disk_path) + : virtual_path(virtual_path), disk_path(disk_path) {} }; - std::vector mappings_; - std::string last_error_message_; + vector mappings_; // Like Open(), but returns the on-disk path in disk_file if disk_file is // non-NULL and the file could be successfully opened. - io::ZeroCopyInputStream* OpenVirtualFile(const std::string& virtual_file, - std::string* disk_file); + io::ZeroCopyInputStream* OpenVirtualFile(const string& virtual_file, + string* disk_file); // Like Open() but given the actual on-disk path. - io::ZeroCopyInputStream* OpenDiskFile(const std::string& filename); + io::ZeroCopyInputStream* OpenDiskFile(const string& filename); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DiskSourceTree); }; } // namespace compiler } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_IMPORTER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/zip_writer.h b/depends/protobuf/google/protobuf/compiler/main.cc similarity index 61% rename from depends/protobuf/src/google/protobuf/compiler/zip_writer.h rename to depends/protobuf/google/protobuf/compiler/main.cc index 5d7f69a40..4a17b87d9 100644 --- a/depends/protobuf/src/google/protobuf/compiler/zip_writer.h +++ b/depends/protobuf/google/protobuf/compiler/main.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -29,41 +29,33 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Author: kenton@google.com (Kenton Varda) -#ifndef GOOGLE_PROTOBUF_COMPILER_ZIP_WRITER_H__ -#define GOOGLE_PROTOBUF_COMPILER_ZIP_WRITER_H__ -#include -#include +#include +#include +//#include +//#include -#include -#include -namespace google { -namespace protobuf { -namespace compiler { +int main(int argc, char* argv[]) { -class ZipWriter { - public: - ZipWriter(io::ZeroCopyOutputStream* raw_output); - ~ZipWriter(); + google::protobuf::compiler::CommandLineInterface cli; + cli.AllowPlugins("protoc-"); - bool Write(const std::string& filename, const std::string& contents); - bool WriteDirectory(); + // Proto2 C++ + google::protobuf::compiler::cpp::CppGenerator cpp_generator; + cli.RegisterGenerator("--cpp_out", &cpp_generator, + "Generate C++ header and source."); - private: - struct FileInfo { - std::string name; - uint32_t offset; - uint32_t size; - uint32_t crc32; - }; + // Proto2 Java + //google::protobuf::compiler::java::JavaGenerator java_generator; + //cli.RegisterGenerator("--java_out", &java_generator, + // "Generate Java source file."); - io::ZeroCopyOutputStream* raw_output_; - std::vector files_; -}; -} // namespace compiler -} // namespace protobuf -} // namespace google + // Proto2 Python + //google::protobuf::compiler::python::Generator py_generator; + //cli.RegisterGenerator("--python_out", &py_generator, + // "Generate Python source file."); -#endif // GOOGLE_PROTOBUF_COMPILER_ZIP_WRITER_H__ + return cli.Run(argc, argv); +} diff --git a/depends/protobuf/google/protobuf/compiler/mock_code_generator.cc b/depends/protobuf/google/protobuf/compiler/mock_code_generator.cc new file mode 100644 index 000000000..5b76af257 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/mock_code_generator.cc @@ -0,0 +1,231 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { + +// Returns the list of the names of files in all_files in the form of a +// comma-separated string. +string CommaSeparatedList(const vector all_files) { + vector names; + for (int i = 0; i < all_files.size(); i++) { + names.push_back(all_files[i]->name()); + } + return JoinStrings(names, ","); +} + +static const char* kFirstInsertionPointName = "first_mock_insertion_point"; +static const char* kSecondInsertionPointName = "second_mock_insertion_point"; +static const char* kFirstInsertionPoint = + "# @@protoc_insertion_point(first_mock_insertion_point) is here\n"; +static const char* kSecondInsertionPoint = + " # @@protoc_insertion_point(second_mock_insertion_point) is here\n"; + +MockCodeGenerator::MockCodeGenerator(const string& name) + : name_(name) {} + +MockCodeGenerator::~MockCodeGenerator() {} + +void MockCodeGenerator::ExpectGenerated( + const string& name, + const string& parameter, + const string& insertions, + const string& file, + const string& first_message_name, + const string& first_parsed_file_name, + const string& output_directory) { + string content; + ASSERT_TRUE(File::ReadFileToString( + output_directory + "/" + GetOutputFileName(name, file), &content)); + + vector lines; + SplitStringUsing(content, "\n", &lines); + + while (!lines.empty() && lines.back().empty()) { + lines.pop_back(); + } + for (int i = 0; i < lines.size(); i++) { + lines[i] += "\n"; + } + + vector insertion_list; + if (!insertions.empty()) { + SplitStringUsing(insertions, ",", &insertion_list); + } + + ASSERT_EQ(lines.size(), 3 + insertion_list.size() * 2); + EXPECT_EQ(GetOutputFileContent(name, parameter, file, + first_parsed_file_name, first_message_name), + lines[0]); + + EXPECT_EQ(kFirstInsertionPoint, lines[1 + insertion_list.size()]); + EXPECT_EQ(kSecondInsertionPoint, lines[2 + insertion_list.size() * 2]); + + for (int i = 0; i < insertion_list.size(); i++) { + EXPECT_EQ(GetOutputFileContent(insertion_list[i], "first_insert", + file, file, first_message_name), + lines[1 + i]); + // Second insertion point is indented, so the inserted text should + // automatically be indented too. + EXPECT_EQ(" " + GetOutputFileContent(insertion_list[i], "second_insert", + file, file, first_message_name), + lines[2 + insertion_list.size() + i]); + } +} + +bool MockCodeGenerator::Generate( + const FileDescriptor* file, + const string& parameter, + GeneratorContext* context, + string* error) const { + for (int i = 0; i < file->message_type_count(); i++) { + if (HasPrefixString(file->message_type(i)->name(), "MockCodeGenerator_")) { + string command = StripPrefixString(file->message_type(i)->name(), + "MockCodeGenerator_"); + if (command == "Error") { + *error = "Saw message type MockCodeGenerator_Error."; + return false; + } else if (command == "Exit") { + cerr << "Saw message type MockCodeGenerator_Exit." << endl; + exit(123); + } else if (command == "Abort") { + cerr << "Saw message type MockCodeGenerator_Abort." << endl; + abort(); + } else { + GOOGLE_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command; + } + } + } + + if (HasPrefixString(parameter, "insert=")) { + vector insert_into; + SplitStringUsing(StripPrefixString(parameter, "insert="), + ",", &insert_into); + + for (int i = 0; i < insert_into.size(); i++) { + { + scoped_ptr output( + context->OpenForInsert( + GetOutputFileName(insert_into[i], file), + kFirstInsertionPointName)); + io::Printer printer(output.get(), '$'); + printer.PrintRaw(GetOutputFileContent(name_, "first_insert", + file, context)); + if (printer.failed()) { + *error = "MockCodeGenerator detected write error."; + return false; + } + } + + { + scoped_ptr output( + context->OpenForInsert( + GetOutputFileName(insert_into[i], file), + kSecondInsertionPointName)); + io::Printer printer(output.get(), '$'); + printer.PrintRaw(GetOutputFileContent(name_, "second_insert", + file, context)); + if (printer.failed()) { + *error = "MockCodeGenerator detected write error."; + return false; + } + } + } + } else { + scoped_ptr output( + context->Open(GetOutputFileName(name_, file))); + + io::Printer printer(output.get(), '$'); + printer.PrintRaw(GetOutputFileContent(name_, parameter, + file, context)); + printer.PrintRaw(kFirstInsertionPoint); + printer.PrintRaw(kSecondInsertionPoint); + + if (printer.failed()) { + *error = "MockCodeGenerator detected write error."; + return false; + } + } + + return true; +} + +string MockCodeGenerator::GetOutputFileName(const string& generator_name, + const FileDescriptor* file) { + return GetOutputFileName(generator_name, file->name()); +} + +string MockCodeGenerator::GetOutputFileName(const string& generator_name, + const string& file) { + return file + ".MockCodeGenerator." + generator_name; +} + +string MockCodeGenerator::GetOutputFileContent( + const string& generator_name, + const string& parameter, + const FileDescriptor* file, + GeneratorContext *context) { + vector all_files; + context->ListParsedFiles(&all_files); + return GetOutputFileContent( + generator_name, parameter, file->name(), + CommaSeparatedList(all_files), + file->message_type_count() > 0 ? + file->message_type(0)->name() : "(none)"); +} + +string MockCodeGenerator::GetOutputFileContent( + const string& generator_name, + const string& parameter, + const string& file, + const string& parsed_file_list, + const string& first_message_name) { + return strings::Substitute("$0: $1, $2, $3, $4\n", + generator_name, parameter, file, + first_message_name, parsed_file_list); +} + +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/mock_code_generator.h b/depends/protobuf/google/protobuf/compiler/mock_code_generator.h similarity index 57% rename from depends/protobuf/src/google/protobuf/compiler/mock_code_generator.h rename to depends/protobuf/google/protobuf/compiler/mock_code_generator.h index 45d735a30..5c7942bda 100644 --- a/depends/protobuf/src/google/protobuf/compiler/mock_code_generator.h +++ b/depends/protobuf/google/protobuf/compiler/mock_code_generator.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,17 +33,9 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_MOCK_CODE_GENERATOR_H__ #define GOOGLE_PROTOBUF_COMPILER_MOCK_CODE_GENERATOR_H__ -#include #include - #include -namespace google { -namespace protobuf { -class FileDescriptor; -} // namespace protobuf -} // namespace google - namespace google { namespace protobuf { namespace compiler { @@ -57,9 +49,7 @@ 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. 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. +// MockCodeGenerators. // // MockCodeGenerator will also modify its behavior slightly if the input file // contains a message type with one of the following names: @@ -69,16 +59,10 @@ namespace compiler { // MockCodeGenerator_Exit." to stderr and then calls exit(123). // MockCodeGenerator_Abort: Generate() prints "Saw message type // MockCodeGenerator_Abort." to stderr and then calls abort(). -// MockCodeGenerator_HasSourceCodeInfo: Causes Generate() to abort after -// printing "Saw message type MockCodeGenerator_HasSourceCodeInfo: FOO." to -// stderr, where FOO is "1" if the supplied FileDescriptorProto has source -// code info, and "0" otherwise. -// MockCodeGenerator_Annotate: Generate() will add annotations to its output -// that can later be verified with CheckGeneratedAnnotations. class MockCodeGenerator : public CodeGenerator { public: - MockCodeGenerator(const std::string& name); - ~MockCodeGenerator() override; + MockCodeGenerator(const string& name); + virtual ~MockCodeGenerator(); // Expect (via gTest) that a MockCodeGenerator with the given name was called // with the given parameters by inspecting the output location. @@ -87,50 +71,43 @@ class MockCodeGenerator : public CodeGenerator { // should have inserted lines into this file. // |parsed_file_list| is a comma-separated list of names of the files // that are being compiled together in this run. - static void ExpectGenerated(const std::string& name, - const std::string& parameter, - const std::string& insertions, - const std::string& file, - const std::string& first_message_name, - const std::string& parsed_file_list, - const std::string& output_directory); - - // Checks that the correct text ranges were annotated by the - // MockCodeGenerator_Annotate directive. - static void CheckGeneratedAnnotations(const std::string& name, - const std::string& file, - const std::string& output_directory); + static void ExpectGenerated(const string& name, + const string& parameter, + const string& insertions, + const string& file, + const string& first_message_name, + const string& parsed_file_list, + const string& output_directory); // Get the name of the file which would be written by the given generator. - static std::string GetOutputFileName(const std::string& generator_name, - const FileDescriptor* file); - static std::string GetOutputFileName(const std::string& generator_name, - const std::string& file); + static string GetOutputFileName(const string& generator_name, + const FileDescriptor* file); + static string GetOutputFileName(const string& generator_name, + const string& file); // implements CodeGenerator ---------------------------------------- - 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); + virtual bool Generate(const FileDescriptor* file, + const string& parameter, + GeneratorContext* context, + string* error) const; private: - std::string name_; - uint64_t suppressed_features_ = 0; - - static std::string GetOutputFileContent(const std::string& generator_name, - const std::string& parameter, - const FileDescriptor* file, - GeneratorContext* context); - static std::string GetOutputFileContent( - const std::string& generator_name, const std::string& parameter, - const std::string& file, const std::string& parsed_file_list, - const std::string& first_message_name); + string name_; + + static string GetOutputFileContent(const string& generator_name, + const string& parameter, + const FileDescriptor* file, + GeneratorContext *context); + static string GetOutputFileContent(const string& generator_name, + const string& parameter, + const string& file, + const string& parsed_file_list, + const string& first_message_name); }; } // namespace compiler } // namespace protobuf -} // namespace google +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_MOCK_CODE_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/package_info.h b/depends/protobuf/google/protobuf/compiler/package_info.h similarity index 98% rename from depends/protobuf/src/google/protobuf/compiler/package_info.h rename to depends/protobuf/google/protobuf/compiler/package_info.h index 105ef601a..b89712674 100644 --- a/depends/protobuf/src/google/protobuf/compiler/package_info.h +++ b/depends/protobuf/google/protobuf/compiler/package_info.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,6 +37,7 @@ // documentation generator. namespace google { + namespace protobuf { // Implementation of the Protocol Buffer compiler. diff --git a/depends/protobuf/google/protobuf/compiler/parser.cc b/depends/protobuf/google/protobuf/compiler/parser.cc new file mode 100644 index 000000000..34317b1fd --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/parser.cc @@ -0,0 +1,1473 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Recursive descent FTW. + +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { + +using internal::WireFormat; + +namespace { + +typedef hash_map TypeNameMap; + +TypeNameMap MakeTypeNameTable() { + TypeNameMap result; + + result["double" ] = FieldDescriptorProto::TYPE_DOUBLE; + result["float" ] = FieldDescriptorProto::TYPE_FLOAT; + result["uint64" ] = FieldDescriptorProto::TYPE_UINT64; + result["fixed64" ] = FieldDescriptorProto::TYPE_FIXED64; + result["fixed32" ] = FieldDescriptorProto::TYPE_FIXED32; + result["bool" ] = FieldDescriptorProto::TYPE_BOOL; + result["string" ] = FieldDescriptorProto::TYPE_STRING; + result["group" ] = FieldDescriptorProto::TYPE_GROUP; + + result["bytes" ] = FieldDescriptorProto::TYPE_BYTES; + result["uint32" ] = FieldDescriptorProto::TYPE_UINT32; + result["sfixed32"] = FieldDescriptorProto::TYPE_SFIXED32; + result["sfixed64"] = FieldDescriptorProto::TYPE_SFIXED64; + result["int32" ] = FieldDescriptorProto::TYPE_INT32; + result["int64" ] = FieldDescriptorProto::TYPE_INT64; + result["sint32" ] = FieldDescriptorProto::TYPE_SINT32; + result["sint64" ] = FieldDescriptorProto::TYPE_SINT64; + + return result; +} + +const TypeNameMap kTypeNames = MakeTypeNameTable(); + +} // anonymous namespace + +// Makes code slightly more readable. The meaning of "DO(foo)" is +// "Execute foo and fail if it fails.", where failure is indicated by +// returning false. +#define DO(STATEMENT) if (STATEMENT) {} else return false + +// =================================================================== + +Parser::Parser() + : input_(NULL), + error_collector_(NULL), + source_location_table_(NULL), + had_errors_(false), + require_syntax_identifier_(false), + stop_after_syntax_identifier_(false) { +} + +Parser::~Parser() { +} + +// =================================================================== + +inline bool Parser::LookingAt(const char* text) { + return input_->current().text == text; +} + +inline bool Parser::LookingAtType(io::Tokenizer::TokenType token_type) { + return input_->current().type == token_type; +} + +inline bool Parser::AtEnd() { + return LookingAtType(io::Tokenizer::TYPE_END); +} + +bool Parser::TryConsume(const char* text) { + if (LookingAt(text)) { + input_->Next(); + return true; + } else { + return false; + } +} + +bool Parser::Consume(const char* text, const char* error) { + if (TryConsume(text)) { + return true; + } else { + AddError(error); + return false; + } +} + +bool Parser::Consume(const char* text) { + if (TryConsume(text)) { + return true; + } else { + AddError("Expected \"" + string(text) + "\"."); + return false; + } +} + +bool Parser::ConsumeIdentifier(string* output, const char* error) { + if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { + *output = input_->current().text; + input_->Next(); + return true; + } else { + AddError(error); + return false; + } +} + +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, &value)) { + AddError("Integer out of range."); + // We still return true because we did, in fact, parse an integer. + } + *output = value; + input_->Next(); + return true; + } else { + AddError(error); + return false; + } +} + +bool Parser::ConsumeInteger64(uint64 max_value, uint64* output, + const char* error) { + if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { + if (!io::Tokenizer::ParseInteger(input_->current().text, max_value, + output)) { + AddError("Integer out of range."); + // We still return true because we did, in fact, parse an integer. + *output = 0; + } + input_->Next(); + return true; + } else { + AddError(error); + return false; + } +} + +bool Parser::ConsumeNumber(double* output, const char* error) { + if (LookingAtType(io::Tokenizer::TYPE_FLOAT)) { + *output = io::Tokenizer::ParseFloat(input_->current().text); + input_->Next(); + return true; + } else if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { + // Also accept integers. + uint64 value = 0; + if (!io::Tokenizer::ParseInteger(input_->current().text, + kuint64max, &value)) { + AddError("Integer out of range."); + // We still return true because we did, in fact, parse a number. + } + *output = value; + input_->Next(); + return true; + } else if (LookingAt("inf")) { + *output = numeric_limits::infinity(); + input_->Next(); + return true; + } else if (LookingAt("nan")) { + *output = numeric_limits::quiet_NaN(); + input_->Next(); + return true; + } else { + AddError(error); + return false; + } +} + +bool Parser::ConsumeString(string* output, const char* error) { + if (LookingAtType(io::Tokenizer::TYPE_STRING)) { + io::Tokenizer::ParseString(input_->current().text, output); + input_->Next(); + // Allow C++ like concatenation of adjacent string tokens. + while (LookingAtType(io::Tokenizer::TYPE_STRING)) { + io::Tokenizer::ParseStringAppend(input_->current().text, output); + input_->Next(); + } + return true; + } else { + AddError(error); + return false; + } +} + +// ------------------------------------------------------------------- + +void Parser::AddError(int line, int column, const string& error) { + if (error_collector_ != NULL) { + error_collector_->AddError(line, column, error); + } + had_errors_ = true; +} + +void Parser::AddError(const string& error) { + AddError(input_->current().line, input_->current().column, error); +} + +// ------------------------------------------------------------------- + +Parser::LocationRecorder::LocationRecorder(Parser* parser) + : parser_(parser), + location_(parser_->source_code_info_->add_location()) { + location_->add_span(parser_->input_->current().line); + location_->add_span(parser_->input_->current().column); +} + +Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent) { + Init(parent); +} + +Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent, + int path1) { + Init(parent); + AddPath(path1); +} + +Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent, + int path1, int path2) { + Init(parent); + AddPath(path1); + AddPath(path2); +} + +void Parser::LocationRecorder::Init(const LocationRecorder& parent) { + parser_ = parent.parser_; + location_ = parser_->source_code_info_->add_location(); + location_->mutable_path()->CopyFrom(parent.location_->path()); + + location_->add_span(parser_->input_->current().line); + location_->add_span(parser_->input_->current().column); +} + +Parser::LocationRecorder::~LocationRecorder() { + if (location_->span_size() <= 2) { + EndAt(parser_->input_->previous()); + } +} + +void Parser::LocationRecorder::AddPath(int path_component) { + location_->add_path(path_component); +} + +void Parser::LocationRecorder::StartAt(const io::Tokenizer::Token& token) { + location_->set_span(0, token.line); + location_->set_span(1, token.column); +} + +void Parser::LocationRecorder::EndAt(const io::Tokenizer::Token& token) { + if (token.line != location_->span(0)) { + location_->add_span(token.line); + } + location_->add_span(token.end_column); +} + +void Parser::LocationRecorder::RecordLegacyLocation(const Message* descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location) { + if (parser_->source_location_table_ != NULL) { + parser_->source_location_table_->Add( + descriptor, location, location_->span(0), location_->span(1)); + } +} + +// ------------------------------------------------------------------- + +void Parser::SkipStatement() { + while (true) { + if (AtEnd()) { + return; + } else if (LookingAtType(io::Tokenizer::TYPE_SYMBOL)) { + if (TryConsume(";")) { + return; + } else if (TryConsume("{")) { + SkipRestOfBlock(); + return; + } else if (LookingAt("}")) { + return; + } + } + input_->Next(); + } +} + +void Parser::SkipRestOfBlock() { + while (true) { + if (AtEnd()) { + return; + } else if (LookingAtType(io::Tokenizer::TYPE_SYMBOL)) { + if (TryConsume("}")) { + return; + } else if (TryConsume("{")) { + SkipRestOfBlock(); + } + } + input_->Next(); + } +} + +// =================================================================== + +bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { + input_ = input; + had_errors_ = false; + syntax_identifier_.clear(); + + // Note that |file| could be NULL at this point if + // stop_after_syntax_identifier_ is true. So, we conservatively allocate + // SourceCodeInfo on the stack, then swap it into the FileDescriptorProto + // later on. + SourceCodeInfo source_code_info; + source_code_info_ = &source_code_info; + + if (LookingAtType(io::Tokenizer::TYPE_START)) { + // Advance to first token. + input_->Next(); + } + + { + LocationRecorder root_location(this); + + if (require_syntax_identifier_ || LookingAt("syntax")) { + if (!ParseSyntaxIdentifier()) { + // Don't attempt to parse the file if we didn't recognize the syntax + // identifier. + return false; + } + } else if (!stop_after_syntax_identifier_) { + syntax_identifier_ = "proto2"; + } + + if (stop_after_syntax_identifier_) return !had_errors_; + + // Repeatedly parse statements until we reach the end of the file. + while (!AtEnd()) { + if (!ParseTopLevelStatement(file, root_location)) { + // This statement failed to parse. Skip it, but keep looping to parse + // other statements. + SkipStatement(); + + if (LookingAt("}")) { + AddError("Unmatched \"}\"."); + input_->Next(); + } + } + } + } + + input_ = NULL; + source_code_info_ = NULL; + source_code_info.Swap(file->mutable_source_code_info()); + return !had_errors_; +} + +bool Parser::ParseSyntaxIdentifier() { + DO(Consume("syntax", "File must begin with 'syntax = \"proto2\";'.")); + DO(Consume("=")); + io::Tokenizer::Token syntax_token = input_->current(); + string syntax; + DO(ConsumeString(&syntax, "Expected syntax identifier.")); + DO(Consume(";")); + + syntax_identifier_ = syntax; + + if (syntax != "proto2" && !stop_after_syntax_identifier_) { + AddError(syntax_token.line, syntax_token.column, + "Unrecognized syntax identifier \"" + syntax + "\". This parser " + "only recognizes \"proto2\"."); + return false; + } + + return true; +} + +bool Parser::ParseTopLevelStatement(FileDescriptorProto* file, + const LocationRecorder& root_location) { + if (TryConsume(";")) { + // empty statement; ignore + return true; + } else if (LookingAt("message")) { + LocationRecorder location(root_location, + FileDescriptorProto::kMessageTypeFieldNumber, file->message_type_size()); + return ParseMessageDefinition(file->add_message_type(), location); + } else if (LookingAt("enum")) { + LocationRecorder location(root_location, + FileDescriptorProto::kEnumTypeFieldNumber, file->enum_type_size()); + return ParseEnumDefinition(file->add_enum_type(), location); + } else if (LookingAt("service")) { + LocationRecorder location(root_location, + FileDescriptorProto::kServiceFieldNumber, file->service_size()); + return ParseServiceDefinition(file->add_service(), location); + } else if (LookingAt("extend")) { + LocationRecorder location(root_location, + FileDescriptorProto::kExtensionFieldNumber); + return ParseExtend(file->mutable_extension(), + file->mutable_message_type(), + root_location, + FileDescriptorProto::kMessageTypeFieldNumber, + location); + } else if (LookingAt("import")) { + int index = file->dependency_size(); + return ParseImport(file->add_dependency(), root_location, index); + } else if (LookingAt("package")) { + return ParsePackage(file, root_location); + } else if (LookingAt("option")) { + LocationRecorder location(root_location, + FileDescriptorProto::kOptionsFieldNumber); + return ParseOption(file->mutable_options(), location); + } else { + AddError("Expected top-level statement (e.g. \"message\")."); + return false; + } +} + +// ------------------------------------------------------------------- +// Messages + +bool Parser::ParseMessageDefinition(DescriptorProto* message, + const LocationRecorder& message_location) { + DO(Consume("message")); + { + LocationRecorder location(message_location, + DescriptorProto::kNameFieldNumber); + location.RecordLegacyLocation( + message, DescriptorPool::ErrorCollector::NAME); + DO(ConsumeIdentifier(message->mutable_name(), "Expected message name.")); + } + DO(ParseMessageBlock(message, message_location)); + return true; +} + +bool Parser::ParseMessageBlock(DescriptorProto* message, + const LocationRecorder& message_location) { + DO(Consume("{")); + + while (!TryConsume("}")) { + if (AtEnd()) { + AddError("Reached end of input in message definition (missing '}')."); + return false; + } + + if (!ParseMessageStatement(message, message_location)) { + // This statement failed to parse. Skip it, but keep looping to parse + // other statements. + SkipStatement(); + } + } + + return true; +} + +bool Parser::ParseMessageStatement(DescriptorProto* message, + const LocationRecorder& message_location) { + if (TryConsume(";")) { + // empty statement; ignore + return true; + } else if (LookingAt("message")) { + LocationRecorder location(message_location, + DescriptorProto::kNestedTypeFieldNumber, + message->nested_type_size()); + return ParseMessageDefinition(message->add_nested_type(), location); + } else if (LookingAt("enum")) { + LocationRecorder location(message_location, + DescriptorProto::kEnumTypeFieldNumber, + message->enum_type_size()); + return ParseEnumDefinition(message->add_enum_type(), location); + } else if (LookingAt("extensions")) { + LocationRecorder location(message_location, + DescriptorProto::kExtensionRangeFieldNumber); + return ParseExtensions(message, location); + } else if (LookingAt("extend")) { + LocationRecorder location(message_location, + DescriptorProto::kExtensionFieldNumber); + return ParseExtend(message->mutable_extension(), + message->mutable_nested_type(), + message_location, + DescriptorProto::kNestedTypeFieldNumber, + location); + } else if (LookingAt("option")) { + LocationRecorder location(message_location, + DescriptorProto::kOptionsFieldNumber); + return ParseOption(message->mutable_options(), location); + } else { + LocationRecorder location(message_location, + DescriptorProto::kFieldFieldNumber, + message->field_size()); + return ParseMessageField(message->add_field(), + message->mutable_nested_type(), + message_location, + DescriptorProto::kNestedTypeFieldNumber, + location); + } +} + +bool Parser::ParseMessageField(FieldDescriptorProto* field, + RepeatedPtrField* messages, + const LocationRecorder& parent_location, + int location_field_number_for_nested_type, + const LocationRecorder& field_location) { + // Parse label and type. + io::Tokenizer::Token label_token = input_->current(); + { + LocationRecorder location(field_location, + FieldDescriptorProto::kLabelFieldNumber); + FieldDescriptorProto::Label label; + DO(ParseLabel(&label)); + field->set_label(label); + } + + { + LocationRecorder location(field_location); // add path later + location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::TYPE); + + FieldDescriptorProto::Type type = FieldDescriptorProto::TYPE_INT32; + string type_name; + DO(ParseType(&type, &type_name)); + if (type_name.empty()) { + location.AddPath(FieldDescriptorProto::kTypeFieldNumber); + field->set_type(type); + } else { + location.AddPath(FieldDescriptorProto::kTypeNameFieldNumber); + field->set_type_name(type_name); + } + } + + // Parse name and '='. + io::Tokenizer::Token name_token = input_->current(); + { + LocationRecorder location(field_location, + FieldDescriptorProto::kNameFieldNumber); + location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::NAME); + DO(ConsumeIdentifier(field->mutable_name(), "Expected field name.")); + } + DO(Consume("=", "Missing field number.")); + + // Parse field number. + { + LocationRecorder location(field_location, + FieldDescriptorProto::kNumberFieldNumber); + location.RecordLegacyLocation( + field, DescriptorPool::ErrorCollector::NUMBER); + int number; + DO(ConsumeInteger(&number, "Expected field number.")); + field->set_number(number); + } + + // Parse options. + DO(ParseFieldOptions(field, field_location)); + + // Deal with groups. + if (field->has_type() && field->type() == FieldDescriptorProto::TYPE_GROUP) { + // Awkward: Since a group declares both a message type and a field, we + // have to create overlapping locations. + LocationRecorder group_location(parent_location); + group_location.StartAt(label_token); + group_location.AddPath(location_field_number_for_nested_type); + group_location.AddPath(messages->size()); + + DescriptorProto* group = messages->Add(); + group->set_name(field->name()); + + // Record name location to match the field name's location. + { + LocationRecorder location(group_location, + DescriptorProto::kNameFieldNumber); + location.StartAt(name_token); + location.EndAt(name_token); + location.RecordLegacyLocation( + group, DescriptorPool::ErrorCollector::NAME); + } + + // The field's type_name also comes from the name. Confusing! + { + LocationRecorder location(field_location, + FieldDescriptorProto::kTypeNameFieldNumber); + location.StartAt(name_token); + location.EndAt(name_token); + } + + // As a hack for backwards-compatibility, we force the group name to start + // with a capital letter and lower-case the field name. New code should + // not use groups; it should use nested messages. + if (group->name()[0] < 'A' || 'Z' < group->name()[0]) { + AddError(name_token.line, name_token.column, + "Group names must start with a capital letter."); + } + LowerString(field->mutable_name()); + + field->set_type_name(group->name()); + if (LookingAt("{")) { + DO(ParseMessageBlock(group, group_location)); + } else { + AddError("Missing group body."); + return false; + } + } else { + DO(Consume(";")); + } + + return true; +} + +bool Parser::ParseFieldOptions(FieldDescriptorProto* field, + const LocationRecorder& field_location) { + if (!LookingAt("[")) return true; + + LocationRecorder location(field_location, + FieldDescriptorProto::kOptionsFieldNumber); + + DO(Consume("[")); + + // Parse field options. + do { + if (LookingAt("default")) { + // We intentionally pass field_location rather than location here, since + // the default value is not actually an option. + DO(ParseDefaultAssignment(field, field_location)); + } else { + DO(ParseOptionAssignment(field->mutable_options(), location)); + } + } while (TryConsume(",")); + + DO(Consume("]")); + return true; +} + +bool Parser::ParseDefaultAssignment(FieldDescriptorProto* field, + const LocationRecorder& field_location) { + if (field->has_default_value()) { + AddError("Already set option \"default\"."); + field->clear_default_value(); + } + + DO(Consume("default")); + DO(Consume("=")); + + LocationRecorder location(field_location, + FieldDescriptorProto::kDefaultValueFieldNumber); + location.RecordLegacyLocation( + field, DescriptorPool::ErrorCollector::DEFAULT_VALUE); + string* default_value = field->mutable_default_value(); + + if (!field->has_type()) { + // The field has a type name, but we don't know if it is a message or an + // enum yet. Assume an enum for now. + DO(ConsumeIdentifier(default_value, "Expected identifier.")); + return true; + } + + switch (field->type()) { + case FieldDescriptorProto::TYPE_INT32: + case FieldDescriptorProto::TYPE_INT64: + case FieldDescriptorProto::TYPE_SINT32: + case FieldDescriptorProto::TYPE_SINT64: + case FieldDescriptorProto::TYPE_SFIXED32: + case FieldDescriptorProto::TYPE_SFIXED64: { + uint64 max_value = kint64max; + if (field->type() == FieldDescriptorProto::TYPE_INT32 || + field->type() == FieldDescriptorProto::TYPE_SINT32 || + field->type() == FieldDescriptorProto::TYPE_SFIXED32) { + max_value = kint32max; + } + + // These types can be negative. + if (TryConsume("-")) { + default_value->append("-"); + // Two's complement always has one more negative value than positive. + ++max_value; + } + // Parse the integer to verify that it is not out-of-range. + uint64 value; + DO(ConsumeInteger64(max_value, &value, "Expected integer.")); + // And stringify it again. + default_value->append(SimpleItoa(value)); + break; + } + + case FieldDescriptorProto::TYPE_UINT32: + case FieldDescriptorProto::TYPE_UINT64: + case FieldDescriptorProto::TYPE_FIXED32: + case FieldDescriptorProto::TYPE_FIXED64: { + uint64 max_value = kuint64max; + if (field->type() == FieldDescriptorProto::TYPE_UINT32 || + field->type() == FieldDescriptorProto::TYPE_FIXED32) { + max_value = kuint32max; + } + + // Numeric, not negative. + if (TryConsume("-")) { + AddError("Unsigned field can't have negative default value."); + } + // Parse the integer to verify that it is not out-of-range. + uint64 value; + DO(ConsumeInteger64(max_value, &value, "Expected integer.")); + // And stringify it again. + default_value->append(SimpleItoa(value)); + break; + } + + case FieldDescriptorProto::TYPE_FLOAT: + case FieldDescriptorProto::TYPE_DOUBLE: + // These types can be negative. + if (TryConsume("-")) { + default_value->append("-"); + } + // Parse the integer because we have to convert hex integers to decimal + // floats. + double value; + DO(ConsumeNumber(&value, "Expected number.")); + // And stringify it again. + default_value->append(SimpleDtoa(value)); + break; + + case FieldDescriptorProto::TYPE_BOOL: + if (TryConsume("true")) { + default_value->assign("true"); + } else if (TryConsume("false")) { + default_value->assign("false"); + } else { + AddError("Expected \"true\" or \"false\"."); + return false; + } + break; + + case FieldDescriptorProto::TYPE_STRING: + DO(ConsumeString(default_value, "Expected string.")); + break; + + case FieldDescriptorProto::TYPE_BYTES: + DO(ConsumeString(default_value, "Expected string.")); + *default_value = CEscape(*default_value); + break; + + case FieldDescriptorProto::TYPE_ENUM: + DO(ConsumeIdentifier(default_value, "Expected identifier.")); + break; + + case FieldDescriptorProto::TYPE_MESSAGE: + case FieldDescriptorProto::TYPE_GROUP: + AddError("Messages can't have default values."); + return false; + } + + return true; +} + +bool Parser::ParseOptionNamePart(UninterpretedOption* uninterpreted_option, + const LocationRecorder& part_location) { + UninterpretedOption::NamePart* name = uninterpreted_option->add_name(); + string identifier; // We parse identifiers into this string. + if (LookingAt("(")) { // This is an extension. + DO(Consume("(")); + + { + LocationRecorder location( + part_location, UninterpretedOption::NamePart::kNamePartFieldNumber); + // An extension name consists of dot-separated identifiers, and may begin + // with a dot. + if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { + DO(ConsumeIdentifier(&identifier, "Expected identifier.")); + name->mutable_name_part()->append(identifier); + } + while (LookingAt(".")) { + DO(Consume(".")); + name->mutable_name_part()->append("."); + DO(ConsumeIdentifier(&identifier, "Expected identifier.")); + name->mutable_name_part()->append(identifier); + } + } + + DO(Consume(")")); + name->set_is_extension(true); + } else { // This is a regular field. + LocationRecorder location( + part_location, UninterpretedOption::NamePart::kNamePartFieldNumber); + DO(ConsumeIdentifier(&identifier, "Expected identifier.")); + name->mutable_name_part()->append(identifier); + name->set_is_extension(false); + } + return true; +} + +bool Parser::ParseUninterpretedBlock(string* value) { + // Note that enclosing braces are not added to *value. + DO(Consume("{")); + int brace_depth = 1; + while (!AtEnd()) { + if (LookingAt("{")) { + brace_depth++; + } else if (LookingAt("}")) { + brace_depth--; + if (brace_depth == 0) { + input_->Next(); + return true; + } + } + // TODO(sanjay): Interpret line/column numbers to preserve formatting + if (!value->empty()) value->push_back(' '); + value->append(input_->current().text); + input_->Next(); + } + AddError("Unexpected end of stream while parsing aggregate value."); + return false; +} + +// We don't interpret the option here. Instead we store it in an +// UninterpretedOption, to be interpreted later. +bool Parser::ParseOptionAssignment(Message* options, + const LocationRecorder& options_location) { + // Create an entry in the uninterpreted_option field. + const FieldDescriptor* uninterpreted_option_field = options->GetDescriptor()-> + FindFieldByName("uninterpreted_option"); + GOOGLE_CHECK(uninterpreted_option_field != NULL) + << "No field named \"uninterpreted_option\" in the Options proto."; + + const Reflection* reflection = options->GetReflection(); + + LocationRecorder location( + options_location, uninterpreted_option_field->number(), + reflection->FieldSize(*options, uninterpreted_option_field)); + + UninterpretedOption* uninterpreted_option = down_cast( + options->GetReflection()->AddMessage(options, + uninterpreted_option_field)); + + // Parse dot-separated name. + { + LocationRecorder name_location(location, + UninterpretedOption::kNameFieldNumber); + name_location.RecordLegacyLocation( + uninterpreted_option, DescriptorPool::ErrorCollector::OPTION_NAME); + + { + LocationRecorder part_location(name_location, + uninterpreted_option->name_size()); + DO(ParseOptionNamePart(uninterpreted_option, part_location)); + } + + while (LookingAt(".")) { + DO(Consume(".")); + LocationRecorder part_location(name_location, + uninterpreted_option->name_size()); + DO(ParseOptionNamePart(uninterpreted_option, part_location)); + } + } + + DO(Consume("=")); + + LocationRecorder value_location(location); + value_location.RecordLegacyLocation( + uninterpreted_option, DescriptorPool::ErrorCollector::OPTION_VALUE); + + // All values are a single token, except for negative numbers, which consist + // of a single '-' symbol, followed by a positive number. + bool is_negative = TryConsume("-"); + + switch (input_->current().type) { + case io::Tokenizer::TYPE_START: + GOOGLE_LOG(FATAL) << "Trying to read value before any tokens have been read."; + return false; + + case io::Tokenizer::TYPE_END: + AddError("Unexpected end of stream while parsing option value."); + return false; + + case io::Tokenizer::TYPE_IDENTIFIER: { + value_location.AddPath(UninterpretedOption::kIdentifierValueFieldNumber); + if (is_negative) { + AddError("Invalid '-' symbol before identifier."); + return false; + } + string value; + DO(ConsumeIdentifier(&value, "Expected identifier.")); + uninterpreted_option->set_identifier_value(value); + break; + } + + case io::Tokenizer::TYPE_INTEGER: { + uint64 value; + uint64 max_value = + is_negative ? static_cast(kint64max) + 1 : kuint64max; + DO(ConsumeInteger64(max_value, &value, "Expected integer.")); + if (is_negative) { + value_location.AddPath( + UninterpretedOption::kNegativeIntValueFieldNumber); + uninterpreted_option->set_negative_int_value(-static_cast(value)); + } else { + value_location.AddPath( + UninterpretedOption::kPositiveIntValueFieldNumber); + uninterpreted_option->set_positive_int_value(value); + } + break; + } + + case io::Tokenizer::TYPE_FLOAT: { + value_location.AddPath(UninterpretedOption::kDoubleValueFieldNumber); + double value; + DO(ConsumeNumber(&value, "Expected number.")); + uninterpreted_option->set_double_value(is_negative ? -value : value); + break; + } + + case io::Tokenizer::TYPE_STRING: { + value_location.AddPath(UninterpretedOption::kStringValueFieldNumber); + if (is_negative) { + AddError("Invalid '-' symbol before string."); + return false; + } + string value; + DO(ConsumeString(&value, "Expected string.")); + uninterpreted_option->set_string_value(value); + break; + } + + case io::Tokenizer::TYPE_SYMBOL: + if (LookingAt("{")) { + value_location.AddPath(UninterpretedOption::kAggregateValueFieldNumber); + DO(ParseUninterpretedBlock( + uninterpreted_option->mutable_aggregate_value())); + } else { + AddError("Expected option value."); + return false; + } + break; + } + + return true; +} + +bool Parser::ParseExtensions(DescriptorProto* message, + const LocationRecorder& extensions_location) { + // Parse the declaration. + DO(Consume("extensions")); + + do { + // Note that kExtensionRangeFieldNumber was already pushed by the parent. + LocationRecorder location(extensions_location, + message->extension_range_size()); + + DescriptorProto::ExtensionRange* range = message->add_extension_range(); + location.RecordLegacyLocation( + range, DescriptorPool::ErrorCollector::NUMBER); + + int start, end; + io::Tokenizer::Token start_token; + + { + LocationRecorder start_location( + location, DescriptorProto::ExtensionRange::kStartFieldNumber); + start_token = input_->current(); + DO(ConsumeInteger(&start, "Expected field number range.")); + } + + if (TryConsume("to")) { + LocationRecorder end_location( + location, DescriptorProto::ExtensionRange::kEndFieldNumber); + if (TryConsume("max")) { + end = FieldDescriptor::kMaxNumber; + } else { + DO(ConsumeInteger(&end, "Expected integer.")); + } + } else { + LocationRecorder end_location( + location, DescriptorProto::ExtensionRange::kEndFieldNumber); + end_location.StartAt(start_token); + end_location.EndAt(start_token); + end = start; + } + + // Users like to specify inclusive ranges, but in code we like the end + // number to be exclusive. + ++end; + + range->set_start(start); + range->set_end(end); + } while (TryConsume(",")); + + DO(Consume(";")); + return true; +} + +bool Parser::ParseExtend(RepeatedPtrField* extensions, + RepeatedPtrField* messages, + const LocationRecorder& parent_location, + int location_field_number_for_nested_type, + const LocationRecorder& extend_location) { + DO(Consume("extend")); + + // Parse the extendee type. + io::Tokenizer::Token extendee_start = input_->current(); + string extendee; + DO(ParseUserDefinedType(&extendee)); + io::Tokenizer::Token extendee_end = input_->previous(); + + // Parse the block. + DO(Consume("{")); + + bool is_first = true; + + do { + if (AtEnd()) { + AddError("Reached end of input in extend definition (missing '}')."); + return false; + } + + // Note that kExtensionFieldNumber was already pushed by the parent. + LocationRecorder location(extend_location, extensions->size()); + + FieldDescriptorProto* field = extensions->Add(); + + { + LocationRecorder extendee_location( + location, FieldDescriptorProto::kExtendeeFieldNumber); + extendee_location.StartAt(extendee_start); + extendee_location.EndAt(extendee_end); + + if (is_first) { + extendee_location.RecordLegacyLocation( + field, DescriptorPool::ErrorCollector::EXTENDEE); + is_first = false; + } + } + + field->set_extendee(extendee); + + if (!ParseMessageField(field, messages, parent_location, + location_field_number_for_nested_type, + location)) { + // This statement failed to parse. Skip it, but keep looping to parse + // other statements. + SkipStatement(); + } + } while(!TryConsume("}")); + + return true; +} + +// ------------------------------------------------------------------- +// Enums + +bool Parser::ParseEnumDefinition(EnumDescriptorProto* enum_type, + const LocationRecorder& enum_location) { + DO(Consume("enum")); + + { + LocationRecorder location(enum_location, + EnumDescriptorProto::kNameFieldNumber); + location.RecordLegacyLocation( + enum_type, DescriptorPool::ErrorCollector::NAME); + DO(ConsumeIdentifier(enum_type->mutable_name(), "Expected enum name.")); + } + + DO(ParseEnumBlock(enum_type, enum_location)); + return true; +} + +bool Parser::ParseEnumBlock(EnumDescriptorProto* enum_type, + const LocationRecorder& enum_location) { + DO(Consume("{")); + + while (!TryConsume("}")) { + if (AtEnd()) { + AddError("Reached end of input in enum definition (missing '}')."); + return false; + } + + if (!ParseEnumStatement(enum_type, enum_location)) { + // This statement failed to parse. Skip it, but keep looping to parse + // other statements. + SkipStatement(); + } + } + + return true; +} + +bool Parser::ParseEnumStatement(EnumDescriptorProto* enum_type, + const LocationRecorder& enum_location) { + if (TryConsume(";")) { + // empty statement; ignore + return true; + } else if (LookingAt("option")) { + LocationRecorder location(enum_location, + EnumDescriptorProto::kOptionsFieldNumber); + return ParseOption(enum_type->mutable_options(), location); + } else { + LocationRecorder location(enum_location, + EnumDescriptorProto::kValueFieldNumber, enum_type->value_size()); + return ParseEnumConstant(enum_type->add_value(), location); + } +} + +bool Parser::ParseEnumConstant(EnumValueDescriptorProto* enum_value, + const LocationRecorder& enum_value_location) { + // Parse name. + { + LocationRecorder location(enum_value_location, + EnumValueDescriptorProto::kNameFieldNumber); + location.RecordLegacyLocation( + enum_value, DescriptorPool::ErrorCollector::NAME); + DO(ConsumeIdentifier(enum_value->mutable_name(), + "Expected enum constant name.")); + } + + DO(Consume("=", "Missing numeric value for enum constant.")); + + // Parse value. + { + LocationRecorder location( + enum_value_location, EnumValueDescriptorProto::kNumberFieldNumber); + location.RecordLegacyLocation( + enum_value, DescriptorPool::ErrorCollector::NUMBER); + + bool is_negative = TryConsume("-"); + int number; + DO(ConsumeInteger(&number, "Expected integer.")); + if (is_negative) number *= -1; + enum_value->set_number(number); + } + + DO(ParseEnumConstantOptions(enum_value, enum_value_location)); + + DO(Consume(";")); + + return true; +} + +bool Parser::ParseEnumConstantOptions( + EnumValueDescriptorProto* value, + const LocationRecorder& enum_value_location) { + if (!LookingAt("[")) return true; + + LocationRecorder location( + enum_value_location, EnumValueDescriptorProto::kOptionsFieldNumber); + + DO(Consume("[")); + + do { + DO(ParseOptionAssignment(value->mutable_options(), location)); + } while (TryConsume(",")); + + DO(Consume("]")); + return true; +} + +// ------------------------------------------------------------------- +// Services + +bool Parser::ParseServiceDefinition(ServiceDescriptorProto* service, + const LocationRecorder& service_location) { + DO(Consume("service")); + + { + LocationRecorder location(service_location, + ServiceDescriptorProto::kNameFieldNumber); + location.RecordLegacyLocation( + service, DescriptorPool::ErrorCollector::NAME); + DO(ConsumeIdentifier(service->mutable_name(), "Expected service name.")); + } + + DO(ParseServiceBlock(service, service_location)); + return true; +} + +bool Parser::ParseServiceBlock(ServiceDescriptorProto* service, + const LocationRecorder& service_location) { + DO(Consume("{")); + + while (!TryConsume("}")) { + if (AtEnd()) { + AddError("Reached end of input in service definition (missing '}')."); + return false; + } + + if (!ParseServiceStatement(service, service_location)) { + // This statement failed to parse. Skip it, but keep looping to parse + // other statements. + SkipStatement(); + } + } + + return true; +} + +bool Parser::ParseServiceStatement(ServiceDescriptorProto* service, + const LocationRecorder& service_location) { + if (TryConsume(";")) { + // empty statement; ignore + return true; + } else if (LookingAt("option")) { + LocationRecorder location( + service_location, ServiceDescriptorProto::kOptionsFieldNumber); + return ParseOption(service->mutable_options(), location); + } else { + LocationRecorder location(service_location, + ServiceDescriptorProto::kMethodFieldNumber, service->method_size()); + return ParseServiceMethod(service->add_method(), location); + } +} + +bool Parser::ParseServiceMethod(MethodDescriptorProto* method, + const LocationRecorder& method_location) { + DO(Consume("rpc")); + + { + LocationRecorder location(method_location, + MethodDescriptorProto::kNameFieldNumber); + location.RecordLegacyLocation( + method, DescriptorPool::ErrorCollector::NAME); + DO(ConsumeIdentifier(method->mutable_name(), "Expected method name.")); + } + + // Parse input type. + DO(Consume("(")); + { + LocationRecorder location(method_location, + MethodDescriptorProto::kInputTypeFieldNumber); + location.RecordLegacyLocation( + method, DescriptorPool::ErrorCollector::INPUT_TYPE); + DO(ParseUserDefinedType(method->mutable_input_type())); + } + DO(Consume(")")); + + // Parse output type. + DO(Consume("returns")); + DO(Consume("(")); + { + LocationRecorder location(method_location, + MethodDescriptorProto::kOutputTypeFieldNumber); + location.RecordLegacyLocation( + method, DescriptorPool::ErrorCollector::OUTPUT_TYPE); + DO(ParseUserDefinedType(method->mutable_output_type())); + } + DO(Consume(")")); + + if (TryConsume("{")) { + // Options! + while (!TryConsume("}")) { + if (AtEnd()) { + AddError("Reached end of input in method options (missing '}')."); + return false; + } + + if (TryConsume(";")) { + // empty statement; ignore + } else { + LocationRecorder location(method_location, + MethodDescriptorProto::kOptionsFieldNumber); + if (!ParseOption(method->mutable_options(), location)) { + // This statement failed to parse. Skip it, but keep looping to + // parse other statements. + SkipStatement(); + } + } + } + } else { + DO(Consume(";")); + } + + return true; +} + +// ------------------------------------------------------------------- + +bool Parser::ParseLabel(FieldDescriptorProto::Label* label) { + if (TryConsume("optional")) { + *label = FieldDescriptorProto::LABEL_OPTIONAL; + return true; + } else if (TryConsume("repeated")) { + *label = FieldDescriptorProto::LABEL_REPEATED; + return true; + } else if (TryConsume("required")) { + *label = FieldDescriptorProto::LABEL_REQUIRED; + return true; + } else { + AddError("Expected \"required\", \"optional\", or \"repeated\"."); + // We can actually reasonably recover here by just assuming the user + // forgot the label altogether. + *label = FieldDescriptorProto::LABEL_OPTIONAL; + return true; + } +} + +bool Parser::ParseType(FieldDescriptorProto::Type* type, + string* type_name) { + TypeNameMap::const_iterator iter = kTypeNames.find(input_->current().text); + if (iter != kTypeNames.end()) { + *type = iter->second; + input_->Next(); + } else { + DO(ParseUserDefinedType(type_name)); + } + return true; +} + +bool Parser::ParseUserDefinedType(string* type_name) { + type_name->clear(); + + TypeNameMap::const_iterator iter = kTypeNames.find(input_->current().text); + if (iter != kTypeNames.end()) { + // Note: The only place enum types are allowed is for field types, but + // if we are parsing a field type then we would not get here because + // primitives are allowed there as well. So this error message doesn't + // need to account for enums. + AddError("Expected message type."); + + // Pretend to accept this type so that we can go on parsing. + *type_name = input_->current().text; + input_->Next(); + return true; + } + + // A leading "." means the name is fully-qualified. + if (TryConsume(".")) type_name->append("."); + + // Consume the first part of the name. + string identifier; + DO(ConsumeIdentifier(&identifier, "Expected type name.")); + type_name->append(identifier); + + // Consume more parts. + while (TryConsume(".")) { + type_name->append("."); + DO(ConsumeIdentifier(&identifier, "Expected identifier.")); + type_name->append(identifier); + } + + return true; +} + +// =================================================================== + +bool Parser::ParsePackage(FileDescriptorProto* file, + const LocationRecorder& root_location) { + if (file->has_package()) { + AddError("Multiple package definitions."); + // Don't append the new package to the old one. Just replace it. Not + // that it really matters since this is an error anyway. + file->clear_package(); + } + + DO(Consume("package")); + + { + LocationRecorder location(root_location, + FileDescriptorProto::kPackageFieldNumber); + location.RecordLegacyLocation(file, DescriptorPool::ErrorCollector::NAME); + + while (true) { + string identifier; + DO(ConsumeIdentifier(&identifier, "Expected identifier.")); + file->mutable_package()->append(identifier); + if (!TryConsume(".")) break; + file->mutable_package()->append("."); + } + } + + DO(Consume(";")); + return true; +} + +bool Parser::ParseImport(string* import_filename, + const LocationRecorder& root_location, + int index) { + DO(Consume("import")); + { + LocationRecorder location(root_location, + FileDescriptorProto::kDependencyFieldNumber, + index); + DO(ConsumeString(import_filename, + "Expected a string naming the file to import.")); + } + DO(Consume(";")); + return true; +} + +bool Parser::ParseOption(Message* options, + const LocationRecorder& options_location) { + DO(Consume("option")); + DO(ParseOptionAssignment(options, options_location)); + DO(Consume(";")); + return true; +} + +// =================================================================== + +SourceLocationTable::SourceLocationTable() {} +SourceLocationTable::~SourceLocationTable() {} + +bool SourceLocationTable::Find( + const Message* descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location, + int* line, int* column) const { + const pair* result = + FindOrNull(location_map_, make_pair(descriptor, location)); + if (result == NULL) { + *line = -1; + *column = 0; + return false; + } else { + *line = result->first; + *column = result->second; + return true; + } +} + +void SourceLocationTable::Add( + const Message* descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location, + int line, int column) { + location_map_[make_pair(descriptor, location)] = make_pair(line, column); +} + +void SourceLocationTable::Clear() { + location_map_.clear(); +} + +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/parser.h b/depends/protobuf/google/protobuf/compiler/parser.h similarity index 62% rename from depends/protobuf/src/google/protobuf/compiler/parser.h rename to depends/protobuf/google/protobuf/compiler/parser.h index d4eb76302..4cc90a29a 100644 --- a/depends/protobuf/src/google/protobuf/compiler/parser.h +++ b/depends/protobuf/google/protobuf/compiler/parser.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,24 +37,19 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_PARSER_H__ #define GOOGLE_PROTOBUF_COMPILER_PARSER_H__ -#include #include #include #include - +#include #include #include -#include #include - -// Must be included last. -#include +#include namespace google { -namespace protobuf { - -class Message; +namespace protobuf { class Message; } +namespace protobuf { namespace compiler { // Defined in this file. @@ -68,7 +63,7 @@ class SourceLocationTable; // to a FileDescriptorProto. It does not resolve import directives or perform // many other kinds of validation needed to construct a complete // FileDescriptor. -class PROTOBUF_EXPORT Parser { +class LIBPROTOBUF_EXPORT Parser { public: Parser(); ~Parser(); @@ -77,7 +72,7 @@ class PROTOBUF_EXPORT Parser { // it. Returns true if no errors occurred, false otherwise. bool Parse(io::Tokenizer* input, FileDescriptorProto* file); - // Optional features: + // Optional fetaures: // DEPRECATED: New code should use the SourceCodeInfo embedded in the // FileDescriptorProto. @@ -98,7 +93,7 @@ class PROTOBUF_EXPORT Parser { // Returns the identifier used in the "syntax = " declaration, if one was // seen during the last call to Parse(), or the empty string otherwise. - const std::string& GetSyntaxIdentifier() { return syntax_identifier_; } + const string& GetSyntaxIdentifier() { return syntax_identifier_; } // If set true, input files will be required to begin with a syntax // identifier. Otherwise, files may omit this. If a syntax identifier @@ -121,9 +116,6 @@ class PROTOBUF_EXPORT Parser { } private: - class LocationRecorder; - struct MapField; - // ================================================================= // Error recovery helpers @@ -169,58 +161,34 @@ class PROTOBUF_EXPORT Parser { // where "text" is the expected token text. bool Consume(const char* text); // Consume a token of type IDENTIFIER and store its text in "output". - bool ConsumeIdentifier(std::string* output, const char* error); + bool ConsumeIdentifier(string* output, const char* error); // Consume an integer and store its value in "output". bool ConsumeInteger(int* output, const char* error); - // Consume a signed integer and store its value in "output". - 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_t max_value, uint64_t* output, - const char* error); + bool ConsumeInteger64(uint64 max_value, uint64* 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); // Consume a string literal and store its (unescaped) value in "output". - bool ConsumeString(std::string* output, const char* error); - - // Consume a token representing the end of the statement. Comments between - // this token and the next will be harvested for documentation. The given - // LocationRecorder should refer to the declaration that was just parsed; - // it will be populated with these comments. - // - // TODO(kenton): The LocationRecorder is const because historically locations - // have been passed around by const reference, for no particularly good - // reason. We should probably go through and change them all to mutable - // pointer to make this more intuitive. - bool TryConsumeEndOfDeclaration(const char* text, - const LocationRecorder* location); - bool TryConsumeEndOfDeclarationFinishScope(const char* text, - const LocationRecorder* location); - - bool ConsumeEndOfDeclaration(const char* text, - const LocationRecorder* location); + bool ConsumeString(string* output, const char* error); // ----------------------------------------------------------------- // Error logging helpers // Invokes error_collector_->AddError(), if error_collector_ is not NULL. - void AddError(int line, int column, const std::string& error); + void AddError(int line, int column, const string& error); // Invokes error_collector_->AddError() with the line and column number // of the current token. - void AddError(const std::string& error); - - // Invokes error_collector_->AddWarning() with the line and column number - // of the current token. - void AddWarning(const std::string& warning); + void AddError(const string& error); // Records a location in the SourceCodeInfo.location table (see // descriptor.proto). We use RAII to ensure that the start and end locations // are recorded -- the constructor records the start location and the // destructor records the end location. Since the parser is // recursive-descent, this works out beautifully. - class PROTOBUF_EXPORT LocationRecorder { + class LIBPROTOBUF_EXPORT LocationRecorder { public: // Construct the file's "root" location. LocationRecorder(Parser* parser); @@ -236,10 +204,6 @@ class PROTOBUF_EXPORT Parser { LocationRecorder(const LocationRecorder& parent, int path1); LocationRecorder(const LocationRecorder& parent, int path1, int path2); - // Creates a recorder that generates locations into given source code info. - LocationRecorder(const LocationRecorder& parent, int path1, - SourceCodeInfo* source_code_info); - ~LocationRecorder(); // Add a path component. See SourceCodeInfo.Location.path in @@ -251,9 +215,6 @@ class PROTOBUF_EXPORT Parser { // location to the given token instead. void StartAt(const io::Tokenizer::Token& token); - // Start at the same location as some other LocationRecorder. - void StartAt(const LocationRecorder& other); - // By default the location is considered to end at the previous token at // the time the LocationRecorder is destroyed. EndAt() sets the end // location to the given token instead. @@ -263,30 +224,14 @@ class PROTOBUF_EXPORT Parser { // was passed to RecordSourceLocationsTo(), if any. SourceLocationTable // is an older way of keeping track of source locations which is still // used in some places. - void RecordLegacyLocation( - const Message* descriptor, + void RecordLegacyLocation(const Message* descriptor, DescriptorPool::ErrorCollector::ErrorLocation location); - void RecordLegacyImportLocation(const Message* descriptor, - const std::string& name); - - // Returns the number of path components in the recorder's current location. - int CurrentPathSize() const; - - // Attaches leading and trailing comments to the location. The two strings - // will be swapped into place, so after this is called *leading and - // *trailing will be empty. - // - // TODO(kenton): See comment on TryConsumeEndOfDeclaration(), above, for - // why this is const. - void AttachComments(std::string* leading, std::string* trailing, - std::vector* detached_comments) const; private: Parser* parser_; - SourceCodeInfo* source_code_info_; SourceCodeInfo::Location* location_; - void Init(const LocationRecorder& parent, SourceCodeInfo* source_code_info); + void Init(const LocationRecorder& parent); }; // ================================================================= @@ -295,7 +240,7 @@ class PROTOBUF_EXPORT Parser { // Parses the "syntax = \"proto2\";" line at the top of the file. Returns // false if it failed to parse or if the syntax identifier was not // recognized. - bool ParseSyntaxIdentifier(const LocationRecorder& parent); + bool ParseSyntaxIdentifier(); // These methods parse various individual bits of code. They return // false if they completely fail to parse the construct. In this case, @@ -313,47 +258,37 @@ class PROTOBUF_EXPORT Parser { // Parse various language high-level language construrcts. bool ParseMessageDefinition(DescriptorProto* message, - const LocationRecorder& message_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& message_location); bool ParseEnumDefinition(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& enum_location); bool ParseServiceDefinition(ServiceDescriptorProto* service, - const LocationRecorder& service_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& service_location); bool ParsePackage(FileDescriptorProto* file, - const LocationRecorder& root_location, - const FileDescriptorProto* containing_file); - bool ParseImport(RepeatedPtrField* dependency, - RepeatedField* public_dependency, - RepeatedField* weak_dependency, + const LocationRecorder& root_location); + bool ParseImport(string* import_filename, const LocationRecorder& root_location, - const FileDescriptorProto* containing_file); + int index); + bool ParseOption(Message* options, + const LocationRecorder& options_location); // These methods parse the contents of a message, enum, or service type and // add them to the given object. They consume the entire block including // the beginning and ending brace. bool ParseMessageBlock(DescriptorProto* message, - const LocationRecorder& message_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& message_location); bool ParseEnumBlock(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& enum_location); bool ParseServiceBlock(ServiceDescriptorProto* service, - const LocationRecorder& service_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& service_location); - // Parse one statement within a message, enum, or service block, including + // Parse one statement within a message, enum, or service block, inclunding // final semicolon. bool ParseMessageStatement(DescriptorProto* message, - const LocationRecorder& message_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& message_location); bool ParseEnumStatement(EnumDescriptorProto* message, - const LocationRecorder& enum_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& enum_location); bool ParseServiceStatement(ServiceDescriptorProto* message, - const LocationRecorder& service_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& service_location); // Parse a field of a message. If the field is a group, its type will be // added to "messages". @@ -367,39 +302,11 @@ class PROTOBUF_EXPORT Parser { RepeatedPtrField* messages, const LocationRecorder& parent_location, int location_field_number_for_nested_type, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file); - - // Like ParseMessageField() but expects the label has already been filled in - // by the caller. - bool ParseMessageFieldNoLabel(FieldDescriptorProto* field, - RepeatedPtrField* messages, - const LocationRecorder& parent_location, - int location_field_number_for_nested_type, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file); - - bool ParseMapType(MapField* map_field, FieldDescriptorProto* field, - LocationRecorder& type_name_location); + const LocationRecorder& field_location); // Parse an "extensions" declaration. bool ParseExtensions(DescriptorProto* message, - const LocationRecorder& extensions_location, - const FileDescriptorProto* containing_file); - - // Parse a "reserved" declaration. - bool ParseReserved(DescriptorProto* message, - const LocationRecorder& message_location); - bool ParseReservedNames(DescriptorProto* message, - const LocationRecorder& parent_location); - bool ParseReservedNumbers(DescriptorProto* message, - const LocationRecorder& parent_location); - bool ParseReserved(EnumDescriptorProto* message, - const LocationRecorder& message_location); - bool ParseReservedNames(EnumDescriptorProto* message, - const LocationRecorder& parent_location); - bool ParseReservedNumbers(EnumDescriptorProto* message, - const LocationRecorder& parent_location); + const LocationRecorder& extensions_location); // Parse an "extend" declaration. (See also comments for // ParseMessageField().) @@ -407,87 +314,55 @@ class PROTOBUF_EXPORT Parser { RepeatedPtrField* messages, const LocationRecorder& parent_location, int location_field_number_for_nested_type, - const LocationRecorder& extend_location, - const FileDescriptorProto* containing_file); - - // Parse a "oneof" declaration. The caller is responsible for setting - // oneof_decl->label() since it will have had to parse the label before it - // knew it was parsing a oneof. - bool ParseOneof(OneofDescriptorProto* oneof_decl, - DescriptorProto* containing_type, int oneof_index, - const LocationRecorder& oneof_location, - const LocationRecorder& containing_type_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& extend_location); // Parse a single enum value within an enum block. bool ParseEnumConstant(EnumValueDescriptorProto* enum_value, - const LocationRecorder& enum_value_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& enum_value_location); // Parse enum constant options, i.e. the list in square brackets at the end // of the enum constant value definition. bool ParseEnumConstantOptions(EnumValueDescriptorProto* value, - const LocationRecorder& enum_value_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& enum_value_location); // Parse a single method within a service definition. bool ParseServiceMethod(MethodDescriptorProto* method, - const LocationRecorder& method_location, - const FileDescriptorProto* containing_file); - - // Parse options of a single method or stream. - bool ParseMethodOptions(const LocationRecorder& parent_location, - const FileDescriptorProto* containing_file, - const int optionsFieldNumber, - Message* mutable_options); + const LocationRecorder& method_location); // Parse "required", "optional", or "repeated" and fill in "label" - // with the value. Returns true if such a label is consumed. - bool ParseLabel(FieldDescriptorProto::Label* label, - const LocationRecorder& field_location); + // with the value. + bool ParseLabel(FieldDescriptorProto::Label* label); // Parse a type name and fill in "type" (if it is a primitive) or // "type_name" (if it is not) with the type parsed. - bool ParseType(FieldDescriptorProto::Type* type, std::string* type_name); + bool ParseType(FieldDescriptorProto::Type* type, + string* type_name); // Parse a user-defined type and fill in "type_name" with the name. // If a primitive type is named, it is treated as an error. - bool ParseUserDefinedType(std::string* type_name); + bool ParseUserDefinedType(string* type_name); // Parses field options, i.e. the stuff in square brackets at the end // of a field definition. Also parses default value. bool ParseFieldOptions(FieldDescriptorProto* field, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& field_location); // Parse the "default" option. This needs special handling because its // type is the field's type. bool ParseDefaultAssignment(FieldDescriptorProto* field, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file); - - bool ParseJsonName(FieldDescriptorProto* field, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file); - - enum OptionStyle { - OPTION_ASSIGNMENT, // just "name = value" - OPTION_STATEMENT // "option name = value;" - }; + const LocationRecorder& field_location); // Parse a single option name/value pair, e.g. "ctype = CORD". The name // identifies a field of the given Message, and the value of that field // is set to the parsed value. - bool ParseOption(Message* options, const LocationRecorder& options_location, - const FileDescriptorProto* containing_file, - OptionStyle style); + bool ParseOptionAssignment(Message* options, + const LocationRecorder& options_location); // Parses a single part of a multipart option name. A multipart name consists // of names separated by dots. Each name is either an identifier or a series // of identifiers separated by dots and enclosed in parentheses. E.g., - // "foo.(bar.baz).moo". + // "foo.(bar.baz).qux". bool ParseOptionNamePart(UninterpretedOption* uninterpreted_option, - const LocationRecorder& part_location, - const FileDescriptorProto* containing_file); + const LocationRecorder& part_location); // Parses a string surrounded by balanced braces. Strips off the outer // braces and stores the enclosed string in *value. @@ -499,30 +374,7 @@ class PROTOBUF_EXPORT Parser { // REQUIRES: LookingAt("{") // When finished successfully, we are looking at the first token past // the ending brace. - bool ParseUninterpretedBlock(std::string* value); - - struct MapField { - // Whether the field is a map field. - bool is_map_field; - // The types of the key and value if they are primitive types. - FieldDescriptorProto::Type key_type; - FieldDescriptorProto::Type value_type; - // Or the type names string if the types are customized types. - std::string key_type_name; - std::string value_type_name; - - MapField() : is_map_field(false) {} - }; - // Desugar the map syntax to generate a nested map entry message. - void GenerateMapEntry(const MapField& map_field, FieldDescriptorProto* field, - RepeatedPtrField* messages); - - // Whether fields without label default to optional fields. - bool DefaultToOptionalFields() const { - return syntax_identifier_ == "proto3"; - } - - bool ValidateEnum(const EnumDescriptorProto* proto); + bool ParseUninterpretedBlock(string* value); // ================================================================= @@ -533,18 +385,7 @@ class PROTOBUF_EXPORT Parser { bool had_errors_; bool require_syntax_identifier_; bool stop_after_syntax_identifier_; - std::string syntax_identifier_; - - // Leading doc comments for the next declaration. These are not complete - // yet; use ConsumeEndOfDeclaration() to get the complete comments. - std::string upcoming_doc_comments_; - - // Detached comments are not connected to any syntax entities. Elements in - // this vector are paragraphs of comments separated by empty lines. The - // detached comments will be put into the leading_detached_comments field for - // the next element (See SourceCodeInfo.Location in descriptor.proto), when - // ConsumeEndOfDeclaration() is called. - std::vector upcoming_detached_comments_; + string syntax_identifier_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Parser); }; @@ -557,7 +398,7 @@ class PROTOBUF_EXPORT Parser { // far more complete information about source locations. However, as of this // writing you still need to use SourceLocationTable when integrating with // DescriptorPool. -class PROTOBUF_EXPORT SourceLocationTable { +class LIBPROTOBUF_EXPORT SourceLocationTable { public: SourceLocationTable(); ~SourceLocationTable(); @@ -568,35 +409,26 @@ class PROTOBUF_EXPORT SourceLocationTable { // location" in the ErrorCollector interface). Returns true if found, false // otherwise. bool Find(const Message* descriptor, - DescriptorPool::ErrorCollector::ErrorLocation location, int* line, - int* column) const; - bool FindImport(const Message* descriptor, const std::string& name, int* line, - int* column) const; + DescriptorPool::ErrorCollector::ErrorLocation location, + int* line, int* column) const; // Adds a location to the table. void Add(const Message* descriptor, - DescriptorPool::ErrorCollector::ErrorLocation location, int line, - int column); - void AddImport(const Message* descriptor, const std::string& name, int line, - int column); + DescriptorPool::ErrorCollector::ErrorLocation location, + int line, int column); // Clears the contents of the table. void Clear(); private: - typedef std::map< - std::pair, - std::pair > - LocationMap; + typedef map< + pair, + pair > LocationMap; LocationMap location_map_; - std::map, std::pair > - import_location_map_; }; } // namespace compiler } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_PARSER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/plugin.cc b/depends/protobuf/google/protobuf/compiler/plugin.cc similarity index 52% rename from depends/protobuf/src/google/protobuf/compiler/plugin.cc rename to depends/protobuf/google/protobuf/compiler/plugin.cc index 0a323843d..727f94216 100644 --- a/depends/protobuf/src/google/protobuf/compiler/plugin.cc +++ b/depends/protobuf/google/protobuf/compiler/plugin.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -36,18 +36,22 @@ #include #ifdef _WIN32 +#include #include +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif #else #include #endif -#include #include #include #include #include -#include -#include #include @@ -55,141 +59,99 @@ namespace google { namespace protobuf { namespace compiler { -#if defined(_WIN32) -// DO NOT include , instead create functions in io_win32.{h,cc} and import -// them like we do below. -using google::protobuf::io::win32::setmode; -#endif - class GeneratorResponseContext : public GeneratorContext { public: - GeneratorResponseContext( - const Version& compiler_version, CodeGeneratorResponse* response, - const std::vector& parsed_files) - : compiler_version_(compiler_version), - response_(response), + GeneratorResponseContext(CodeGeneratorResponse* response, + const vector& parsed_files) + : response_(response), parsed_files_(parsed_files) {} - ~GeneratorResponseContext() override {} + virtual ~GeneratorResponseContext() {} // implements GeneratorContext -------------------------------------- - io::ZeroCopyOutputStream* Open(const std::string& filename) override { + virtual io::ZeroCopyOutputStream* Open(const string& filename) { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); return new io::StringOutputStream(file->mutable_content()); } - io::ZeroCopyOutputStream* OpenForInsert( - const std::string& filename, - const std::string& insertion_point) override { + virtual io::ZeroCopyOutputStream* OpenForInsert( + const string& filename, const string& insertion_point) { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); file->set_insertion_point(insertion_point); return new io::StringOutputStream(file->mutable_content()); } - 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 { + void ListParsedFiles(vector* output) { *output = parsed_files_; } - void GetCompilerVersion(Version* version) const override { - *version = compiler_version_; - } - private: - Version compiler_version_; CodeGeneratorResponse* response_; - const std::vector& parsed_files_; + const vector& parsed_files_; }; -bool GenerateCode(const CodeGeneratorRequest& request, - const CodeGenerator& generator, - CodeGeneratorResponse* response, std::string* error_msg) { - DescriptorPool pool; - for (int i = 0; i < request.proto_file_size(); i++) { - const FileDescriptor* file = pool.BuildFile(request.proto_file(i)); - if (file == nullptr) { - // BuildFile() already wrote an error message. - return false; - } - } - - std::vector parsed_files; - for (int i = 0; i < request.file_to_generate_size(); i++) { - parsed_files.push_back(pool.FindFileByName(request.file_to_generate(i))); - if (parsed_files.back() == nullptr) { - *error_msg = - "protoc asked plugin to generate a file but " - "did not provide a descriptor for the file: " + - request.file_to_generate(i); - return false; - } - } - - GeneratorResponseContext context(request.compiler_version(), response, - parsed_files); - - - std::string error; - 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 " - "description."; - } - if (!error.empty()) { - response->set_error(error); - } - - return true; -} - int PluginMain(int argc, char* argv[], const CodeGenerator* generator) { if (argc > 1) { - std::cerr << argv[0] << ": Unknown option: " << argv[1] << std::endl; + cerr << argv[0] << ": Unknown option: " << argv[1] << endl; return 1; } #ifdef _WIN32 - setmode(STDIN_FILENO, _O_BINARY); - setmode(STDOUT_FILENO, _O_BINARY); + _setmode(STDIN_FILENO, _O_BINARY); + _setmode(STDOUT_FILENO, _O_BINARY); #endif CodeGeneratorRequest request; if (!request.ParseFromFileDescriptor(STDIN_FILENO)) { - std::cerr << argv[0] << ": protoc sent unparseable request to plugin." - << std::endl; + cerr << argv[0] << ": protoc sent unparseable request to plugin." << endl; return 1; } + DescriptorPool pool; + for (int i = 0; i < request.proto_file_size(); i++) { + const FileDescriptor* file = pool.BuildFile(request.proto_file(i)); + if (file == NULL) { + // BuildFile() already wrote an error message. + return 1; + } + } + + vector parsed_files; + for (int i = 0; i < request.file_to_generate_size(); i++) { + parsed_files.push_back(pool.FindFileByName(request.file_to_generate(i))); + if (parsed_files.back() == NULL) { + cerr << argv[0] << ": protoc asked plugin to generate a file but " + "did not provide a descriptor for the file: " + << request.file_to_generate(i) << endl; + return 1; + } + } - std::string error_msg; CodeGeneratorResponse response; + GeneratorResponseContext context(&response, parsed_files); - if (GenerateCode(request, *generator, &response, &error_msg)) { - if (!response.SerializeToFileDescriptor(STDOUT_FILENO)) { - std::cerr << argv[0] << ": Error writing to stdout." << std::endl; - return 1; + for (int i = 0; i < parsed_files.size(); i++) { + const FileDescriptor* file = parsed_files[i]; + + string error; + bool succeeded = generator->Generate( + file, request.parameter(), &context, &error); + + if (!succeeded && error.empty()) { + error = "Code generator returned false but provided no error " + "description."; } - } else { - if (!error_msg.empty()) { - std::cerr << argv[0] << ": " << error_msg << std::endl; + if (!error.empty()) { + response.set_error(file->name() + ": " + error); + break; } + } + + if (!response.SerializeToFileDescriptor(STDOUT_FILENO)) { + cerr << argv[0] << ": Error writing to stdout." << endl; return 1; } diff --git a/depends/protobuf/src/google/protobuf/compiler/plugin.h b/depends/protobuf/google/protobuf/compiler/plugin.h similarity index 73% rename from depends/protobuf/src/google/protobuf/compiler/plugin.h rename to depends/protobuf/google/protobuf/compiler/plugin.h index 611713e2c..64dfb1d2c 100644 --- a/depends/protobuf/src/google/protobuf/compiler/plugin.h +++ b/depends/protobuf/google/protobuf/compiler/plugin.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -40,13 +40,6 @@ // } // You must link your plugin against libprotobuf and libprotoc. // -// The core part of PluginMain is to invoke the given CodeGenerator on a -// CodeGeneratorRequest to generate a CodeGeneratorResponse. This part is -// abstracted out and made into function GenerateCode so that it can be reused, -// for example, to implement a variant of PluginMain that does some -// preprocessing on the input CodeGeneratorRequest before feeding the request -// to the given code generator. -// // To get protoc to use the plugin, do one of the following: // * Place the plugin binary somewhere in the PATH and give it the name // "protoc-gen-NAME" (replacing "NAME" with the name of your plugin). If you @@ -62,35 +55,19 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_PLUGIN_H__ #define GOOGLE_PROTOBUF_COMPILER_PLUGIN_H__ -#include - -// Must be included last. -#include +#include namespace google { namespace protobuf { namespace compiler { -class CodeGenerator; // code_generator.h -class CodeGeneratorRequest; -class CodeGeneratorResponse; +class CodeGenerator; // code_generator.h // Implements main() for a protoc plugin exposing the given code generator. -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 generation fails, error_msg may be -// populated to describe the failure cause. -bool GenerateCode(const CodeGeneratorRequest& request, - const CodeGenerator& generator, - CodeGeneratorResponse* response, std::string* error_msg); +int PluginMain(int argc, char* argv[], const CodeGenerator* generator); } // namespace compiler } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_PLUGIN_H__ diff --git a/depends/protobuf/google/protobuf/compiler/plugin.pb.cc b/depends/protobuf/google/protobuf/compiler/plugin.pb.cc new file mode 100644 index 000000000..ad4b4deb0 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/plugin.pb.cc @@ -0,0 +1,1082 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/compiler/plugin.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { +namespace compiler { + +namespace { + +const ::google::protobuf::Descriptor* CodeGeneratorRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + CodeGeneratorRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* CodeGeneratorResponse_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + CodeGeneratorResponse_reflection_ = NULL; +const ::google::protobuf::Descriptor* CodeGeneratorResponse_File_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + CodeGeneratorResponse_File_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/compiler/plugin.proto"); + GOOGLE_CHECK(file != NULL); + CodeGeneratorRequest_descriptor_ = file->message_type(0); + static const int CodeGeneratorRequest_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, file_to_generate_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, parameter_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, proto_file_), + }; + CodeGeneratorRequest_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + CodeGeneratorRequest_descriptor_, + CodeGeneratorRequest::default_instance_, + CodeGeneratorRequest_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(CodeGeneratorRequest)); + CodeGeneratorResponse_descriptor_ = file->message_type(1); + static const int CodeGeneratorResponse_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, error_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, file_), + }; + CodeGeneratorResponse_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + CodeGeneratorResponse_descriptor_, + CodeGeneratorResponse::default_instance_, + CodeGeneratorResponse_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(CodeGeneratorResponse)); + CodeGeneratorResponse_File_descriptor_ = CodeGeneratorResponse_descriptor_->nested_type(0); + static const int CodeGeneratorResponse_File_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, insertion_point_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, content_), + }; + CodeGeneratorResponse_File_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + CodeGeneratorResponse_File_descriptor_, + CodeGeneratorResponse_File::default_instance_, + CodeGeneratorResponse_File_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(CodeGeneratorResponse_File)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + CodeGeneratorRequest_descriptor_, &CodeGeneratorRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + CodeGeneratorResponse_descriptor_, &CodeGeneratorResponse::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + CodeGeneratorResponse_File_descriptor_, &CodeGeneratorResponse_File::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { + delete CodeGeneratorRequest::default_instance_; + delete CodeGeneratorRequest_reflection_; + delete CodeGeneratorResponse::default_instance_; + delete CodeGeneratorResponse_reflection_; + delete CodeGeneratorResponse_File::default_instance_; + delete CodeGeneratorResponse_File_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n%google/protobuf/compiler/plugin.proto\022" + "\030google.protobuf.compiler\032 google/protob" + "uf/descriptor.proto\"}\n\024CodeGeneratorRequ" + "est\022\030\n\020file_to_generate\030\001 \003(\t\022\021\n\tparamet" + "er\030\002 \001(\t\0228\n\nproto_file\030\017 \003(\0132$.google.pr" + "otobuf.FileDescriptorProto\"\252\001\n\025CodeGener" + "atorResponse\022\r\n\005error\030\001 \001(\t\022B\n\004file\030\017 \003(" + "\01324.google.protobuf.compiler.CodeGenerat" + "orResponse.File\032>\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", 399); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/compiler/plugin.proto", &protobuf_RegisterTypes); + CodeGeneratorRequest::default_instance_ = new CodeGeneratorRequest(); + CodeGeneratorResponse::default_instance_ = new CodeGeneratorResponse(); + CodeGeneratorResponse_File::default_instance_ = new CodeGeneratorResponse_File(); + CodeGeneratorRequest::default_instance_->InitAsDefaultInstance(); + CodeGeneratorResponse::default_instance_->InitAsDefaultInstance(); + CodeGeneratorResponse_File::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto_; + + +// =================================================================== + +#ifndef _MSC_VER +const int CodeGeneratorRequest::kFileToGenerateFieldNumber; +const int CodeGeneratorRequest::kParameterFieldNumber; +const int CodeGeneratorRequest::kProtoFileFieldNumber; +#endif // !_MSC_VER + +CodeGeneratorRequest::CodeGeneratorRequest() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void CodeGeneratorRequest::InitAsDefaultInstance() { +} + +CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void CodeGeneratorRequest::SharedCtor() { + _cached_size_ = 0; + parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +CodeGeneratorRequest::~CodeGeneratorRequest() { + SharedDtor(); +} + +void CodeGeneratorRequest::SharedDtor() { + if (parameter_ != &::google::protobuf::internal::kEmptyString) { + delete parameter_; + } + if (this != default_instance_) { + } +} + +void CodeGeneratorRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* CodeGeneratorRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return CodeGeneratorRequest_descriptor_; +} + +const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_; +} + +CodeGeneratorRequest* CodeGeneratorRequest::default_instance_ = NULL; + +CodeGeneratorRequest* CodeGeneratorRequest::New() const { + return new CodeGeneratorRequest; +} + +void CodeGeneratorRequest::Clear() { + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (has_parameter()) { + if (parameter_ != &::google::protobuf::internal::kEmptyString) { + parameter_->clear(); + } + } + } + file_to_generate_.Clear(); + proto_file_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool CodeGeneratorRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated string file_to_generate = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_file_to_generate: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_file_to_generate())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->file_to_generate(0).data(), this->file_to_generate(0).length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_file_to_generate; + if (input->ExpectTag(18)) goto parse_parameter; + break; + } + + // optional string parameter = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_parameter: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_parameter())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->parameter().data(), this->parameter().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(122)) goto parse_proto_file; + break; + } + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + case 15: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_proto_file: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_proto_file())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(122)) goto parse_proto_file; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void CodeGeneratorRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated string file_to_generate = 1; + for (int i = 0; i < this->file_to_generate_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->file_to_generate(i).data(), this->file_to_generate(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->file_to_generate(i), output); + } + + // optional string parameter = 2; + if (has_parameter()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->parameter().data(), this->parameter().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->parameter(), output); + } + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + for (int i = 0; i < this->proto_file_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 15, this->proto_file(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* CodeGeneratorRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated string file_to_generate = 1; + for (int i = 0; i < this->file_to_generate_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->file_to_generate(i).data(), this->file_to_generate(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(1, this->file_to_generate(i), target); + } + + // optional string parameter = 2; + if (has_parameter()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->parameter().data(), this->parameter().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->parameter(), target); + } + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + for (int i = 0; i < this->proto_file_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 15, this->proto_file(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int CodeGeneratorRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + // optional string parameter = 2; + if (has_parameter()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->parameter()); + } + + } + // repeated string file_to_generate = 1; + total_size += 1 * this->file_to_generate_size(); + for (int i = 0; i < this->file_to_generate_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->file_to_generate(i)); + } + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + total_size += 1 * this->proto_file_size(); + for (int i = 0; i < this->proto_file_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->proto_file(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void CodeGeneratorRequest::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const CodeGeneratorRequest* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) { + GOOGLE_CHECK_NE(&from, this); + file_to_generate_.MergeFrom(from.file_to_generate_); + proto_file_.MergeFrom(from.proto_file_); + if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (from.has_parameter()) { + set_parameter(from.parameter()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void CodeGeneratorRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void CodeGeneratorRequest::CopyFrom(const CodeGeneratorRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CodeGeneratorRequest::IsInitialized() const { + + for (int i = 0; i < proto_file_size(); i++) { + if (!this->proto_file(i).IsInitialized()) return false; + } + return true; +} + +void CodeGeneratorRequest::Swap(CodeGeneratorRequest* other) { + if (other != this) { + file_to_generate_.Swap(&other->file_to_generate_); + std::swap(parameter_, other->parameter_); + proto_file_.Swap(&other->proto_file_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata CodeGeneratorRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = CodeGeneratorRequest_descriptor_; + metadata.reflection = CodeGeneratorRequest_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int CodeGeneratorResponse_File::kNameFieldNumber; +const int CodeGeneratorResponse_File::kInsertionPointFieldNumber; +const int CodeGeneratorResponse_File::kContentFieldNumber; +#endif // !_MSC_VER + +CodeGeneratorResponse_File::CodeGeneratorResponse_File() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void CodeGeneratorResponse_File::InitAsDefaultInstance() { +} + +CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void CodeGeneratorResponse_File::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +CodeGeneratorResponse_File::~CodeGeneratorResponse_File() { + SharedDtor(); +} + +void CodeGeneratorResponse_File::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (insertion_point_ != &::google::protobuf::internal::kEmptyString) { + delete insertion_point_; + } + if (content_ != &::google::protobuf::internal::kEmptyString) { + delete content_; + } + if (this != default_instance_) { + } +} + +void CodeGeneratorResponse_File::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* CodeGeneratorResponse_File::descriptor() { + protobuf_AssignDescriptorsOnce(); + return CodeGeneratorResponse_File_descriptor_; +} + +const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_; +} + +CodeGeneratorResponse_File* CodeGeneratorResponse_File::default_instance_ = NULL; + +CodeGeneratorResponse_File* CodeGeneratorResponse_File::New() const { + return new CodeGeneratorResponse_File; +} + +void CodeGeneratorResponse_File::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + if (has_insertion_point()) { + if (insertion_point_ != &::google::protobuf::internal::kEmptyString) { + insertion_point_->clear(); + } + } + if (has_content()) { + if (content_ != &::google::protobuf::internal::kEmptyString) { + content_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool CodeGeneratorResponse_File::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_insertion_point; + break; + } + + // optional string insertion_point = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_insertion_point: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_insertion_point())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->insertion_point().data(), this->insertion_point().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(122)) goto parse_content; + break; + } + + // optional string content = 15; + case 15: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_content: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_content())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->content().data(), this->content().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void CodeGeneratorResponse_File::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // optional string insertion_point = 2; + if (has_insertion_point()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->insertion_point().data(), this->insertion_point().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->insertion_point(), output); + } + + // optional string content = 15; + if (has_content()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->content().data(), this->content().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 15, this->content(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* CodeGeneratorResponse_File::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional string insertion_point = 2; + if (has_insertion_point()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->insertion_point().data(), this->insertion_point().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->insertion_point(), target); + } + + // optional string content = 15; + if (has_content()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->content().data(), this->content().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 15, this->content(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int CodeGeneratorResponse_File::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional string insertion_point = 2; + if (has_insertion_point()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->insertion_point()); + } + + // optional string content = 15; + if (has_content()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->content()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void CodeGeneratorResponse_File::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const CodeGeneratorResponse_File* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_insertion_point()) { + set_insertion_point(from.insertion_point()); + } + if (from.has_content()) { + set_content(from.content()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void CodeGeneratorResponse_File::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void CodeGeneratorResponse_File::CopyFrom(const CodeGeneratorResponse_File& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CodeGeneratorResponse_File::IsInitialized() const { + + return true; +} + +void CodeGeneratorResponse_File::Swap(CodeGeneratorResponse_File* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(insertion_point_, other->insertion_point_); + std::swap(content_, other->content_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata CodeGeneratorResponse_File::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = CodeGeneratorResponse_File_descriptor_; + metadata.reflection = CodeGeneratorResponse_File_reflection_; + return metadata; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int CodeGeneratorResponse::kErrorFieldNumber; +const int CodeGeneratorResponse::kFileFieldNumber; +#endif // !_MSC_VER + +CodeGeneratorResponse::CodeGeneratorResponse() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void CodeGeneratorResponse::InitAsDefaultInstance() { +} + +CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void CodeGeneratorResponse::SharedCtor() { + _cached_size_ = 0; + error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +CodeGeneratorResponse::~CodeGeneratorResponse() { + SharedDtor(); +} + +void CodeGeneratorResponse::SharedDtor() { + if (error_ != &::google::protobuf::internal::kEmptyString) { + delete error_; + } + if (this != default_instance_) { + } +} + +void CodeGeneratorResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* CodeGeneratorResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return CodeGeneratorResponse_descriptor_; +} + +const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_; +} + +CodeGeneratorResponse* CodeGeneratorResponse::default_instance_ = NULL; + +CodeGeneratorResponse* CodeGeneratorResponse::New() const { + return new CodeGeneratorResponse; +} + +void CodeGeneratorResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_error()) { + if (error_ != &::google::protobuf::internal::kEmptyString) { + error_->clear(); + } + } + } + file_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool CodeGeneratorResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string error = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_error())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->error().data(), this->error().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(122)) goto parse_file; + break; + } + + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + case 15: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_file: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_file())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(122)) goto parse_file; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void CodeGeneratorResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string error = 1; + if (has_error()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->error().data(), this->error().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->error(), output); + } + + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + for (int i = 0; i < this->file_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 15, this->file(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* CodeGeneratorResponse::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string error = 1; + if (has_error()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->error().data(), this->error().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->error(), target); + } + + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + for (int i = 0; i < this->file_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 15, this->file(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int CodeGeneratorResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string error = 1; + if (has_error()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->error()); + } + + } + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + total_size += 1 * this->file_size(); + for (int i = 0; i < this->file_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->file(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void CodeGeneratorResponse::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const CodeGeneratorResponse* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) { + GOOGLE_CHECK_NE(&from, this); + file_.MergeFrom(from.file_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_error()) { + set_error(from.error()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void CodeGeneratorResponse::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void CodeGeneratorResponse::CopyFrom(const CodeGeneratorResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CodeGeneratorResponse::IsInitialized() const { + + return true; +} + +void CodeGeneratorResponse::Swap(CodeGeneratorResponse* other) { + if (other != this) { + std::swap(error_, other->error_); + file_.Swap(&other->file_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata CodeGeneratorResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = CodeGeneratorResponse_descriptor_; + metadata.reflection = CodeGeneratorResponse_reflection_; + return metadata; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace compiler +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/depends/protobuf/google/protobuf/compiler/plugin.pb.h b/depends/protobuf/google/protobuf/compiler/plugin.pb.h new file mode 100644 index 000000000..14216c2a1 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/plugin.pb.h @@ -0,0 +1,790 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/compiler/plugin.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2004000 +#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 2004001 < GOOGLE_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. +#endif + +#include +#include +#include +#include +#include "google/protobuf/descriptor.pb.h" +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { +namespace compiler { + +// Internal implementation detail -- do not call these. +void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + +class CodeGeneratorRequest; +class CodeGeneratorResponse; +class CodeGeneratorResponse_File; + +// =================================================================== + +class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message { + public: + CodeGeneratorRequest(); + virtual ~CodeGeneratorRequest(); + + CodeGeneratorRequest(const CodeGeneratorRequest& from); + + inline CodeGeneratorRequest& operator=(const CodeGeneratorRequest& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const CodeGeneratorRequest& default_instance(); + + void Swap(CodeGeneratorRequest* other); + + // implements Message ---------------------------------------------- + + CodeGeneratorRequest* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const CodeGeneratorRequest& from); + void MergeFrom(const CodeGeneratorRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated string file_to_generate = 1; + inline int file_to_generate_size() const; + inline void clear_file_to_generate(); + static const int kFileToGenerateFieldNumber = 1; + inline const ::std::string& file_to_generate(int index) const; + inline ::std::string* mutable_file_to_generate(int index); + inline void set_file_to_generate(int index, const ::std::string& value); + inline void set_file_to_generate(int index, const char* value); + inline void set_file_to_generate(int index, const char* value, size_t size); + inline ::std::string* add_file_to_generate(); + inline void add_file_to_generate(const ::std::string& value); + inline void add_file_to_generate(const char* value); + inline void add_file_to_generate(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& file_to_generate() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_file_to_generate(); + + // optional string parameter = 2; + inline bool has_parameter() const; + inline void clear_parameter(); + static const int kParameterFieldNumber = 2; + inline const ::std::string& parameter() const; + inline void set_parameter(const ::std::string& value); + inline void set_parameter(const char* value); + inline void set_parameter(const char* value, size_t size); + inline ::std::string* mutable_parameter(); + inline ::std::string* release_parameter(); + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + inline int proto_file_size() const; + inline void clear_proto_file(); + static const int kProtoFileFieldNumber = 15; + inline const ::google::protobuf::FileDescriptorProto& proto_file(int index) const; + inline ::google::protobuf::FileDescriptorProto* mutable_proto_file(int index); + inline ::google::protobuf::FileDescriptorProto* add_proto_file(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& + proto_file() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* + mutable_proto_file(); + + // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) + private: + inline void set_has_parameter(); + inline void clear_has_parameter(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::std::string> file_to_generate_; + ::std::string* parameter_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > proto_file_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + + void InitAsDefaultInstance(); + static CodeGeneratorRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::Message { + public: + CodeGeneratorResponse_File(); + virtual ~CodeGeneratorResponse_File(); + + CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from); + + inline CodeGeneratorResponse_File& operator=(const CodeGeneratorResponse_File& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const CodeGeneratorResponse_File& default_instance(); + + void Swap(CodeGeneratorResponse_File* other); + + // implements Message ---------------------------------------------- + + CodeGeneratorResponse_File* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const CodeGeneratorResponse_File& from); + void MergeFrom(const CodeGeneratorResponse_File& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // optional string insertion_point = 2; + inline bool has_insertion_point() const; + inline void clear_insertion_point(); + static const int kInsertionPointFieldNumber = 2; + inline const ::std::string& insertion_point() const; + inline void set_insertion_point(const ::std::string& value); + inline void set_insertion_point(const char* value); + inline void set_insertion_point(const char* value, size_t size); + inline ::std::string* mutable_insertion_point(); + inline ::std::string* release_insertion_point(); + + // optional string content = 15; + inline bool has_content() const; + inline void clear_content(); + static const int kContentFieldNumber = 15; + inline const ::std::string& content() const; + inline void set_content(const ::std::string& value); + inline void set_content(const char* value); + inline void set_content(const char* value, size_t size); + inline ::std::string* mutable_content(); + inline ::std::string* release_content(); + + // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_insertion_point(); + inline void clear_has_insertion_point(); + inline void set_has_content(); + inline void clear_has_content(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::std::string* insertion_point_; + ::std::string* content_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + + void InitAsDefaultInstance(); + static CodeGeneratorResponse_File* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Message { + public: + CodeGeneratorResponse(); + virtual ~CodeGeneratorResponse(); + + CodeGeneratorResponse(const CodeGeneratorResponse& from); + + inline CodeGeneratorResponse& operator=(const CodeGeneratorResponse& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const CodeGeneratorResponse& default_instance(); + + void Swap(CodeGeneratorResponse* other); + + // implements Message ---------------------------------------------- + + CodeGeneratorResponse* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const CodeGeneratorResponse& from); + void MergeFrom(const CodeGeneratorResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef CodeGeneratorResponse_File File; + + // accessors ------------------------------------------------------- + + // optional string error = 1; + inline bool has_error() const; + inline void clear_error(); + static const int kErrorFieldNumber = 1; + inline const ::std::string& error() const; + inline void set_error(const ::std::string& value); + inline void set_error(const char* value); + inline void set_error(const char* value, size_t size); + inline ::std::string* mutable_error(); + inline ::std::string* release_error(); + + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + inline int file_size() const; + inline void clear_file(); + static const int kFileFieldNumber = 15; + inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& file(int index) const; + inline ::google::protobuf::compiler::CodeGeneratorResponse_File* mutable_file(int index); + inline ::google::protobuf::compiler::CodeGeneratorResponse_File* add_file(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >& + file() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >* + mutable_file(); + + // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse) + private: + inline void set_has_error(); + inline void clear_has_error(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* error_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File > file_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void LIBPROTOC_EXPORT protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + + void InitAsDefaultInstance(); + static CodeGeneratorResponse* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// CodeGeneratorRequest + +// repeated string file_to_generate = 1; +inline int CodeGeneratorRequest::file_to_generate_size() const { + return file_to_generate_.size(); +} +inline void CodeGeneratorRequest::clear_file_to_generate() { + file_to_generate_.Clear(); +} +inline const ::std::string& CodeGeneratorRequest::file_to_generate(int index) const { + return file_to_generate_.Get(index); +} +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) { + file_to_generate_.Mutable(index)->assign(value); +} +inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* value) { + file_to_generate_.Mutable(index)->assign(value); +} +inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* value, size_t size) { + file_to_generate_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* CodeGeneratorRequest::add_file_to_generate() { + return file_to_generate_.Add(); +} +inline void CodeGeneratorRequest::add_file_to_generate(const ::std::string& value) { + file_to_generate_.Add()->assign(value); +} +inline void CodeGeneratorRequest::add_file_to_generate(const char* value) { + file_to_generate_.Add()->assign(value); +} +inline void CodeGeneratorRequest::add_file_to_generate(const char* value, size_t size) { + file_to_generate_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +CodeGeneratorRequest::file_to_generate() const { + return file_to_generate_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +CodeGeneratorRequest::mutable_file_to_generate() { + return &file_to_generate_; +} + +// optional string parameter = 2; +inline bool CodeGeneratorRequest::has_parameter() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void CodeGeneratorRequest::set_has_parameter() { + _has_bits_[0] |= 0x00000002u; +} +inline void CodeGeneratorRequest::clear_has_parameter() { + _has_bits_[0] &= ~0x00000002u; +} +inline void CodeGeneratorRequest::clear_parameter() { + if (parameter_ != &::google::protobuf::internal::kEmptyString) { + parameter_->clear(); + } + clear_has_parameter(); +} +inline const ::std::string& CodeGeneratorRequest::parameter() const { + return *parameter_; +} +inline void CodeGeneratorRequest::set_parameter(const ::std::string& value) { + set_has_parameter(); + if (parameter_ == &::google::protobuf::internal::kEmptyString) { + parameter_ = new ::std::string; + } + parameter_->assign(value); +} +inline void CodeGeneratorRequest::set_parameter(const char* value) { + set_has_parameter(); + if (parameter_ == &::google::protobuf::internal::kEmptyString) { + parameter_ = new ::std::string; + } + parameter_->assign(value); +} +inline void CodeGeneratorRequest::set_parameter(const char* value, size_t size) { + set_has_parameter(); + if (parameter_ == &::google::protobuf::internal::kEmptyString) { + parameter_ = new ::std::string; + } + parameter_->assign(reinterpret_cast(value), size); +} +inline ::std::string* CodeGeneratorRequest::mutable_parameter() { + set_has_parameter(); + if (parameter_ == &::google::protobuf::internal::kEmptyString) { + parameter_ = new ::std::string; + } + return parameter_; +} +inline ::std::string* CodeGeneratorRequest::release_parameter() { + clear_has_parameter(); + if (parameter_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = parameter_; + parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .google.protobuf.FileDescriptorProto proto_file = 15; +inline int CodeGeneratorRequest::proto_file_size() const { + return proto_file_.size(); +} +inline void CodeGeneratorRequest::clear_proto_file() { + proto_file_.Clear(); +} +inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { + return proto_file_.Get(index); +} +inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { + return proto_file_.Mutable(index); +} +inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { + return proto_file_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& +CodeGeneratorRequest::proto_file() const { + return proto_file_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* +CodeGeneratorRequest::mutable_proto_file() { + return &proto_file_; +} + +// ------------------------------------------------------------------- + +// CodeGeneratorResponse_File + +// optional string name = 1; +inline bool CodeGeneratorResponse_File::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void CodeGeneratorResponse_File::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void CodeGeneratorResponse_File::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void CodeGeneratorResponse_File::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& CodeGeneratorResponse_File::name() const { + return *name_; +} +inline void CodeGeneratorResponse_File::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void CodeGeneratorResponse_File::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void CodeGeneratorResponse_File::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* CodeGeneratorResponse_File::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* CodeGeneratorResponse_File::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string insertion_point = 2; +inline bool CodeGeneratorResponse_File::has_insertion_point() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void CodeGeneratorResponse_File::set_has_insertion_point() { + _has_bits_[0] |= 0x00000002u; +} +inline void CodeGeneratorResponse_File::clear_has_insertion_point() { + _has_bits_[0] &= ~0x00000002u; +} +inline void CodeGeneratorResponse_File::clear_insertion_point() { + if (insertion_point_ != &::google::protobuf::internal::kEmptyString) { + insertion_point_->clear(); + } + clear_has_insertion_point(); +} +inline const ::std::string& CodeGeneratorResponse_File::insertion_point() const { + return *insertion_point_; +} +inline void CodeGeneratorResponse_File::set_insertion_point(const ::std::string& value) { + set_has_insertion_point(); + if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + insertion_point_ = new ::std::string; + } + insertion_point_->assign(value); +} +inline void CodeGeneratorResponse_File::set_insertion_point(const char* value) { + set_has_insertion_point(); + if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + insertion_point_ = new ::std::string; + } + insertion_point_->assign(value); +} +inline void CodeGeneratorResponse_File::set_insertion_point(const char* value, size_t size) { + set_has_insertion_point(); + if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + insertion_point_ = new ::std::string; + } + insertion_point_->assign(reinterpret_cast(value), size); +} +inline ::std::string* CodeGeneratorResponse_File::mutable_insertion_point() { + set_has_insertion_point(); + if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + insertion_point_ = new ::std::string; + } + return insertion_point_; +} +inline ::std::string* CodeGeneratorResponse_File::release_insertion_point() { + clear_has_insertion_point(); + if (insertion_point_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = insertion_point_; + insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string content = 15; +inline bool CodeGeneratorResponse_File::has_content() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void CodeGeneratorResponse_File::set_has_content() { + _has_bits_[0] |= 0x00000004u; +} +inline void CodeGeneratorResponse_File::clear_has_content() { + _has_bits_[0] &= ~0x00000004u; +} +inline void CodeGeneratorResponse_File::clear_content() { + if (content_ != &::google::protobuf::internal::kEmptyString) { + content_->clear(); + } + clear_has_content(); +} +inline const ::std::string& CodeGeneratorResponse_File::content() const { + return *content_; +} +inline void CodeGeneratorResponse_File::set_content(const ::std::string& value) { + set_has_content(); + if (content_ == &::google::protobuf::internal::kEmptyString) { + content_ = new ::std::string; + } + content_->assign(value); +} +inline void CodeGeneratorResponse_File::set_content(const char* value) { + set_has_content(); + if (content_ == &::google::protobuf::internal::kEmptyString) { + content_ = new ::std::string; + } + content_->assign(value); +} +inline void CodeGeneratorResponse_File::set_content(const char* value, size_t size) { + set_has_content(); + if (content_ == &::google::protobuf::internal::kEmptyString) { + content_ = new ::std::string; + } + content_->assign(reinterpret_cast(value), size); +} +inline ::std::string* CodeGeneratorResponse_File::mutable_content() { + set_has_content(); + if (content_ == &::google::protobuf::internal::kEmptyString) { + content_ = new ::std::string; + } + return content_; +} +inline ::std::string* CodeGeneratorResponse_File::release_content() { + clear_has_content(); + if (content_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = content_; + content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// CodeGeneratorResponse + +// optional string error = 1; +inline bool CodeGeneratorResponse::has_error() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void CodeGeneratorResponse::set_has_error() { + _has_bits_[0] |= 0x00000001u; +} +inline void CodeGeneratorResponse::clear_has_error() { + _has_bits_[0] &= ~0x00000001u; +} +inline void CodeGeneratorResponse::clear_error() { + if (error_ != &::google::protobuf::internal::kEmptyString) { + error_->clear(); + } + clear_has_error(); +} +inline const ::std::string& CodeGeneratorResponse::error() const { + return *error_; +} +inline void CodeGeneratorResponse::set_error(const ::std::string& value) { + set_has_error(); + if (error_ == &::google::protobuf::internal::kEmptyString) { + error_ = new ::std::string; + } + error_->assign(value); +} +inline void CodeGeneratorResponse::set_error(const char* value) { + set_has_error(); + if (error_ == &::google::protobuf::internal::kEmptyString) { + error_ = new ::std::string; + } + error_->assign(value); +} +inline void CodeGeneratorResponse::set_error(const char* value, size_t size) { + set_has_error(); + if (error_ == &::google::protobuf::internal::kEmptyString) { + error_ = new ::std::string; + } + error_->assign(reinterpret_cast(value), size); +} +inline ::std::string* CodeGeneratorResponse::mutable_error() { + set_has_error(); + if (error_ == &::google::protobuf::internal::kEmptyString) { + error_ = new ::std::string; + } + return error_; +} +inline ::std::string* CodeGeneratorResponse::release_error() { + clear_has_error(); + if (error_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = error_; + error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; +inline int CodeGeneratorResponse::file_size() const { + return file_.size(); +} +inline void CodeGeneratorResponse::clear_file() { + file_.Clear(); +} +inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { + return file_.Get(index); +} +inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { + return file_.Mutable(index); +} +inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { + return file_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >& +CodeGeneratorResponse::file() const { + return file_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >* +CodeGeneratorResponse::mutable_file() { + return &file_; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace compiler +} // namespace protobuf +} // namespace google + +#ifndef SWIG +namespace google { +namespace protobuf { + + +} // namespace google +} // namespace protobuf +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED diff --git a/depends/protobuf/src/google/protobuf/compiler/subprocess.cc b/depends/protobuf/google/protobuf/compiler/subprocess.cc similarity index 67% rename from depends/protobuf/src/google/protobuf/compiler/subprocess.cc rename to depends/protobuf/google/protobuf/compiler/subprocess.cc index 6f547db79..5fb5d5cb7 100644 --- a/depends/protobuf/src/google/protobuf/compiler/subprocess.cc +++ b/depends/protobuf/google/protobuf/compiler/subprocess.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,36 +33,22 @@ #include #include -#include -#include #ifndef _WIN32 #include -#include #include #include +#include #endif -#include #include -#include #include -#include +#include namespace google { namespace protobuf { namespace compiler { -namespace { -char* portable_strdup(const char* s) { - char* ns = (char*)malloc(strlen(s) + 1); - if (ns != nullptr) { - strcpy(ns, s); - } - return ns; -} -} // namespace - #ifdef _WIN32 static void CloseHandleOrDie(HANDLE handle) { @@ -74,47 +60,45 @@ static void CloseHandleOrDie(HANDLE handle) { Subprocess::Subprocess() : process_start_error_(ERROR_SUCCESS), - child_handle_(nullptr), - child_stdin_(nullptr), - child_stdout_(nullptr) {} + child_handle_(NULL), child_stdin_(NULL), child_stdout_(NULL) {} Subprocess::~Subprocess() { - if (child_stdin_ != nullptr) { + if (child_stdin_ != NULL) { CloseHandleOrDie(child_stdin_); } - if (child_stdout_ != nullptr) { + if (child_stdout_ != NULL) { CloseHandleOrDie(child_stdout_); } } -void Subprocess::Start(const std::string& program, SearchMode search_mode) { +void Subprocess::Start(const string& program, SearchMode search_mode) { // Create the pipes. HANDLE stdin_pipe_read; HANDLE stdin_pipe_write; HANDLE stdout_pipe_read; HANDLE stdout_pipe_write; - if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, nullptr, 0)) { + if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, NULL, 0)) { GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); } - if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, nullptr, 0)) { + if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, NULL, 0)) { GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); } // Make child side of the pipes inheritable. - if (!SetHandleInformation(stdin_pipe_read, HANDLE_FLAG_INHERIT, - HANDLE_FLAG_INHERIT)) { + if (!SetHandleInformation(stdin_pipe_read, + HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { GOOGLE_LOG(FATAL) << "SetHandleInformation: " << Win32ErrorMessage(GetLastError()); } - if (!SetHandleInformation(stdout_pipe_write, HANDLE_FLAG_INHERIT, - HANDLE_FLAG_INHERIT)) { + if (!SetHandleInformation(stdout_pipe_write, + HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { GOOGLE_LOG(FATAL) << "SetHandleInformation: " << Win32ErrorMessage(GetLastError()); } // Setup STARTUPINFO to redirect handles. - STARTUPINFOW startup_info; + STARTUPINFOA startup_info; ZeroMemory(&startup_info, sizeof(startup_info)); startup_info.cb = sizeof(startup_info); startup_info.dwFlags = STARTF_USESTDHANDLES; @@ -123,40 +107,26 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { startup_info.hStdError = GetStdHandle(STD_ERROR_HANDLE); if (startup_info.hStdError == INVALID_HANDLE_VALUE) { - GOOGLE_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError()); - } - - // get wide string version of program as the path may contain non-ascii characters - std::wstring wprogram; - if (!io::win32::strings::utf8_to_wcs(program.c_str(), &wprogram)) { - GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); - } - - // Invoking cmd.exe allows for '.bat' files from the path as well as '.exe'. - std::string command_line = "cmd.exe /c \"" + program + "\""; - - // get wide string version of command line as the path may contain non-ascii characters - std::wstring wcommand_line; - if (!io::win32::strings::utf8_to_wcs(command_line.c_str(), &wcommand_line)) { - GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); + GOOGLE_LOG(FATAL) << "GetStdHandle: " + << Win32ErrorMessage(GetLastError()); } - // Using a malloc'ed string because CreateProcess() can mutate its second - // parameter. - wchar_t *wcommand_line_copy = _wcsdup(wcommand_line.c_str()); + // CreateProcess() mutates its second parameter. WTF? + char* name_copy = strdup(program.c_str()); // Create the process. PROCESS_INFORMATION process_info; - if (CreateProcessW((search_mode == SEARCH_PATH) ? nullptr : wprogram.c_str(), - (search_mode == SEARCH_PATH) ? wcommand_line_copy : NULL, - nullptr, // process security attributes - nullptr, // thread security attributes - TRUE, // inherit handles? - 0, // obscure creation flags - nullptr, // environment (inherit from parent) - nullptr, // current directory (inherit from parent) - &startup_info, &process_info)) { + if (CreateProcessA((search_mode == SEARCH_PATH) ? NULL : program.c_str(), + (search_mode == SEARCH_PATH) ? name_copy : NULL, + NULL, // process security attributes + NULL, // thread security attributes + TRUE, // inherit handles? + 0, // obscure creation flags + NULL, // environment (inherit from parent) + NULL, // current directory (inherit from parent) + &startup_info, + &process_info)) { child_handle_ = process_info.hProcess; CloseHandleOrDie(process_info.hThread); child_stdin_ = stdin_pipe_write; @@ -169,42 +139,38 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { CloseHandleOrDie(stdin_pipe_read); CloseHandleOrDie(stdout_pipe_write); - free(wcommand_line_copy); + free(name_copy); } bool Subprocess::Communicate(const Message& input, Message* output, - std::string* error) { + string* error) { if (process_start_error_ != ERROR_SUCCESS) { *error = Win32ErrorMessage(process_start_error_); return false; } - GOOGLE_CHECK(child_handle_ != nullptr) << "Must call Start() first."; + GOOGLE_CHECK(child_handle_ != NULL) << "Must call Start() first."; - std::string input_data; - if (!input.SerializeToString(&input_data)) { - *error = "Failed to serialize request."; - return false; - } - std::string output_data; + string input_data = input.SerializeAsString(); + string output_data; int input_pos = 0; - while (child_stdout_ != nullptr) { + while (child_stdout_ != NULL) { HANDLE handles[2]; int handle_count = 0; - if (child_stdin_ != nullptr) { + if (child_stdin_ != NULL) { handles[handle_count++] = child_stdin_; } - if (child_stdout_ != nullptr) { + if (child_stdout_ != NULL) { handles[handle_count++] = child_stdout_; } DWORD wait_result = WaitForMultipleObjects(handle_count, handles, FALSE, INFINITE); - HANDLE signaled_handle = nullptr; + HANDLE signaled_handle; if (wait_result >= WAIT_OBJECT_0 && wait_result < WAIT_OBJECT_0 + handle_count) { signaled_handle = handles[wait_result - WAIT_OBJECT_0]; @@ -218,8 +184,10 @@ bool Subprocess::Communicate(const Message& input, Message* output, if (signaled_handle == child_stdin_) { DWORD n; - if (!WriteFile(child_stdin_, input_data.data() + input_pos, - input_data.size() - input_pos, &n, nullptr)) { + if (!WriteFile(child_stdin_, + input_data.data() + input_pos, + input_data.size() - input_pos, + &n, NULL)) { // Child closed pipe. Presumably it will report an error later. // Pretend we're done for now. input_pos = input_data.size(); @@ -230,27 +198,27 @@ bool Subprocess::Communicate(const Message& input, Message* output, if (input_pos == input_data.size()) { // We're done writing. Close. CloseHandleOrDie(child_stdin_); - child_stdin_ = nullptr; + child_stdin_ = NULL; } } else if (signaled_handle == child_stdout_) { char buffer[4096]; DWORD n; - if (!ReadFile(child_stdout_, buffer, sizeof(buffer), &n, nullptr)) { + if (!ReadFile(child_stdout_, buffer, sizeof(buffer), &n, NULL)) { // We're done reading. Close. CloseHandleOrDie(child_stdout_); - child_stdout_ = nullptr; + child_stdout_ = NULL; } else { output_data.append(buffer, n); } } } - if (child_stdin_ != nullptr) { + if (child_stdin_ != NULL) { // Child did not finish reading input before it closed the output. // Presumably it exited with an error. CloseHandleOrDie(child_stdin_); - child_stdin_ = nullptr; + child_stdin_ = NULL; } DWORD wait_result = WaitForSingleObject(child_handle_, INFINITE); @@ -270,10 +238,11 @@ bool Subprocess::Communicate(const Message& input, Message* output, } CloseHandleOrDie(child_handle_); - child_handle_ = nullptr; + 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; } @@ -285,18 +254,18 @@ bool Subprocess::Communicate(const Message& input, Message* output, return true; } -std::string Subprocess::Win32ErrorMessage(DWORD error_code) { +string Subprocess::Win32ErrorMessage(DWORD error_code) { char* message; // WTF? - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, error_code, - MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), - (LPSTR)&message, // NOT A BUG! - 0, nullptr); - - std::string result = message; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, error_code, 0, + (LPTSTR)&message, // NOT A BUG! + 0, NULL); + + string result = message; LocalFree(message); return result; } @@ -317,7 +286,7 @@ Subprocess::~Subprocess() { } } -void Subprocess::Start(const std::string& program, SearchMode search_mode) { +void Subprocess::Start(const string& program, SearchMode search_mode) { // Note that we assume that there are no other threads, thus we don't have to // do crazy stuff like using socket pairs or avoiding libc locks. @@ -325,10 +294,10 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { int stdin_pipe[2]; int stdout_pipe[2]; - GOOGLE_CHECK(pipe(stdin_pipe) != -1); - GOOGLE_CHECK(pipe(stdout_pipe) != -1); + pipe(stdin_pipe); + pipe(stdout_pipe); - char* argv[2] = {portable_strdup(program.c_str()), nullptr}; + char* argv[2] = { strdup(program.c_str()), NULL }; child_pid_ = fork(); if (child_pid_ == -1) { @@ -354,14 +323,9 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { // Write directly to STDERR_FILENO to avoid stdio code paths that may do // stuff that is unsafe here. - int ignored; - ignored = write(STDERR_FILENO, argv[0], strlen(argv[0])); - const char* message = - ": program not found or is not executable\n" - "Please specify a program using absolute path or make sure " - "the program is available in your PATH system variable\n"; - ignored = write(STDERR_FILENO, message, strlen(message)); - (void)ignored; + write(STDERR_FILENO, argv[0], strlen(argv[0])); + const char* message = ": program not found or is not executable\n"; + write(STDERR_FILENO, message, strlen(message)); // Must use _exit() rather than exit() to avoid flushing output buffers // that will also be flushed by the parent. @@ -378,7 +342,8 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { } bool Subprocess::Communicate(const Message& input, Message* output, - std::string* error) { + string* error) { + GOOGLE_CHECK_NE(child_stdin_, -1) << "Must call Start() first."; // The "sighandler_t" typedef is GNU-specific, so define our own. @@ -387,15 +352,11 @@ bool Subprocess::Communicate(const Message& input, Message* output, // Make sure SIGPIPE is disabled so that if the child dies it doesn't kill us. SignalHandler* old_pipe_handler = signal(SIGPIPE, SIG_IGN); - std::string input_data; - if (!input.SerializeToString(&input_data)) { - *error = "Failed to serialize request."; - return false; - } - std::string output_data; + string input_data = input.SerializeAsString(); + string output_data; int input_pos = 0; - int max_fd = std::max(child_stdin_, child_stdout_); + int max_fd = max(child_stdin_, child_stdout_); while (child_stdout_ != -1) { fd_set read_fds; @@ -409,7 +370,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, FD_SET(child_stdin_, &write_fds); } - if (select(max_fd + 1, &read_fds, &write_fds, nullptr, nullptr) < 0) { + if (select(max_fd + 1, &read_fds, &write_fds, NULL, NULL) < 0) { if (errno == EINTR) { // Interrupted by signal. Try again. continue; @@ -420,7 +381,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, if (child_stdin_ != -1 && FD_ISSET(child_stdin_, &write_fds)) { int n = write(child_stdin_, input_data.data() + input_pos, - input_data.size() - input_pos); + input_data.size() - input_pos); if (n < 0) { // Child closed pipe. Presumably it will report an error later. // Pretend we're done for now. @@ -470,13 +431,14 @@ bool Subprocess::Communicate(const Message& input, Message* output, if (WIFEXITED(status)) { if (WEXITSTATUS(status) != 0) { int error_code = WEXITSTATUS(status); - *error = - strings::Substitute("Plugin failed with status code $0.", error_code); + *error = strings::Substitute( + "Plugin failed with status code $0.", error_code); return false; } } else if (WIFSIGNALED(status)) { int signal = WTERMSIG(status); - *error = strings::Substitute("Plugin killed by signal $0.", signal); + *error = strings::Substitute( + "Plugin killed by signal $0.", signal); return false; } else { *error = "Neither WEXITSTATUS nor WTERMSIG is true?"; @@ -484,7 +446,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, } if (!output->ParseFromString(output_data)) { - *error = "Plugin output is unparseable: " + CEscape(output_data); + *error = "Plugin output is unparseable."; return false; } diff --git a/depends/protobuf/src/google/protobuf/compiler/subprocess.h b/depends/protobuf/google/protobuf/compiler/subprocess.h similarity index 84% rename from depends/protobuf/src/google/protobuf/compiler/subprocess.h rename to depends/protobuf/google/protobuf/compiler/subprocess.h index 5cb784d46..de9fce9ec 100644 --- a/depends/protobuf/src/google/protobuf/compiler/subprocess.h +++ b/depends/protobuf/google/protobuf/compiler/subprocess.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -34,9 +34,7 @@ #define GOOGLE_PROTOBUF_COMPILER_SUBPROCESS_H__ #ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN // right... -#endif +#define WIN32_LEAN_AND_MEAN // right... #include #else // _WIN32 #include @@ -46,8 +44,6 @@ #include -// Must be included last. -#include namespace google { namespace protobuf { @@ -57,31 +53,31 @@ class Message; namespace compiler { // Utility class for launching sub-processes. -class PROTOC_EXPORT Subprocess { +class Subprocess { public: Subprocess(); ~Subprocess(); enum SearchMode { - SEARCH_PATH, // Use PATH environment variable. - EXACT_NAME // Program is an exact file name; don't use the PATH. + SEARCH_PATH, // Use PATH environment variable. + EXACT_NAME // Program is an exact file name; don't use the PATH. }; // Start the subprocess. Currently we don't provide a way to specify // arguments as protoc plugins don't have any. - void Start(const std::string& program, SearchMode search_mode); + void Start(const string& program, SearchMode search_mode); // Serialize the input message and pipe it to the subprocess's stdin, then // close the pipe. Meanwhile, read from the subprocess's stdout and parse // the data into *output. All this is done carefully to avoid deadlocks. // Returns true if successful. On any sort of error, returns false and sets // *error to a description of the problem. - bool Communicate(const Message& input, Message* output, std::string* error); + bool Communicate(const Message& input, Message* output, string* error); #ifdef _WIN32 // Given an error code, returns a human-readable error message. This is // defined here so that CommandLineInterface can share it. - static std::string Win32ErrorMessage(DWORD error_code); + static string Win32ErrorMessage(DWORD error_code); #endif private: @@ -107,8 +103,6 @@ class PROTOC_EXPORT Subprocess { } // namespace compiler } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_SUBPROCESS_H__ diff --git a/depends/protobuf/src/google/protobuf/string_member_robber.h b/depends/protobuf/google/protobuf/compiler/test_plugin.cc similarity index 70% rename from depends/protobuf/src/google/protobuf/string_member_robber.h rename to depends/protobuf/google/protobuf/compiler/test_plugin.cc index a4c1051e0..5cbbf3d9d 100644 --- a/depends/protobuf/src/google/protobuf/string_member_robber.h +++ b/depends/protobuf/google/protobuf/compiler/test_plugin.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -28,11 +28,24 @@ // (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_STRING_MEMBER_ROBBER_H__ -#define GOOGLE_PROTOBUF_STRING_MEMBER_ROBBER_H__ +// Author: kenton@google.com (Kenton Varda) +// +// This is a dummy code generator plugin used by +// command_line_interface_unittest. #include -#include +#include +#include +#include +#include +int main(int argc, char* argv[]) { +#ifdef _MSC_VER + // Don't print a silly message or stick a modal dialog box in my face, + // please. + _set_abort_behavior(0, ~0); +#endif // !_MSC_VER -#endif // GOOGLE_PROTOBUF_STRING_MEMBER_ROBBER_H__ + google::protobuf::compiler::MockCodeGenerator generator("test_plugin"); + return google::protobuf::compiler::PluginMain(argc, argv, &generator); +} diff --git a/depends/protobuf/google/protobuf/compiler/zip_writer.cc b/depends/protobuf/google/protobuf/compiler/zip_writer.cc new file mode 100644 index 000000000..65d735270 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/zip_writer.cc @@ -0,0 +1,218 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace compiler { + +static const uint32 kCRC32Table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +static uint32 ComputeCRC32(const string &buf) { + uint32 x = ~0U; + for (int i = 0; i < buf.size(); ++i) { + unsigned char c = buf[i]; + x = kCRC32Table[(x ^ c) & 0xff] ^ (x >> 8); + } + return ~x; +} + +static void WriteShort(io::CodedOutputStream *out, uint16 val) { + uint8 p[2]; + p[0] = static_cast(val); + p[1] = static_cast(val >> 8); + out->WriteRaw(p, 2); +} + +ZipWriter::ZipWriter(io::ZeroCopyOutputStream* raw_output) + : raw_output_(raw_output) {} +ZipWriter::~ZipWriter() {} + +bool ZipWriter::Write(const string& filename, const string& contents) { + FileInfo info; + + info.name = filename; + uint16 filename_size = filename.size(); + info.offset = raw_output_->ByteCount(); + info.size = contents.size(); + info.crc32 = ComputeCRC32(contents); + + files_.push_back(info); + + // write file header + io::CodedOutputStream output(raw_output_); + output.WriteLittleEndian32(0x04034b50); // magic + WriteShort(&output, 10); // version needed to extract + WriteShort(&output, 0); // flags + WriteShort(&output, 0); // compression method: stored + WriteShort(&output, 0); // last modified time + WriteShort(&output, 0); // last modified date + output.WriteLittleEndian32(info.crc32); // crc-32 + output.WriteLittleEndian32(info.size); // compressed size + output.WriteLittleEndian32(info.size); // uncompressed size + WriteShort(&output, filename_size); // file name length + WriteShort(&output, 0); // extra field length + output.WriteString(filename); // file name + output.WriteString(contents); // file data + + return !output.HadError(); +} + +bool ZipWriter::WriteDirectory() { + uint16 num_entries = files_.size(); + uint32 dir_ofs = raw_output_->ByteCount(); + + // write central directory + io::CodedOutputStream output(raw_output_); + for (int i = 0; i < num_entries; ++i) { + const 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; + + output.WriteLittleEndian32(0x02014b50); // magic + WriteShort(&output, 10); // version made by + WriteShort(&output, 10); // version needed to extract + WriteShort(&output, 0); // flags + WriteShort(&output, 0); // compression method: stored + WriteShort(&output, 0); // last modified time + WriteShort(&output, 0); // last modified date + output.WriteLittleEndian32(crc32); // crc-32 + output.WriteLittleEndian32(size); // compressed size + output.WriteLittleEndian32(size); // uncompressed size + WriteShort(&output, filename_size); // file name length + WriteShort(&output, 0); // extra field length + WriteShort(&output, 0); // file comment length + WriteShort(&output, 0); // starting disk number + WriteShort(&output, 0); // internal file attributes + output.WriteLittleEndian32(0); // external file attributes + output.WriteLittleEndian32(offset); // local header offset + output.WriteString(filename); // file name + } + uint32 dir_len = output.ByteCount(); + + // write end of central directory marker + output.WriteLittleEndian32(0x06054b50); // magic + WriteShort(&output, 0); // disk number + WriteShort(&output, 0); // disk with start of central directory + WriteShort(&output, num_entries); // central directory entries (this disk) + WriteShort(&output, num_entries); // central directory entries (total) + output.WriteLittleEndian32(dir_len); // central directory byte size + output.WriteLittleEndian32(dir_ofs); // central directory offset + WriteShort(&output, 0); // comment length + + return output.HadError(); +} + +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/compiler/zip_writer.h b/depends/protobuf/google/protobuf/compiler/zip_writer.h new file mode 100644 index 000000000..be73972a6 --- /dev/null +++ b/depends/protobuf/google/protobuf/compiler/zip_writer.h @@ -0,0 +1,93 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// http://code.google.com/p/protobuf/ +// +// 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 string& filename, const string& contents); + bool WriteDirectory(); + + private: + struct FileInfo { + string name; + uint32 offset; + uint32 size; + uint32 crc32; + }; + + io::ZeroCopyOutputStream* raw_output_; + vector files_; +}; + +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/descriptor.cc b/depends/protobuf/google/protobuf/descriptor.cc new file mode 100644 index 000000000..754b56283 --- /dev/null +++ b/depends/protobuf/google/protobuf/descriptor.cc @@ -0,0 +1,4497 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +#undef PACKAGE // autoheader #defines this. :( + +namespace google { +namespace protobuf { + +const FieldDescriptor::CppType +FieldDescriptor::kTypeToCppTypeMap[MAX_TYPE + 1] = { + static_cast(0), // 0 is reserved for errors + + CPPTYPE_DOUBLE, // TYPE_DOUBLE + CPPTYPE_FLOAT, // TYPE_FLOAT + CPPTYPE_INT64, // TYPE_INT64 + CPPTYPE_UINT64, // TYPE_UINT64 + CPPTYPE_INT32, // TYPE_INT32 + CPPTYPE_UINT64, // TYPE_FIXED64 + CPPTYPE_UINT32, // TYPE_FIXED32 + CPPTYPE_BOOL, // TYPE_BOOL + CPPTYPE_STRING, // TYPE_STRING + CPPTYPE_MESSAGE, // TYPE_GROUP + CPPTYPE_MESSAGE, // TYPE_MESSAGE + CPPTYPE_STRING, // TYPE_BYTES + CPPTYPE_UINT32, // TYPE_UINT32 + CPPTYPE_ENUM, // TYPE_ENUM + CPPTYPE_INT32, // TYPE_SFIXED32 + CPPTYPE_INT64, // TYPE_SFIXED64 + CPPTYPE_INT32, // TYPE_SINT32 + CPPTYPE_INT64, // TYPE_SINT64 +}; + +const char * const FieldDescriptor::kTypeToName[MAX_TYPE + 1] = { + "ERROR", // 0 is reserved for errors + + "double", // TYPE_DOUBLE + "float", // TYPE_FLOAT + "int64", // TYPE_INT64 + "uint64", // TYPE_UINT64 + "int32", // TYPE_INT32 + "fixed64", // TYPE_FIXED64 + "fixed32", // TYPE_FIXED32 + "bool", // TYPE_BOOL + "string", // TYPE_STRING + "group", // TYPE_GROUP + "message", // TYPE_MESSAGE + "bytes", // TYPE_BYTES + "uint32", // TYPE_UINT32 + "enum", // TYPE_ENUM + "sfixed32", // TYPE_SFIXED32 + "sfixed64", // TYPE_SFIXED64 + "sint32", // TYPE_SINT32 + "sint64", // TYPE_SINT64 +}; + +const char * const FieldDescriptor::kLabelToName[MAX_LABEL + 1] = { + "ERROR", // 0 is reserved for errors + + "optional", // LABEL_OPTIONAL + "required", // LABEL_REQUIRED + "repeated", // LABEL_REPEATED +}; + +#ifndef _MSC_VER // MSVC doesn't need these and won't even accept them. +const int FieldDescriptor::kMaxNumber; +const int FieldDescriptor::kFirstReservedNumber; +const int FieldDescriptor::kLastReservedNumber; +#endif + +namespace { + +const string kEmptyString; + +string ToCamelCase(const string& input) { + bool capitalize_next = false; + string result; + result.reserve(input.size()); + + for (int i = 0; i < input.size(); i++) { + if (input[i] == '_') { + capitalize_next = true; + } else if (capitalize_next) { + // Note: I distrust ctype.h due to locales. + if ('a' <= input[i] && input[i] <= 'z') { + result.push_back(input[i] - 'a' + 'A'); + } else { + result.push_back(input[i]); + } + capitalize_next = false; + } else { + result.push_back(input[i]); + } + } + + // Lower-case the first letter. + if (!result.empty() && 'A' <= result[0] && result[0] <= 'Z') { + result[0] = result[0] - 'A' + 'a'; + } + + return result; +} + +// A DescriptorPool contains a bunch of hash_maps to implement the +// various Find*By*() methods. Since hashtable lookups are O(1), it's +// most efficient to construct a fixed set of large hash_maps used by +// all objects in the pool rather than construct one or more small +// hash_maps for each object. +// +// The keys to these hash_maps are (parent, name) or (parent, number) +// pairs. Unfortunately STL doesn't provide hash functions for pair<>, +// so we must invent our own. +// +// 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 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; + } +}; + +template +struct PointerIntegerPairHash { + size_t operator()(const PairType& p) const { + // FIXME(kenton): What is the best way to compute this hash? I have + // no idea! This seems a bit better than an XOR. + return reinterpret_cast(p.first) * ((1 << 16) - 1) + p.second; + } + + // Used only by MSVC and platforms where hash_map is not available. + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; + inline bool operator()(const PairType& a, const PairType& b) const { + return a.first < b.first || + (a.first == b.first && a.second < b.second); + } +}; + +typedef pair DescriptorIntPair; +typedef pair EnumIntPair; + +struct PointerStringPairHash { + size_t operator()(const PointerStringPair& p) const { + // FIXME(kenton): What is the best way to compute this hash? I have + // no idea! This seems a bit better than an XOR. + hash cstring_hash; + return reinterpret_cast(p.first) * ((1 << 16) - 1) + + cstring_hash(p.second); + } + + // Used only by MSVC and platforms where hash_map is not available. + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; + 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; + } +}; + + +struct Symbol { + enum Type { + NULL_SYMBOL, MESSAGE, FIELD, ENUM, ENUM_VALUE, SERVICE, METHOD, PACKAGE + }; + Type type; + union { + const Descriptor* descriptor; + const FieldDescriptor* field_descriptor; + const EnumDescriptor* enum_descriptor; + const EnumValueDescriptor* enum_value_descriptor; + const ServiceDescriptor* service_descriptor; + const MethodDescriptor* method_descriptor; + const FileDescriptor* package_file_descriptor; + }; + + inline Symbol() : type(NULL_SYMBOL) { descriptor = NULL; } + 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; + } + +#define CONSTRUCTOR(TYPE, TYPE_CONSTANT, FIELD) \ + inline explicit Symbol(const TYPE* value) { \ + type = TYPE_CONSTANT; \ + this->FIELD = value; \ + } + + CONSTRUCTOR(Descriptor , MESSAGE , descriptor ) + CONSTRUCTOR(FieldDescriptor , FIELD , field_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: return NULL; + case MESSAGE : return descriptor ->file(); + case FIELD : return field_descriptor ->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; + } + return NULL; + } +}; + +const Symbol kNullSymbol; + +typedef hash_map, streq> + SymbolsByNameMap; +typedef hash_map + SymbolsByParentMap; +typedef hash_map, streq> + FilesByNameMap; +typedef hash_map + FieldsByNameMap; +typedef hash_map > + FieldsByNumberMap; +typedef hash_map > + 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 +// for that. +typedef map + ExtensionsGroupedByDescriptorMap; + +} // anonymous namespace + +// =================================================================== +// DescriptorPool::Tables + +class DescriptorPool::Tables { + public: + Tables(); + ~Tables(); + + // Checkpoint the state of the tables. Future calls to Rollback() will + // return the Tables to this state. This is used when building files, since + // some kinds of validation errors cannot be detected until the file's + // descriptors have already been added to the tables. BuildFile() calls + // Checkpoint() before it starts building and Rollback() if it encounters + // an error. + void Checkpoint(); + + // Roll back the Tables to the state of the last Checkpoint(), removing + // everything that was added after that point. + void Rollback(); + + // The stack of files which are currently being built. Used to detect + // cyclic dependencies when loading files from a DescriptorDatabase. Not + // used when fallback_database_ == NULL. + vector pending_files_; + + // A set of files which we have tried to load from the fallback database + // and encountered errors. We will not attempt to load them again. + // Not used when fallback_database_ == NULL. + hash_set known_bad_files_; + + // The set of descriptors for which we've already loaded the full + // set of extensions numbers from fallback_database_. + hash_set extensions_loaded_from_db_; + + // ----------------------------------------------------------------- + // Finding items. + + // Find symbols. This returns a null Symbol (symbol.IsNull() is true) + // if not found. + inline Symbol FindSymbol(const string& 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 string& name) const; + + // These return NULL if not found. + inline const FileDescriptor* FindFile(const string& key) const; + inline const FieldDescriptor* FindExtension(const Descriptor* extendee, + int number); + inline void FindAllExtensions(const Descriptor* extendee, + vector* out) const; + + // ----------------------------------------------------------------- + // Adding items. + + // These add items to the corresponding tables. They return false if + // the key already exists in the table. For AddSymbol(), the string passed + // in must be one that was constructed using AllocateString(), as it will + // be used as a key in the symbols_by_name_ map without copying. + bool AddSymbol(const string& full_name, Symbol symbol); + bool AddFile(const FileDescriptor* file); + bool AddExtension(const FieldDescriptor* field); + + // ----------------------------------------------------------------- + // Allocating memory. + + // Allocate an object which will be reclaimed when the pool is + // destroyed. Note that the object's destructor will never be called, + // so its fields must be plain old data (primitive data types and + // pointers). All of the descriptor types are such objects. + template Type* Allocate(); + + // Allocate an array of objects which will be reclaimed when the + // pool in destroyed. Again, destructors are never called. + template Type* AllocateArray(int count); + + // Allocate a string which will be destroyed when the pool is destroyed. + // The string is initialized to the given value for convenience. + string* AllocateString(const string& value); + + // Allocate a protocol message object. Some older versions of GCC have + // trouble understanding explicit template instantiations in some cases, so + // in those cases we have to pass a dummy pointer of the right type as the + // parameter instead of specifying the type explicitly. + template Type* AllocateMessage(Type* dummy = NULL); + + // Allocate a FileDescriptorTables object. + FileDescriptorTables* AllocateFileTables(); + + private: + vector strings_; // All strings in the pool. + vector messages_; // All messages in the pool. + vector file_tables_; // All file tables in the pool. + vector allocations_; // All other memory allocated in the pool. + + SymbolsByNameMap symbols_by_name_; + FilesByNameMap files_by_name_; + ExtensionsGroupedByDescriptorMap extensions_; + + int strings_before_checkpoint_; + int messages_before_checkpoint_; + int file_tables_before_checkpoint_; + int allocations_before_checkpoint_; + vector symbols_after_checkpoint_; + vector files_after_checkpoint_; + vector extensions_after_checkpoint_; + + // Allocate some bytes which will be reclaimed when the pool is + // destroyed. + void* AllocateBytes(int size); +}; + +// Contains tables specific to a particular file. These tables are not +// modified once the file has been constructed, so they need not be +// protected by a mutex. This makes operations that depend only on the +// contents of a single file -- e.g. Descriptor::FindFieldByName() -- +// lock-free. +// +// For historical reasons, the definitions of the methods of +// FileDescriptorTables and DescriptorPool::Tables are interleaved below. +// These used to be a single class. +class FileDescriptorTables { + public: + FileDescriptorTables(); + ~FileDescriptorTables(); + + // Empty table, used with placeholder files. + static const FileDescriptorTables kEmpty; + + // ----------------------------------------------------------------- + // Finding items. + + // Find symbols. These return a null Symbol (symbol.IsNull() is true) + // if not found. + inline Symbol FindNestedSymbol(const void* parent, + const string& name) const; + inline Symbol FindNestedSymbolOfType(const void* parent, + const string& name, + const Symbol::Type type) const; + + // These return NULL if not found. + inline const FieldDescriptor* FindFieldByNumber( + const Descriptor* parent, int number) const; + inline const FieldDescriptor* FindFieldByLowercaseName( + const void* parent, const string& lowercase_name) const; + inline const FieldDescriptor* FindFieldByCamelcaseName( + const void* parent, const string& camelcase_name) const; + inline const EnumValueDescriptor* FindEnumValueByNumber( + const EnumDescriptor* parent, int number) const; + + // ----------------------------------------------------------------- + // Adding items. + + // These add items to the corresponding tables. They return false if + // the key already exists in the table. For AddAliasUnderParent(), the + // string passed in must be one that was constructed using AllocateString(), + // as it will be used as a key in the symbols_by_parent_ map without copying. + bool AddAliasUnderParent(const void* parent, const string& name, + Symbol symbol); + bool AddFieldByNumber(const FieldDescriptor* field); + bool AddEnumValueByNumber(const 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. + void AddFieldByStylizedNames(const FieldDescriptor* field); + + private: + SymbolsByParentMap symbols_by_parent_; + FieldsByNameMap fields_by_lowercase_name_; + FieldsByNameMap fields_by_camelcase_name_; + FieldsByNumberMap fields_by_number_; // Not including extensions. + EnumValuesByNumberMap enum_values_by_number_; +}; + +DescriptorPool::Tables::Tables() + : strings_before_checkpoint_(0), + messages_before_checkpoint_(0), + allocations_before_checkpoint_(0) {} + +DescriptorPool::Tables::~Tables() { + // Note that the deletion order is important, since the destructors of some + // messages may refer to objects in allocations_. + STLDeleteElements(&messages_); + for (int i = 0; i < allocations_.size(); i++) { + operator delete(allocations_[i]); + } + STLDeleteElements(&strings_); + STLDeleteElements(&file_tables_); +} + +FileDescriptorTables::FileDescriptorTables() {} +FileDescriptorTables::~FileDescriptorTables() {} + +const FileDescriptorTables FileDescriptorTables::kEmpty; + +void DescriptorPool::Tables::Checkpoint() { + strings_before_checkpoint_ = strings_.size(); + messages_before_checkpoint_ = messages_.size(); + file_tables_before_checkpoint_ = file_tables_.size(); + allocations_before_checkpoint_ = allocations_.size(); + + symbols_after_checkpoint_.clear(); + files_after_checkpoint_.clear(); + extensions_after_checkpoint_.clear(); +} + +void DescriptorPool::Tables::Rollback() { + for (int i = 0; i < symbols_after_checkpoint_.size(); i++) { + symbols_by_name_.erase(symbols_after_checkpoint_[i]); + } + for (int i = 0; i < files_after_checkpoint_.size(); i++) { + files_by_name_.erase(files_after_checkpoint_[i]); + } + for (int i = 0; i < extensions_after_checkpoint_.size(); i++) { + extensions_.erase(extensions_after_checkpoint_[i]); + } + + symbols_after_checkpoint_.clear(); + files_after_checkpoint_.clear(); + extensions_after_checkpoint_.clear(); + + STLDeleteContainerPointers( + strings_.begin() + strings_before_checkpoint_, strings_.end()); + STLDeleteContainerPointers( + messages_.begin() + messages_before_checkpoint_, messages_.end()); + STLDeleteContainerPointers( + file_tables_.begin() + file_tables_before_checkpoint_, file_tables_.end()); + for (int i = allocations_before_checkpoint_; i < allocations_.size(); i++) { + operator delete(allocations_[i]); + } + + strings_.resize(strings_before_checkpoint_); + messages_.resize(messages_before_checkpoint_); + file_tables_.resize(file_tables_before_checkpoint_); + allocations_.resize(allocations_before_checkpoint_); +} + +// ------------------------------------------------------------------- + +inline Symbol DescriptorPool::Tables::FindSymbol(const string& key) const { + const Symbol* result = FindOrNull(symbols_by_name_, key.c_str()); + if (result == NULL) { + return kNullSymbol; + } else { + return *result; + } +} + +inline Symbol FileDescriptorTables::FindNestedSymbol( + const void* parent, const string& name) const { + const Symbol* result = + FindOrNull(symbols_by_parent_, PointerStringPair(parent, name.c_str())); + if (result == NULL) { + return kNullSymbol; + } else { + return *result; + } +} + +inline Symbol FileDescriptorTables::FindNestedSymbolOfType( + const void* parent, const string& name, const Symbol::Type type) const { + Symbol result = FindNestedSymbol(parent, name); + if (result.type != type) return kNullSymbol; + return result; +} + +Symbol DescriptorPool::Tables::FindByNameHelper( + const DescriptorPool* pool, const string& name) const { + MutexLockMaybe lock(pool->mutex_); + Symbol result = FindSymbol(name); + + if (result.IsNull() && pool->underlay_ != NULL) { + // Symbol not found; check the underlay. + result = + pool->underlay_->tables_->FindByNameHelper(pool->underlay_, name); + } + + if (result.IsNull()) { + // Symbol still not found, so check fallback database. + if (pool->TryFindSymbolInFallbackDatabase(name)) { + result = FindSymbol(name); + } + } + + return result; +} + +inline const FileDescriptor* DescriptorPool::Tables::FindFile( + const string& key) const { + return FindPtrOrNull(files_by_name_, key.c_str()); +} + +inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber( + const Descriptor* parent, int number) const { + return FindPtrOrNull(fields_by_number_, make_pair(parent, number)); +} + +inline const FieldDescriptor* FileDescriptorTables::FindFieldByLowercaseName( + const void* parent, const string& lowercase_name) const { + return FindPtrOrNull(fields_by_lowercase_name_, + PointerStringPair(parent, lowercase_name.c_str())); +} + +inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName( + const void* parent, const string& camelcase_name) const { + return FindPtrOrNull(fields_by_camelcase_name_, + PointerStringPair(parent, camelcase_name.c_str())); +} + +inline const EnumValueDescriptor* FileDescriptorTables::FindEnumValueByNumber( + const EnumDescriptor* parent, int number) const { + return FindPtrOrNull(enum_values_by_number_, make_pair(parent, number)); +} + +inline const FieldDescriptor* DescriptorPool::Tables::FindExtension( + const Descriptor* extendee, int number) { + return FindPtrOrNull(extensions_, make_pair(extendee, number)); +} + +inline void DescriptorPool::Tables::FindAllExtensions( + const Descriptor* extendee, vector* out) const { + ExtensionsGroupedByDescriptorMap::const_iterator it = + extensions_.lower_bound(make_pair(extendee, 0)); + for (; it != extensions_.end() && it->first.first == extendee; ++it) { + out->push_back(it->second); + } +} + +// ------------------------------------------------------------------- + +bool DescriptorPool::Tables::AddSymbol( + const string& full_name, Symbol symbol) { + if (InsertIfNotPresent(&symbols_by_name_, full_name.c_str(), symbol)) { + symbols_after_checkpoint_.push_back(full_name.c_str()); + return true; + } else { + return false; + } +} + +bool FileDescriptorTables::AddAliasUnderParent( + const void* parent, const string& name, Symbol symbol) { + PointerStringPair by_parent_key(parent, name.c_str()); + return InsertIfNotPresent(&symbols_by_parent_, by_parent_key, symbol); +} + +bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) { + if (InsertIfNotPresent(&files_by_name_, file->name().c_str(), file)) { + files_after_checkpoint_.push_back(file->name().c_str()); + return true; + } else { + return false; + } +} + +void FileDescriptorTables::AddFieldByStylizedNames( + const FieldDescriptor* field) { + const void* parent; + if (field->is_extension()) { + if (field->extension_scope() == NULL) { + parent = field->file(); + } else { + parent = field->extension_scope(); + } + } else { + parent = field->containing_type(); + } + + PointerStringPair lowercase_key(parent, field->lowercase_name().c_str()); + InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field); + + PointerStringPair camelcase_key(parent, field->camelcase_name().c_str()); + InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field); +} + +bool FileDescriptorTables::AddFieldByNumber(const FieldDescriptor* field) { + DescriptorIntPair key(field->containing_type(), field->number()); + return InsertIfNotPresent(&fields_by_number_, key, field); +} + +bool FileDescriptorTables::AddEnumValueByNumber( + const EnumValueDescriptor* value) { + EnumIntPair key(value->type(), value->number()); + return InsertIfNotPresent(&enum_values_by_number_, key, value); +} + +bool DescriptorPool::Tables::AddExtension(const FieldDescriptor* field) { + DescriptorIntPair key(field->containing_type(), field->number()); + if (InsertIfNotPresent(&extensions_, key, field)) { + extensions_after_checkpoint_.push_back(key); + return true; + } else { + return false; + } +} + +// ------------------------------------------------------------------- + +template +Type* DescriptorPool::Tables::Allocate() { + return reinterpret_cast(AllocateBytes(sizeof(Type))); +} + +template +Type* DescriptorPool::Tables::AllocateArray(int count) { + return reinterpret_cast(AllocateBytes(sizeof(Type) * count)); +} + +string* DescriptorPool::Tables::AllocateString(const string& value) { + string* result = new string(value); + strings_.push_back(result); + return result; +} + +template +Type* DescriptorPool::Tables::AllocateMessage(Type* dummy) { + Type* result = new Type; + messages_.push_back(result); + return result; +} + +FileDescriptorTables* DescriptorPool::Tables::AllocateFileTables() { + FileDescriptorTables* result = new FileDescriptorTables; + file_tables_.push_back(result); + return result; +} + +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 NULL; + + void* result = operator new(size); + allocations_.push_back(result); + return result; +} + +// =================================================================== +// DescriptorPool + +DescriptorPool::ErrorCollector::~ErrorCollector() {} + +DescriptorPool::DescriptorPool() + : mutex_(NULL), + fallback_database_(NULL), + default_error_collector_(NULL), + underlay_(NULL), + tables_(new Tables), + enforce_dependencies_(true), + allow_unknown_(false) {} + +DescriptorPool::DescriptorPool(DescriptorDatabase* fallback_database, + ErrorCollector* error_collector) + : mutex_(new Mutex), + fallback_database_(fallback_database), + default_error_collector_(error_collector), + underlay_(NULL), + tables_(new Tables), + enforce_dependencies_(true), + allow_unknown_(false) { +} + +DescriptorPool::DescriptorPool(const DescriptorPool* underlay) + : mutex_(NULL), + fallback_database_(NULL), + default_error_collector_(NULL), + underlay_(underlay), + tables_(new Tables), + enforce_dependencies_(true), + allow_unknown_(false) {} + +DescriptorPool::~DescriptorPool() { + if (mutex_ != NULL) delete mutex_; +} + +// DescriptorPool::BuildFile() defined later. +// DescriptorPool::BuildFileCollectingErrors() defined later. + +void DescriptorPool::InternalDontEnforceDependencies() { + enforce_dependencies_ = false; +} + +bool DescriptorPool::InternalIsFileLoaded(const string& filename) const { + MutexLockMaybe lock(mutex_); + return tables_->FindFile(filename) != NULL; +} + +// generated_pool ==================================================== + +namespace { + + +EncodedDescriptorDatabase* generated_database_ = NULL; +DescriptorPool* generated_pool_ = NULL; +GOOGLE_PROTOBUF_DECLARE_ONCE(generated_pool_init_); + +void DeleteGeneratedPool() { + delete generated_database_; + generated_database_ = NULL; + delete generated_pool_; + generated_pool_ = NULL; +} + +void InitGeneratedPool() { + generated_database_ = new EncodedDescriptorDatabase; + generated_pool_ = new DescriptorPool(generated_database_); + + internal::OnShutdown(&DeleteGeneratedPool); +} + +inline void InitGeneratedPoolOnce() { + ::google::protobuf::GoogleOnceInit(&generated_pool_init_, &InitGeneratedPool); +} + +} // anonymous namespace + +const DescriptorPool* DescriptorPool::generated_pool() { + InitGeneratedPoolOnce(); + return generated_pool_; +} + +DescriptorPool* DescriptorPool::internal_generated_pool() { + InitGeneratedPoolOnce(); + return generated_pool_; +} + +void DescriptorPool::InternalAddGeneratedFile( + const void* encoded_file_descriptor, int size) { + // So, this function is called in the process of initializing the + // descriptors for generated proto classes. Each generated .pb.cc file + // has an internal procedure called AddDescriptors() which is called at + // process startup, and that function calls this one in order to register + // the raw bytes of the FileDescriptorProto representing the file. + // + // We do not actually construct the descriptor objects right away. We just + // hang on to the bytes until they are actually needed. We actually construct + // the descriptor the first time one of the following things happens: + // * Someone calls a method like descriptor(), GetDescriptor(), or + // GetReflection() on the generated types, which requires returning the + // descriptor or an object based on it. + // * Someone looks up the descriptor in DescriptorPool::generated_pool(). + // + // Once one of these happens, the DescriptorPool actually parses the + // FileDescriptorProto and generates a FileDescriptor (and all its children) + // based on it. + // + // Note that FileDescriptorProto is itself a generated protocol message. + // Therefore, when we parse one, we have to be very careful to avoid using + // any descriptor-based operations, since this might cause infinite recursion + // or deadlock. + InitGeneratedPoolOnce(); + GOOGLE_CHECK(generated_database_->Add(encoded_file_descriptor, size)); +} + + +// Find*By* methods ================================================== + +// TODO(kenton): There's a lot of repeated code here, but I'm not sure if +// there's any good way to factor it out. Think about this some time when +// there's nothing more important to do (read: never). + +const FileDescriptor* DescriptorPool::FindFileByName(const string& name) const { + MutexLockMaybe lock(mutex_); + const FileDescriptor* result = tables_->FindFile(name); + if (result != NULL) return result; + if (underlay_ != NULL) { + const FileDescriptor* result = underlay_->FindFileByName(name); + if (result != NULL) return result; + } + if (TryFindFileInFallbackDatabase(name)) { + const FileDescriptor* result = tables_->FindFile(name); + if (result != NULL) return result; + } + return NULL; +} + +const FileDescriptor* DescriptorPool::FindFileContainingSymbol( + const string& symbol_name) const { + MutexLockMaybe lock(mutex_); + Symbol result = tables_->FindSymbol(symbol_name); + if (!result.IsNull()) return result.GetFile(); + if (underlay_ != NULL) { + const FileDescriptor* result = + underlay_->FindFileContainingSymbol(symbol_name); + if (result != NULL) return result; + } + if (TryFindSymbolInFallbackDatabase(symbol_name)) { + Symbol result = tables_->FindSymbol(symbol_name); + if (!result.IsNull()) return result.GetFile(); + } + return NULL; +} + +const Descriptor* DescriptorPool::FindMessageTypeByName( + const string& name) const { + Symbol result = tables_->FindByNameHelper(this, name); + return (result.type == Symbol::MESSAGE) ? result.descriptor : NULL; +} + +const FieldDescriptor* DescriptorPool::FindFieldByName( + const 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 NULL; + } +} + +const FieldDescriptor* DescriptorPool::FindExtensionByName( + const 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 NULL; + } +} + +const EnumDescriptor* DescriptorPool::FindEnumTypeByName( + const string& name) const { + Symbol result = tables_->FindByNameHelper(this, name); + return (result.type == Symbol::ENUM) ? result.enum_descriptor : NULL; +} + +const EnumValueDescriptor* DescriptorPool::FindEnumValueByName( + const string& name) const { + Symbol result = tables_->FindByNameHelper(this, name); + return (result.type == Symbol::ENUM_VALUE) ? + result.enum_value_descriptor : NULL; +} + +const ServiceDescriptor* DescriptorPool::FindServiceByName( + const string& name) const { + Symbol result = tables_->FindByNameHelper(this, name); + return (result.type == Symbol::SERVICE) ? result.service_descriptor : NULL; +} + +const MethodDescriptor* DescriptorPool::FindMethodByName( + const string& name) const { + Symbol result = tables_->FindByNameHelper(this, name); + return (result.type == Symbol::METHOD) ? result.method_descriptor : NULL; +} + +const FieldDescriptor* DescriptorPool::FindExtensionByNumber( + const Descriptor* extendee, int number) const { + MutexLockMaybe lock(mutex_); + const FieldDescriptor* result = tables_->FindExtension(extendee, number); + if (result != NULL) { + return result; + } + if (underlay_ != NULL) { + const FieldDescriptor* result = + underlay_->FindExtensionByNumber(extendee, number); + if (result != NULL) return result; + } + if (TryFindExtensionInFallbackDatabase(extendee, number)) { + const FieldDescriptor* result = tables_->FindExtension(extendee, number); + if (result != NULL) { + return result; + } + } + return NULL; +} + +void DescriptorPool::FindAllExtensions( + const Descriptor* extendee, vector* out) const { + MutexLockMaybe lock(mutex_); + + // Initialize tables_->extensions_ from the fallback database first + // (but do this only once per descriptor). + if (fallback_database_ != NULL && + tables_->extensions_loaded_from_db_.count(extendee) == 0) { + vector numbers; + if (fallback_database_->FindAllExtensionNumbers(extendee->full_name(), + &numbers)) { + for (int i = 0; i < numbers.size(); ++i) { + int number = numbers[i]; + if (tables_->FindExtension(extendee, number) == NULL) { + TryFindExtensionInFallbackDatabase(extendee, number); + } + } + tables_->extensions_loaded_from_db_.insert(extendee); + } + } + + tables_->FindAllExtensions(extendee, out); + if (underlay_ != NULL) { + underlay_->FindAllExtensions(extendee, out); + } +} + +// ------------------------------------------------------------------- + +const FieldDescriptor* +Descriptor::FindFieldByNumber(int key) const { + const FieldDescriptor* result = + file()->tables_->FindFieldByNumber(this, key); + if (result == NULL || result->is_extension()) { + return NULL; + } else { + return result; + } +} + +const FieldDescriptor* +Descriptor::FindFieldByLowercaseName(const string& key) const { + const FieldDescriptor* result = + file()->tables_->FindFieldByLowercaseName(this, key); + if (result == NULL || result->is_extension()) { + return NULL; + } else { + return result; + } +} + +const FieldDescriptor* +Descriptor::FindFieldByCamelcaseName(const string& key) const { + const FieldDescriptor* result = + file()->tables_->FindFieldByCamelcaseName(this, key); + if (result == NULL || result->is_extension()) { + return NULL; + } else { + return result; + } +} + +const FieldDescriptor* +Descriptor::FindFieldByName(const 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 NULL; + } +} + +const FieldDescriptor* +Descriptor::FindExtensionByName(const 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 NULL; + } +} + +const FieldDescriptor* +Descriptor::FindExtensionByLowercaseName(const string& key) const { + const FieldDescriptor* result = + file()->tables_->FindFieldByLowercaseName(this, key); + if (result == NULL || !result->is_extension()) { + return NULL; + } else { + return result; + } +} + +const FieldDescriptor* +Descriptor::FindExtensionByCamelcaseName(const string& key) const { + const FieldDescriptor* result = + file()->tables_->FindFieldByCamelcaseName(this, key); + if (result == NULL || !result->is_extension()) { + return NULL; + } else { + return result; + } +} + +const Descriptor* +Descriptor::FindNestedTypeByName(const string& key) const { + Symbol result = + file()->tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE); + if (!result.IsNull()) { + return result.descriptor; + } else { + return NULL; + } +} + +const EnumDescriptor* +Descriptor::FindEnumTypeByName(const string& key) const { + Symbol result = + file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM); + if (!result.IsNull()) { + return result.enum_descriptor; + } else { + return NULL; + } +} + +const EnumValueDescriptor* +Descriptor::FindEnumValueByName(const string& key) const { + Symbol result = + file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); + if (!result.IsNull()) { + return result.enum_value_descriptor; + } else { + return NULL; + } +} + +const EnumValueDescriptor* +EnumDescriptor::FindValueByName(const string& key) const { + Symbol result = + file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); + if (!result.IsNull()) { + return result.enum_value_descriptor; + } else { + return NULL; + } +} + +const EnumValueDescriptor* +EnumDescriptor::FindValueByNumber(int key) const { + return file()->tables_->FindEnumValueByNumber(this, key); +} + +const MethodDescriptor* +ServiceDescriptor::FindMethodByName(const string& key) const { + Symbol result = + file()->tables_->FindNestedSymbolOfType(this, key, Symbol::METHOD); + if (!result.IsNull()) { + return result.method_descriptor; + } else { + return NULL; + } +} + +const Descriptor* +FileDescriptor::FindMessageTypeByName(const string& key) const { + Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE); + if (!result.IsNull()) { + return result.descriptor; + } else { + return NULL; + } +} + +const EnumDescriptor* +FileDescriptor::FindEnumTypeByName(const string& key) const { + Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM); + if (!result.IsNull()) { + return result.enum_descriptor; + } else { + return NULL; + } +} + +const EnumValueDescriptor* +FileDescriptor::FindEnumValueByName(const string& key) const { + Symbol result = + tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); + if (!result.IsNull()) { + return result.enum_value_descriptor; + } else { + return NULL; + } +} + +const ServiceDescriptor* +FileDescriptor::FindServiceByName(const string& key) const { + Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::SERVICE); + if (!result.IsNull()) { + return result.service_descriptor; + } else { + return NULL; + } +} + +const FieldDescriptor* +FileDescriptor::FindExtensionByName(const 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 NULL; + } +} + +const FieldDescriptor* +FileDescriptor::FindExtensionByLowercaseName(const string& key) const { + const FieldDescriptor* result = tables_->FindFieldByLowercaseName(this, key); + if (result == NULL || !result->is_extension()) { + return NULL; + } else { + return result; + } +} + +const FieldDescriptor* +FileDescriptor::FindExtensionByCamelcaseName(const string& key) const { + const FieldDescriptor* result = tables_->FindFieldByCamelcaseName(this, key); + if (result == NULL || !result->is_extension()) { + return NULL; + } else { + return result; + } +} + +bool Descriptor::IsExtensionNumber(int number) const { + // Linear search should be fine because we don't expect a message to have + // more than a couple extension ranges. + for (int i = 0; i < extension_range_count(); i++) { + if (number >= extension_range(i)->start && + number < extension_range(i)->end) { + return true; + } + } + return false; +} + +// ------------------------------------------------------------------- + +bool DescriptorPool::TryFindFileInFallbackDatabase(const string& name) const { + if (fallback_database_ == NULL) return false; + + if (tables_->known_bad_files_.count(name) > 0) return false; + + FileDescriptorProto file_proto; + if (!fallback_database_->FindFileByName(name, &file_proto) || + BuildFileFromDatabase(file_proto) == NULL) { + tables_->known_bad_files_.insert(name); + return false; + } + + return true; +} + +bool DescriptorPool::TryFindSymbolInFallbackDatabase(const string& name) const { + if (fallback_database_ == NULL) return false; + + FileDescriptorProto file_proto; + if (!fallback_database_->FindFileContainingSymbol(name, &file_proto)) { + return false; + } + + if (tables_->FindFile(file_proto.name()) != NULL) { + // We've already loaded this file, and it apparently doesn't contain the + // symbol we're looking for. Some DescriptorDatabases return false + // positives. + return false; + } + + if (BuildFileFromDatabase(file_proto) == NULL) { + return false; + } + + return true; +} + +bool DescriptorPool::TryFindExtensionInFallbackDatabase( + const Descriptor* containing_type, int field_number) const { + if (fallback_database_ == NULL) return false; + + FileDescriptorProto file_proto; + if (!fallback_database_->FindFileContainingExtension( + containing_type->full_name(), field_number, &file_proto)) { + return false; + } + + if (tables_->FindFile(file_proto.name()) != NULL) { + // We've already loaded this file, and it apparently doesn't contain the + // extension we're looking for. Some DescriptorDatabases return false + // positives. + return false; + } + + if (BuildFileFromDatabase(file_proto) == NULL) { + return false; + } + + return true; +} + +// =================================================================== + +string FieldDescriptor::DefaultValueAsString(bool quote_string_type) const { + GOOGLE_CHECK(has_default_value()) << "No default value"; + switch (cpp_type()) { + case CPPTYPE_INT32: + return SimpleItoa(default_value_int32()); + break; + case CPPTYPE_INT64: + return SimpleItoa(default_value_int64()); + break; + case CPPTYPE_UINT32: + return SimpleItoa(default_value_uint32()); + break; + case CPPTYPE_UINT64: + return SimpleItoa(default_value_uint64()); + break; + 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()) + "\""; + } else { + if (type() == TYPE_BYTES) { + return CEscape(default_value_string()); + } else { + 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; + } + GOOGLE_LOG(FATAL) << "Can't get here: failed to get default value as string"; + return ""; +} + +// CopyTo methods ==================================================== + +void FileDescriptor::CopyTo(FileDescriptorProto* proto) const { + proto->set_name(name()); + if (!package().empty()) proto->set_package(package()); + + for (int i = 0; i < dependency_count(); i++) { + proto->add_dependency(dependency(i)->name()); + } + + for (int i = 0; i < message_type_count(); i++) { + message_type(i)->CopyTo(proto->add_message_type()); + } + for (int i = 0; i < enum_type_count(); i++) { + enum_type(i)->CopyTo(proto->add_enum_type()); + } + for (int i = 0; i < service_count(); i++) { + service(i)->CopyTo(proto->add_service()); + } + for (int i = 0; i < extension_count(); i++) { + extension(i)->CopyTo(proto->add_extension()); + } + + if (&options() != &FileOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +void Descriptor::CopyTo(DescriptorProto* proto) const { + proto->set_name(name()); + + for (int i = 0; i < field_count(); i++) { + field(i)->CopyTo(proto->add_field()); + } + for (int i = 0; i < nested_type_count(); i++) { + nested_type(i)->CopyTo(proto->add_nested_type()); + } + for (int i = 0; i < enum_type_count(); i++) { + enum_type(i)->CopyTo(proto->add_enum_type()); + } + for (int i = 0; i < extension_range_count(); i++) { + DescriptorProto::ExtensionRange* range = proto->add_extension_range(); + range->set_start(extension_range(i)->start); + range->set_end(extension_range(i)->end); + } + for (int i = 0; i < extension_count(); i++) { + extension(i)->CopyTo(proto->add_extension()); + } + + if (&options() != &MessageOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const { + proto->set_name(name()); + proto->set_number(number()); + + // Some compilers do not allow static_cast directly between two enum types, + // so we must cast to int first. + proto->set_label(static_cast( + implicit_cast(label()))); + proto->set_type(static_cast( + implicit_cast(type()))); + + if (is_extension()) { + if (!containing_type()->is_unqualified_placeholder_) { + proto->set_extendee("."); + } + proto->mutable_extendee()->append(containing_type()->full_name()); + } + + if (cpp_type() == CPPTYPE_MESSAGE) { + if (message_type()->is_placeholder_) { + // We don't actually know if the type is a message type. It could be + // an enum. + proto->clear_type(); + } + + if (!message_type()->is_unqualified_placeholder_) { + proto->set_type_name("."); + } + proto->mutable_type_name()->append(message_type()->full_name()); + } else if (cpp_type() == CPPTYPE_ENUM) { + if (!enum_type()->is_unqualified_placeholder_) { + proto->set_type_name("."); + } + proto->mutable_type_name()->append(enum_type()->full_name()); + } + + if (has_default_value()) { + proto->set_default_value(DefaultValueAsString(false)); + } + + if (&options() != &FieldOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +void EnumDescriptor::CopyTo(EnumDescriptorProto* proto) const { + proto->set_name(name()); + + for (int i = 0; i < value_count(); i++) { + value(i)->CopyTo(proto->add_value()); + } + + if (&options() != &EnumOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +void EnumValueDescriptor::CopyTo(EnumValueDescriptorProto* proto) const { + proto->set_name(name()); + proto->set_number(number()); + + if (&options() != &EnumValueOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +void ServiceDescriptor::CopyTo(ServiceDescriptorProto* proto) const { + proto->set_name(name()); + + for (int i = 0; i < method_count(); i++) { + method(i)->CopyTo(proto->add_method()); + } + + if (&options() != &ServiceOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +void MethodDescriptor::CopyTo(MethodDescriptorProto* proto) const { + proto->set_name(name()); + + if (!input_type()->is_unqualified_placeholder_) { + proto->set_input_type("."); + } + proto->mutable_input_type()->append(input_type()->full_name()); + + if (!output_type()->is_unqualified_placeholder_) { + proto->set_output_type("."); + } + proto->mutable_output_type()->append(output_type()->full_name()); + + if (&options() != &MethodOptions::default_instance()) { + proto->mutable_options()->CopyFrom(options()); + } +} + +// DebugString methods =============================================== + +namespace { + +// Used by each of the option formatters. +bool RetrieveOptions(const Message &options, vector *option_entries) { + option_entries->clear(); + const Reflection* reflection = options.GetReflection(); + vector fields; + reflection->ListFields(options, &fields); + for (int i = 0; i < fields.size(); i++) { + // Doesn't make sense to have message type fields here + if (fields[i]->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + continue; + } + int count = 1; + bool repeated = false; + if (fields[i]->is_repeated()) { + count = reflection->FieldSize(options, fields[i]); + repeated = true; + } + for (int j = 0; j < count; j++) { + string fieldval; + TextFormat::PrintFieldValueToString(options, fields[i], + repeated ? count : -1, &fieldval); + option_entries->push_back(fields[i]->name() + " = " + fieldval); + } + } + return !option_entries->empty(); +} + +// Formats options that all appear together in brackets. Does not include +// brackets. +bool FormatBracketedOptions(const Message &options, string *output) { + vector all_options; + if (RetrieveOptions(options, &all_options)) { + output->append(JoinStrings(all_options, ", ")); + } + return !all_options.empty(); +} + +// Formats options one per line +bool FormatLineOptions(int depth, const Message &options, string *output) { + string prefix(depth * 2, ' '); + vector all_options; + if (RetrieveOptions(options, &all_options)) { + for (int i = 0; i < all_options.size(); i++) { + strings::SubstituteAndAppend(output, "$0option $1;\n", + prefix, all_options[i]); + } + } + return !all_options.empty(); +} + +} // anonymous namespace + +string FileDescriptor::DebugString() const { + string contents = "syntax = \"proto2\";\n\n"; + + for (int i = 0; i < dependency_count(); i++) { + strings::SubstituteAndAppend(&contents, "import \"$0\";\n", + dependency(i)->name()); + } + + if (!package().empty()) { + strings::SubstituteAndAppend(&contents, "package $0;\n\n", package()); + } + + if (FormatLineOptions(0, options(), &contents)) { + contents.append("\n"); // add some space if we had options + } + + for (int i = 0; i < enum_type_count(); i++) { + enum_type(i)->DebugString(0, &contents); + contents.append("\n"); + } + + // Find all the 'group' type extensions; we will not output their nested + // definitions (those will be done with their group field descriptor). + set groups; + for (int i = 0; i < extension_count(); i++) { + if (extension(i)->type() == FieldDescriptor::TYPE_GROUP) { + groups.insert(extension(i)->message_type()); + } + } + + for (int i = 0; i < message_type_count(); i++) { + if (groups.count(message_type(i)) == 0) { + strings::SubstituteAndAppend(&contents, "message $0", + message_type(i)->name()); + message_type(i)->DebugString(0, &contents); + contents.append("\n"); + } + } + + for (int i = 0; i < service_count(); i++) { + service(i)->DebugString(&contents); + contents.append("\n"); + } + + const Descriptor* containing_type = NULL; + for (int i = 0; i < extension_count(); i++) { + if (extension(i)->containing_type() != containing_type) { + if (i > 0) contents.append("}\n\n"); + containing_type = extension(i)->containing_type(); + strings::SubstituteAndAppend(&contents, "extend .$0 {\n", + containing_type->full_name()); + } + extension(i)->DebugString(1, &contents); + } + if (extension_count() > 0) contents.append("}\n\n"); + + return contents; +} + +string Descriptor::DebugString() const { + string contents; + strings::SubstituteAndAppend(&contents, "message $0", name()); + DebugString(0, &contents); + return contents; +} + +void Descriptor::DebugString(int depth, string *contents) const { + string prefix(depth * 2, ' '); + ++depth; + contents->append(" {\n"); + + FormatLineOptions(depth, options(), contents); + + // Find all the 'group' types for fields and extensions; we will not output + // their nested definitions (those will be done with their group field + // descriptor). + set groups; + for (int i = 0; i < field_count(); i++) { + if (field(i)->type() == FieldDescriptor::TYPE_GROUP) { + groups.insert(field(i)->message_type()); + } + } + for (int i = 0; i < extension_count(); i++) { + if (extension(i)->type() == FieldDescriptor::TYPE_GROUP) { + groups.insert(extension(i)->message_type()); + } + } + + for (int i = 0; i < nested_type_count(); i++) { + if (groups.count(nested_type(i)) == 0) { + strings::SubstituteAndAppend(contents, "$0 message $1", + prefix, nested_type(i)->name()); + nested_type(i)->DebugString(depth, contents); + } + } + for (int i = 0; i < enum_type_count(); i++) { + enum_type(i)->DebugString(depth, contents); + } + for (int i = 0; i < field_count(); i++) { + field(i)->DebugString(depth, 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); + } + + // Group extensions by what they extend, so they can be printed out together. + const Descriptor* containing_type = NULL; + for (int i = 0; i < extension_count(); i++) { + if (extension(i)->containing_type() != containing_type) { + 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()); + } + extension(i)->DebugString(depth + 1, contents); + } + if (extension_count() > 0) + strings::SubstituteAndAppend(contents, "$0 }\n", prefix); + + strings::SubstituteAndAppend(contents, "$0}\n", prefix); +} + +string FieldDescriptor::DebugString() const { + string contents; + int depth = 0; + if (is_extension()) { + strings::SubstituteAndAppend(&contents, "extend .$0 {\n", + containing_type()->full_name()); + depth = 1; + } + DebugString(depth, &contents); + if (is_extension()) { + contents.append("}\n"); + } + return contents; +} + +void FieldDescriptor::DebugString(int depth, string *contents) const { + string prefix(depth * 2, ' '); + string field_type; + switch (type()) { + case TYPE_MESSAGE: + field_type = "." + message_type()->full_name(); + break; + case TYPE_ENUM: + field_type = "." + enum_type()->full_name(); + break; + default: + field_type = kTypeToName[type()]; + } + + strings::SubstituteAndAppend(contents, "$0$1 $2 $3 = $4", + prefix, + kLabelToName[label()], + field_type, + type() == TYPE_GROUP ? message_type()->name() : + name(), + number()); + + bool bracketed = false; + if (has_default_value()) { + bracketed = true; + strings::SubstituteAndAppend(contents, " [default = $0", + DefaultValueAsString(true)); + } + + string formatted_options; + if (FormatBracketedOptions(options(), &formatted_options)) { + contents->append(bracketed ? ", " : " ["); + bracketed = true; + contents->append(formatted_options); + } + + if (bracketed) { + contents->append("]"); + } + + if (type() == TYPE_GROUP) { + message_type()->DebugString(depth, contents); + } else { + contents->append(";\n"); + } +} + +string EnumDescriptor::DebugString() const { + string contents; + DebugString(0, &contents); + return contents; +} + +void EnumDescriptor::DebugString(int depth, string *contents) const { + string prefix(depth * 2, ' '); + ++depth; + strings::SubstituteAndAppend(contents, "$0enum $1 {\n", + prefix, name()); + + FormatLineOptions(depth, options(), contents); + + for (int i = 0; i < value_count(); i++) { + value(i)->DebugString(depth, contents); + } + strings::SubstituteAndAppend(contents, "$0}\n", prefix); +} + +string EnumValueDescriptor::DebugString() const { + string contents; + DebugString(0, &contents); + return contents; +} + +void EnumValueDescriptor::DebugString(int depth, string *contents) const { + string prefix(depth * 2, ' '); + strings::SubstituteAndAppend(contents, "$0$1 = $2", + prefix, name(), number()); + + string formatted_options; + if (FormatBracketedOptions(options(), &formatted_options)) { + strings::SubstituteAndAppend(contents, " [$0]", formatted_options); + } + contents->append(";\n"); +} + +string ServiceDescriptor::DebugString() const { + string contents; + DebugString(&contents); + return contents; +} + +void ServiceDescriptor::DebugString(string *contents) const { + strings::SubstituteAndAppend(contents, "service $0 {\n", name()); + + FormatLineOptions(1, options(), contents); + + for (int i = 0; i < method_count(); i++) { + method(i)->DebugString(1, contents); + } + + contents->append("}\n"); +} + +string MethodDescriptor::DebugString() const { + string contents; + DebugString(0, &contents); + return contents; +} + +void MethodDescriptor::DebugString(int depth, string *contents) const { + string prefix(depth * 2, ' '); + ++depth; + strings::SubstituteAndAppend(contents, "$0rpc $1(.$2) returns (.$3)", + prefix, name(), + input_type()->full_name(), + output_type()->full_name()); + + string formatted_options; + if (FormatLineOptions(depth, options(), &formatted_options)) { + strings::SubstituteAndAppend(contents, " {\n$0$1}\n", + formatted_options, prefix); + } else { + contents->append(";\n"); + } +} +// =================================================================== + +namespace { + +// Represents an options message to interpret. Extension names in the option +// name are respolved relative to name_scope. element_name and orig_opt are +// used only for error reporting (since the parser records locations against +// pointers in the original options, not the mutable copy). The Message must be +// one of the Options messages in descriptor.proto. +struct OptionsToInterpret { + OptionsToInterpret(const string& ns, + const string& el, + const Message* orig_opt, + Message* opt) + : name_scope(ns), + element_name(el), + original_options(orig_opt), + options(opt) { + } + string name_scope; + string element_name; + const Message* original_options; + Message* options; +}; + +} // namespace + +class DescriptorBuilder { + public: + DescriptorBuilder(const DescriptorPool* pool, + DescriptorPool::Tables* tables, + DescriptorPool::ErrorCollector* error_collector); + ~DescriptorBuilder(); + + const FileDescriptor* BuildFile(const FileDescriptorProto& proto); + + private: + friend class OptionInterpreter; + + const DescriptorPool* pool_; + DescriptorPool::Tables* tables_; // for convenience + DescriptorPool::ErrorCollector* error_collector_; + + // As we build descriptors we store copies of the options messages in + // them. We put pointers to those copies in this vector, as we build, so we + // can later (after cross-linking) interpret those options. + vector options_to_interpret_; + + bool had_errors_; + string filename_; + FileDescriptor* file_; + FileDescriptorTables* file_tables_; + + // If LookupSymbol() finds a symbol that is in a file which is not a declared + // dependency of this file, it will fail, but will set + // possible_undeclared_dependency_ to point at that file. This is only used + // by AddNotDefinedError() to report a more useful error message. + // possible_undeclared_dependency_name_ is the name of the symbol that was + // actually found in possible_undeclared_dependency_, which may be a parent + // of the symbol actually looked for. + const FileDescriptor* possible_undeclared_dependency_; + string possible_undeclared_dependency_name_; + + void AddError(const string& element_name, + const Message& descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location, + const string& error); + + // Adds an error indicating that undefined_symbol was not defined. Must + // only be called after LookupSymbol() fails. + void AddNotDefinedError( + const string& element_name, + const Message& descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location, + const string& undefined_symbol); + + // Silly helper which determines if the given file is in the given package. + // I.e., either file->package() == package_name or file->package() is a + // nested package within package_name. + bool IsInPackage(const FileDescriptor* file, const string& package_name); + + // Like tables_->FindSymbol(), but additionally: + // - Search the pool's underlay if not found in tables_. + // - Insure that the resulting Symbol is from one of the file's declared + // dependencies. + Symbol FindSymbol(const string& name); + + // Like FindSymbol() but does not require that the symbol is in one of the + // file's declared dependencies. + Symbol FindSymbolNotEnforcingDeps(const string& name); + + // Like FindSymbol(), but looks up the name relative to some other symbol + // name. This first searches siblings of relative_to, then siblings of its + // parents, etc. For example, LookupSymbol("foo.bar", "baz.qux.corge") makes + // the following calls, returning the first non-null result: + // FindSymbol("baz.qux.foo.bar"), FindSymbol("baz.foo.bar"), + // FindSymbol("foo.bar"). If AllowUnknownDependencies() has been called + // on the DescriptorPool, this will generate a placeholder type if + // the name is not found (unless the name itself is malformed). The + // placeholder_type parameter indicates what kind of placeholder should be + // constructed in this case. The resolve_mode parameter determines whether + // any symbol is returned, or only symbols that are types. Note, however, + // that LookupSymbol may still return a non-type symbol in LOOKUP_TYPES mode, + // if it believes that's all it could refer to. The caller should always + // check that it receives the type of symbol it was expecting. + enum PlaceholderType { + PLACEHOLDER_MESSAGE, + PLACEHOLDER_ENUM, + PLACEHOLDER_EXTENDABLE_MESSAGE + }; + enum ResolveMode { + LOOKUP_ALL, LOOKUP_TYPES + }; + Symbol LookupSymbol(const string& name, const string& relative_to, + PlaceholderType placeholder_type = PLACEHOLDER_MESSAGE, + ResolveMode resolve_mode = LOOKUP_ALL); + + // Like LookupSymbol() but will not return a placeholder even if + // AllowUnknownDependencies() has been used. + Symbol LookupSymbolNoPlaceholder(const string& name, + const string& relative_to, + ResolveMode resolve_mode = LOOKUP_ALL); + + // Creates a placeholder type suitable for return from LookupSymbol(). May + // return kNullSymbol if the name is not a valid type name. + Symbol NewPlaceholder(const string& name, PlaceholderType placeholder_type); + + // Creates a placeholder file. Never returns NULL. This is used when an + // import is not found and AllowUnknownDependencies() is enabled. + const FileDescriptor* NewPlaceholderFile(const string& name); + + // Calls tables_->AddSymbol() and records an error if it fails. Returns + // true if successful or false if failed, though most callers can ignore + // the return value since an error has already been recorded. + bool AddSymbol(const string& full_name, + const void* parent, const string& name, + const Message& proto, Symbol symbol); + + // 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 + // "foo.bar" and "foo" to the table). + void AddPackage(const string& name, const Message& proto, + const FileDescriptor* file); + + // Checks that the symbol name contains only alphanumeric characters and + // underscores. Records an error otherwise. + void ValidateSymbolName(const string& name, const string& full_name, + const Message& proto); + + // Like ValidateSymbolName(), but the name is allowed to contain periods and + // an error is indicated by returning false (not recording the error). + bool ValidateQualifiedName(const string& name); + + // Used by BUILD_ARRAY macro (below) to avoid having to have the type + // specified as a macro parameter. + template + inline void AllocateArray(int size, Type** output) { + *output = tables_->AllocateArray(size); + } + + // Allocates a copy of orig_options in tables_ and stores it in the + // descriptor. Remembers its uninterpreted options, to be interpreted + // later. DescriptorT must be one of the Descriptor messages from + // descriptor.proto. + template void AllocateOptions( + const typename DescriptorT::OptionsType& orig_options, + DescriptorT* descriptor); + // Specialization for FileOptions. + void AllocateOptions(const FileOptions& orig_options, + FileDescriptor* descriptor); + + // Implementation for AllocateOptions(). Don't call this directly. + template void AllocateOptionsImpl( + const string& name_scope, + const string& element_name, + const typename DescriptorT::OptionsType& orig_options, + DescriptorT* descriptor); + + // 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, + bool is_extension); + void BuildField(const FieldDescriptorProto& proto, + const Descriptor* parent, + FieldDescriptor* result) { + BuildFieldOrExtension(proto, parent, result, false); + } + void BuildExtension(const FieldDescriptorProto& proto, + const Descriptor* parent, + FieldDescriptor* result) { + BuildFieldOrExtension(proto, parent, result, true); + } + void BuildExtensionRange(const DescriptorProto::ExtensionRange& proto, + const Descriptor* parent, + Descriptor::ExtensionRange* result); + void BuildEnum(const EnumDescriptorProto& proto, + const Descriptor* parent, + EnumDescriptor* result); + void BuildEnumValue(const EnumValueDescriptorProto& proto, + const EnumDescriptor* parent, + EnumValueDescriptor* result); + void BuildService(const ServiceDescriptorProto& proto, + const void* dummy, + ServiceDescriptor* result); + void BuildMethod(const MethodDescriptorProto& proto, + const ServiceDescriptor* parent, + MethodDescriptor* result); + + // Must be run only after building. + // + // NOTE: Options will not be available during cross-linking, as they + // have not yet been interpreted. Defer any handling of options to the + // Validate*Options methods. + void CrossLinkFile(FileDescriptor* file, const FileDescriptorProto& proto); + void CrossLinkMessage(Descriptor* message, const DescriptorProto& proto); + void CrossLinkField(FieldDescriptor* field, + const FieldDescriptorProto& proto); + void CrossLinkEnum(EnumDescriptor* enum_type, + const EnumDescriptorProto& proto); + void CrossLinkEnumValue(EnumValueDescriptor* enum_value, + const EnumValueDescriptorProto& proto); + void CrossLinkService(ServiceDescriptor* service, + const ServiceDescriptorProto& proto); + void CrossLinkMethod(MethodDescriptor* method, + const MethodDescriptorProto& proto); + + // Must be run only after cross-linking. + void InterpretOptions(); + + // A helper class for interpreting options. + class OptionInterpreter { + public: + // Creates an interpreter that operates in the context of the pool of the + // specified builder, which must not be NULL. We don't take ownership of the + // builder. + explicit OptionInterpreter(DescriptorBuilder* builder); + + ~OptionInterpreter(); + + // Interprets the uninterpreted options in the specified Options message. + // On error, calls AddError() on the underlying builder and returns false. + // Otherwise returns true. + bool InterpretOptions(OptionsToInterpret* options_to_interpret); + + class AggregateOptionFinder; + + private: + // Interprets uninterpreted_option_ on the specified message, which + // must be the mutable copy of the original options message to which + // uninterpreted_option_ belongs. + bool InterpretSingleOption(Message* options); + + // Adds the uninterpreted_option to the given options message verbatim. + // Used when AllowUnknownDependencies() is in effect and we can't find + // the option's definition. + void AddWithoutInterpreting(const UninterpretedOption& uninterpreted_option, + Message* options); + + // A recursive helper function that drills into the intermediate fields + // in unknown_fields to check if field innermost_field is set on the + // innermost message. Returns false and sets an error if so. + bool ExamineIfOptionIsSet( + vector::const_iterator intermediate_fields_iter, + vector::const_iterator intermediate_fields_end, + const FieldDescriptor* innermost_field, const string& debug_msg_name, + const UnknownFieldSet& unknown_fields); + + // Validates the value for the option field of the currently interpreted + // option and then sets it on the unknown_field. + bool SetOptionValue(const FieldDescriptor* option_field, + UnknownFieldSet* unknown_fields); + + // Parses an aggregate value for a CPPTYPE_MESSAGE option and + // saves it into *unknown_fields. + bool SetAggregateOption(const FieldDescriptor* option_field, + UnknownFieldSet* unknown_fields); + + // 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, + UnknownFieldSet* unknown_fields); + void SetInt64(int number, int64 value, FieldDescriptor::Type type, + UnknownFieldSet* unknown_fields); + void SetUInt32(int number, uint32 value, FieldDescriptor::Type type, + UnknownFieldSet* unknown_fields); + void SetUInt64(int number, uint64 value, FieldDescriptor::Type type, + UnknownFieldSet* unknown_fields); + + // A helper function that adds an error at the specified location of the + // option we're currently interpreting, and returns false. + bool AddOptionError(DescriptorPool::ErrorCollector::ErrorLocation location, + const string& msg) { + builder_->AddError(options_to_interpret_->element_name, + *uninterpreted_option_, location, msg); + return false; + } + + // A helper function that adds an error at the location of the option name + // and returns false. + bool AddNameError(const string& msg) { + return AddOptionError(DescriptorPool::ErrorCollector::OPTION_NAME, msg); + } + + // A helper function that adds an error at the location of the option name + // and returns false. + bool AddValueError(const string& msg) { + return AddOptionError(DescriptorPool::ErrorCollector::OPTION_VALUE, msg); + } + + // We interpret against this builder's pool. Is never NULL. We don't own + // this pointer. + DescriptorBuilder* builder_; + + // The options we're currently interpreting, or NULL if we're not in a call + // to InterpretOptions. + const OptionsToInterpret* options_to_interpret_; + + // The option we're currently interpreting within options_to_interpret_, or + // NULL if we're not in a call to InterpretOptions(). This points to a + // submessage of the original option, not the mutable copy. Therefore we + // can use it to find locations recorded by the parser. + const UninterpretedOption* uninterpreted_option_; + + // Factory used to create the dynamic messages we need to parse + // any aggregate option values we encounter. + DynamicMessageFactory dynamic_factory_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OptionInterpreter); + }; + + // Work-around for broken compilers: According to the C++ standard, + // OptionInterpreter should have access to the private members of any class + // which has declared DescriptorBuilder as a friend. Unfortunately some old + // versions of GCC and other compilers do not implement this correctly. So, + // we have to have these intermediate methods to provide access. We also + // redundantly declare OptionInterpreter a friend just to make things extra + // clear for these bad compilers. + friend class OptionInterpreter; + friend class OptionInterpreter::AggregateOptionFinder; + + static inline bool get_allow_unknown(const DescriptorPool* pool) { + return pool->allow_unknown_; + } + static inline bool get_is_placeholder(const Descriptor* descriptor) { + return descriptor->is_placeholder_; + } + static inline void assert_mutex_held(const DescriptorPool* pool) { + if (pool->mutex_ != NULL) { + pool->mutex_->AssertHeld(); + } + } + + // Must be run only after options have been interpreted. + // + // NOTE: Validation code must only reference the options in the mutable + // descriptors, which are the ones that have been interpreted. The const + // proto references are passed in only so they can be provided to calls to + // AddError(). Do not look at their options, which have not been interpreted. + void ValidateFileOptions(FileDescriptor* file, + const FileDescriptorProto& proto); + void ValidateMessageOptions(Descriptor* message, + const DescriptorProto& proto); + void ValidateFieldOptions(FieldDescriptor* field, + const FieldDescriptorProto& proto); + void ValidateEnumOptions(EnumDescriptor* enm, + const EnumDescriptorProto& proto); + void ValidateEnumValueOptions(EnumValueDescriptor* enum_value, + const EnumValueDescriptorProto& proto); + void ValidateServiceOptions(ServiceDescriptor* service, + const ServiceDescriptorProto& proto); + void ValidateMethodOptions(MethodDescriptor* method, + const MethodDescriptorProto& proto); + + void ValidateMapKey(FieldDescriptor* field, + const FieldDescriptorProto& proto); +}; + +const FileDescriptor* DescriptorPool::BuildFile( + const FileDescriptorProto& proto) { + GOOGLE_CHECK(fallback_database_ == NULL) + << "Cannot call BuildFile on a DescriptorPool that uses a " + "DescriptorDatabase. You must instead find a way to get your file " + "into the underlying database."; + GOOGLE_CHECK(mutex_ == NULL); // Implied by the above GOOGLE_CHECK. + return DescriptorBuilder(this, tables_.get(), NULL).BuildFile(proto); +} + +const FileDescriptor* DescriptorPool::BuildFileCollectingErrors( + const FileDescriptorProto& proto, + ErrorCollector* error_collector) { + GOOGLE_CHECK(fallback_database_ == NULL) + << "Cannot call BuildFile on a DescriptorPool that uses a " + "DescriptorDatabase. You must instead find a way to get your file " + "into the underlying database."; + GOOGLE_CHECK(mutex_ == NULL); // Implied by the above GOOGLE_CHECK. + return DescriptorBuilder(this, tables_.get(), + error_collector).BuildFile(proto); +} + +const FileDescriptor* DescriptorPool::BuildFileFromDatabase( + const FileDescriptorProto& proto) const { + mutex_->AssertHeld(); + return DescriptorBuilder(this, tables_.get(), + default_error_collector_).BuildFile(proto); +} + +DescriptorBuilder::DescriptorBuilder( + const DescriptorPool* pool, + DescriptorPool::Tables* tables, + DescriptorPool::ErrorCollector* error_collector) + : pool_(pool), + tables_(tables), + error_collector_(error_collector), + had_errors_(false), + possible_undeclared_dependency_(NULL) {} + +DescriptorBuilder::~DescriptorBuilder() {} + +void DescriptorBuilder::AddError( + const string& element_name, + const Message& descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location, + const string& error) { + if (error_collector_ == NULL) { + if (!had_errors_) { + GOOGLE_LOG(ERROR) << "Invalid proto descriptor for file \"" << filename_ + << "\":"; + } + GOOGLE_LOG(ERROR) << " " << element_name << ": " << error; + } else { + error_collector_->AddError(filename_, element_name, + &descriptor, location, error); + } + had_errors_ = true; +} + +void DescriptorBuilder::AddNotDefinedError( + const string& element_name, + const Message& descriptor, + DescriptorPool::ErrorCollector::ErrorLocation location, + const string& undefined_symbol) { + if (possible_undeclared_dependency_ == NULL) { + AddError(element_name, descriptor, location, + "\"" + undefined_symbol + "\" is not defined."); + } else { + AddError(element_name, descriptor, location, + "\"" + possible_undeclared_dependency_name_ + + "\" seems to be defined in \"" + + possible_undeclared_dependency_->name() + "\", which is not " + "imported by \"" + filename_ + "\". To use it here, please " + "add the necessary import."); + } +} + +bool DescriptorBuilder::IsInPackage(const FileDescriptor* file, + const string& package_name) { + return HasPrefixString(file->package(), package_name) && + (file->package().size() == package_name.size() || + file->package()[package_name.size()] == '.'); +} + +Symbol DescriptorBuilder::FindSymbolNotEnforcingDeps(const string& name) { + Symbol result; + + // We need to search our pool and all its underlays. + const DescriptorPool* pool = pool_; + while (true) { + // If we are looking at an underlay, we must lock its mutex_, since we are + // accessing the underlay's tables_ dircetly. + MutexLockMaybe lock((pool == pool_) ? NULL : pool->mutex_); + + // Note that we don't have to check fallback_database_ here because the + // symbol has to be in one of its file's direct dependencies, and we have + // already loaded those by the time we get here. + result = pool->tables_->FindSymbol(name); + if (!result.IsNull()) break; + if (pool->underlay_ == NULL) return kNullSymbol; + pool = pool->underlay_; + } + + return result; +} + +Symbol DescriptorBuilder::FindSymbol(const string& name) { + Symbol result = FindSymbolNotEnforcingDeps(name); + + if (!pool_->enforce_dependencies_) { + // Hack for CompilerUpgrader. + return result; + } + + // Only find symbols which were defined in this file or one of its + // dependencies. + const FileDescriptor* file = result.GetFile(); + if (file == file_) return result; + for (int i = 0; i < file_->dependency_count(); i++) { + if (file == file_->dependency(i)) return result; + } + + 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 + // that that file is not a direct dependency of the file we are currently + // building, but it could be that some other file which *is* a direct + // dependency also defines the same package. We can't really rule out this + // symbol unless none of the dependencies define it. + if (IsInPackage(file_, name)) return result; + for (int i = 0; i < file_->dependency_count(); i++) { + // Note: A dependency may be NULL if it was not found or had errors. + if (file_->dependency(i) != NULL && + IsInPackage(file_->dependency(i), name)) { + return result; + } + } + } + + possible_undeclared_dependency_ = file; + possible_undeclared_dependency_name_ = name; + return kNullSymbol; +} + +Symbol DescriptorBuilder::LookupSymbolNoPlaceholder( + const string& name, const string& relative_to, ResolveMode resolve_mode) { + possible_undeclared_dependency_ = NULL; + + if (name.size() > 0 && name[0] == '.') { + // Fully-qualified name. + return FindSymbol(name.substr(1)); + } + + // If name is something like "Foo.Bar.baz", and symbols named "Foo" are + // defined in multiple parent scopes, we only want to find "Bar.baz" in the + // innermost one. E.g., the following should produce an error: + // message Bar { message Baz {} } + // message Foo { + // message Bar { + // } + // optional Bar.Baz baz = 1; + // } + // So, we look for just "Foo" first, then look for "Bar.baz" within it if + // found. + int name_dot_pos = name.find_first_of('.'); + string first_part_of_name; + if (name_dot_pos == string::npos) { + first_part_of_name = name; + } else { + first_part_of_name = name.substr(0, name_dot_pos); + } + + string scope_to_try(relative_to); + + while (true) { + // Chop off the last component of the scope. + string::size_type dot_pos = scope_to_try.find_last_of('.'); + if (dot_pos == string::npos) { + return FindSymbol(name); + } else { + scope_to_try.erase(dot_pos); + } + + // Append ".first_part_of_name" and try to find. + string::size_type old_size = scope_to_try.size(); + scope_to_try.append(1, '.'); + scope_to_try.append(first_part_of_name); + Symbol result = FindSymbol(scope_to_try); + if (!result.IsNull()) { + if (first_part_of_name.size() < name.size()) { + // name is a compound symbol, of which we only found the first part. + // Now try to look up the rest of it. + if (result.IsAggregate()) { + scope_to_try.append(name, first_part_of_name.size(), + name.size() - first_part_of_name.size()); + return FindSymbol(scope_to_try); + } else { + // We found a symbol but it's not an aggregate. Continue the loop. + } + } else { + if (resolve_mode == LOOKUP_TYPES && !result.IsType()) { + // We found a symbol but it's not a type. Continue the loop. + } else { + return result; + } + } + } + + // Not found. Remove the name so we can try again. + scope_to_try.erase(old_size); + } +} + +Symbol DescriptorBuilder::LookupSymbol( + const string& name, const string& relative_to, + PlaceholderType placeholder_type, ResolveMode resolve_mode) { + Symbol result = LookupSymbolNoPlaceholder( + name, relative_to, resolve_mode); + if (result.IsNull() && pool_->allow_unknown_) { + // Not found, but AllowUnknownDependencies() is enabled. Return a + // placeholder instead. + result = NewPlaceholder(name, placeholder_type); + } + return result; +} + +Symbol DescriptorBuilder::NewPlaceholder(const string& name, + PlaceholderType placeholder_type) { + // Compute names. + const string* placeholder_full_name; + const string* placeholder_name; + const string* placeholder_package; + + if (!ValidateQualifiedName(name)) return kNullSymbol; + if (name[0] == '.') { + // Fully-qualified. + placeholder_full_name = tables_->AllocateString(name.substr(1)); + } else { + placeholder_full_name = tables_->AllocateString(name); + } + + string::size_type dotpos = placeholder_full_name->find_last_of('.'); + if (dotpos != string::npos) { + placeholder_package = tables_->AllocateString( + placeholder_full_name->substr(0, dotpos)); + placeholder_name = tables_->AllocateString( + placeholder_full_name->substr(dotpos + 1)); + } else { + placeholder_package = &kEmptyString; + placeholder_name = placeholder_full_name; + } + + // Create the placeholders. + FileDescriptor* placeholder_file = tables_->Allocate(); + memset(placeholder_file, 0, sizeof(*placeholder_file)); + + placeholder_file->name_ = + tables_->AllocateString(*placeholder_full_name + ".placeholder.proto"); + placeholder_file->package_ = placeholder_package; + placeholder_file->pool_ = pool_; + placeholder_file->options_ = &FileOptions::default_instance(); + placeholder_file->tables_ = &FileDescriptorTables::kEmpty; + // All other fields are zero or NULL. + + if (placeholder_type == PLACEHOLDER_ENUM) { + placeholder_file->enum_type_count_ = 1; + placeholder_file->enum_types_ = + tables_->AllocateArray(1); + + EnumDescriptor* placeholder_enum = &placeholder_file->enum_types_[0]; + memset(placeholder_enum, 0, sizeof(*placeholder_enum)); + + placeholder_enum->full_name_ = placeholder_full_name; + placeholder_enum->name_ = placeholder_name; + placeholder_enum->file_ = placeholder_file; + placeholder_enum->options_ = &EnumOptions::default_instance(); + placeholder_enum->is_placeholder_ = true; + placeholder_enum->is_unqualified_placeholder_ = (name[0] != '.'); + + // Enums must have at least one value. + placeholder_enum->value_count_ = 1; + placeholder_enum->values_ = tables_->AllocateArray(1); + + EnumValueDescriptor* placeholder_value = &placeholder_enum->values_[0]; + memset(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->number_ = 0; + placeholder_value->type_ = placeholder_enum; + placeholder_value->options_ = &EnumValueOptions::default_instance(); + + return Symbol(placeholder_enum); + } else { + placeholder_file->message_type_count_ = 1; + placeholder_file->message_types_ = + tables_->AllocateArray(1); + + Descriptor* placeholder_message = &placeholder_file->message_types_[0]; + memset(placeholder_message, 0, sizeof(*placeholder_message)); + + placeholder_message->full_name_ = placeholder_full_name; + placeholder_message->name_ = placeholder_name; + placeholder_message->file_ = placeholder_file; + placeholder_message->options_ = &MessageOptions::default_instance(); + placeholder_message->is_placeholder_ = true; + placeholder_message->is_unqualified_placeholder_ = (name[0] != '.'); + + if (placeholder_type == PLACEHOLDER_EXTENDABLE_MESSAGE) { + placeholder_message->extension_range_count_ = 1; + placeholder_message->extension_ranges_ = + tables_->AllocateArray(1); + placeholder_message->extension_ranges_->start = 1; + // kMaxNumber + 1 because ExtensionRange::end is exclusive. + placeholder_message->extension_ranges_->end = + FieldDescriptor::kMaxNumber + 1; + } + + return Symbol(placeholder_message); + } +} + +const FileDescriptor* DescriptorBuilder::NewPlaceholderFile( + const string& name) { + FileDescriptor* placeholder = tables_->Allocate(); + memset(placeholder, 0, sizeof(*placeholder)); + + placeholder->name_ = tables_->AllocateString(name); + placeholder->package_ = &kEmptyString; + placeholder->pool_ = pool_; + placeholder->options_ = &FileOptions::default_instance(); + placeholder->tables_ = &FileDescriptorTables::kEmpty; + // All other fields are zero or NULL. + + return placeholder; +} + +bool DescriptorBuilder::AddSymbol( + const string& full_name, const void* parent, const string& name, + const Message& proto, Symbol symbol) { + // If the caller passed NULL for the parent, the symbol is at file scope. + // Use its file as the parent instead. + if (parent == NULL) parent = file_; + + if (tables_->AddSymbol(full_name, symbol)) { + if (!file_tables_->AddAliasUnderParent(parent, name, symbol)) { + GOOGLE_LOG(DFATAL) << "\"" << full_name << "\" not previously defined in " + "symbols_by_name_, but was defined in symbols_by_parent_; " + "this shouldn't be possible."; + return false; + } + return true; + } else { + const FileDescriptor* other_file = tables_->FindSymbol(full_name).GetFile(); + if (other_file == file_) { + string::size_type dot_pos = full_name.find_last_of('.'); + if (dot_pos == string::npos) { + AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + full_name + "\" is already defined."); + } else { + AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + full_name.substr(dot_pos + 1) + + "\" is already defined in \"" + + full_name.substr(0, dot_pos) + "\"."); + } + } else { + // 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() + "\"."); + } + return false; + } +} + +void DescriptorBuilder::AddPackage( + const string& name, const Message& proto, const FileDescriptor* file) { + if (tables_->AddSymbol(name, Symbol(file))) { + // Success. Also add parent package, if any. + string::size_type dot_pos = name.find_last_of('.'); + if (dot_pos == string::npos) { + // No parents. + ValidateSymbolName(name, name, proto); + } else { + // Has parent. + string* parent_name = tables_->AllocateString(name.substr(0, dot_pos)); + AddPackage(*parent_name, 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() + + "\"."); + } + } +} + +void DescriptorBuilder::ValidateSymbolName( + const string& name, const string& full_name, const Message& proto) { + if (name.empty()) { + AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, + "Missing name."); + } else { + for (int i = 0; i < name.size(); i++) { + // 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] != '_')) { + AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + name + "\" is not a valid identifier."); + } + } + } +} + +bool DescriptorBuilder::ValidateQualifiedName(const string& name) { + bool last_was_period = false; + + for (int i = 0; i < name.size(); i++) { + // 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] == '_')) { + last_was_period = false; + } else if (name[i] == '.') { + if (last_was_period) return false; + last_was_period = true; + } else { + return false; + } + } + + return !name.empty() && !last_was_period; +} + +// ------------------------------------------------------------------- + +// This generic implementation is good for all descriptors except +// FileDescriptor. +template void DescriptorBuilder::AllocateOptions( + const typename DescriptorT::OptionsType& orig_options, + DescriptorT* descriptor) { + AllocateOptionsImpl(descriptor->full_name(), descriptor->full_name(), + orig_options, descriptor); +} + +// We specialize for FileDescriptor. +void DescriptorBuilder::AllocateOptions(const FileOptions& orig_options, + FileDescriptor* descriptor) { + // We add the dummy token so that LookupSymbol does the right thing. + AllocateOptionsImpl(descriptor->package() + ".dummy", descriptor->name(), + orig_options, descriptor); +} + +template void DescriptorBuilder::AllocateOptionsImpl( + const string& name_scope, + const string& element_name, + const typename DescriptorT::OptionsType& orig_options, + DescriptorT* descriptor) { + // We need to use a dummy pointer to work around a bug in older versions of + // GCC. Otherwise, the following two lines could be replaced with: + // typename DescriptorT::OptionsType* options = + // tables_->AllocateMessage(); + typename DescriptorT::OptionsType* const dummy = NULL; + typename DescriptorT::OptionsType* options = tables_->AllocateMessage(dummy); + options->CopyFrom(orig_options); + descriptor->options_ = options; + + // Don't add to options_to_interpret_ unless there were uninterpreted + // options. This not only avoids unnecessary work, but prevents a + // bootstrapping problem when building descriptors for descriptor.proto. + // descriptor.proto does not contain any uninterpreted options, but + // attempting to interpret options anyway will cause + // OptionsType::GetDescriptor() to be called which may then deadlock since + // we're still trying to build it. + if (options->uninterpreted_option_size() > 0) { + options_to_interpret_.push_back( + OptionsToInterpret(name_scope, element_name, &orig_options, options)); + } +} + + +// A common pattern: We want to convert a repeated field in the descriptor +// to an array of values, calling some method to build each value. +#define BUILD_ARRAY(INPUT, OUTPUT, NAME, METHOD, PARENT) \ + OUTPUT->NAME##_count_ = INPUT.NAME##_size(); \ + AllocateArray(INPUT.NAME##_size(), &OUTPUT->NAME##s_); \ + for (int i = 0; i < INPUT.NAME##_size(); i++) { \ + METHOD(INPUT.NAME(i), PARENT, OUTPUT->NAME##s_ + i); \ + } + +const FileDescriptor* DescriptorBuilder::BuildFile( + const FileDescriptorProto& proto) { + filename_ = proto.name(); + + // Check if the file already exists and is identical to the one being built. + // Note: This only works if the input is canonical -- that is, it + // fully-qualifies all type names, has no UninterpretedOptions, etc. + // This is fine, because this idempotency "feature" really only exists to + // accomodate one hack in the proto1->proto2 migration layer. + const FileDescriptor* existing_file = tables_->FindFile(filename_); + if (existing_file != NULL) { + // File already in pool. Compare the existing one to the input. + FileDescriptorProto existing_proto; + existing_file->CopyTo(&existing_proto); + if (existing_proto.SerializeAsString() == proto.SerializeAsString()) { + // They're identical. Return the existing descriptor. + return existing_file; + } + + // Not a match. The error will be detected and handled later. + } + + // Check to see if this file is already on the pending files list. + // TODO(kenton): Allow recursive imports? It may not work with some + // (most?) programming languages. E.g., in C++, a forward declaration + // of a type is not sufficient to allow it to be used even in a + // generated header file due to inlining. This could perhaps be + // worked around using tricks involving inserting #include statements + // 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++) { + if (tables_->pending_files_[i] == proto.name()) { + string error_message("File recursively imports itself: "); + for (; i < tables_->pending_files_.size(); i++) { + error_message.append(tables_->pending_files_[i]); + error_message.append(" -> "); + } + error_message.append(proto.name()); + + AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER, + error_message); + return NULL; + } + } + + // If we have a fallback_database_, attempt to load all dependencies now, + // before checkpointing tables_. This avoids confusion with recursive + // checkpoints. + if (pool_->fallback_database_ != NULL) { + tables_->pending_files_.push_back(proto.name()); + for (int i = 0; i < proto.dependency_size(); i++) { + if (tables_->FindFile(proto.dependency(i)) == NULL && + (pool_->underlay_ == NULL || + pool_->underlay_->FindFileByName(proto.dependency(i)) == NULL)) { + // We don't care what this returns since we'll find out below anyway. + pool_->TryFindFileInFallbackDatabase(proto.dependency(i)); + } + } + tables_->pending_files_.pop_back(); + } + + // Checkpoint the tables so that we can roll back if something goes wrong. + tables_->Checkpoint(); + + FileDescriptor* result = tables_->Allocate(); + file_ = result; + + file_tables_ = tables_->AllocateFileTables(); + file_->tables_ = file_tables_; + + if (!proto.has_name()) { + AddError("", proto, DescriptorPool::ErrorCollector::OTHER, + "Missing field: FileDescriptorProto.name."); + } + + result->name_ = tables_->AllocateString(proto.name()); + if (proto.has_package()) { + result->package_ = tables_->AllocateString(proto.package()); + } else { + // We cannot rely on proto.package() returning a valid string if + // proto.has_package() is false, because we might be running at static + // initialization time, in which case default values have not yet been + // initialized. + result->package_ = tables_->AllocateString(""); + } + result->pool_ = pool_; + + // Add to tables. + if (!tables_->AddFile(result)) { + AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER, + "A file with this name is already in the pool."); + // Bail out early so that if this is actually the exact same file, we + // don't end up reporting that every single symbol is already defined. + tables_->Rollback(); + return NULL; + } + if (!result->package().empty()) { + AddPackage(result->package(), proto, result); + } + + // Make sure all dependencies are loaded. + set seen_dependencies; + result->dependency_count_ = proto.dependency_size(); + result->dependencies_ = + tables_->AllocateArray(proto.dependency_size()); + for (int i = 0; i < proto.dependency_size(); i++) { + if (!seen_dependencies.insert(proto.dependency(i)).second) { + AddError(proto.name(), proto, + DescriptorPool::ErrorCollector::OTHER, + "Import \"" + proto.dependency(i) + "\" was listed twice."); + } + + const FileDescriptor* dependency = tables_->FindFile(proto.dependency(i)); + if (dependency == NULL && pool_->underlay_ != NULL) { + dependency = pool_->underlay_->FindFileByName(proto.dependency(i)); + } + + if (dependency == NULL) { + if (pool_->allow_unknown_) { + dependency = NewPlaceholderFile(proto.dependency(i)); + } else { + string message; + if (pool_->fallback_database_ == NULL) { + message = "Import \"" + proto.dependency(i) + + "\" has not been loaded."; + } else { + message = "Import \"" + proto.dependency(i) + + "\" was not found or had errors."; + } + AddError(proto.name(), proto, + DescriptorPool::ErrorCollector::OTHER, + message); + } + } + + result->dependencies_[i] = dependency; + } + + // Convert children. + BUILD_ARRAY(proto, result, message_type, BuildMessage , NULL); + BUILD_ARRAY(proto, result, enum_type , BuildEnum , NULL); + BUILD_ARRAY(proto, result, service , BuildService , NULL); + BUILD_ARRAY(proto, result, extension , BuildExtension, NULL); + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + // Note that the following steps must occur in exactly the specified order. + + // Cross-link. + CrossLinkFile(result, proto); + + // Interpret any remaining uninterpreted options gathered into + // options_to_interpret_ during descriptor building. Cross-linking has made + // extension options known, so all interpretations should now succeed. + if (!had_errors_) { + OptionInterpreter option_interpreter(this); + for (vector::iterator iter = + options_to_interpret_.begin(); + iter != options_to_interpret_.end(); ++iter) { + option_interpreter.InterpretOptions(&(*iter)); + } + options_to_interpret_.clear(); + } + + // Validate options. + if (!had_errors_) { + ValidateFileOptions(result, proto); + } + + if (had_errors_) { + tables_->Rollback(); + return NULL; + } else { + tables_->Checkpoint(); + return result; + } +} + +void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, + const Descriptor* parent, + Descriptor* result) { + const string& scope = (parent == NULL) ? + file_->package() : parent->full_name(); + string* full_name = tables_->AllocateString(scope); + if (!full_name->empty()) full_name->append(1, '.'); + full_name->append(proto.name()); + + ValidateSymbolName(proto.name(), *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; + + BUILD_ARRAY(proto, result, field , BuildField , result); + BUILD_ARRAY(proto, result, nested_type , BuildMessage , result); + BUILD_ARRAY(proto, result, enum_type , BuildEnum , result); + BUILD_ARRAY(proto, result, extension_range, BuildExtensionRange, result); + BUILD_ARRAY(proto, result, extension , BuildExtension , result); + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + AddSymbol(result->full_name(), parent, result->name(), + proto, Symbol(result)); + + // Check that no fields have numbers in extension ranges. + 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++) { + const Descriptor::ExtensionRange* range = result->extension_range(j); + if (range->start <= field->number() && field->number() < range->end) { + AddError(field->full_name(), proto.extension_range(j), + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute( + "Extension range $0 to $1 includes field \"$2\" ($3).", + range->start, range->end - 1, + field->name(), field->number())); + } + } + } + + // Check that extension ranges don't overlap. + for (int i = 0; i < result->extension_range_count(); i++) { + const Descriptor::ExtensionRange* range1 = result->extension_range(i); + for (int j = i + 1; j < result->extension_range_count(); j++) { + const Descriptor::ExtensionRange* range2 = result->extension_range(j); + if (range1->end > range2->start && range2->end > range1->start) { + AddError(result->full_name(), proto.extension_range(j), + 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)); + } + } + } +} + +void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, + const Descriptor* parent, + FieldDescriptor* result, + bool is_extension) { + const string& scope = (parent == NULL) ? + file_->package() : parent->full_name(); + string* full_name = tables_->AllocateString(scope); + if (!full_name->empty()) full_name->append(1, '.'); + full_name->append(proto.name()); + + ValidateSymbolName(proto.name(), *full_name, proto); + + result->name_ = tables_->AllocateString(proto.name()); + result->full_name_ = full_name; + result->file_ = file_; + result->number_ = proto.number(); + result->is_extension_ = is_extension; + + // 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. + 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); + } + + // 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())); + + // Some compilers do not allow static_cast directly between two enum types, + // so we must cast to int first. + result->type_ = static_cast( + implicit_cast(proto.type())); + result->label_ = static_cast( + implicit_cast(proto.label())); + + // Some of these may be filled in when cross-linking. + result->containing_type_ = NULL; + result->extension_scope_ = NULL; + result->experimental_map_key_ = NULL; + result->message_type_ = NULL; + result->enum_type_ = NULL; + + result->has_default_value_ = proto.has_default_value(); + if (proto.has_default_value() && result->is_repeated()) { + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::DEFAULT_VALUE, + "Repeated fields can't have default values."); + } + + if (proto.has_type()) { + if (proto.has_default_value()) { + char* end_pos = NULL; + switch (result->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: + result->default_value_int32_ = + strtol(proto.default_value().c_str(), &end_pos, 0); + break; + case FieldDescriptor::CPPTYPE_INT64: + result->default_value_int64_ = + strto64(proto.default_value().c_str(), &end_pos, 0); + break; + case FieldDescriptor::CPPTYPE_UINT32: + result->default_value_uint32_ = + strtoul(proto.default_value().c_str(), &end_pos, 0); + break; + case FieldDescriptor::CPPTYPE_UINT64: + result->default_value_uint64_ = + strtou64(proto.default_value().c_str(), &end_pos, 0); + break; + case FieldDescriptor::CPPTYPE_FLOAT: + if (proto.default_value() == "inf") { + result->default_value_float_ = numeric_limits::infinity(); + } else if (proto.default_value() == "-inf") { + result->default_value_float_ = -numeric_limits::infinity(); + } else if (proto.default_value() == "nan") { + result->default_value_float_ = numeric_limits::quiet_NaN(); + } else { + result->default_value_float_ = + NoLocaleStrtod(proto.default_value().c_str(), &end_pos); + } + break; + case FieldDescriptor::CPPTYPE_DOUBLE: + if (proto.default_value() == "inf") { + result->default_value_double_ = numeric_limits::infinity(); + } else if (proto.default_value() == "-inf") { + result->default_value_double_ = -numeric_limits::infinity(); + } else if (proto.default_value() == "nan") { + result->default_value_double_ = numeric_limits::quiet_NaN(); + } else { + result->default_value_double_ = + NoLocaleStrtod(proto.default_value().c_str(), &end_pos); + } + break; + case FieldDescriptor::CPPTYPE_BOOL: + if (proto.default_value() == "true") { + result->default_value_bool_ = true; + } else if (proto.default_value() == "false") { + result->default_value_bool_ = false; + } else { + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::DEFAULT_VALUE, + "Boolean default must be true or false."); + } + break; + case FieldDescriptor::CPPTYPE_ENUM: + // This will be filled in when cross-linking. + result->default_value_enum_ = NULL; + break; + case FieldDescriptor::CPPTYPE_STRING: + if (result->type() == FieldDescriptor::TYPE_BYTES) { + result->default_value_string_ = tables_->AllocateString( + UnescapeCEscapeString(proto.default_value())); + } else { + result->default_value_string_ = + tables_->AllocateString(proto.default_value()); + } + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::DEFAULT_VALUE, + "Messages can't have default values."); + result->has_default_value_ = false; + break; + } + + if (end_pos != NULL) { + // end_pos is only set non-NULL by the parsers for numeric types, above. + // This checks that the default was non-empty and had no extra junk + // after the end of the number. + if (proto.default_value().empty() || *end_pos != '\0') { + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::DEFAULT_VALUE, + "Couldn't parse default value."); + } + } + } else { + // No explicit default value + switch (result->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: + result->default_value_int32_ = 0; + break; + case FieldDescriptor::CPPTYPE_INT64: + result->default_value_int64_ = 0; + break; + case FieldDescriptor::CPPTYPE_UINT32: + result->default_value_uint32_ = 0; + break; + case FieldDescriptor::CPPTYPE_UINT64: + result->default_value_uint64_ = 0; + break; + case FieldDescriptor::CPPTYPE_FLOAT: + result->default_value_float_ = 0.0f; + break; + case FieldDescriptor::CPPTYPE_DOUBLE: + result->default_value_double_ = 0.0; + break; + case FieldDescriptor::CPPTYPE_BOOL: + result->default_value_bool_ = false; + break; + case FieldDescriptor::CPPTYPE_ENUM: + // This will be filled in when cross-linking. + result->default_value_enum_ = NULL; + break; + case FieldDescriptor::CPPTYPE_STRING: + result->default_value_string_ = &kEmptyString; + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + break; + } + } + } + + if (result->number() <= 0) { + AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, + "Field numbers must be positive integers."); + } else if (result->number() > FieldDescriptor::kMaxNumber) { + AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute("Field numbers cannot be greater than $0.", + FieldDescriptor::kMaxNumber)); + } else if (result->number() >= FieldDescriptor::kFirstReservedNumber && + result->number() <= FieldDescriptor::kLastReservedNumber) { + AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute( + "Field numbers $0 through $1 are reserved for the protocol " + "buffer library implementation.", + FieldDescriptor::kFirstReservedNumber, + FieldDescriptor::kLastReservedNumber)); + } + + if (is_extension) { + if (!proto.has_extendee()) { + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::EXTENDEE, + "FieldDescriptorProto.extendee not set for extension field."); + } + + result->extension_scope_ = parent; + } else { + if (proto.has_extendee()) { + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::EXTENDEE, + "FieldDescriptorProto.extendee set for non-extension field."); + } + + result->containing_type_ = parent; + } + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + AddSymbol(result->full_name(), parent, result->name(), + proto, Symbol(result)); +} + +void DescriptorBuilder::BuildExtensionRange( + const DescriptorProto::ExtensionRange& proto, + const Descriptor* parent, + Descriptor::ExtensionRange* result) { + result->start = proto.start(); + result->end = proto.end(); + if (result->start <= 0) { + AddError(parent->full_name(), proto, + DescriptorPool::ErrorCollector::NUMBER, + "Extension numbers must be positive integers."); + } + + if (result->end > FieldDescriptor::kMaxNumber + 1) { + AddError(parent->full_name(), proto, + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute("Extension numbers cannot be greater than $0.", + FieldDescriptor::kMaxNumber)); + } + + if (result->start >= result->end) { + AddError(parent->full_name(), proto, + DescriptorPool::ErrorCollector::NUMBER, + "Extension range end number must be greater than start number."); + } +} + +void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, + const Descriptor* parent, + EnumDescriptor* result) { + const string& scope = (parent == NULL) ? + file_->package() : parent->full_name(); + string* full_name = tables_->AllocateString(scope); + if (!full_name->empty()) full_name->append(1, '.'); + full_name->append(proto.name()); + + ValidateSymbolName(proto.name(), *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; + + if (proto.value_size() == 0) { + // We cannot allow enums with no values because this would mean there + // would be no valid default value for fields of this type. + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::NAME, + "Enums must contain at least one value."); + } + + BUILD_ARRAY(proto, result, value, BuildEnumValue, result); + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + AddSymbol(result->full_name(), parent, result->name(), + proto, Symbol(result)); +} + +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. + string* full_name = tables_->AllocateString(*parent->full_name_); + full_name->resize(full_name->size() - parent->name_->size()); + full_name->append(*result->name_); + result->full_name_ = full_name; + + ValidateSymbolName(proto.name(), *full_name, proto); + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + // Again, enum values are weird because we makes them appear as siblings + // of the enum type instead of children of it. So, we use + // 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)); + + // 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)); + + if (added_to_inner_scope && !added_to_outer_scope) { + // This value did not conflict with any values defined in the same enum, + // but it did conflict with some other symbol defined in the enum type's + // scope. Let's print an additional error to explain this. + string outer_scope; + if (parent->containing_type() == NULL) { + outer_scope = file_->package(); + } else { + outer_scope = parent->containing_type()->full_name(); + } + + if (outer_scope.empty()) { + outer_scope = "the global scope"; + } else { + outer_scope = "\"" + outer_scope + "\""; + } + + AddError(result->full_name(), proto, + DescriptorPool::ErrorCollector::NAME, + "Note that enum values use C++ scoping rules, meaning that " + "enum values are siblings of their type, not children of it. " + "Therefore, \"" + result->name() + "\" must be unique within " + + outer_scope + ", not just within \"" + parent->name() + "\"."); + } + + // An enum is allowed to define two numbers that refer to the same value. + // FindValueByNumber() should return the first such value, so we simply + // ignore AddEnumValueByNumber()'s return code. + file_tables_->AddEnumValueByNumber(result); +} + +void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto, + const void* dummy, + ServiceDescriptor* result) { + string* full_name = tables_->AllocateString(file_->package()); + if (!full_name->empty()) full_name->append(1, '.'); + full_name->append(proto.name()); + + ValidateSymbolName(proto.name(), *full_name, proto); + + result->name_ = tables_->AllocateString(proto.name()); + result->full_name_ = full_name; + result->file_ = file_; + + BUILD_ARRAY(proto, result, method, BuildMethod, result); + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + AddSymbol(result->full_name(), NULL, result->name(), + proto, Symbol(result)); +} + +void DescriptorBuilder::BuildMethod(const MethodDescriptorProto& proto, + const ServiceDescriptor* parent, + MethodDescriptor* result) { + result->name_ = tables_->AllocateString(proto.name()); + result->service_ = parent; + + string* full_name = tables_->AllocateString(parent->full_name()); + full_name->append(1, '.'); + full_name->append(*result->name_); + result->full_name_ = full_name; + + ValidateSymbolName(proto.name(), *full_name, proto); + + // These will be filled in when cross-linking. + result->input_type_ = NULL; + result->output_type_ = NULL; + + // Copy options. + if (!proto.has_options()) { + result->options_ = NULL; // Will set to default_instance later. + } else { + AllocateOptions(proto.options(), result); + } + + AddSymbol(result->full_name(), parent, result->name(), + proto, Symbol(result)); +} + +#undef BUILD_ARRAY + +// ------------------------------------------------------------------- + +void DescriptorBuilder::CrossLinkFile( + FileDescriptor* file, const FileDescriptorProto& proto) { + if (file->options_ == NULL) { + file->options_ = &FileOptions::default_instance(); + } + + for (int i = 0; i < file->message_type_count(); i++) { + CrossLinkMessage(&file->message_types_[i], proto.message_type(i)); + } + + for (int i = 0; i < file->extension_count(); i++) { + CrossLinkField(&file->extensions_[i], proto.extension(i)); + } + + for (int i = 0; i < file->enum_type_count(); i++) { + CrossLinkEnum(&file->enum_types_[i], proto.enum_type(i)); + } + + for (int i = 0; i < file->service_count(); i++) { + CrossLinkService(&file->services_[i], proto.service(i)); + } +} + +void DescriptorBuilder::CrossLinkMessage( + Descriptor* message, const DescriptorProto& proto) { + if (message->options_ == NULL) { + message->options_ = &MessageOptions::default_instance(); + } + + for (int i = 0; i < message->nested_type_count(); i++) { + CrossLinkMessage(&message->nested_types_[i], proto.nested_type(i)); + } + + for (int i = 0; i < message->enum_type_count(); i++) { + CrossLinkEnum(&message->enum_types_[i], proto.enum_type(i)); + } + + for (int i = 0; i < message->field_count(); i++) { + CrossLinkField(&message->fields_[i], proto.field(i)); + } + + for (int i = 0; i < message->extension_count(); i++) { + CrossLinkField(&message->extensions_[i], proto.extension(i)); + } +} + +void DescriptorBuilder::CrossLinkField( + FieldDescriptor* field, const FieldDescriptorProto& proto) { + if (field->options_ == NULL) { + field->options_ = &FieldOptions::default_instance(); + } + + if (proto.has_extendee()) { + Symbol extendee = LookupSymbol(proto.extendee(), field->full_name(), + PLACEHOLDER_EXTENDABLE_MESSAGE); + if (extendee.IsNull()) { + AddNotDefinedError(field->full_name(), proto, + DescriptorPool::ErrorCollector::EXTENDEE, + proto.extendee()); + return; + } 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; + + if (!field->containing_type()->IsExtensionNumber(field->number())) { + 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())); + } + } + + if (proto.has_type_name()) { + // Assume we are expecting a message type unless the proto contains some + // evidence that it expects an enum type. This only makes a difference if + // we end up creating a placeholder. + bool expecting_enum = (proto.type() == FieldDescriptorProto::TYPE_ENUM) || + proto.has_default_value(); + + Symbol type = + LookupSymbol(proto.type_name(), field->full_name(), + expecting_enum ? PLACEHOLDER_ENUM : PLACEHOLDER_MESSAGE, + LOOKUP_TYPES); + + if (type.IsNull()) { + AddNotDefinedError(field->full_name(), proto, + DescriptorPool::ErrorCollector::TYPE, + proto.type_name()); + return; + } + + if (!proto.has_type()) { + // Choose field type based on symbol. + if (type.type == Symbol::MESSAGE) { + field->type_ = FieldDescriptor::TYPE_MESSAGE; + } else if (type.type == Symbol::ENUM) { + field->type_ = FieldDescriptor::TYPE_ENUM; + } else { + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::TYPE, + "\"" + proto.type_name() + "\" is not a type."); + return; + } + } + + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (type.type != Symbol::MESSAGE) { + 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, + DescriptorPool::ErrorCollector::DEFAULT_VALUE, + "Messages can't have default values."); + } + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { + if (type.type != Symbol::ENUM) { + 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 + // to just drop them. + field->has_default_value_ = false; + } + + if (field->has_default_value()) { + // 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; + } else { + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::DEFAULT_VALUE, + "Enum type \"" + field->enum_type()->full_name() + + "\" has no value named \"" + proto.default_value() + "\"."); + } + } else if (field->enum_type()->value_count() > 0) { + // All enums must have at least one value, or we would have reported + // an error elsewhere. We use the first defined value as the default + // if a default is not explicitly defined. + field->default_value_enum_ = field->enum_type()->value(0); + } + } else { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "Field with primitive type has type_name."); + } + } else { + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || + field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "Field with message or enum type missing type_name."); + } + } + + // Add the field to the fields-by-number table. + // Note: We have to do this *after* cross-linking because extensions do not + // know their containing type until now. + if (!file_tables_->AddFieldByNumber(field)) { + const FieldDescriptor* conflicting_field = + file_tables_->FindFieldByNumber(field->containing_type(), + field->number()); + if (field->is_extension()) { + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute("Extension number $0 has already been used " + "in \"$1\" by extension \"$2\".", + field->number(), + field->containing_type()->full_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(), + field->containing_type()->full_name(), + conflicting_field->name())); + } + } + + if (field->is_extension()) { + // No need for error checking: if the extension number collided, + // we've already been informed of it by the if() above. + tables_->AddExtension(field); + } + + // Add the field to the lowercase-name and camelcase-name tables. + file_tables_->AddFieldByStylizedNames(field); +} + +void DescriptorBuilder::CrossLinkEnum( + EnumDescriptor* enum_type, const EnumDescriptorProto& proto) { + if (enum_type->options_ == NULL) { + enum_type->options_ = &EnumOptions::default_instance(); + } + + for (int i = 0; i < enum_type->value_count(); i++) { + CrossLinkEnumValue(&enum_type->values_[i], proto.value(i)); + } +} + +void DescriptorBuilder::CrossLinkEnumValue( + EnumValueDescriptor* enum_value, const EnumValueDescriptorProto& proto) { + if (enum_value->options_ == NULL) { + enum_value->options_ = &EnumValueOptions::default_instance(); + } +} + +void DescriptorBuilder::CrossLinkService( + ServiceDescriptor* service, const ServiceDescriptorProto& proto) { + if (service->options_ == NULL) { + service->options_ = &ServiceOptions::default_instance(); + } + + for (int i = 0; i < service->method_count(); i++) { + CrossLinkMethod(&service->methods_[i], proto.method(i)); + } +} + +void DescriptorBuilder::CrossLinkMethod( + MethodDescriptor* method, const MethodDescriptorProto& proto) { + if (method->options_ == NULL) { + method->options_ = &MethodOptions::default_instance(); + } + + Symbol input_type = LookupSymbol(proto.input_type(), method->full_name()); + if (input_type.IsNull()) { + AddNotDefinedError(method->full_name(), proto, + DescriptorPool::ErrorCollector::INPUT_TYPE, + proto.input_type()); + } 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_ = input_type.descriptor; + } + + Symbol output_type = LookupSymbol(proto.output_type(), method->full_name()); + if (output_type.IsNull()) { + AddNotDefinedError(method->full_name(), proto, + DescriptorPool::ErrorCollector::OUTPUT_TYPE, + proto.output_type()); + } 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_ = output_type.descriptor; + } +} + +// ------------------------------------------------------------------- + +#define VALIDATE_OPTIONS_FROM_ARRAY(descriptor, array_name, type) \ + for (int i = 0; i < descriptor->array_name##_count(); ++i) { \ + Validate##type##Options(descriptor->array_name##s_ + i, \ + proto.array_name(i)); \ + } + +// Determine if the file uses optimize_for = LITE_RUNTIME, being careful to +// avoid problems that exist at init time. +static bool IsLite(const FileDescriptor* file) { + // TODO(kenton): I don't even remember how many of these conditions are + // actually possible. I'm just being super-safe. + return file != NULL && + &file->options() != NULL && + &file->options() != &FileOptions::default_instance() && + file->options().optimize_for() == FileOptions::LITE_RUNTIME; +} + +void DescriptorBuilder::ValidateFileOptions(FileDescriptor* file, + const FileDescriptorProto& proto) { + VALIDATE_OPTIONS_FROM_ARRAY(file, message_type, Message); + VALIDATE_OPTIONS_FROM_ARRAY(file, enum_type, Enum); + VALIDATE_OPTIONS_FROM_ARRAY(file, service, Service); + VALIDATE_OPTIONS_FROM_ARRAY(file, extension, Field); + + // Lite files can only be imported by other Lite files. + if (!IsLite(file)) { + for (int i = 0; i < file->dependency_count(); i++) { + if (IsLite(file->dependency(i))) { + AddError( + file->name(), proto, + DescriptorPool::ErrorCollector::OTHER, + "Files that do not use optimize_for = LITE_RUNTIME cannot import " + "files which do use this option. This file is not lite, but it " + "imports \"" + file->dependency(i)->name() + "\" which is."); + break; + } + } + } +} + +void DescriptorBuilder::ValidateMessageOptions(Descriptor* message, + const DescriptorProto& proto) { + VALIDATE_OPTIONS_FROM_ARRAY(message, field, Field); + VALIDATE_OPTIONS_FROM_ARRAY(message, nested_type, Message); + VALIDATE_OPTIONS_FROM_ARRAY(message, enum_type, Enum); + VALIDATE_OPTIONS_FROM_ARRAY(message, extension, Field); +} + +void DescriptorBuilder::ValidateFieldOptions(FieldDescriptor* field, + const FieldDescriptorProto& proto) { + if (field->options().has_experimental_map_key()) { + ValidateMapKey(field, proto); + } + + // Only repeated primitive fields may be packed. + if (field->options().packed() && !field->is_packable()) { + AddError( + field->full_name(), proto, + DescriptorPool::ErrorCollector::TYPE, + "[packed = true] can only be specified for repeated primitive fields."); + } + + // Note: Default instance may not yet be initialized here, so we have to + // avoid reading from it. + if (field->containing_type_ != NULL && + &field->containing_type()->options() != + &MessageOptions::default_instance() && + field->containing_type()->options().message_set_wire_format()) { + if (field->is_extension()) { + if (!field->is_optional() || + field->type() != FieldDescriptor::TYPE_MESSAGE) { + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::TYPE, + "Extensions of MessageSets must be optional messages."); + } + } else { + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::NAME, + "MessageSets cannot have fields, only extensions."); + } + } + + // Lite extensions can only be of Lite types. + if (IsLite(field->file()) && + field->containing_type_ != NULL && + !IsLite(field->containing_type()->file())) { + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::EXTENDEE, + "Extensions to non-lite types can only be declared in non-lite " + "files. Note that you cannot extend a non-lite type to contain " + "a lite type, but the reverse is allowed."); + } +} + +void DescriptorBuilder::ValidateEnumOptions(EnumDescriptor* enm, + const EnumDescriptorProto& proto) { + VALIDATE_OPTIONS_FROM_ARRAY(enm, value, EnumValue); +} + +void DescriptorBuilder::ValidateEnumValueOptions( + EnumValueDescriptor* enum_value, const EnumValueDescriptorProto& proto) { + // Nothing to do so far. +} +void DescriptorBuilder::ValidateServiceOptions(ServiceDescriptor* service, + const ServiceDescriptorProto& proto) { + if (IsLite(service->file()) && + (service->file()->options().cc_generic_services() || + service->file()->options().java_generic_services())) { + AddError(service->full_name(), proto, + DescriptorPool::ErrorCollector::NAME, + "Files with optimize_for = LITE_RUNTIME cannot define services " + "unless you set both options cc_generic_services and " + "java_generic_sevices to false."); + } + + VALIDATE_OPTIONS_FROM_ARRAY(service, method, Method); +} + +void DescriptorBuilder::ValidateMethodOptions(MethodDescriptor* method, + const MethodDescriptorProto& proto) { + // Nothing to do so far. +} + +void DescriptorBuilder::ValidateMapKey(FieldDescriptor* field, + const FieldDescriptorProto& proto) { + if (!field->is_repeated()) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "map type is only allowed for repeated fields."); + return; + } + + if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "map type is only allowed for fields with a message type."); + return; + } + + const Descriptor* item_type = field->message_type(); + if (item_type == NULL) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "Could not find field type."); + return; + } + + // Find the field in item_type named by "experimental_map_key" + const string& key_name = field->options().experimental_map_key(); + const Symbol key_symbol = LookupSymbol( + key_name, + // We append ".key_name" to the containing type's name since + // LookupSymbol() searches for peers of the supplied name, not + // children of the supplied name. + item_type->full_name() + "." + key_name); + + if (key_symbol.IsNull() || key_symbol.field_descriptor->is_extension()) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "Could not find field named \"" + key_name + "\" in type \"" + + item_type->full_name() + "\"."); + return; + } + const FieldDescriptor* key_field = key_symbol.field_descriptor; + + if (key_field->is_repeated()) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "map_key must not name a repeated field."); + return; + } + + if (key_field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "map key must name a scalar or string field."); + return; + } + + field->experimental_map_key_ = key_field; +} + +#undef VALIDATE_OPTIONS_FROM_ARRAY + +// ------------------------------------------------------------------- + +DescriptorBuilder::OptionInterpreter::OptionInterpreter( + DescriptorBuilder* builder) : builder_(builder) { + GOOGLE_CHECK(builder_); +} + +DescriptorBuilder::OptionInterpreter::~OptionInterpreter() { +} + +bool DescriptorBuilder::OptionInterpreter::InterpretOptions( + OptionsToInterpret* options_to_interpret) { + // Note that these may be in different pools, so we can't use the same + // descriptor and reflection objects on both. + Message* options = options_to_interpret->options; + const Message* original_options = options_to_interpret->original_options; + + bool failed = false; + options_to_interpret_ = options_to_interpret; + + // Find the uninterpreted_option field in the mutable copy of the options + // and clear them, since we're about to interpret them. + const FieldDescriptor* uninterpreted_options_field = + options->GetDescriptor()->FindFieldByName("uninterpreted_option"); + GOOGLE_CHECK(uninterpreted_options_field != NULL) + << "No field named \"uninterpreted_option\" in the Options proto."; + options->GetReflection()->ClearField(options, uninterpreted_options_field); + + // Find the uninterpreted_option field in the original options. + const FieldDescriptor* original_uninterpreted_options_field = + original_options->GetDescriptor()-> + FindFieldByName("uninterpreted_option"); + GOOGLE_CHECK(original_uninterpreted_options_field != NULL) + << "No field named \"uninterpreted_option\" in the Options proto."; + + const int num_uninterpreted_options = original_options->GetReflection()-> + FieldSize(*original_options, original_uninterpreted_options_field); + for (int i = 0; i < num_uninterpreted_options; ++i) { + uninterpreted_option_ = down_cast( + &original_options->GetReflection()->GetRepeatedMessage( + *original_options, original_uninterpreted_options_field, i)); + if (!InterpretSingleOption(options)) { + // Error already added by InterpretSingleOption(). + failed = true; + break; + } + } + // Reset these, so we don't have any dangling pointers. + uninterpreted_option_ = NULL; + options_to_interpret_ = NULL; + + if (!failed) { + // InterpretSingleOption() added the interpreted options in the + // UnknownFieldSet, in case the option isn't yet known to us. Now we + // serialize the options message and deserialize it back. That way, any + // option fields that we do happen to know about will get moved from the + // UnknownFieldSet into the real fields, and thus be available right away. + // If they are not known, that's OK too. They will get reparsed into the + // UnknownFieldSet and wait there until the message is parsed by something + // that does know about the options. + string buf; + options->AppendToString(&buf); + GOOGLE_CHECK(options->ParseFromString(buf)) + << "Protocol message serialized itself in invalid fashion."; + } + + return !failed; +} + +bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( + Message* options) { + // First do some basic validation. + if (uninterpreted_option_->name_size() == 0) { + // This should never happen unless the parser has gone seriously awry or + // someone has manually created the uninterpreted option badly. + return AddNameError("Option must have a name."); + } + if (uninterpreted_option_->name(0).name_part() == "uninterpreted_option") { + return AddNameError("Option must not use reserved name " + "\"uninterpreted_option\"."); + } + + const Descriptor* options_descriptor = NULL; + // Get the options message's descriptor from the builder's pool, so that we + // get the version that knows about any extension options declared in the + // file we're currently building. The descriptor should be there as long as + // the file we're building imported "google/protobuf/descriptors.proto". + + // Note that we use DescriptorBuilder::FindSymbol(), not + // DescriptorPool::FindMessageTypeByName() because we're already holding the + // pool's mutex, and the latter method locks it again. + Symbol symbol = builder_->FindSymbolNotEnforcingDeps( + options->GetDescriptor()->full_name()); + if (!symbol.IsNull() && symbol.type == Symbol::MESSAGE) { + options_descriptor = symbol.descriptor; + } else { + // 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. + options_descriptor = options->GetDescriptor(); + } + GOOGLE_CHECK(options_descriptor); + + // We iterate over the name parts to drill into the submessages until we find + // the leaf field for the option. As we drill down we remember the current + // submessage's descriptor in |descriptor| and the next field in that + // submessage in |field|. We also track the fields we're drilling down + // through in |intermediate_fields|. As we go, we reconstruct the full option + // name in |debug_msg_name|, for use in error messages. + const Descriptor* descriptor = options_descriptor; + const FieldDescriptor* field = NULL; + vector intermediate_fields; + string debug_msg_name = ""; + + for (int i = 0; i < uninterpreted_option_->name_size(); ++i) { + const string& name_part = uninterpreted_option_->name(i).name_part(); + if (debug_msg_name.size() > 0) { + debug_msg_name += "."; + } + if (uninterpreted_option_->name(i).is_extension()) { + debug_msg_name += "(" + name_part + ")"; + // Search for the extension's descriptor as an extension in the builder's + // pool. Note that we use DescriptorBuilder::LookupSymbol(), not + // DescriptorPool::FindExtensionByName(), for two reasons: 1) It allows + // relative lookups, and 2) because we're already holding the pool's + // mutex, and the latter method locks it again. + Symbol symbol = builder_->LookupSymbol(name_part, + options_to_interpret_->name_scope); + if (!symbol.IsNull() && symbol.type == Symbol::FIELD) { + 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 + // you use, so they must be present in the builder's pool. + } else { + debug_msg_name += name_part; + // Search for the field's descriptor as a regular field. + field = descriptor->FindFieldByName(name_part); + } + + if (field == NULL) { + if (get_allow_unknown(builder_->pool_)) { + // We can't find the option, but AllowUnknownDependencies() is enabled, + // so we will just leave it as uninterpreted. + AddWithoutInterpreting(*uninterpreted_option_, options); + return true; + } else { + return AddNameError("Option \"" + debug_msg_name + "\" unknown."); + } + } else if (field->containing_type() != descriptor) { + if (get_is_placeholder(field->containing_type())) { + // The field is an extension of a placeholder type, so we can't + // reliably verify whether it is a valid extension to use here (e.g. + // we don't know if it is an extension of the correct *Options message, + // or if it has a valid field number, etc.). Just leave it as + // uninterpreted instead. + AddWithoutInterpreting(*uninterpreted_option_, options); + return true; + } else { + // This can only happen if, due to some insane misconfiguration of the + // pools, we find the options message in one pool but the field in + // another. This would probably imply a hefty bug somewhere. + return AddNameError("Option field \"" + debug_msg_name + + "\" is not a field or extension of message \"" + + descriptor->name() + "\"."); + } + } else if (field->is_repeated()) { + return AddNameError("Option field \"" + debug_msg_name + + "\" is repeated. Repeated options are not " + "supported."); + } else if (i < uninterpreted_option_->name_size() - 1) { + if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { + return AddNameError("Option \"" + debug_msg_name + + "\" is an atomic type, not a message."); + } else { + // Drill down into the submessage. + intermediate_fields.push_back(field); + descriptor = field->message_type(); + } + } + } + + // We've found the leaf field. Now we use UnknownFieldSets to set its value + // on the options message. We do so because the message may not yet know + // about its extension fields, so we may not be able to set the fields + // directly. But the UnknownFieldSets will serialize to the same wire-format + // message, so reading that message back in once the extension fields are + // known will populate them correctly. + + // First see if the option is already set. + if (!ExamineIfOptionIsSet( + intermediate_fields.begin(), + intermediate_fields.end(), + field, debug_msg_name, + options->GetReflection()->GetUnknownFields(*options))) { + return false; // ExamineIfOptionIsSet() already added the error. + } + + + // First set the value on the UnknownFieldSet corresponding to the + // innermost message. + scoped_ptr unknown_fields(new UnknownFieldSet()); + if (!SetOptionValue(field, unknown_fields.get())) { + return false; // SetOptionValue() already added the error. + } + + // Now wrap the UnknownFieldSet with UnknownFieldSets corresponding to all + // the intermediate messages. + for (vector::reverse_iterator iter = + intermediate_fields.rbegin(); + iter != intermediate_fields.rend(); ++iter) { + scoped_ptr parent_unknown_fields(new UnknownFieldSet()); + switch ((*iter)->type()) { + case FieldDescriptor::TYPE_MESSAGE: { + io::StringOutputStream outstr( + parent_unknown_fields->AddLengthDelimited((*iter)->number())); + io::CodedOutputStream out(&outstr); + internal::WireFormat::SerializeUnknownFields(*unknown_fields, &out); + GOOGLE_CHECK(!out.HadError()) + << "Unexpected failure while serializing option submessage " + << debug_msg_name << "\"."; + break; + } + + case FieldDescriptor::TYPE_GROUP: { + parent_unknown_fields->AddGroup((*iter)->number()) + ->MergeFrom(*unknown_fields); + break; + } + + default: + GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " + << (*iter)->type(); + return false; + } + unknown_fields.reset(parent_unknown_fields.release()); + } + + // Now merge the UnknownFieldSet corresponding to the top-level message into + // the options message. + options->GetReflection()->MutableUnknownFields(options)->MergeFrom( + *unknown_fields); + + return true; +} + +void DescriptorBuilder::OptionInterpreter::AddWithoutInterpreting( + const UninterpretedOption& uninterpreted_option, Message* options) { + const FieldDescriptor* field = + options->GetDescriptor()->FindFieldByName("uninterpreted_option"); + GOOGLE_CHECK(field != NULL); + + options->GetReflection()->AddMessage(options, field) + ->CopyFrom(uninterpreted_option); +} + +bool DescriptorBuilder::OptionInterpreter::ExamineIfOptionIsSet( + vector::const_iterator intermediate_fields_iter, + vector::const_iterator intermediate_fields_end, + const FieldDescriptor* innermost_field, const string& debug_msg_name, + const UnknownFieldSet& unknown_fields) { + // We do linear searches of the UnknownFieldSet and its sub-groups. This + // should be fine since it's unlikely that any one options structure will + // contain more than a handful of options. + + if (intermediate_fields_iter == intermediate_fields_end) { + // We're at the innermost submessage. + for (int i = 0; i < unknown_fields.field_count(); i++) { + if (unknown_fields.field(i).number() == innermost_field->number()) { + return AddNameError("Option \"" + debug_msg_name + + "\" was already set."); + } + } + return true; + } + + for (int i = 0; i < unknown_fields.field_count(); i++) { + if (unknown_fields.field(i).number() == + (*intermediate_fields_iter)->number()) { + const UnknownField* unknown_field = &unknown_fields.field(i); + FieldDescriptor::Type type = (*intermediate_fields_iter)->type(); + // Recurse into the next submessage. + switch (type) { + case FieldDescriptor::TYPE_MESSAGE: + if (unknown_field->type() == UnknownField::TYPE_LENGTH_DELIMITED) { + UnknownFieldSet intermediate_unknown_fields; + if (intermediate_unknown_fields.ParseFromString( + unknown_field->length_delimited()) && + !ExamineIfOptionIsSet(intermediate_fields_iter + 1, + intermediate_fields_end, + innermost_field, debug_msg_name, + intermediate_unknown_fields)) { + return false; // Error already added. + } + } + break; + + case FieldDescriptor::TYPE_GROUP: + if (unknown_field->type() == UnknownField::TYPE_GROUP) { + if (!ExamineIfOptionIsSet(intermediate_fields_iter + 1, + intermediate_fields_end, + innermost_field, debug_msg_name, + unknown_field->group())) { + return false; // Error already added. + } + } + break; + + default: + GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " << type; + return false; + } + } + } + return true; +} + +bool DescriptorBuilder::OptionInterpreter::SetOptionValue( + const FieldDescriptor* option_field, + UnknownFieldSet* unknown_fields) { + // We switch on the CppType to validate. + switch (option_field->cpp_type()) { + + case FieldDescriptor::CPPTYPE_INT32: + if (uninterpreted_option_->has_positive_int_value()) { + if (uninterpreted_option_->positive_int_value() > + static_cast(kint32max)) { + return AddValueError("Value out of range for int32 option \"" + + option_field->full_name() + "\"."); + } else { + SetInt32(option_field->number(), + uninterpreted_option_->positive_int_value(), + option_field->type(), unknown_fields); + } + } else if (uninterpreted_option_->has_negative_int_value()) { + if (uninterpreted_option_->negative_int_value() < + static_cast(kint32min)) { + return AddValueError("Value out of range for int32 option \"" + + option_field->full_name() + "\"."); + } else { + SetInt32(option_field->number(), + uninterpreted_option_->negative_int_value(), + option_field->type(), unknown_fields); + } + } else { + return AddValueError("Value must be integer for int32 option \"" + + option_field->full_name() + "\"."); + } + break; + + case FieldDescriptor::CPPTYPE_INT64: + if (uninterpreted_option_->has_positive_int_value()) { + if (uninterpreted_option_->positive_int_value() > + static_cast(kint64max)) { + return AddValueError("Value out of range for int64 option \"" + + option_field->full_name() + "\"."); + } else { + SetInt64(option_field->number(), + uninterpreted_option_->positive_int_value(), + option_field->type(), unknown_fields); + } + } else if (uninterpreted_option_->has_negative_int_value()) { + SetInt64(option_field->number(), + uninterpreted_option_->negative_int_value(), + option_field->type(), unknown_fields); + } else { + return AddValueError("Value must be integer for int64 option \"" + + option_field->full_name() + "\"."); + } + break; + + case FieldDescriptor::CPPTYPE_UINT32: + if (uninterpreted_option_->has_positive_int_value()) { + if (uninterpreted_option_->positive_int_value() > kuint32max) { + return AddValueError("Value out of range for uint32 option \"" + + option_field->name() + "\"."); + } else { + SetUInt32(option_field->number(), + uninterpreted_option_->positive_int_value(), + option_field->type(), unknown_fields); + } + } else { + return AddValueError("Value must be non-negative integer for uint32 " + "option \"" + option_field->full_name() + "\"."); + } + break; + + case FieldDescriptor::CPPTYPE_UINT64: + if (uninterpreted_option_->has_positive_int_value()) { + SetUInt64(option_field->number(), + uninterpreted_option_->positive_int_value(), + option_field->type(), unknown_fields); + } else { + return AddValueError("Value must be non-negative integer for uint64 " + "option \"" + option_field->full_name() + "\"."); + } + break; + + case FieldDescriptor::CPPTYPE_FLOAT: { + float value; + if (uninterpreted_option_->has_double_value()) { + value = uninterpreted_option_->double_value(); + } else if (uninterpreted_option_->has_positive_int_value()) { + value = uninterpreted_option_->positive_int_value(); + } else if (uninterpreted_option_->has_negative_int_value()) { + value = uninterpreted_option_->negative_int_value(); + } else { + return AddValueError("Value must be number for float option \"" + + option_field->full_name() + "\"."); + } + unknown_fields->AddFixed32(option_field->number(), + google::protobuf::internal::WireFormatLite::EncodeFloat(value)); + break; + } + + case FieldDescriptor::CPPTYPE_DOUBLE: { + double value; + if (uninterpreted_option_->has_double_value()) { + value = uninterpreted_option_->double_value(); + } else if (uninterpreted_option_->has_positive_int_value()) { + value = uninterpreted_option_->positive_int_value(); + } else if (uninterpreted_option_->has_negative_int_value()) { + value = uninterpreted_option_->negative_int_value(); + } else { + return AddValueError("Value must be number for double option \"" + + option_field->full_name() + "\"."); + } + unknown_fields->AddFixed64(option_field->number(), + google::protobuf::internal::WireFormatLite::EncodeDouble(value)); + break; + } + + case FieldDescriptor::CPPTYPE_BOOL: + uint64 value; + if (!uninterpreted_option_->has_identifier_value()) { + return AddValueError("Value must be identifier for boolean option " + "\"" + option_field->full_name() + "\"."); + } + if (uninterpreted_option_->identifier_value() == "true") { + value = 1; + } else if (uninterpreted_option_->identifier_value() == "false") { + value = 0; + } else { + return AddValueError("Value must be \"true\" or \"false\" for boolean " + "option \"" + option_field->full_name() + "\"."); + } + unknown_fields->AddVarint(option_field->number(), value); + break; + + case FieldDescriptor::CPPTYPE_ENUM: { + if (!uninterpreted_option_->has_identifier_value()) { + return AddValueError("Value must be identifier for enum-valued option " + "\"" + option_field->full_name() + "\"."); + } + const EnumDescriptor* enum_type = option_field->enum_type(); + const string& value_name = uninterpreted_option_->identifier_value(); + const EnumValueDescriptor* enum_value = NULL; + + if (enum_type->file()->pool() != DescriptorPool::generated_pool()) { + // Note that the enum value's fully-qualified name is a sibling of the + // enum's name, not a child of it. + string fully_qualified_name = enum_type->full_name(); + fully_qualified_name.resize(fully_qualified_name.size() - + enum_type->name().size()); + fully_qualified_name += value_name; + + // Search for the enum value's descriptor in the builder's pool. Note + // that we use DescriptorBuilder::FindSymbolNotEnforcingDeps(), not + // DescriptorPool::FindEnumValueByName() because we're already holding + // 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) { + 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; + } + } + } else { + // The enum type is in the generated pool, so we can search for the + // value there. + enum_value = enum_type->FindValueByName(value_name); + } + + if (enum_value == NULL) { + return AddValueError("Enum type \"" + + option_field->enum_type()->full_name() + + "\" has no value named \"" + value_name + "\" for " + "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. + unknown_fields->AddVarint(option_field->number(), + static_cast(static_cast(enum_value->number()))); + } + break; + } + + case FieldDescriptor::CPPTYPE_STRING: + if (!uninterpreted_option_->has_string_value()) { + return AddValueError("Value must be quoted string for string option " + "\"" + option_field->full_name() + "\"."); + } + // The string has already been unquoted and unescaped by the parser. + unknown_fields->AddLengthDelimited(option_field->number(), + uninterpreted_option_->string_value()); + break; + + case FieldDescriptor::CPPTYPE_MESSAGE: + if (!SetAggregateOption(option_field, unknown_fields)) { + return false; + } + break; + } + + return true; +} + +class DescriptorBuilder::OptionInterpreter::AggregateOptionFinder + : public TextFormat::Finder { + public: + DescriptorBuilder* builder_; + + virtual const FieldDescriptor* FindExtension( + Message* message, const string& name) const { + assert_mutex_held(builder_->pool_); + Symbol result = builder_->LookupSymbolNoPlaceholder( + name, message->GetDescriptor()->full_name()); + if (result.type == Symbol::FIELD && + result.field_descriptor->is_extension()) { + return result.field_descriptor; + } else { + return NULL; + } + } +}; + +// A custom error collector to record any text-format parsing errors +namespace { +class AggregateErrorCollector : public io::ErrorCollector { + public: + string error_; + + virtual void AddError(int line, int column, const string& message) { + if (!error_.empty()) { + error_ += "; "; + } + error_ += message; + } + + virtual void AddWarning(int line, int column, const string& message) { + // Ignore warnings + } +}; +} + +// We construct a dynamic message of the type corresponding to +// option_field, parse the supplied text-format string into this +// message, and serialize the resulting message to produce the value. +bool DescriptorBuilder::OptionInterpreter::SetAggregateOption( + const FieldDescriptor* option_field, + UnknownFieldSet* unknown_fields) { + if (!uninterpreted_option_->has_aggregate_value()) { + return AddValueError("Option \"" + option_field->full_name() + + "\" is a message. To set the entire message, use " + "syntax like \"" + option_field->name() + + " = { }\". " + "To set fields within it, use " + "syntax like \"" + option_field->name() + + ".foo = value\"."); + } + + const Descriptor* type = option_field->message_type(); + scoped_ptr dynamic(dynamic_factory_.GetPrototype(type)->New()); + GOOGLE_CHECK(dynamic.get() != NULL) + << "Could not create an instance of " << option_field->DebugString(); + + AggregateErrorCollector collector; + AggregateOptionFinder finder; + finder.builder_ = builder_; + TextFormat::Parser parser; + parser.RecordErrorsTo(&collector); + parser.SetFinder(&finder); + if (!parser.ParseFromString(uninterpreted_option_->aggregate_value(), + dynamic.get())) { + AddValueError("Error while parsing option value for \"" + + option_field->name() + "\": " + collector.error_); + return false; + } else { + string serial; + dynamic->SerializeToString(&serial); // Never fails + unknown_fields->AddLengthDelimited(option_field->number(), serial); + return true; + } +} + +void DescriptorBuilder::OptionInterpreter::SetInt32(int number, int32 value, + FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { + switch (type) { + case FieldDescriptor::TYPE_INT32: + unknown_fields->AddVarint(number, + static_cast(static_cast(value))); + break; + + case FieldDescriptor::TYPE_SFIXED32: + unknown_fields->AddFixed32(number, static_cast(value)); + break; + + case FieldDescriptor::TYPE_SINT32: + unknown_fields->AddVarint(number, + google::protobuf::internal::WireFormatLite::ZigZagEncode32(value)); + break; + + default: + GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT32: " << type; + break; + } +} + +void DescriptorBuilder::OptionInterpreter::SetInt64(int number, int64 value, + FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { + switch (type) { + case FieldDescriptor::TYPE_INT64: + unknown_fields->AddVarint(number, static_cast(value)); + break; + + case FieldDescriptor::TYPE_SFIXED64: + unknown_fields->AddFixed64(number, static_cast(value)); + break; + + case FieldDescriptor::TYPE_SINT64: + unknown_fields->AddVarint(number, + google::protobuf::internal::WireFormatLite::ZigZagEncode64(value)); + break; + + default: + GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT64: " << type; + break; + } +} + +void DescriptorBuilder::OptionInterpreter::SetUInt32(int number, uint32 value, + FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { + switch (type) { + case FieldDescriptor::TYPE_UINT32: + unknown_fields->AddVarint(number, static_cast(value)); + break; + + case FieldDescriptor::TYPE_FIXED32: + unknown_fields->AddFixed32(number, static_cast(value)); + break; + + default: + GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT32: " << type; + break; + } +} + +void DescriptorBuilder::OptionInterpreter::SetUInt64(int number, uint64 value, + FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { + switch (type) { + case FieldDescriptor::TYPE_UINT64: + unknown_fields->AddVarint(number, value); + break; + + case FieldDescriptor::TYPE_FIXED64: + unknown_fields->AddFixed64(number, value); + break; + + default: + GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT64: " << type; + break; + } +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/descriptor.h b/depends/protobuf/google/protobuf/descriptor.h new file mode 100644 index 000000000..7f87dd809 --- /dev/null +++ b/depends/protobuf/google/protobuf/descriptor.h @@ -0,0 +1,1367 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 file contains classes which describe a type of protocol message. +// You can use a message's descriptor to learn at runtime what fields +// it contains and what the types of those fields are. The Message +// interface also allows you to dynamically access and modify individual +// fields by passing the FieldDescriptor of the field you are interested +// in. +// +// Most users will not care about descriptors, because they will write +// code specific to certain protocol types and will simply use the classes +// generated by the protocol compiler directly. Advanced users who want +// to operate on arbitrary types (not known at compile time) may want to +// read descriptors in order to learn about the contents of a message. +// A very small number of users will want to construct their own +// Descriptors, either because they are implementing Message manually or +// because they are writing something like the protocol compiler. +// +// For an example of how you might use descriptors, see the code example +// at the top of message.h. + +#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__ +#define GOOGLE_PROTOBUF_DESCRIPTOR_H__ + +#include +#include +#include + + +namespace google { +namespace protobuf { + +// Defined in this file. +class Descriptor; +class FieldDescriptor; +class EnumDescriptor; +class EnumValueDescriptor; +class ServiceDescriptor; +class MethodDescriptor; +class FileDescriptor; +class DescriptorDatabase; +class DescriptorPool; + +// Defined in descriptor.proto +class DescriptorProto; +class FieldDescriptorProto; +class EnumDescriptorProto; +class EnumValueDescriptorProto; +class ServiceDescriptorProto; +class MethodDescriptorProto; +class FileDescriptorProto; +class MessageOptions; +class FieldOptions; +class EnumOptions; +class EnumValueOptions; +class ServiceOptions; +class MethodOptions; +class FileOptions; +class UninterpretedOption; + +// Defined in message.h +class Message; + +// Defined in descriptor.cc +class DescriptorBuilder; +class FileDescriptorTables; + +// Defined in unknown_field_set.h. +class UnknownField; + +// Describes a type of protocol message, or a particular group within a +// message. To obtain the Descriptor for a given message object, call +// 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 LIBPROTOBUF_EXPORT Descriptor { + public: + // The name of the message type, not including its scope. + const string& name() const; + + // The fully-qualified name of the message type, scope delimited by + // periods. For example, message type "Foo" which is declared in package + // "bar" has full name "bar.Foo". If a type "Baz" is nested within + // Foo, Baz's full_name is "bar.Foo.Baz". To get only the part that + // comes after the last '.', use name(). + const string& full_name() const; + + // Index of this descriptor within the file or containing type's message + // type array. + int index() const; + + // The .proto file in which this message type was defined. Never NULL. + const FileDescriptor* file() const; + + // If this Descriptor describes a nested type, this returns the type + // in which it is nested. Otherwise, returns NULL. + const Descriptor* containing_type() const; + + // Get options for this message type. These are specified in the .proto file + // by placing lines like "option foo = 1234;" in the message definition. + // Allowed options are defined by MessageOptions in + // google/protobuf/descriptor.proto, and any available extensions of that + // message. + const MessageOptions& options() const; + + // Write the contents of this Descriptor into the given DescriptorProto. + // The target DescriptorProto must be clear before calling this; if it + // isn't, the result may be garbage. + void CopyTo(DescriptorProto* proto) const; + + // Write the contents of this decriptor in a human-readable form. Output + // will be suitable for re-parsing. + string DebugString() const; + + // Field stuff ----------------------------------------------------- + + // The number of fields in this message type. + int field_count() const; + // Gets a field by index, where 0 <= index < field_count(). + // These are returned in the order they were defined in the .proto file. + const FieldDescriptor* field(int index) const; + + // Looks up a field by declared tag number. Returns NULL if no such field + // exists. + const FieldDescriptor* FindFieldByNumber(int number) const; + // Looks up a field by name. Returns NULL if no such field exists. + const FieldDescriptor* FindFieldByName(const string& 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 string& 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 string& camelcase_name) const; + + // Nested type stuff ----------------------------------------------- + + // The number of nested types in this message type. + int nested_type_count() const; + // Gets a nested type by index, where 0 <= index < nested_type_count(). + // These are returned in the order they were defined in the .proto file. + const Descriptor* nested_type(int index) const; + + // Looks up a nested type by name. Returns NULL if no such nested type + // exists. + const Descriptor* FindNestedTypeByName(const string& name) const; + + // Enum stuff ------------------------------------------------------ + + // The number of enum types in this message type. + int enum_type_count() const; + // Gets an enum type by index, where 0 <= index < enum_type_count(). + // These are returned in the order they were defined in the .proto file. + const EnumDescriptor* enum_type(int index) const; + + // Looks up an enum type by name. Returns NULL if no such enum type exists. + const EnumDescriptor* FindEnumTypeByName(const string& name) const; + + // Looks up an enum value by name, among all enum types in this message. + // Returns NULL if no such value exists. + const EnumValueDescriptor* FindEnumValueByName(const string& name) const; + + // Extensions ------------------------------------------------------ + + // A range of field numbers which are designated for third-party + // extensions. + struct ExtensionRange { + int start; // inclusive + int end; // exclusive + }; + + // The number of extension ranges in this message type. + int extension_range_count() const; + // Gets an extension range by index, where 0 <= index < + // extension_range_count(). These are returned in the order they were defined + // in the .proto file. + const ExtensionRange* extension_range(int index) const; + + // Returns true if the number is in one of the extension ranges. + bool IsExtensionNumber(int number) const; + + // The number of extensions -- extending *other* messages -- that were + // defined nested within this message type's scope. + 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. + const FieldDescriptor* extension(int index) const; + + // Looks up a named extension (which extends some *other* message type) + // defined within this message type's scope. + const FieldDescriptor* FindExtensionByName(const string& name) const; + + // Similar to FindFieldByLowercaseName(), but finds extensions defined within + // this message type's scope. + const FieldDescriptor* FindExtensionByLowercaseName(const string& name) const; + + // Similar to FindFieldByCamelcaseName(), but finds extensions defined within + // this message type's scope. + const FieldDescriptor* FindExtensionByCamelcaseName(const string& name) const; + + private: + typedef MessageOptions OptionsType; + + // Internal version of DebugString; controls the level of indenting for + // correct depth + void DebugString(int depth, string *contents) const; + + const string* name_; + const string* full_name_; + const FileDescriptor* file_; + const Descriptor* containing_type_; + const MessageOptions* options_; + + // 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_; + + int field_count_; + FieldDescriptor* fields_; + int nested_type_count_; + Descriptor* nested_types_; + int enum_type_count_; + EnumDescriptor* enum_types_; + int extension_range_count_; + ExtensionRange* extension_ranges_; + int extension_count_; + FieldDescriptor* extensions_; + // 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. + + // Must be constructed using DescriptorPool. + Descriptor() {} + friend class DescriptorBuilder; + friend class EnumDescriptor; + friend class FieldDescriptor; + friend class MethodDescriptor; + friend class FileDescriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Descriptor); +}; + +// Describes a single field of a message. To get the descriptor for a given +// field, first get the Descriptor for the message in which it is defined, +// then call Descriptor::FindFieldByName(). To get a FieldDescriptor for +// an extension, do one of the following: +// - Get the Descriptor or FileDescriptor for its containing scope, then +// call Descriptor::FindExtensionByName() or +// FileDescriptor::FindExtensionByName(). +// - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber(). +// - Given a Reflection for a message object, call +// Reflection::FindKnownExtensionByName() or +// Reflection::FindKnownExtensionByNumber(). +// Use DescriptorPool to construct your own descriptors. +class LIBPROTOBUF_EXPORT FieldDescriptor { + public: + // Identifies a field type. 0 is reserved for errors. The order is weird + // for historical reasons. Types 12 and up are new in proto2. + enum Type { + TYPE_DOUBLE = 1, // double, exactly eight bytes on the wire. + TYPE_FLOAT = 2, // float, exactly four bytes on the wire. + TYPE_INT64 = 3, // int64, varint on the wire. Negative numbers + // take 10 bytes. Use TYPE_SINT64 if negative + // values are likely. + TYPE_UINT64 = 4, // uint64, varint on the wire. + TYPE_INT32 = 5, // int32, varint on the wire. Negative numbers + // take 10 bytes. Use TYPE_SINT32 if negative + // values are likely. + TYPE_FIXED64 = 6, // uint64, exactly eight bytes on the wire. + TYPE_FIXED32 = 7, // uint32, exactly four bytes on the wire. + TYPE_BOOL = 8, // bool, varint on the wire. + TYPE_STRING = 9, // UTF-8 text. + TYPE_GROUP = 10, // Tag-delimited message. Deprecated. + TYPE_MESSAGE = 11, // Length-delimited message. + + TYPE_BYTES = 12, // Arbitrary byte array. + TYPE_UINT32 = 13, // uint32, varint on the wire + TYPE_ENUM = 14, // Enum, varint on the wire + TYPE_SFIXED32 = 15, // int32, exactly four bytes on the wire + TYPE_SFIXED64 = 16, // int64, exactly eight bytes on the wire + TYPE_SINT32 = 17, // int32, ZigZag-encoded varint on the wire + TYPE_SINT64 = 18, // int64, ZigZag-encoded varint on the wire + + MAX_TYPE = 18, // Constant useful for defining lookup tables + // indexed by Type. + }; + + // Specifies the C++ data type used to represent the field. There is a + // fixed mapping from Type to CppType where each Type maps to exactly one + // CppType. 0 is reserved for errors. + enum CppType { + CPPTYPE_INT32 = 1, // TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32 + CPPTYPE_INT64 = 2, // TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64 + CPPTYPE_UINT32 = 3, // TYPE_UINT32, TYPE_FIXED32 + CPPTYPE_UINT64 = 4, // TYPE_UINT64, TYPE_FIXED64 + CPPTYPE_DOUBLE = 5, // TYPE_DOUBLE + CPPTYPE_FLOAT = 6, // TYPE_FLOAT + CPPTYPE_BOOL = 7, // TYPE_BOOL + CPPTYPE_ENUM = 8, // TYPE_ENUM + CPPTYPE_STRING = 9, // TYPE_STRING, TYPE_BYTES + CPPTYPE_MESSAGE = 10, // TYPE_MESSAGE, TYPE_GROUP + + MAX_CPPTYPE = 10, // Constant useful for defining lookup tables + // indexed by CppType. + }; + + // Identifies whether the field is optional, required, or repeated. 0 is + // reserved for errors. + enum Label { + LABEL_OPTIONAL = 1, // optional + LABEL_REQUIRED = 2, // required + LABEL_REPEATED = 3, // repeated + + MAX_LABEL = 3, // Constant useful for defining lookup tables + // indexed by Label. + }; + + // Valid field numbers are positive integers up to kMaxNumber. + static const int kMaxNumber = (1 << 29) - 1; + + // First field number reserved for the protocol buffer library implementation. + // Users may not declare fields that use reserved numbers. + static const int kFirstReservedNumber = 19000; + // Last field number reserved for the protocol buffer library implementation. + // Users may not declare fields that use reserved numbers. + static const int kLastReservedNumber = 19999; + + const string& name() const; // Name of this field within the message. + const string& full_name() const; // Fully-qualified name of the field. + const FileDescriptor* file() const;// File in which this field was defined. + bool is_extension() const; // Is this an extension field? + int number() const; // Declared tag number. + + // Same as name() except converted to lower-case. This (and especially the + // FindFieldByLowercaseName() method) can be useful when parsing formats + // which prefer to use lowercase naming style. (Although, technically + // field names should be lowercased anyway according to the protobuf style + // guide, so this only makes a difference when dealing with old .proto files + // which do not follow the guide.) + const string& lowercase_name() const; + + // Same as name() except converted to camel-case. In this conversion, any + // time an underscore appears in the name, it is removed and the next + // letter is capitalized. Furthermore, the first letter of the name is + // lower-cased. Examples: + // FooBar -> fooBar + // foo_bar -> fooBar + // fooBar -> fooBar + // This (and especially the FindFieldByCamelcaseName() method) can be useful + // when parsing formats which prefer to use camel-case naming style. + const string& camelcase_name() const; + + Type type() const; // Declared type of this field. + CppType cpp_type() const; // C++ type of this field. + Label label() const; // optional/required/repeated + + bool is_required() const; // shorthand for label() == LABEL_REQUIRED + bool is_optional() const; // shorthand for label() == LABEL_OPTIONAL + bool is_repeated() const; // shorthand for label() == LABEL_REPEATED + bool is_packable() const; // shorthand for is_repeated() && + // IsTypePackable(type()) + + // Index of this field within the message's field array, or the file or + // extension scope's extensions array. + int index() const; + + // Does this field have an explicitly-declared default value? + bool has_default_value() const; + + // 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; + // 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; + // 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; + // 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; + // 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; + // Get the field default value if cpp_type() == CPPTYPE_DOUBLE. If no + // explicit default was defined, the default is 0.0. + double default_value_double() const; + // Get the field default value if cpp_type() == CPPTYPE_BOOL. If no + // explicit default was defined, the default is false. + bool default_value_bool() const; + // Get the field default value if cpp_type() == CPPTYPE_ENUM. If no + // explicit default was defined, the default is the first value defined + // in the enum type (all enum types are required to have at least one value). + // This never returns NULL. + const EnumValueDescriptor* default_value_enum() const; + // Get the field default value if cpp_type() == CPPTYPE_STRING. If no + // explicit default was defined, the default is the empty string. + const string& default_value_string() const; + + // The Descriptor for the message of which this is a field. For extensions, + // this is the extended type. Never NULL. + const Descriptor* containing_type() const; + + // An extension may be declared within the scope of another message. If this + // field is an extension (is_extension() is true), then extension_scope() + // returns that message, or NULL if the extension was declared at global + // scope. If this is not an extension, extension_scope() is undefined (may + // assert-fail). + const Descriptor* extension_scope() const; + + // If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the + // message or the group type. Otherwise, undefined. + const Descriptor* message_type() const; + // If type is TYPE_ENUM, returns a descriptor for the enum. Otherwise, + // undefined. + const EnumDescriptor* enum_type() const; + + // EXPERIMENTAL; DO NOT USE. + // If this field is a map field, experimental_map_key() is the field + // that is the key for this map. + // experimental_map_key()->containing_type() is the same as message_type(). + const FieldDescriptor* experimental_map_key() const; + + // Get the FieldOptions for this field. This includes things listed in + // square brackets after the field definition. E.g., the field: + // optional string text = 1 [ctype=CORD]; + // has the "ctype" option set. Allowed options are defined by FieldOptions + // in google/protobuf/descriptor.proto, and any available extensions of that + // message. + const FieldOptions& options() const; + + // See Descriptor::CopyTo(). + void CopyTo(FieldDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + // Helper method to get the CppType for a particular Type. + static CppType TypeToCppType(Type type); + + // Return true iff [packed = true] is valid for fields of this type. + static inline bool IsTypePackable(Type field_type); + + private: + typedef FieldOptions OptionsType; + + // See Descriptor::DebugString(). + void DebugString(int depth, string *contents) 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. + string DefaultValueAsString(bool quote_string_type) const; + + const string* name_; + const string* full_name_; + const string* lowercase_name_; + const string* camelcase_name_; + const FileDescriptor* file_; + int number_; + Type type_; + Label label_; + bool is_extension_; + const Descriptor* containing_type_; + const Descriptor* extension_scope_; + const Descriptor* message_type_; + const EnumDescriptor* enum_type_; + const FieldDescriptor* experimental_map_key_; + const FieldOptions* options_; + // 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. + + bool has_default_value_; + union { + int32 default_value_int32_; + int64 default_value_int64_; + uint32 default_value_uint32_; + uint64 default_value_uint64_; + float default_value_float_; + double default_value_double_; + bool default_value_bool_; + + const EnumValueDescriptor* default_value_enum_; + const string* default_value_string_; + }; + + static const CppType kTypeToCppTypeMap[MAX_TYPE + 1]; + + static const char * const kTypeToName[MAX_TYPE + 1]; + + static const char * const kLabelToName[MAX_LABEL + 1]; + + // Must be constructed using DescriptorPool. + FieldDescriptor() {} + friend class DescriptorBuilder; + friend class FileDescriptor; + friend class Descriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldDescriptor); +}; + +// 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 LIBPROTOBUF_EXPORT EnumDescriptor { + public: + // The name of this enum type in the containing scope. + const string& name() const; + + // The fully-qualified name of the enum type, scope delimited by periods. + const string& full_name() const; + + // Index of this enum within the file or containing message's enum array. + int index() const; + + // The .proto file in which this enum type was defined. Never NULL. + const FileDescriptor* file() const; + + // The number of values for this EnumDescriptor. Guaranteed to be greater + // than zero. + int value_count() const; + // Gets a value by index, where 0 <= index < value_count(). + // These are returned in the order they were defined in the .proto file. + const EnumValueDescriptor* value(int index) const; + + // Looks up a value by name. Returns NULL if no such value exists. + const EnumValueDescriptor* FindValueByName(const string& name) const; + // Looks up a value by number. Returns NULL if no such value exists. If + // multiple values have this number, the first one defined is returned. + const EnumValueDescriptor* FindValueByNumber(int number) const; + + // If this enum type is nested in a message type, this is that message type. + // Otherwise, NULL. + const Descriptor* containing_type() const; + + // Get options for this enum type. These are specified in the .proto file by + // placing lines like "option foo = 1234;" in the enum definition. Allowed + // options are defined by EnumOptions in google/protobuf/descriptor.proto, + // and any available extensions of that message. + const EnumOptions& options() const; + + // See Descriptor::CopyTo(). + void CopyTo(EnumDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + private: + typedef EnumOptions OptionsType; + + // See Descriptor::DebugString(). + void DebugString(int depth, string *contents) const; + + const string* name_; + const 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_; + // True if this is a placeholder and the type name wasn't fully-qualified. + bool is_unqualified_placeholder_; + + int value_count_; + EnumValueDescriptor* values_; + // 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. + + // Must be constructed using DescriptorPool. + EnumDescriptor() {} + friend class DescriptorBuilder; + friend class Descriptor; + friend class FieldDescriptor; + friend class EnumValueDescriptor; + friend class FileDescriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumDescriptor); +}; + +// Describes an individual enum constant of a particular type. To get the +// EnumValueDescriptor for a given enum value, first get the EnumDescriptor +// for its type, then use EnumDescriptor::FindValueByName() or +// EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct +// your own descriptors. +class LIBPROTOBUF_EXPORT EnumValueDescriptor { + public: + const string& name() const; // Name of this enum constant. + int index() const; // Index within the enums's Descriptor. + int number() const; // Numeric value of this enum constant. + + // The full_name of an enum value is a sibling symbol of the enum type. + // e.g. the full name of FieldDescriptorProto::TYPE_INT32 is actually + // "google.protobuf.FieldDescriptorProto.TYPE_INT32", NOT + // "google.protobuf.FieldDescriptorProto.Type.TYPE_INT32". This is to conform + // with C++ scoping rules for enums. + const string& full_name() const; + + // The type of this value. Never NULL. + const EnumDescriptor* type() const; + + // Get options for this enum value. These are specified in the .proto file + // by adding text like "[foo = 1234]" after an enum value definition. + // Allowed options are defined by EnumValueOptions in + // google/protobuf/descriptor.proto, and any available extensions of that + // message. + const EnumValueOptions& options() const; + + // See Descriptor::CopyTo(). + void CopyTo(EnumValueDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + private: + typedef EnumValueOptions OptionsType; + + // See Descriptor::DebugString(). + void DebugString(int depth, string *contents) const; + + const string* name_; + const string* full_name_; + int number_; + const EnumDescriptor* type_; + const EnumValueOptions* options_; + // 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. + + // Must be constructed using DescriptorPool. + EnumValueDescriptor() {} + friend class DescriptorBuilder; + friend class EnumDescriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumValueDescriptor); +}; + +// Describes an RPC service. To get the ServiceDescriptor for a service, +// call Service::GetDescriptor(). Generated service classes also have a +// static method called descriptor() which returns the type's +// ServiceDescriptor. Use DescriptorPool to construct your own descriptors. +class LIBPROTOBUF_EXPORT ServiceDescriptor { + public: + // The name of the service, not including its containing scope. + const string& name() const; + // The fully-qualified name of the service, scope delimited by periods. + const string& full_name() const; + // Index of this service within the file's services array. + int index() const; + + // The .proto file in which this service was defined. Never NULL. + const FileDescriptor* file() const; + + // Get options for this service type. These are specified in the .proto file + // by placing lines like "option foo = 1234;" in the service definition. + // Allowed options are defined by ServiceOptions in + // google/protobuf/descriptor.proto, and any available extensions of that + // message. + const ServiceOptions& options() const; + + // The number of methods this service defines. + int method_count() const; + // Gets a MethodDescriptor by index, where 0 <= index < method_count(). + // These are returned in the order they were defined in the .proto file. + const MethodDescriptor* method(int index) const; + + // Look up a MethodDescriptor by name. + const MethodDescriptor* FindMethodByName(const string& name) const; + + // See Descriptor::CopyTo(). + void CopyTo(ServiceDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + private: + typedef ServiceOptions OptionsType; + + // See Descriptor::DebugString(). + void DebugString(string *contents) const; + + const string* name_; + const string* full_name_; + const FileDescriptor* file_; + const ServiceOptions* options_; + int method_count_; + MethodDescriptor* methods_; + // 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. + + // Must be constructed using DescriptorPool. + ServiceDescriptor() {} + friend class DescriptorBuilder; + friend class FileDescriptor; + friend class MethodDescriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceDescriptor); +}; + +// Describes an individual service method. To obtain a MethodDescriptor given +// a service, first get its ServiceDescriptor, then call +// ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your +// own descriptors. +class LIBPROTOBUF_EXPORT MethodDescriptor { + public: + // Name of this method, not including containing scope. + const string& name() const; + // The fully-qualified name of the method, scope delimited by periods. + const string& full_name() const; + // Index within the service's Descriptor. + int index() const; + + // Gets the service to which this method belongs. Never NULL. + const ServiceDescriptor* service() const; + + // Gets the type of protocol message which this method accepts as input. + const Descriptor* input_type() const; + // Gets the type of protocol message which this message produces as output. + const Descriptor* output_type() const; + + // Get options for this method. These are specified in the .proto file by + // placing lines like "option foo = 1234;" in curly-braces after a method + // declaration. Allowed options are defined by MethodOptions in + // google/protobuf/descriptor.proto, and any available extensions of that + // message. + const MethodOptions& options() const; + + // See Descriptor::CopyTo(). + void CopyTo(MethodDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + private: + typedef MethodOptions OptionsType; + + // See Descriptor::DebugString(). + void DebugString(int depth, string *contents) const; + + const string* name_; + const string* full_name_; + const ServiceDescriptor* service_; + const Descriptor* input_type_; + const Descriptor* output_type_; + const MethodOptions* options_; + // 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. + + // Must be constructed using DescriptorPool. + MethodDescriptor() {} + friend class DescriptorBuilder; + friend class ServiceDescriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MethodDescriptor); +}; + +// Describes a whole .proto file. To get the FileDescriptor for a compiled-in +// file, get the descriptor for something defined in that file and call +// descriptor->file(). Use DescriptorPool to construct your own descriptors. +class LIBPROTOBUF_EXPORT FileDescriptor { + public: + // The filename, relative to the source tree. + // e.g. "google/protobuf/descriptor.proto" + const string& name() const; + + // The package, e.g. "google.protobuf.compiler". + const string& package() const; + + // The DescriptorPool in which this FileDescriptor and all its contents were + // allocated. Never NULL. + const DescriptorPool* pool() const; + + // The number of files imported by this one. + int dependency_count() const; + // Gets an imported file by index, where 0 <= index < dependency_count(). + // These are returned in the order they were defined in the .proto file. + const FileDescriptor* dependency(int index) const; + + // Number of top-level message types defined in this file. (This does not + // include nested types.) + int message_type_count() const; + // Gets a top-level message type, where 0 <= index < message_type_count(). + // These are returned in the order they were defined in the .proto file. + const Descriptor* message_type(int index) const; + + // Number of top-level enum types defined in this file. (This does not + // include nested types.) + int enum_type_count() const; + // Gets a top-level enum type, where 0 <= index < enum_type_count(). + // These are returned in the order they were defined in the .proto file. + const EnumDescriptor* enum_type(int index) const; + + // Number of services defined in this file. + int service_count() const; + // Gets a service, where 0 <= index < service_count(). + // These are returned in the order they were defined in the .proto file. + const ServiceDescriptor* service(int index) const; + + // Number of extensions defined at file scope. (This does not include + // extensions nested within message types.) + int extension_count() const; + // Gets an extension's descriptor, where 0 <= index < extension_count(). + // These are returned in the order they were defined in the .proto file. + const FieldDescriptor* extension(int index) const; + + // Get options for this file. These are specified in the .proto file by + // placing lines like "option foo = 1234;" at the top level, outside of any + // other definitions. Allowed options are defined by FileOptions in + // google/protobuf/descriptor.proto, and any available extensions of that + // message. + const FileOptions& options() const; + + // Find a top-level message type by name. Returns NULL if not found. + const Descriptor* FindMessageTypeByName(const string& name) const; + // Find a top-level enum type by name. Returns NULL if not found. + const EnumDescriptor* FindEnumTypeByName(const string& name) const; + // Find an enum value defined in any top-level enum by name. Returns NULL if + // not found. + const EnumValueDescriptor* FindEnumValueByName(const string& name) const; + // Find a service definition by name. Returns NULL if not found. + const ServiceDescriptor* FindServiceByName(const string& name) const; + // Find a top-level extension definition by name. Returns NULL if not found. + const FieldDescriptor* FindExtensionByName(const string& name) const; + // Similar to FindExtensionByName(), but searches by lowercased-name. See + // Descriptor::FindFieldByLowercaseName(). + const FieldDescriptor* FindExtensionByLowercaseName(const string& name) const; + // Similar to FindExtensionByName(), but searches by camelcased-name. See + // Descriptor::FindFieldByCamelcaseName(). + const FieldDescriptor* FindExtensionByCamelcaseName(const string& name) const; + + // See Descriptor::CopyTo(). + void CopyTo(FileDescriptorProto* proto) const; + + // See Descriptor::DebugString(). + string DebugString() const; + + private: + typedef FileOptions OptionsType; + + const string* name_; + const string* package_; + const DescriptorPool* pool_; + int dependency_count_; + const FileDescriptor** dependencies_; + int message_type_count_; + Descriptor* message_types_; + int enum_type_count_; + EnumDescriptor* enum_types_; + int service_count_; + ServiceDescriptor* services_; + int extension_count_; + FieldDescriptor* extensions_; + const FileOptions* options_; + + const FileDescriptorTables* tables_; + // 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. + + FileDescriptor() {} + friend class DescriptorBuilder; + friend class Descriptor; + friend class FieldDescriptor; + friend class EnumDescriptor; + friend class ServiceDescriptor; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileDescriptor); +}; + +// =================================================================== + +// Used to construct descriptors. +// +// Normally you won't want to build your own descriptors. Message classes +// constructed by the protocol compiler will provide them for you. However, +// if you are implementing Message on your own, or if you are writing a +// program which can operate on totally arbitrary types and needs to load +// them from some sort of database, you might need to. +// +// Since Descriptors are composed of a whole lot of cross-linked bits of +// data that would be a pain to put together manually, the +// DescriptorPool class is provided to make the process easier. It can +// take a FileDescriptorProto (defined in descriptor.proto), validate it, +// and convert it to a set of nicely cross-linked Descriptors. +// +// DescriptorPool also helps with memory management. Descriptors are +// composed of many objects containing static data and pointers to each +// other. In all likelihood, when it comes time to delete this data, +// you'll want to delete it all at once. In fact, it is not uncommon to +// have a whole pool of descriptors all cross-linked with each other which +// you wish to delete all at once. This class represents such a pool, and +// handles the memory management for you. +// +// You can also search for descriptors within a DescriptorPool by name, and +// extensions by number. +class LIBPROTOBUF_EXPORT DescriptorPool { + public: + // Create a normal, empty DescriptorPool. + DescriptorPool(); + + // Constructs a DescriptorPool that, when it can't find something among the + // descriptors already in the pool, looks for it in the given + // DescriptorDatabase. + // Notes: + // - If a DescriptorPool is constructed this way, its BuildFile*() methods + // must not be called (they will assert-fail). The only way to populate + // the pool with descriptors is to call the Find*By*() methods. + // - The Find*By*() methods may block the calling thread if the + // DescriptorDatabase blocks. This in turn means that parsing messages + // may block if they need to look up extensions. + // - The Find*By*() methods will use mutexes for thread-safety, thus making + // them slower even when they don't have to fall back to the database. + // In fact, even the Find*By*() methods of descriptor objects owned by + // this pool will be slower, since they will have to obtain locks too. + // - An ErrorCollector may optionally be given to collect validation errors + // in files loaded from the database. If not given, errors will be printed + // to GOOGLE_LOG(ERROR). Remember that files are built on-demand, so this + // ErrorCollector may be called from any thread that calls one of the + // Find*By*() methods. + class ErrorCollector; + explicit DescriptorPool(DescriptorDatabase* fallback_database, + ErrorCollector* error_collector = NULL); + + ~DescriptorPool(); + + // Get a pointer to the generated pool. Generated protocol message classes + // which are compiled into the binary will allocate their descriptors in + // this pool. Do not add your own descriptors to this pool. + static const DescriptorPool* generated_pool(); + + // Find a FileDescriptor in the pool by file name. Returns NULL if not + // found. + const FileDescriptor* FindFileByName(const string& 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 NULL. + const FileDescriptor* FindFileContainingSymbol( + const string& 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 NULL if not + // found. + + const Descriptor* FindMessageTypeByName(const string& name) const; + const FieldDescriptor* FindFieldByName(const string& name) const; + const FieldDescriptor* FindExtensionByName(const string& name) const; + const EnumDescriptor* FindEnumTypeByName(const string& name) const; + const EnumValueDescriptor* FindEnumValueByName(const string& name) const; + const ServiceDescriptor* FindServiceByName(const string& name) const; + const MethodDescriptor* FindMethodByName(const string& 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. + const FieldDescriptor* FindExtensionByNumber(const Descriptor* extendee, + int number) const; + + // Finds extensions of extendee. The extensions will be appended to + // out in an undefined order. Only extensions defined directly in + // this DescriptorPool or one of its underlays are guaranteed to be + // found: extensions defined in the fallback database might not be found + // depending on the database implementation. + void FindAllExtensions(const Descriptor* extendee, + vector* out) const; + + // Building descriptors -------------------------------------------- + + // When converting a FileDescriptorProto to a FileDescriptor, various + // errors might be detected in the input. The caller may handle these + // programmatically by implementing an ErrorCollector. + class LIBPROTOBUF_EXPORT ErrorCollector { + public: + inline ErrorCollector() {} + virtual ~ErrorCollector(); + + // These constants specify what exact part of the construct is broken. + // This is useful e.g. for mapping the error back to an exact location + // in a .proto file. + enum ErrorLocation { + NAME, // the symbol name, or the package name for files + NUMBER, // field or extension range number + TYPE, // field type + EXTENDEE, // field extendee + DEFAULT_VALUE, // field default value + INPUT_TYPE, // method input type + OUTPUT_TYPE, // method output type + OPTION_NAME, // name in assignment + OPTION_VALUE, // value in option assignment + OTHER // some other problem + }; + + // Reports an error in the FileDescriptorProto. + virtual void AddError( + const string& filename, // File name in which the error occurred. + const string& element_name, // Full name of the erroneous element. + const Message* descriptor, // Descriptor of the erroneous element. + ErrorLocation location, // One of the location constants, above. + const string& message // Human-readable error message. + ) = 0; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector); + }; + + // Convert the FileDescriptorProto to real descriptors and place them in + // this DescriptorPool. All dependencies of the file must already be in + // the pool. Returns the resulting FileDescriptor, or NULL if there were + // problems with the input (e.g. the message was invalid, or dependencies + // were missing). Details about the errors are written to GOOGLE_LOG(ERROR). + const FileDescriptor* BuildFile(const FileDescriptorProto& proto); + + // Same as BuildFile() except errors are sent to the given ErrorCollector. + const FileDescriptor* BuildFileCollectingErrors( + const FileDescriptorProto& proto, + ErrorCollector* error_collector); + + // By default, it is an error if a FileDescriptorProto contains references + // to types or other files that are not found in the DescriptorPool (or its + // backing DescriptorDatabase, if any). If you call + // AllowUnknownDependencies(), however, then unknown types and files + // will be replaced by placeholder descriptors. This can allow you to + // perform some useful operations with a .proto file even if you do not + // have access to other .proto files on which it depends. However, some + // heuristics must be used to fill in the gaps in information, and these + // can lead to descriptors which are inaccurate. For example, the + // DescriptorPool may be forced to guess whether an unknown type is a message + // or an enum, as well as what package it resides in. Furthermore, + // placeholder types will not be discoverable via FindMessageTypeByName() + // and similar methods, which could confuse some descriptor-based algorithms. + // Generally, the results of this option should only be relied upon for + // debugging purposes. + void AllowUnknownDependencies() { allow_unknown_ = true; } + + // Internal stuff -------------------------------------------------- + // These methods MUST NOT be called from outside the proto2 library. + // These methods may contain hidden pitfalls and may be removed in a + // future library version. + + // Create a DescriptorPool which is overlaid on top of some other pool. + // If you search for a descriptor in the overlay and it is not found, the + // underlay will be searched as a backup. If the underlay has its own + // underlay, that will be searched next, and so on. This also means that + // files built in the overlay will be cross-linked with the underlay's + // descriptors if necessary. The underlay remains property of the caller; + // it must remain valid for the lifetime of the newly-constructed pool. + // + // Example: Say you want to parse a .proto file at runtime in order to use + // its type with a DynamicMessage. Say this .proto file has dependencies, + // but you know that all the dependencies will be things that are already + // compiled into the binary. For ease of use, you'd like to load the types + // right out of generated_pool() rather than have to parse redundant copies + // of all these .protos and runtime. But, you don't want to add the parsed + // types directly into generated_pool(): this is not allowed, and would be + // bad design anyway. So, instead, you could use generated_pool() as an + // underlay for a new DescriptorPool in which you add only the new file. + // + // WARNING: Use of underlays can lead to many subtle gotchas. Instead, + // try to formulate what you want to do in terms of DescriptorDatabases. + explicit DescriptorPool(const DescriptorPool* underlay); + + // Called by generated classes at init time to add their descriptors to + // generated_pool. Do NOT call this in your own code! filename must be a + // permanent string (e.g. a string literal). + static void InternalAddGeneratedFile( + const void* encoded_file_descriptor, int size); + + + // For internal use only: Gets a non-const pointer to the generated pool. + // This is called at static-initialization time only, so thread-safety is + // not a concern. If both an underlay and a fallback database are present, + // the fallback database takes precedence. + static DescriptorPool* internal_generated_pool(); + + // 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. + void InternalDontEnforceDependencies(); + + // For internal use only. + void internal_set_underlay(const DescriptorPool* underlay) { + underlay_ = underlay; + } + + // 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 string& filename) const; + + private: + friend class Descriptor; + friend class FieldDescriptor; + friend class EnumDescriptor; + friend class ServiceDescriptor; + friend class FileDescriptor; + friend class DescriptorBuilder; + + // 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 string& name) const; + bool TryFindSymbolInFallbackDatabase(const string& name) const; + bool TryFindExtensionInFallbackDatabase(const Descriptor* containing_type, + int field_number) const; + + // Like BuildFile() but called internally when the file has been loaded from + // fallback_database_. Declared const because it is called by (semantically) + // const methods. + const FileDescriptor* BuildFileFromDatabase( + const FileDescriptorProto& proto) const; + + // If fallback_database_ is NULL, this is NULL. Otherwise, this is a mutex + // which must be locked while accessing tables_. + Mutex* mutex_; + + // See constructor. + DescriptorDatabase* fallback_database_; + ErrorCollector* default_error_collector_; + const DescriptorPool* underlay_; + + // This class contains a lot of hash maps with complicated types that + // we'd like to keep out of the header. + class Tables; + scoped_ptr tables_; + + bool enforce_dependencies_; + bool allow_unknown_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorPool); +}; + +// inline methods ==================================================== + +// These macros makes this repetitive code more readable. +#define PROTOBUF_DEFINE_ACCESSOR(CLASS, FIELD, TYPE) \ + inline TYPE CLASS::FIELD() const { return FIELD##_; } + +// Strings fields are stored as pointers but returned as const references. +#define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \ + inline const string& CLASS::FIELD() const { return *FIELD##_; } + +// 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; } + +#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_ACCESSOR(Descriptor, file, const FileDescriptor*) +PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*) + +PROTOBUF_DEFINE_ACCESSOR(Descriptor, field_count, int) +PROTOBUF_DEFINE_ACCESSOR(Descriptor, nested_type_count, int) +PROTOBUF_DEFINE_ACCESSOR(Descriptor, enum_type_count, int) + +PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, field, const FieldDescriptor*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, nested_type, const Descriptor*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, enum_type, const EnumDescriptor*) + +PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_range_count, int) +PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_count, int) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension_range, + const Descriptor::ExtensionRange*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension, + const FieldDescriptor*) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions); + +PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) +PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name) +PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name) +PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, type, FieldDescriptor::Type) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, message_type, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, enum_type, const EnumDescriptor*) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, experimental_map_key, + const FieldDescriptor*) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions); +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, 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_float , float ) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool , bool ) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_enum, + const EnumValueDescriptor*) +PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) + +PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name) +PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name) +PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*) +PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value, + const EnumValueDescriptor*) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions); + +PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) +PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name) +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_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_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) +PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, input_type, const Descriptor*) +PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, output_type, const Descriptor*) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions); + +PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, name) +PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, package) +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, pool, const DescriptorPool*) +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, dependency_count, int) +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int) +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int) +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int) +PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions); + +PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, message_type, const Descriptor*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, enum_type, const EnumDescriptor*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, service, + const ServiceDescriptor*) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, extension, + const FieldDescriptor*) + +#undef PROTOBUF_DEFINE_ACCESSOR +#undef PROTOBUF_DEFINE_STRING_ACCESSOR +#undef PROTOBUF_DEFINE_ARRAY_ACCESSOR + +// A few accessors differ from the macros... + +inline bool FieldDescriptor::is_required() const { + return label() == LABEL_REQUIRED; +} + +inline bool FieldDescriptor::is_optional() const { + return label() == LABEL_OPTIONAL; +} + +inline bool FieldDescriptor::is_repeated() const { + return label() == LABEL_REPEATED; +} + +inline bool FieldDescriptor::is_packable() const { + return is_repeated() && IsTypePackable(type()); +} + +// To save space, index() is computed by looking at the descriptor's position +// in the parent's array of children. +inline int FieldDescriptor::index() const { + if (!is_extension_) { + return this - containing_type_->fields_; + } else if (extension_scope_ != NULL) { + return this - extension_scope_->extensions_; + } else { + return this - file_->extensions_; + } +} + +inline int Descriptor::index() const { + if (containing_type_ == NULL) { + return this - file_->message_types_; + } else { + return this - containing_type_->nested_types_; + } +} + +inline int EnumDescriptor::index() const { + if (containing_type_ == NULL) { + return this - file_->enum_types_; + } else { + return this - containing_type_->enum_types_; + } +} + +inline int EnumValueDescriptor::index() const { + return this - type_->values_; +} + +inline int ServiceDescriptor::index() const { + return this - file_->services_; +} + +inline int MethodDescriptor::index() const { + return this - service_->methods_; +} + +inline FieldDescriptor::CppType FieldDescriptor::cpp_type() const { + return kTypeToCppTypeMap[type_]; +} + +inline FieldDescriptor::CppType FieldDescriptor::TypeToCppType(Type type) { + return kTypeToCppTypeMap[type]; +} + +inline bool FieldDescriptor::IsTypePackable(Type field_type) { + return (field_type != FieldDescriptor::TYPE_STRING && + field_type != FieldDescriptor::TYPE_GROUP && + field_type != FieldDescriptor::TYPE_MESSAGE && + field_type != FieldDescriptor::TYPE_BYTES); +} + +inline const FileDescriptor* FileDescriptor::dependency(int index) const { + return dependencies_[index]; +} + +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_DESCRIPTOR_H__ diff --git a/depends/protobuf/google/protobuf/descriptor.pb.cc b/depends/protobuf/google/protobuf/descriptor.pb.cc new file mode 100644 index 000000000..87303ef87 --- /dev/null +++ b/depends/protobuf/google/protobuf/descriptor.pb.cc @@ -0,0 +1,7708 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/descriptor.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* FileDescriptorSet_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FileDescriptorSet_reflection_ = NULL; +const ::google::protobuf::Descriptor* FileDescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FileDescriptorProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* DescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + DescriptorProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + DescriptorProto_ExtensionRange_reflection_ = NULL; +const ::google::protobuf::Descriptor* FieldDescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FieldDescriptorProto_reflection_ = NULL; +const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor_ = NULL; +const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Label_descriptor_ = NULL; +const ::google::protobuf::Descriptor* EnumDescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + EnumDescriptorProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* EnumValueDescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + EnumValueDescriptorProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* ServiceDescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ServiceDescriptorProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* MethodDescriptorProto_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + MethodDescriptorProto_reflection_ = NULL; +const ::google::protobuf::Descriptor* FileOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FileOptions_reflection_ = NULL; +const ::google::protobuf::EnumDescriptor* FileOptions_OptimizeMode_descriptor_ = NULL; +const ::google::protobuf::Descriptor* MessageOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + MessageOptions_reflection_ = NULL; +const ::google::protobuf::Descriptor* FieldOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FieldOptions_reflection_ = NULL; +const ::google::protobuf::EnumDescriptor* FieldOptions_CType_descriptor_ = NULL; +const ::google::protobuf::Descriptor* EnumOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + EnumOptions_reflection_ = NULL; +const ::google::protobuf::Descriptor* EnumValueOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + EnumValueOptions_reflection_ = NULL; +const ::google::protobuf::Descriptor* ServiceOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ServiceOptions_reflection_ = NULL; +const ::google::protobuf::Descriptor* MethodOptions_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + MethodOptions_reflection_ = NULL; +const ::google::protobuf::Descriptor* UninterpretedOption_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + UninterpretedOption_reflection_ = NULL; +const ::google::protobuf::Descriptor* UninterpretedOption_NamePart_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + UninterpretedOption_NamePart_reflection_ = NULL; +const ::google::protobuf::Descriptor* SourceCodeInfo_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + SourceCodeInfo_reflection_ = NULL; +const ::google::protobuf::Descriptor* SourceCodeInfo_Location_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + SourceCodeInfo_Location_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/descriptor.proto"); + GOOGLE_CHECK(file != NULL); + FileDescriptorSet_descriptor_ = file->message_type(0); + static const int FileDescriptorSet_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, file_), + }; + FileDescriptorSet_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + FileDescriptorSet_descriptor_, + FileDescriptorSet::default_instance_, + FileDescriptorSet_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(FileDescriptorSet)); + FileDescriptorProto_descriptor_ = file->message_type(1); + static const int FileDescriptorProto_offsets_[9] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, package_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, dependency_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, message_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, enum_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, service_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, extension_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, source_code_info_), + }; + FileDescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + FileDescriptorProto_descriptor_, + FileDescriptorProto::default_instance_, + FileDescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(FileDescriptorProto)); + DescriptorProto_descriptor_ = file->message_type(2); + static const int DescriptorProto_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, field_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, nested_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, enum_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_range_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, options_), + }; + DescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + DescriptorProto_descriptor_, + DescriptorProto::default_instance_, + DescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(DescriptorProto)); + DescriptorProto_ExtensionRange_descriptor_ = DescriptorProto_descriptor_->nested_type(0); + static const int DescriptorProto_ExtensionRange_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, start_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, end_), + }; + DescriptorProto_ExtensionRange_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + DescriptorProto_ExtensionRange_descriptor_, + DescriptorProto_ExtensionRange::default_instance_, + DescriptorProto_ExtensionRange_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(DescriptorProto_ExtensionRange)); + FieldDescriptorProto_descriptor_ = file->message_type(3); + static const int FieldDescriptorProto_offsets_[8] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, label_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, extendee_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, default_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, options_), + }; + FieldDescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + FieldDescriptorProto_descriptor_, + FieldDescriptorProto::default_instance_, + FieldDescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(FieldDescriptorProto)); + FieldDescriptorProto_Type_descriptor_ = FieldDescriptorProto_descriptor_->enum_type(0); + FieldDescriptorProto_Label_descriptor_ = FieldDescriptorProto_descriptor_->enum_type(1); + EnumDescriptorProto_descriptor_ = file->message_type(4); + static const int EnumDescriptorProto_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, options_), + }; + EnumDescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + EnumDescriptorProto_descriptor_, + EnumDescriptorProto::default_instance_, + EnumDescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(EnumDescriptorProto)); + EnumValueDescriptorProto_descriptor_ = file->message_type(5); + static const int EnumValueDescriptorProto_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, options_), + }; + EnumValueDescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + EnumValueDescriptorProto_descriptor_, + EnumValueDescriptorProto::default_instance_, + EnumValueDescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(EnumValueDescriptorProto)); + ServiceDescriptorProto_descriptor_ = file->message_type(6); + static const int ServiceDescriptorProto_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, method_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, options_), + }; + ServiceDescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + ServiceDescriptorProto_descriptor_, + ServiceDescriptorProto::default_instance_, + ServiceDescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(ServiceDescriptorProto)); + MethodDescriptorProto_descriptor_ = file->message_type(7); + static const int MethodDescriptorProto_offsets_[4] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, input_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, output_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, options_), + }; + MethodDescriptorProto_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + MethodDescriptorProto_descriptor_, + MethodDescriptorProto::default_instance_, + MethodDescriptorProto_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(MethodDescriptorProto)); + FileOptions_descriptor_ = file->message_type(8); + static const int FileOptions_offsets_[9] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generate_equals_and_hash_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, optimize_for_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, py_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_), + }; + FileOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + FileOptions_descriptor_, + FileOptions::default_instance_, + FileOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(FileOptions)); + FileOptions_OptimizeMode_descriptor_ = FileOptions_descriptor_->enum_type(0); + MessageOptions_descriptor_ = file->message_type(9); + static const int MessageOptions_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, message_set_wire_format_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, no_standard_descriptor_accessor_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, uninterpreted_option_), + }; + MessageOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + MessageOptions_descriptor_, + MessageOptions::default_instance_, + MessageOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(MessageOptions)); + FieldOptions_descriptor_ = file->message_type(10); + static const int FieldOptions_offsets_[5] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, ctype_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, packed_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, experimental_map_key_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, uninterpreted_option_), + }; + FieldOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + FieldOptions_descriptor_, + FieldOptions::default_instance_, + FieldOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(FieldOptions)); + FieldOptions_CType_descriptor_ = FieldOptions_descriptor_->enum_type(0); + EnumOptions_descriptor_ = file->message_type(11); + static const int EnumOptions_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, uninterpreted_option_), + }; + EnumOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + EnumOptions_descriptor_, + EnumOptions::default_instance_, + EnumOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(EnumOptions)); + EnumValueOptions_descriptor_ = file->message_type(12); + static const int EnumValueOptions_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, uninterpreted_option_), + }; + EnumValueOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + EnumValueOptions_descriptor_, + EnumValueOptions::default_instance_, + EnumValueOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(EnumValueOptions)); + ServiceOptions_descriptor_ = file->message_type(13); + static const int ServiceOptions_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, uninterpreted_option_), + }; + ServiceOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + ServiceOptions_descriptor_, + ServiceOptions::default_instance_, + ServiceOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(ServiceOptions)); + MethodOptions_descriptor_ = file->message_type(14); + static const int MethodOptions_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, uninterpreted_option_), + }; + MethodOptions_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + MethodOptions_descriptor_, + MethodOptions::default_instance_, + MethodOptions_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _unknown_fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _extensions_), + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(MethodOptions)); + UninterpretedOption_descriptor_ = file->message_type(15); + static const int UninterpretedOption_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, identifier_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, positive_int_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, negative_int_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, double_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, string_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, aggregate_value_), + }; + UninterpretedOption_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + UninterpretedOption_descriptor_, + UninterpretedOption::default_instance_, + UninterpretedOption_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(UninterpretedOption)); + UninterpretedOption_NamePart_descriptor_ = UninterpretedOption_descriptor_->nested_type(0); + static const int UninterpretedOption_NamePart_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, name_part_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, is_extension_), + }; + UninterpretedOption_NamePart_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + UninterpretedOption_NamePart_descriptor_, + UninterpretedOption_NamePart::default_instance_, + UninterpretedOption_NamePart_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(UninterpretedOption_NamePart)); + SourceCodeInfo_descriptor_ = file->message_type(16); + static const int SourceCodeInfo_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, location_), + }; + SourceCodeInfo_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + SourceCodeInfo_descriptor_, + SourceCodeInfo::default_instance_, + SourceCodeInfo_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(SourceCodeInfo)); + SourceCodeInfo_Location_descriptor_ = SourceCodeInfo_descriptor_->nested_type(0); + static const int SourceCodeInfo_Location_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, path_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, span_), + }; + SourceCodeInfo_Location_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + SourceCodeInfo_Location_descriptor_, + SourceCodeInfo_Location::default_instance_, + SourceCodeInfo_Location_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(SourceCodeInfo_Location)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FileDescriptorSet_descriptor_, &FileDescriptorSet::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FileDescriptorProto_descriptor_, &FileDescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + DescriptorProto_descriptor_, &DescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + DescriptorProto_ExtensionRange_descriptor_, &DescriptorProto_ExtensionRange::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FieldDescriptorProto_descriptor_, &FieldDescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + EnumDescriptorProto_descriptor_, &EnumDescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + EnumValueDescriptorProto_descriptor_, &EnumValueDescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ServiceDescriptorProto_descriptor_, &ServiceDescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + MethodDescriptorProto_descriptor_, &MethodDescriptorProto::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FileOptions_descriptor_, &FileOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + MessageOptions_descriptor_, &MessageOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FieldOptions_descriptor_, &FieldOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + EnumOptions_descriptor_, &EnumOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + EnumValueOptions_descriptor_, &EnumValueOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ServiceOptions_descriptor_, &ServiceOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + MethodOptions_descriptor_, &MethodOptions::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + UninterpretedOption_descriptor_, &UninterpretedOption::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + UninterpretedOption_NamePart_descriptor_, &UninterpretedOption_NamePart::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + SourceCodeInfo_descriptor_, &SourceCodeInfo::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + SourceCodeInfo_Location_descriptor_, &SourceCodeInfo_Location::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto() { + delete FileDescriptorSet::default_instance_; + delete FileDescriptorSet_reflection_; + delete FileDescriptorProto::default_instance_; + delete FileDescriptorProto_reflection_; + delete DescriptorProto::default_instance_; + delete DescriptorProto_reflection_; + delete DescriptorProto_ExtensionRange::default_instance_; + delete DescriptorProto_ExtensionRange_reflection_; + delete FieldDescriptorProto::default_instance_; + delete FieldDescriptorProto_reflection_; + delete EnumDescriptorProto::default_instance_; + delete EnumDescriptorProto_reflection_; + delete EnumValueDescriptorProto::default_instance_; + delete EnumValueDescriptorProto_reflection_; + delete ServiceDescriptorProto::default_instance_; + delete ServiceDescriptorProto_reflection_; + delete MethodDescriptorProto::default_instance_; + delete MethodDescriptorProto_reflection_; + delete FileOptions::default_instance_; + delete FileOptions_reflection_; + delete MessageOptions::default_instance_; + delete MessageOptions_reflection_; + delete FieldOptions::default_instance_; + delete FieldOptions_reflection_; + delete EnumOptions::default_instance_; + delete EnumOptions_reflection_; + delete EnumValueOptions::default_instance_; + delete EnumValueOptions_reflection_; + delete ServiceOptions::default_instance_; + delete ServiceOptions_reflection_; + delete MethodOptions::default_instance_; + delete MethodOptions_reflection_; + delete UninterpretedOption::default_instance_; + delete UninterpretedOption_reflection_; + delete UninterpretedOption_NamePart::default_instance_; + delete UninterpretedOption_NamePart_reflection_; + delete SourceCodeInfo::default_instance_; + delete SourceCodeInfo_reflection_; + delete SourceCodeInfo_Location::default_instance_; + delete SourceCodeInfo_Location_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n google/protobuf/descriptor.proto\022\017goog" + "le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file" + "\030\001 \003(\0132$.google.protobuf.FileDescriptorP" + "roto\"\227\003\n\023FileDescriptorProto\022\014\n\004name\030\001 \001" + "(\t\022\017\n\007package\030\002 \001(\t\022\022\n\ndependency\030\003 \003(\t\022" + "6\n\014message_type\030\004 \003(\0132 .google.protobuf." + "DescriptorProto\0227\n\tenum_type\030\005 \003(\0132$.goo" + "gle.protobuf.EnumDescriptorProto\0228\n\007serv" + "ice\030\006 \003(\0132\'.google.protobuf.ServiceDescr" + "iptorProto\0228\n\textension\030\007 \003(\0132%.google.p" + "rotobuf.FieldDescriptorProto\022-\n\007options\030" + "\010 \001(\0132\034.google.protobuf.FileOptions\0229\n\020s" + "ource_code_info\030\t \001(\0132\037.google.protobuf." + "SourceCodeInfo\"\251\003\n\017DescriptorProto\022\014\n\004na" + "me\030\001 \001(\t\0224\n\005field\030\002 \003(\0132%.google.protobu" + "f.FieldDescriptorProto\0228\n\textension\030\006 \003(" + "\0132%.google.protobuf.FieldDescriptorProto" + "\0225\n\013nested_type\030\003 \003(\0132 .google.protobuf." + "DescriptorProto\0227\n\tenum_type\030\004 \003(\0132$.goo" + "gle.protobuf.EnumDescriptorProto\022H\n\017exte" + "nsion_range\030\005 \003(\0132/.google.protobuf.Desc" + "riptorProto.ExtensionRange\0220\n\007options\030\007 " + "\001(\0132\037.google.protobuf.MessageOptions\032,\n\016" + "ExtensionRange\022\r\n\005start\030\001 \001(\005\022\013\n\003end\030\002 \001" + "(\005\"\224\005\n\024FieldDescriptorProto\022\014\n\004name\030\001 \001(" + "\t\022\016\n\006number\030\003 \001(\005\022:\n\005label\030\004 \001(\0162+.googl" + "e.protobuf.FieldDescriptorProto.Label\0228\n" + "\004type\030\005 \001(\0162*.google.protobuf.FieldDescr" + "iptorProto.Type\022\021\n\ttype_name\030\006 \001(\t\022\020\n\010ex" + "tendee\030\002 \001(\t\022\025\n\rdefault_value\030\007 \001(\t\022.\n\007o" + "ptions\030\010 \001(\0132\035.google.protobuf.FieldOpti" + "ons\"\266\002\n\004Type\022\017\n\013TYPE_DOUBLE\020\001\022\016\n\nTYPE_FL" + "OAT\020\002\022\016\n\nTYPE_INT64\020\003\022\017\n\013TYPE_UINT64\020\004\022\016" + "\n\nTYPE_INT32\020\005\022\020\n\014TYPE_FIXED64\020\006\022\020\n\014TYPE" + "_FIXED32\020\007\022\r\n\tTYPE_BOOL\020\010\022\017\n\013TYPE_STRING" + "\020\t\022\016\n\nTYPE_GROUP\020\n\022\020\n\014TYPE_MESSAGE\020\013\022\016\n\n" + "TYPE_BYTES\020\014\022\017\n\013TYPE_UINT32\020\r\022\r\n\tTYPE_EN" + "UM\020\016\022\021\n\rTYPE_SFIXED32\020\017\022\021\n\rTYPE_SFIXED64" + "\020\020\022\017\n\013TYPE_SINT32\020\021\022\017\n\013TYPE_SINT64\020\022\"C\n\005" + "Label\022\022\n\016LABEL_OPTIONAL\020\001\022\022\n\016LABEL_REQUI" + "RED\020\002\022\022\n\016LABEL_REPEATED\020\003\"\214\001\n\023EnumDescri" + "ptorProto\022\014\n\004name\030\001 \001(\t\0228\n\005value\030\002 \003(\0132)" + ".google.protobuf.EnumValueDescriptorProt" + "o\022-\n\007options\030\003 \001(\0132\034.google.protobuf.Enu" + "mOptions\"l\n\030EnumValueDescriptorProto\022\014\n\004" + "name\030\001 \001(\t\022\016\n\006number\030\002 \001(\005\0222\n\007options\030\003 " + "\001(\0132!.google.protobuf.EnumValueOptions\"\220" + "\001\n\026ServiceDescriptorProto\022\014\n\004name\030\001 \001(\t\022" + "6\n\006method\030\002 \003(\0132&.google.protobuf.Method" + "DescriptorProto\0220\n\007options\030\003 \001(\0132\037.googl" + "e.protobuf.ServiceOptions\"\177\n\025MethodDescr" + "iptorProto\022\014\n\004name\030\001 \001(\t\022\022\n\ninput_type\030\002" + " \001(\t\022\023\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001" + "(\0132\036.google.protobuf.MethodOptions\"\325\003\n\013F" + "ileOptions\022\024\n\014java_package\030\001 \001(\t\022\034\n\024java" + "_outer_classname\030\010 \001(\t\022\"\n\023java_multiple_" + "files\030\n \001(\010:\005false\022,\n\035java_generate_equa" + "ls_and_hash\030\024 \001(\010:\005false\022F\n\014optimize_for" + "\030\t \001(\0162).google.protobuf.FileOptions.Opt" + "imizeMode:\005SPEED\022\"\n\023cc_generic_services\030" + "\020 \001(\010:\005false\022$\n\025java_generic_services\030\021 " + "\001(\010:\005false\022\"\n\023py_generic_services\030\022 \001(\010:" + "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." + "google.protobuf.UninterpretedOption\":\n\014O" + "ptimizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n" + "\014LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002\"\270\001\n\016MessageOp" + "tions\022&\n\027message_set_wire_format\030\001 \001(\010:\005" + "false\022.\n\037no_standard_descriptor_accessor" + "\030\002 \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007" + " \003(\0132$.google.protobuf.UninterpretedOpti" + "on*\t\010\350\007\020\200\200\200\200\002\"\224\002\n\014FieldOptions\022:\n\005ctype\030" + "\001 \001(\0162#.google.protobuf.FieldOptions.CTy" + "pe:\006STRING\022\016\n\006packed\030\002 \001(\010\022\031\n\ndeprecated" + "\030\003 \001(\010:\005false\022\034\n\024experimental_map_key\030\t " + "\001(\t\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo" + "gle.protobuf.UninterpretedOption\"/\n\005CTyp" + "e\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020" + "\002*\t\010\350\007\020\200\200\200\200\002\"]\n\013EnumOptions\022C\n\024uninterpr" + "eted_option\030\347\007 \003(\0132$.google.protobuf.Uni" + "nterpretedOption*\t\010\350\007\020\200\200\200\200\002\"b\n\020EnumValue" + "Options\022C\n\024uninterpreted_option\030\347\007 \003(\0132$" + ".google.protobuf.UninterpretedOption*\t\010\350" + "\007\020\200\200\200\200\002\"`\n\016ServiceOptions\022C\n\024uninterpret" + "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" + "erpretedOption*\t\010\350\007\020\200\200\200\200\002\"_\n\rMethodOptio" + "ns\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goog" + "le.protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200" + "\200\002\"\236\002\n\023UninterpretedOption\022;\n\004name\030\002 \003(\013" + "2-.google.protobuf.UninterpretedOption.N" + "amePart\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022pos" + "itive_int_value\030\004 \001(\004\022\032\n\022negative_int_va" + "lue\030\005 \001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014strin" + "g_value\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323" + "\n\010NamePart\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_exte" + "nsion\030\002 \002(\010\"|\n\016SourceCodeInfo\022:\n\010locatio" + "n\030\001 \003(\0132(.google.protobuf.SourceCodeInfo" + ".Location\032.\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022" + "\020\n\004span\030\002 \003(\005B\002\020\001B)\n\023com.google.protobuf" + "B\020DescriptorProtosH\001", 3940); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); + FileDescriptorSet::default_instance_ = new FileDescriptorSet(); + FileDescriptorProto::default_instance_ = new FileDescriptorProto(); + DescriptorProto::default_instance_ = new DescriptorProto(); + DescriptorProto_ExtensionRange::default_instance_ = new DescriptorProto_ExtensionRange(); + FieldDescriptorProto::default_instance_ = new FieldDescriptorProto(); + EnumDescriptorProto::default_instance_ = new EnumDescriptorProto(); + EnumValueDescriptorProto::default_instance_ = new EnumValueDescriptorProto(); + ServiceDescriptorProto::default_instance_ = new ServiceDescriptorProto(); + MethodDescriptorProto::default_instance_ = new MethodDescriptorProto(); + FileOptions::default_instance_ = new FileOptions(); + MessageOptions::default_instance_ = new MessageOptions(); + FieldOptions::default_instance_ = new FieldOptions(); + EnumOptions::default_instance_ = new EnumOptions(); + EnumValueOptions::default_instance_ = new EnumValueOptions(); + ServiceOptions::default_instance_ = new ServiceOptions(); + MethodOptions::default_instance_ = new MethodOptions(); + UninterpretedOption::default_instance_ = new UninterpretedOption(); + UninterpretedOption_NamePart::default_instance_ = new UninterpretedOption_NamePart(); + SourceCodeInfo::default_instance_ = new SourceCodeInfo(); + SourceCodeInfo_Location::default_instance_ = new SourceCodeInfo_Location(); + FileDescriptorSet::default_instance_->InitAsDefaultInstance(); + FileDescriptorProto::default_instance_->InitAsDefaultInstance(); + DescriptorProto::default_instance_->InitAsDefaultInstance(); + DescriptorProto_ExtensionRange::default_instance_->InitAsDefaultInstance(); + FieldDescriptorProto::default_instance_->InitAsDefaultInstance(); + EnumDescriptorProto::default_instance_->InitAsDefaultInstance(); + EnumValueDescriptorProto::default_instance_->InitAsDefaultInstance(); + ServiceDescriptorProto::default_instance_->InitAsDefaultInstance(); + MethodDescriptorProto::default_instance_->InitAsDefaultInstance(); + FileOptions::default_instance_->InitAsDefaultInstance(); + MessageOptions::default_instance_->InitAsDefaultInstance(); + FieldOptions::default_instance_->InitAsDefaultInstance(); + EnumOptions::default_instance_->InitAsDefaultInstance(); + EnumValueOptions::default_instance_->InitAsDefaultInstance(); + ServiceOptions::default_instance_->InitAsDefaultInstance(); + MethodOptions::default_instance_->InitAsDefaultInstance(); + UninterpretedOption::default_instance_->InitAsDefaultInstance(); + UninterpretedOption_NamePart::default_instance_->InitAsDefaultInstance(); + SourceCodeInfo::default_instance_->InitAsDefaultInstance(); + SourceCodeInfo_Location::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fdescriptor_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fdescriptor_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fdescriptor_2eproto_; + + +// =================================================================== + +#ifndef _MSC_VER +const int FileDescriptorSet::kFileFieldNumber; +#endif // !_MSC_VER + +FileDescriptorSet::FileDescriptorSet() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void FileDescriptorSet::InitAsDefaultInstance() { +} + +FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void FileDescriptorSet::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +FileDescriptorSet::~FileDescriptorSet() { + SharedDtor(); +} + +void FileDescriptorSet::SharedDtor() { + if (this != default_instance_) { + } +} + +void FileDescriptorSet::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FileDescriptorSet::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileDescriptorSet_descriptor_; +} + +const FileDescriptorSet& FileDescriptorSet::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +FileDescriptorSet* FileDescriptorSet::default_instance_ = NULL; + +FileDescriptorSet* FileDescriptorSet::New() const { + return new FileDescriptorSet; +} + +void FileDescriptorSet::Clear() { + file_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool FileDescriptorSet::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.FileDescriptorProto file = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_file: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_file())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_file; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void FileDescriptorSet::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.FileDescriptorProto file = 1; + for (int i = 0; i < this->file_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->file(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* FileDescriptorSet::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.FileDescriptorProto file = 1; + for (int i = 0; i < this->file_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->file(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int FileDescriptorSet::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.FileDescriptorProto file = 1; + total_size += 1 * this->file_size(); + for (int i = 0; i < this->file_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->file(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FileDescriptorSet::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const FileDescriptorSet* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FileDescriptorSet::MergeFrom(const FileDescriptorSet& from) { + GOOGLE_CHECK_NE(&from, this); + file_.MergeFrom(from.file_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void FileDescriptorSet::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FileDescriptorSet::CopyFrom(const FileDescriptorSet& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FileDescriptorSet::IsInitialized() const { + + for (int i = 0; i < file_size(); i++) { + if (!this->file(i).IsInitialized()) return false; + } + return true; +} + +void FileDescriptorSet::Swap(FileDescriptorSet* other) { + if (other != this) { + file_.Swap(&other->file_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata FileDescriptorSet::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FileDescriptorSet_descriptor_; + metadata.reflection = FileDescriptorSet_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int FileDescriptorProto::kNameFieldNumber; +const int FileDescriptorProto::kPackageFieldNumber; +const int FileDescriptorProto::kDependencyFieldNumber; +const int FileDescriptorProto::kMessageTypeFieldNumber; +const int FileDescriptorProto::kEnumTypeFieldNumber; +const int FileDescriptorProto::kServiceFieldNumber; +const int FileDescriptorProto::kExtensionFieldNumber; +const int FileDescriptorProto::kOptionsFieldNumber; +const int FileDescriptorProto::kSourceCodeInfoFieldNumber; +#endif // !_MSC_VER + +FileDescriptorProto::FileDescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void FileDescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::FileOptions*>(&::google::protobuf::FileOptions::default_instance()); + source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>(&::google::protobuf::SourceCodeInfo::default_instance()); +} + +FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void FileDescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + options_ = NULL; + source_code_info_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +FileDescriptorProto::~FileDescriptorProto() { + SharedDtor(); +} + +void FileDescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (package_ != &::google::protobuf::internal::kEmptyString) { + delete package_; + } + if (this != default_instance_) { + delete options_; + delete source_code_info_; + } +} + +void FileDescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FileDescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileDescriptorProto_descriptor_; +} + +const FileDescriptorProto& FileDescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +FileDescriptorProto* FileDescriptorProto::default_instance_ = NULL; + +FileDescriptorProto* FileDescriptorProto::New() const { + return new FileDescriptorProto; +} + +void FileDescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + if (has_package()) { + if (package_ != &::google::protobuf::internal::kEmptyString) { + package_->clear(); + } + } + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear(); + } + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (has_source_code_info()) { + if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear(); + } + } + dependency_.Clear(); + message_type_.Clear(); + enum_type_.Clear(); + service_.Clear(); + extension_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool FileDescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_package; + break; + } + + // optional string package = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_package: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_package())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->package().data(), this->package().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_dependency; + break; + } + + // repeated string dependency = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_dependency: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_dependency())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->dependency(0).data(), this->dependency(0).length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_dependency; + if (input->ExpectTag(34)) goto parse_message_type; + break; + } + + // repeated .google.protobuf.DescriptorProto message_type = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_message_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_message_type())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_message_type; + if (input->ExpectTag(42)) goto parse_enum_type; + break; + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_enum_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_enum_type())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_enum_type; + if (input->ExpectTag(50)) goto parse_service; + break; + } + + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_service: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_service())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(50)) goto parse_service; + if (input->ExpectTag(58)) goto parse_extension; + break; + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_extension: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_extension())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_extension; + if (input->ExpectTag(66)) goto parse_options; + break; + } + + // optional .google.protobuf.FileOptions options = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(74)) goto parse_source_code_info; + break; + } + + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_source_code_info: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_source_code_info())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void FileDescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // optional string package = 2; + if (has_package()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->package().data(), this->package().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->package(), output); + } + + // repeated string dependency = 3; + for (int i = 0; i < this->dependency_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->dependency(i).data(), this->dependency(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 3, this->dependency(i), output); + } + + // repeated .google.protobuf.DescriptorProto message_type = 4; + for (int i = 0; i < this->message_type_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, this->message_type(i), output); + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + for (int i = 0; i < this->enum_type_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, this->enum_type(i), output); + } + + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + for (int i = 0; i < this->service_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 6, this->service(i), output); + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + for (int i = 0; i < this->extension_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 7, this->extension(i), output); + } + + // optional .google.protobuf.FileOptions options = 8; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 8, this->options(), output); + } + + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + if (has_source_code_info()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 9, this->source_code_info(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* FileDescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional string package = 2; + if (has_package()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->package().data(), this->package().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->package(), target); + } + + // repeated string dependency = 3; + for (int i = 0; i < this->dependency_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->dependency(i).data(), this->dependency(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(3, this->dependency(i), target); + } + + // repeated .google.protobuf.DescriptorProto message_type = 4; + for (int i = 0; i < this->message_type_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, this->message_type(i), target); + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + for (int i = 0; i < this->enum_type_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, this->enum_type(i), target); + } + + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + for (int i = 0; i < this->service_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 6, this->service(i), target); + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + for (int i = 0; i < this->extension_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 7, this->extension(i), target); + } + + // optional .google.protobuf.FileOptions options = 8; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 8, this->options(), target); + } + + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + if (has_source_code_info()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 9, this->source_code_info(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int FileDescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional string package = 2; + if (has_package()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->package()); + } + + // optional .google.protobuf.FileOptions options = 8; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + if (has_source_code_info()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->source_code_info()); + } + + } + // repeated string dependency = 3; + total_size += 1 * this->dependency_size(); + for (int i = 0; i < this->dependency_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->dependency(i)); + } + + // repeated .google.protobuf.DescriptorProto message_type = 4; + total_size += 1 * this->message_type_size(); + for (int i = 0; i < this->message_type_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->message_type(i)); + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + total_size += 1 * this->enum_type_size(); + for (int i = 0; i < this->enum_type_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->enum_type(i)); + } + + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + total_size += 1 * this->service_size(); + for (int i = 0; i < this->service_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->service(i)); + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + total_size += 1 * this->extension_size(); + for (int i = 0; i < this->extension_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->extension(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FileDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const FileDescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + dependency_.MergeFrom(from.dependency_); + message_type_.MergeFrom(from.message_type_); + enum_type_.MergeFrom(from.enum_type_); + service_.MergeFrom(from.service_); + extension_.MergeFrom(from.extension_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_package()) { + set_package(from.package()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::FileOptions::MergeFrom(from.options()); + } + } + if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (from.has_source_code_info()) { + mutable_source_code_info()->::google::protobuf::SourceCodeInfo::MergeFrom(from.source_code_info()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void FileDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FileDescriptorProto::CopyFrom(const FileDescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FileDescriptorProto::IsInitialized() const { + + for (int i = 0; i < message_type_size(); i++) { + if (!this->message_type(i).IsInitialized()) return false; + } + for (int i = 0; i < enum_type_size(); i++) { + if (!this->enum_type(i).IsInitialized()) return false; + } + for (int i = 0; i < service_size(); i++) { + if (!this->service(i).IsInitialized()) return false; + } + for (int i = 0; i < extension_size(); i++) { + if (!this->extension(i).IsInitialized()) return false; + } + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void FileDescriptorProto::Swap(FileDescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(package_, other->package_); + dependency_.Swap(&other->dependency_); + message_type_.Swap(&other->message_type_); + enum_type_.Swap(&other->enum_type_); + service_.Swap(&other->service_); + extension_.Swap(&other->extension_); + std::swap(options_, other->options_); + std::swap(source_code_info_, other->source_code_info_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata FileDescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FileDescriptorProto_descriptor_; + metadata.reflection = FileDescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int DescriptorProto_ExtensionRange::kStartFieldNumber; +const int DescriptorProto_ExtensionRange::kEndFieldNumber; +#endif // !_MSC_VER + +DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void DescriptorProto_ExtensionRange::InitAsDefaultInstance() { +} + +DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void DescriptorProto_ExtensionRange::SharedCtor() { + _cached_size_ = 0; + start_ = 0; + end_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() { + SharedDtor(); +} + +void DescriptorProto_ExtensionRange::SharedDtor() { + if (this != default_instance_) { + } +} + +void DescriptorProto_ExtensionRange::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange::descriptor() { + protobuf_AssignDescriptorsOnce(); + return DescriptorProto_ExtensionRange_descriptor_; +} + +const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::default_instance_ = NULL; + +DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New() const { + return new DescriptorProto_ExtensionRange; +} + +void DescriptorProto_ExtensionRange::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + start_ = 0; + end_ = 0; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int32 start = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &start_))); + set_has_start(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_end; + break; + } + + // optional int32 end = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_end: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &end_))); + set_has_end(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void DescriptorProto_ExtensionRange::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional int32 start = 1; + if (has_start()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->start(), output); + } + + // optional int32 end = 2; + if (has_end()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->end(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* DescriptorProto_ExtensionRange::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional int32 start = 1; + if (has_start()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target); + } + + // optional int32 end = 2; + if (has_end()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int DescriptorProto_ExtensionRange::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional int32 start = 1; + if (has_start()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->start()); + } + + // optional int32 end = 2; + if (has_end()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->end()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void DescriptorProto_ExtensionRange::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const DescriptorProto_ExtensionRange* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRange& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_start()) { + set_start(from.start()); + } + if (from.has_end()) { + set_end(from.end()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void DescriptorProto_ExtensionRange::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DescriptorProto_ExtensionRange::CopyFrom(const DescriptorProto_ExtensionRange& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DescriptorProto_ExtensionRange::IsInitialized() const { + + return true; +} + +void DescriptorProto_ExtensionRange::Swap(DescriptorProto_ExtensionRange* other) { + if (other != this) { + std::swap(start_, other->start_); + std::swap(end_, other->end_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata DescriptorProto_ExtensionRange::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = DescriptorProto_ExtensionRange_descriptor_; + metadata.reflection = DescriptorProto_ExtensionRange_reflection_; + return metadata; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int DescriptorProto::kNameFieldNumber; +const int DescriptorProto::kFieldFieldNumber; +const int DescriptorProto::kExtensionFieldNumber; +const int DescriptorProto::kNestedTypeFieldNumber; +const int DescriptorProto::kEnumTypeFieldNumber; +const int DescriptorProto::kExtensionRangeFieldNumber; +const int DescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER + +DescriptorProto::DescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void DescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::MessageOptions*>(&::google::protobuf::MessageOptions::default_instance()); +} + +DescriptorProto::DescriptorProto(const DescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void DescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + options_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +DescriptorProto::~DescriptorProto() { + SharedDtor(); +} + +void DescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + delete options_; + } +} + +void DescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* DescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return DescriptorProto_descriptor_; +} + +const DescriptorProto& DescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +DescriptorProto* DescriptorProto::default_instance_ = NULL; + +DescriptorProto* DescriptorProto::New() const { + return new DescriptorProto; +} + +void DescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear(); + } + } + field_.Clear(); + extension_.Clear(); + nested_type_.Clear(); + enum_type_.Clear(); + extension_range_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool DescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_field; + break; + } + + // repeated .google.protobuf.FieldDescriptorProto field = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_field: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_field())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_field; + if (input->ExpectTag(26)) goto parse_nested_type; + break; + } + + // repeated .google.protobuf.DescriptorProto nested_type = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_nested_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_nested_type())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_nested_type; + if (input->ExpectTag(34)) goto parse_enum_type; + break; + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_enum_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_enum_type())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_enum_type; + if (input->ExpectTag(42)) goto parse_extension_range; + break; + } + + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_extension_range: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_extension_range())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_extension_range; + if (input->ExpectTag(50)) goto parse_extension; + break; + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_extension: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_extension())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(50)) goto parse_extension; + if (input->ExpectTag(58)) goto parse_options; + break; + } + + // optional .google.protobuf.MessageOptions options = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void DescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // repeated .google.protobuf.FieldDescriptorProto field = 2; + for (int i = 0; i < this->field_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->field(i), output); + } + + // repeated .google.protobuf.DescriptorProto nested_type = 3; + for (int i = 0; i < this->nested_type_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->nested_type(i), output); + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + for (int i = 0; i < this->enum_type_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, this->enum_type(i), output); + } + + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + for (int i = 0; i < this->extension_range_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, this->extension_range(i), output); + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + for (int i = 0; i < this->extension_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 6, this->extension(i), output); + } + + // optional .google.protobuf.MessageOptions options = 7; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 7, this->options(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* DescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // repeated .google.protobuf.FieldDescriptorProto field = 2; + for (int i = 0; i < this->field_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->field(i), target); + } + + // repeated .google.protobuf.DescriptorProto nested_type = 3; + for (int i = 0; i < this->nested_type_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->nested_type(i), target); + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + for (int i = 0; i < this->enum_type_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, this->enum_type(i), target); + } + + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + for (int i = 0; i < this->extension_range_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, this->extension_range(i), target); + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + for (int i = 0; i < this->extension_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 6, this->extension(i), target); + } + + // optional .google.protobuf.MessageOptions options = 7; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 7, this->options(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int DescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional .google.protobuf.MessageOptions options = 7; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + // repeated .google.protobuf.FieldDescriptorProto field = 2; + total_size += 1 * this->field_size(); + for (int i = 0; i < this->field_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->field(i)); + } + + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + total_size += 1 * this->extension_size(); + for (int i = 0; i < this->extension_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->extension(i)); + } + + // repeated .google.protobuf.DescriptorProto nested_type = 3; + total_size += 1 * this->nested_type_size(); + for (int i = 0; i < this->nested_type_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->nested_type(i)); + } + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + total_size += 1 * this->enum_type_size(); + for (int i = 0; i < this->enum_type_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->enum_type(i)); + } + + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + total_size += 1 * this->extension_range_size(); + for (int i = 0; i < this->extension_range_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->extension_range(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void DescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const DescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void DescriptorProto::MergeFrom(const DescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + field_.MergeFrom(from.field_); + extension_.MergeFrom(from.extension_); + nested_type_.MergeFrom(from.nested_type_); + enum_type_.MergeFrom(from.enum_type_); + extension_range_.MergeFrom(from.extension_range_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::MessageOptions::MergeFrom(from.options()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void DescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DescriptorProto::CopyFrom(const DescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DescriptorProto::IsInitialized() const { + + for (int i = 0; i < field_size(); i++) { + if (!this->field(i).IsInitialized()) return false; + } + for (int i = 0; i < extension_size(); i++) { + if (!this->extension(i).IsInitialized()) return false; + } + for (int i = 0; i < nested_type_size(); i++) { + if (!this->nested_type(i).IsInitialized()) return false; + } + for (int i = 0; i < enum_type_size(); i++) { + if (!this->enum_type(i).IsInitialized()) return false; + } + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void DescriptorProto::Swap(DescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + field_.Swap(&other->field_); + extension_.Swap(&other->extension_); + nested_type_.Swap(&other->nested_type_); + enum_type_.Swap(&other->enum_type_); + extension_range_.Swap(&other->extension_range_); + std::swap(options_, other->options_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata DescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = DescriptorProto_descriptor_; + metadata.reflection = DescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor() { + protobuf_AssignDescriptorsOnce(); + return FieldDescriptorProto_Type_descriptor_; +} +bool FieldDescriptorProto_Type_IsValid(int value) { + switch(value) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_DOUBLE; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FLOAT; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT64; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_UINT64; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT32; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FIXED64; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FIXED32; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_BOOL; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_STRING; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_GROUP; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_MESSAGE; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_BYTES; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_UINT32; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_ENUM; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SFIXED32; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SFIXED64; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SINT32; +const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SINT64; +const FieldDescriptorProto_Type FieldDescriptorProto::Type_MIN; +const FieldDescriptorProto_Type FieldDescriptorProto::Type_MAX; +const int FieldDescriptorProto::Type_ARRAYSIZE; +#endif // _MSC_VER +const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Label_descriptor() { + protobuf_AssignDescriptorsOnce(); + return FieldDescriptorProto_Label_descriptor_; +} +bool FieldDescriptorProto_Label_IsValid(int value) { + switch(value) { + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const FieldDescriptorProto_Label FieldDescriptorProto::LABEL_OPTIONAL; +const FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED; +const FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REPEATED; +const FieldDescriptorProto_Label FieldDescriptorProto::Label_MIN; +const FieldDescriptorProto_Label FieldDescriptorProto::Label_MAX; +const int FieldDescriptorProto::Label_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int FieldDescriptorProto::kNameFieldNumber; +const int FieldDescriptorProto::kNumberFieldNumber; +const int FieldDescriptorProto::kLabelFieldNumber; +const int FieldDescriptorProto::kTypeFieldNumber; +const int FieldDescriptorProto::kTypeNameFieldNumber; +const int FieldDescriptorProto::kExtendeeFieldNumber; +const int FieldDescriptorProto::kDefaultValueFieldNumber; +const int FieldDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER + +FieldDescriptorProto::FieldDescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void FieldDescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::FieldOptions*>(&::google::protobuf::FieldOptions::default_instance()); +} + +FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void FieldDescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + number_ = 0; + label_ = 1; + type_ = 1; + type_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + extendee_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + default_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + options_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +FieldDescriptorProto::~FieldDescriptorProto() { + SharedDtor(); +} + +void FieldDescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (type_name_ != &::google::protobuf::internal::kEmptyString) { + delete type_name_; + } + if (extendee_ != &::google::protobuf::internal::kEmptyString) { + delete extendee_; + } + if (default_value_ != &::google::protobuf::internal::kEmptyString) { + delete default_value_; + } + if (this != default_instance_) { + delete options_; + } +} + +void FieldDescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FieldDescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FieldDescriptorProto_descriptor_; +} + +const FieldDescriptorProto& FieldDescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +FieldDescriptorProto* FieldDescriptorProto::default_instance_ = NULL; + +FieldDescriptorProto* FieldDescriptorProto::New() const { + return new FieldDescriptorProto; +} + +void FieldDescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + number_ = 0; + label_ = 1; + type_ = 1; + if (has_type_name()) { + if (type_name_ != &::google::protobuf::internal::kEmptyString) { + type_name_->clear(); + } + } + if (has_extendee()) { + if (extendee_ != &::google::protobuf::internal::kEmptyString) { + extendee_->clear(); + } + } + if (has_default_value()) { + if (default_value_ != &::google::protobuf::internal::kEmptyString) { + default_value_->clear(); + } + } + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool FieldDescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_extendee; + break; + } + + // optional string extendee = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_extendee: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_extendee())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->extendee().data(), this->extendee().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_number; + break; + } + + // optional int32 number = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &number_))); + set_has_number(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_label; + break; + } + + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_label: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::google::protobuf::FieldDescriptorProto_Label_IsValid(value)) { + set_label(static_cast< ::google::protobuf::FieldDescriptorProto_Label >(value)); + } else { + mutable_unknown_fields()->AddVarint(4, value); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(40)) goto parse_type; + break; + } + + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_type: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::google::protobuf::FieldDescriptorProto_Type_IsValid(value)) { + set_type(static_cast< ::google::protobuf::FieldDescriptorProto_Type >(value)); + } else { + mutable_unknown_fields()->AddVarint(5, value); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(50)) goto parse_type_name; + break; + } + + // optional string type_name = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_type_name: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_type_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->type_name().data(), this->type_name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_default_value; + break; + } + + // optional string default_value = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_default_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_default_value())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->default_value().data(), this->default_value().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_options; + break; + } + + // optional .google.protobuf.FieldOptions options = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void FieldDescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // optional string extendee = 2; + if (has_extendee()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->extendee().data(), this->extendee().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->extendee(), output); + } + + // optional int32 number = 3; + if (has_number()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->number(), output); + } + + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + if (has_label()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 4, this->label(), output); + } + + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + if (has_type()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 5, this->type(), output); + } + + // optional string type_name = 6; + if (has_type_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->type_name().data(), this->type_name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 6, this->type_name(), output); + } + + // optional string default_value = 7; + if (has_default_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->default_value().data(), this->default_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 7, this->default_value(), output); + } + + // optional .google.protobuf.FieldOptions options = 8; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 8, this->options(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* FieldDescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional string extendee = 2; + if (has_extendee()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->extendee().data(), this->extendee().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->extendee(), target); + } + + // optional int32 number = 3; + if (has_number()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->number(), target); + } + + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + if (has_label()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 4, this->label(), target); + } + + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + if (has_type()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 5, this->type(), target); + } + + // optional string type_name = 6; + if (has_type_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->type_name().data(), this->type_name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 6, this->type_name(), target); + } + + // optional string default_value = 7; + if (has_default_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->default_value().data(), this->default_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 7, this->default_value(), target); + } + + // optional .google.protobuf.FieldOptions options = 8; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 8, this->options(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int FieldDescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional int32 number = 3; + if (has_number()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->number()); + } + + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + if (has_label()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->label()); + } + + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + if (has_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); + } + + // optional string type_name = 6; + if (has_type_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->type_name()); + } + + // optional string extendee = 2; + if (has_extendee()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->extendee()); + } + + // optional string default_value = 7; + if (has_default_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->default_value()); + } + + // optional .google.protobuf.FieldOptions options = 8; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FieldDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const FieldDescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_number()) { + set_number(from.number()); + } + if (from.has_label()) { + set_label(from.label()); + } + if (from.has_type()) { + set_type(from.type()); + } + if (from.has_type_name()) { + set_type_name(from.type_name()); + } + if (from.has_extendee()) { + set_extendee(from.extendee()); + } + if (from.has_default_value()) { + set_default_value(from.default_value()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::FieldOptions::MergeFrom(from.options()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void FieldDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FieldDescriptorProto::CopyFrom(const FieldDescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FieldDescriptorProto::IsInitialized() const { + + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void FieldDescriptorProto::Swap(FieldDescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(number_, other->number_); + std::swap(label_, other->label_); + std::swap(type_, other->type_); + std::swap(type_name_, other->type_name_); + std::swap(extendee_, other->extendee_); + std::swap(default_value_, other->default_value_); + std::swap(options_, other->options_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata FieldDescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FieldDescriptorProto_descriptor_; + metadata.reflection = FieldDescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int EnumDescriptorProto::kNameFieldNumber; +const int EnumDescriptorProto::kValueFieldNumber; +const int EnumDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER + +EnumDescriptorProto::EnumDescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void EnumDescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::EnumOptions*>(&::google::protobuf::EnumOptions::default_instance()); +} + +EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void EnumDescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + options_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +EnumDescriptorProto::~EnumDescriptorProto() { + SharedDtor(); +} + +void EnumDescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + delete options_; + } +} + +void EnumDescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EnumDescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return EnumDescriptorProto_descriptor_; +} + +const EnumDescriptorProto& EnumDescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +EnumDescriptorProto* EnumDescriptorProto::default_instance_ = NULL; + +EnumDescriptorProto* EnumDescriptorProto::New() const { + return new EnumDescriptorProto; +} + +void EnumDescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear(); + } + } + value_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool EnumDescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_value; + break; + } + + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_value())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_value; + if (input->ExpectTag(26)) goto parse_options; + break; + } + + // optional .google.protobuf.EnumOptions options = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void EnumDescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + for (int i = 0; i < this->value_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->value(i), output); + } + + // optional .google.protobuf.EnumOptions options = 3; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->options(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* EnumDescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + for (int i = 0; i < this->value_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->value(i), target); + } + + // optional .google.protobuf.EnumOptions options = 3; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->options(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int EnumDescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional .google.protobuf.EnumOptions options = 3; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + total_size += 1 * this->value_size(); + for (int i = 0; i < this->value_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->value(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void EnumDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const EnumDescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + value_.MergeFrom(from.value_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::EnumOptions::MergeFrom(from.options()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void EnumDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void EnumDescriptorProto::CopyFrom(const EnumDescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EnumDescriptorProto::IsInitialized() const { + + for (int i = 0; i < value_size(); i++) { + if (!this->value(i).IsInitialized()) return false; + } + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void EnumDescriptorProto::Swap(EnumDescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + value_.Swap(&other->value_); + std::swap(options_, other->options_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata EnumDescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = EnumDescriptorProto_descriptor_; + metadata.reflection = EnumDescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int EnumValueDescriptorProto::kNameFieldNumber; +const int EnumValueDescriptorProto::kNumberFieldNumber; +const int EnumValueDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER + +EnumValueDescriptorProto::EnumValueDescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void EnumValueDescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::EnumValueOptions*>(&::google::protobuf::EnumValueOptions::default_instance()); +} + +EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void EnumValueDescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + number_ = 0; + options_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +EnumValueDescriptorProto::~EnumValueDescriptorProto() { + SharedDtor(); +} + +void EnumValueDescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + delete options_; + } +} + +void EnumValueDescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EnumValueDescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return EnumValueDescriptorProto_descriptor_; +} + +const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +EnumValueDescriptorProto* EnumValueDescriptorProto::default_instance_ = NULL; + +EnumValueDescriptorProto* EnumValueDescriptorProto::New() const { + return new EnumValueDescriptorProto; +} + +void EnumValueDescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + number_ = 0; + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool EnumValueDescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_number; + break; + } + + // optional int32 number = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &number_))); + set_has_number(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_options; + break; + } + + // optional .google.protobuf.EnumValueOptions options = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void EnumValueDescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // optional int32 number = 2; + if (has_number()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->number(), output); + } + + // optional .google.protobuf.EnumValueOptions options = 3; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->options(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* EnumValueDescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional int32 number = 2; + if (has_number()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->number(), target); + } + + // optional .google.protobuf.EnumValueOptions options = 3; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->options(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int EnumValueDescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional int32 number = 2; + if (has_number()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->number()); + } + + // optional .google.protobuf.EnumValueOptions options = 3; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void EnumValueDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const EnumValueDescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_number()) { + set_number(from.number()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::EnumValueOptions::MergeFrom(from.options()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void EnumValueDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void EnumValueDescriptorProto::CopyFrom(const EnumValueDescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EnumValueDescriptorProto::IsInitialized() const { + + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void EnumValueDescriptorProto::Swap(EnumValueDescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(number_, other->number_); + std::swap(options_, other->options_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata EnumValueDescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = EnumValueDescriptorProto_descriptor_; + metadata.reflection = EnumValueDescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ServiceDescriptorProto::kNameFieldNumber; +const int ServiceDescriptorProto::kMethodFieldNumber; +const int ServiceDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER + +ServiceDescriptorProto::ServiceDescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void ServiceDescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::ServiceOptions*>(&::google::protobuf::ServiceOptions::default_instance()); +} + +ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void ServiceDescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + options_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ServiceDescriptorProto::~ServiceDescriptorProto() { + SharedDtor(); +} + +void ServiceDescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + delete options_; + } +} + +void ServiceDescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ServiceDescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ServiceDescriptorProto_descriptor_; +} + +const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +ServiceDescriptorProto* ServiceDescriptorProto::default_instance_ = NULL; + +ServiceDescriptorProto* ServiceDescriptorProto::New() const { + return new ServiceDescriptorProto; +} + +void ServiceDescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear(); + } + } + method_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool ServiceDescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_method; + break; + } + + // repeated .google.protobuf.MethodDescriptorProto method = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_method: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_method())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_method; + if (input->ExpectTag(26)) goto parse_options; + break; + } + + // optional .google.protobuf.ServiceOptions options = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void ServiceDescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // repeated .google.protobuf.MethodDescriptorProto method = 2; + for (int i = 0; i < this->method_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->method(i), output); + } + + // optional .google.protobuf.ServiceOptions options = 3; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->options(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* ServiceDescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // repeated .google.protobuf.MethodDescriptorProto method = 2; + for (int i = 0; i < this->method_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->method(i), target); + } + + // optional .google.protobuf.ServiceOptions options = 3; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->options(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int ServiceDescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional .google.protobuf.ServiceOptions options = 3; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + // repeated .google.protobuf.MethodDescriptorProto method = 2; + total_size += 1 * this->method_size(); + for (int i = 0; i < this->method_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->method(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ServiceDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const ServiceDescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + method_.MergeFrom(from.method_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::ServiceOptions::MergeFrom(from.options()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void ServiceDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ServiceDescriptorProto::CopyFrom(const ServiceDescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ServiceDescriptorProto::IsInitialized() const { + + for (int i = 0; i < method_size(); i++) { + if (!this->method(i).IsInitialized()) return false; + } + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void ServiceDescriptorProto::Swap(ServiceDescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + method_.Swap(&other->method_); + std::swap(options_, other->options_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata ServiceDescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ServiceDescriptorProto_descriptor_; + metadata.reflection = ServiceDescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int MethodDescriptorProto::kNameFieldNumber; +const int MethodDescriptorProto::kInputTypeFieldNumber; +const int MethodDescriptorProto::kOutputTypeFieldNumber; +const int MethodDescriptorProto::kOptionsFieldNumber; +#endif // !_MSC_VER + +MethodDescriptorProto::MethodDescriptorProto() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void MethodDescriptorProto::InitAsDefaultInstance() { + options_ = const_cast< ::google::protobuf::MethodOptions*>(&::google::protobuf::MethodOptions::default_instance()); +} + +MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void MethodDescriptorProto::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + input_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + output_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + options_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +MethodDescriptorProto::~MethodDescriptorProto() { + SharedDtor(); +} + +void MethodDescriptorProto::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (input_type_ != &::google::protobuf::internal::kEmptyString) { + delete input_type_; + } + if (output_type_ != &::google::protobuf::internal::kEmptyString) { + delete output_type_; + } + if (this != default_instance_) { + delete options_; + } +} + +void MethodDescriptorProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* MethodDescriptorProto::descriptor() { + protobuf_AssignDescriptorsOnce(); + return MethodDescriptorProto_descriptor_; +} + +const MethodDescriptorProto& MethodDescriptorProto::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +MethodDescriptorProto* MethodDescriptorProto::default_instance_ = NULL; + +MethodDescriptorProto* MethodDescriptorProto::New() const { + return new MethodDescriptorProto; +} + +void MethodDescriptorProto::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + if (has_input_type()) { + if (input_type_ != &::google::protobuf::internal::kEmptyString) { + input_type_->clear(); + } + } + if (has_output_type()) { + if (output_type_ != &::google::protobuf::internal::kEmptyString) { + output_type_->clear(); + } + } + if (has_options()) { + if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool MethodDescriptorProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_input_type; + break; + } + + // optional string input_type = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_input_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_input_type())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->input_type().data(), this->input_type().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_output_type; + break; + } + + // optional string output_type = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_output_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_output_type())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->output_type().data(), this->output_type().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_options; + break; + } + + // optional .google.protobuf.MethodOptions options = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_options())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void MethodDescriptorProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // optional string input_type = 2; + if (has_input_type()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->input_type().data(), this->input_type().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->input_type(), output); + } + + // optional string output_type = 3; + if (has_output_type()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->output_type().data(), this->output_type().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 3, this->output_type(), output); + } + + // optional .google.protobuf.MethodOptions options = 4; + if (has_options()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, this->options(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* MethodDescriptorProto::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional string input_type = 2; + if (has_input_type()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->input_type().data(), this->input_type().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->input_type(), target); + } + + // optional string output_type = 3; + if (has_output_type()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->output_type().data(), this->output_type().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 3, this->output_type(), target); + } + + // optional .google.protobuf.MethodOptions options = 4; + if (has_options()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, this->options(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int MethodDescriptorProto::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional string input_type = 2; + if (has_input_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->input_type()); + } + + // optional string output_type = 3; + if (has_output_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->output_type()); + } + + // optional .google.protobuf.MethodOptions options = 4; + if (has_options()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void MethodDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const MethodDescriptorProto* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_input_type()) { + set_input_type(from.input_type()); + } + if (from.has_output_type()) { + set_output_type(from.output_type()); + } + if (from.has_options()) { + mutable_options()->::google::protobuf::MethodOptions::MergeFrom(from.options()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void MethodDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void MethodDescriptorProto::CopyFrom(const MethodDescriptorProto& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MethodDescriptorProto::IsInitialized() const { + + if (has_options()) { + if (!this->options().IsInitialized()) return false; + } + return true; +} + +void MethodDescriptorProto::Swap(MethodDescriptorProto* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(input_type_, other->input_type_); + std::swap(output_type_, other->output_type_); + std::swap(options_, other->options_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata MethodDescriptorProto::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = MethodDescriptorProto_descriptor_; + metadata.reflection = MethodDescriptorProto_reflection_; + return metadata; +} + + +// =================================================================== + +const ::google::protobuf::EnumDescriptor* FileOptions_OptimizeMode_descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileOptions_OptimizeMode_descriptor_; +} +bool FileOptions_OptimizeMode_IsValid(int value) { + switch(value) { + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const FileOptions_OptimizeMode FileOptions::SPEED; +const FileOptions_OptimizeMode FileOptions::CODE_SIZE; +const FileOptions_OptimizeMode FileOptions::LITE_RUNTIME; +const FileOptions_OptimizeMode FileOptions::OptimizeMode_MIN; +const FileOptions_OptimizeMode FileOptions::OptimizeMode_MAX; +const int FileOptions::OptimizeMode_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int FileOptions::kJavaPackageFieldNumber; +const int FileOptions::kJavaOuterClassnameFieldNumber; +const int FileOptions::kJavaMultipleFilesFieldNumber; +const int FileOptions::kJavaGenerateEqualsAndHashFieldNumber; +const int FileOptions::kOptimizeForFieldNumber; +const int FileOptions::kCcGenericServicesFieldNumber; +const int FileOptions::kJavaGenericServicesFieldNumber; +const int FileOptions::kPyGenericServicesFieldNumber; +const int FileOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +FileOptions::FileOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void FileOptions::InitAsDefaultInstance() { +} + +FileOptions::FileOptions(const FileOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void FileOptions::SharedCtor() { + _cached_size_ = 0; + java_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + java_outer_classname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + java_multiple_files_ = false; + java_generate_equals_and_hash_ = false; + optimize_for_ = 1; + cc_generic_services_ = false; + java_generic_services_ = false; + py_generic_services_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +FileOptions::~FileOptions() { + SharedDtor(); +} + +void FileOptions::SharedDtor() { + if (java_package_ != &::google::protobuf::internal::kEmptyString) { + delete java_package_; + } + if (java_outer_classname_ != &::google::protobuf::internal::kEmptyString) { + delete java_outer_classname_; + } + if (this != default_instance_) { + } +} + +void FileOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FileOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileOptions_descriptor_; +} + +const FileOptions& FileOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +FileOptions* FileOptions::default_instance_ = NULL; + +FileOptions* FileOptions::New() const { + return new FileOptions; +} + +void FileOptions::Clear() { + _extensions_.Clear(); + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_java_package()) { + if (java_package_ != &::google::protobuf::internal::kEmptyString) { + java_package_->clear(); + } + } + if (has_java_outer_classname()) { + if (java_outer_classname_ != &::google::protobuf::internal::kEmptyString) { + java_outer_classname_->clear(); + } + } + java_multiple_files_ = false; + java_generate_equals_and_hash_ = false; + optimize_for_ = 1; + cc_generic_services_ = false; + java_generic_services_ = false; + py_generic_services_ = false; + } + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool FileOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string java_package = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_java_package())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->java_package().data(), this->java_package().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_java_outer_classname; + break; + } + + // optional string java_outer_classname = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_java_outer_classname: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_java_outer_classname())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->java_outer_classname().data(), this->java_outer_classname().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(72)) goto parse_optimize_for; + break; + } + + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_optimize_for: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::google::protobuf::FileOptions_OptimizeMode_IsValid(value)) { + set_optimize_for(static_cast< ::google::protobuf::FileOptions_OptimizeMode >(value)); + } else { + mutable_unknown_fields()->AddVarint(9, value); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(80)) goto parse_java_multiple_files; + break; + } + + // optional bool java_multiple_files = 10 [default = false]; + case 10: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_java_multiple_files: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &java_multiple_files_))); + set_has_java_multiple_files(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(128)) goto parse_cc_generic_services; + break; + } + + // optional bool cc_generic_services = 16 [default = false]; + case 16: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_cc_generic_services: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &cc_generic_services_))); + set_has_cc_generic_services(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(136)) goto parse_java_generic_services; + break; + } + + // optional bool java_generic_services = 17 [default = false]; + case 17: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_java_generic_services: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &java_generic_services_))); + set_has_java_generic_services(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(144)) goto parse_py_generic_services; + break; + } + + // optional bool py_generic_services = 18 [default = false]; + case 18: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_py_generic_services: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &py_generic_services_))); + set_has_py_generic_services(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(160)) goto parse_java_generate_equals_and_hash; + break; + } + + // optional bool java_generate_equals_and_hash = 20 [default = false]; + case 20: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_java_generate_equals_and_hash: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &java_generate_equals_and_hash_))); + set_has_java_generate_equals_and_hash(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + break; + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void FileOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string java_package = 1; + if (has_java_package()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->java_package().data(), this->java_package().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->java_package(), output); + } + + // optional string java_outer_classname = 8; + if (has_java_outer_classname()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->java_outer_classname().data(), this->java_outer_classname().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 8, this->java_outer_classname(), output); + } + + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + if (has_optimize_for()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 9, this->optimize_for(), output); + } + + // optional bool java_multiple_files = 10 [default = false]; + if (has_java_multiple_files()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(10, this->java_multiple_files(), output); + } + + // optional bool cc_generic_services = 16 [default = false]; + if (has_cc_generic_services()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(16, this->cc_generic_services(), output); + } + + // optional bool java_generic_services = 17 [default = false]; + if (has_java_generic_services()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(17, this->java_generic_services(), output); + } + + // optional bool py_generic_services = 18 [default = false]; + if (has_py_generic_services()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output); + } + + // optional bool java_generate_equals_and_hash = 20 [default = false]; + if (has_java_generate_equals_and_hash()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(20, this->java_generate_equals_and_hash(), output); + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* FileOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional string java_package = 1; + if (has_java_package()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->java_package().data(), this->java_package().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->java_package(), target); + } + + // optional string java_outer_classname = 8; + if (has_java_outer_classname()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->java_outer_classname().data(), this->java_outer_classname().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 8, this->java_outer_classname(), target); + } + + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + if (has_optimize_for()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 9, this->optimize_for(), target); + } + + // optional bool java_multiple_files = 10 [default = false]; + if (has_java_multiple_files()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target); + } + + // optional bool cc_generic_services = 16 [default = false]; + if (has_cc_generic_services()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target); + } + + // optional bool java_generic_services = 17 [default = false]; + if (has_java_generic_services()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target); + } + + // optional bool py_generic_services = 18 [default = false]; + if (has_py_generic_services()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target); + } + + // optional bool java_generate_equals_and_hash = 20 [default = false]; + if (has_java_generate_equals_and_hash()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target); + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int FileOptions::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string java_package = 1; + if (has_java_package()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->java_package()); + } + + // optional string java_outer_classname = 8; + if (has_java_outer_classname()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->java_outer_classname()); + } + + // optional bool java_multiple_files = 10 [default = false]; + if (has_java_multiple_files()) { + total_size += 1 + 1; + } + + // optional bool java_generate_equals_and_hash = 20 [default = false]; + if (has_java_generate_equals_and_hash()) { + total_size += 2 + 1; + } + + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + if (has_optimize_for()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->optimize_for()); + } + + // optional bool cc_generic_services = 16 [default = false]; + if (has_cc_generic_services()) { + total_size += 2 + 1; + } + + // optional bool java_generic_services = 17 [default = false]; + if (has_java_generic_services()) { + total_size += 2 + 1; + } + + // optional bool py_generic_services = 18 [default = false]; + if (has_py_generic_services()) { + total_size += 2 + 1; + } + + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FileOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const FileOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FileOptions::MergeFrom(const FileOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_java_package()) { + set_java_package(from.java_package()); + } + if (from.has_java_outer_classname()) { + set_java_outer_classname(from.java_outer_classname()); + } + if (from.has_java_multiple_files()) { + set_java_multiple_files(from.java_multiple_files()); + } + if (from.has_java_generate_equals_and_hash()) { + set_java_generate_equals_and_hash(from.java_generate_equals_and_hash()); + } + if (from.has_optimize_for()) { + set_optimize_for(from.optimize_for()); + } + if (from.has_cc_generic_services()) { + set_cc_generic_services(from.cc_generic_services()); + } + if (from.has_java_generic_services()) { + set_java_generic_services(from.java_generic_services()); + } + if (from.has_py_generic_services()) { + set_py_generic_services(from.py_generic_services()); + } + } + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void FileOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FileOptions::CopyFrom(const FileOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FileOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void FileOptions::Swap(FileOptions* other) { + if (other != this) { + std::swap(java_package_, other->java_package_); + std::swap(java_outer_classname_, other->java_outer_classname_); + std::swap(java_multiple_files_, other->java_multiple_files_); + std::swap(java_generate_equals_and_hash_, other->java_generate_equals_and_hash_); + std::swap(optimize_for_, other->optimize_for_); + std::swap(cc_generic_services_, other->cc_generic_services_); + std::swap(java_generic_services_, other->java_generic_services_); + std::swap(py_generic_services_, other->py_generic_services_); + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata FileOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FileOptions_descriptor_; + metadata.reflection = FileOptions_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int MessageOptions::kMessageSetWireFormatFieldNumber; +const int MessageOptions::kNoStandardDescriptorAccessorFieldNumber; +const int MessageOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +MessageOptions::MessageOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void MessageOptions::InitAsDefaultInstance() { +} + +MessageOptions::MessageOptions(const MessageOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void MessageOptions::SharedCtor() { + _cached_size_ = 0; + message_set_wire_format_ = false; + no_standard_descriptor_accessor_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +MessageOptions::~MessageOptions() { + SharedDtor(); +} + +void MessageOptions::SharedDtor() { + if (this != default_instance_) { + } +} + +void MessageOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* MessageOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return MessageOptions_descriptor_; +} + +const MessageOptions& MessageOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +MessageOptions* MessageOptions::default_instance_ = NULL; + +MessageOptions* MessageOptions::New() const { + return new MessageOptions; +} + +void MessageOptions::Clear() { + _extensions_.Clear(); + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + message_set_wire_format_ = false; + no_standard_descriptor_accessor_ = false; + } + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool MessageOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bool message_set_wire_format = 1 [default = false]; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &message_set_wire_format_))); + set_has_message_set_wire_format(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_no_standard_descriptor_accessor; + break; + } + + // optional bool no_standard_descriptor_accessor = 2 [default = false]; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_no_standard_descriptor_accessor: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &no_standard_descriptor_accessor_))); + set_has_no_standard_descriptor_accessor(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + break; + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void MessageOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional bool message_set_wire_format = 1 [default = false]; + if (has_message_set_wire_format()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->message_set_wire_format(), output); + } + + // optional bool no_standard_descriptor_accessor = 2 [default = false]; + if (has_no_standard_descriptor_accessor()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->no_standard_descriptor_accessor(), output); + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* MessageOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional bool message_set_wire_format = 1 [default = false]; + if (has_message_set_wire_format()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->message_set_wire_format(), target); + } + + // optional bool no_standard_descriptor_accessor = 2 [default = false]; + if (has_no_standard_descriptor_accessor()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->no_standard_descriptor_accessor(), target); + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int MessageOptions::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional bool message_set_wire_format = 1 [default = false]; + if (has_message_set_wire_format()) { + total_size += 1 + 1; + } + + // optional bool no_standard_descriptor_accessor = 2 [default = false]; + if (has_no_standard_descriptor_accessor()) { + total_size += 1 + 1; + } + + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void MessageOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const MessageOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void MessageOptions::MergeFrom(const MessageOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_message_set_wire_format()) { + set_message_set_wire_format(from.message_set_wire_format()); + } + if (from.has_no_standard_descriptor_accessor()) { + set_no_standard_descriptor_accessor(from.no_standard_descriptor_accessor()); + } + } + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void MessageOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void MessageOptions::CopyFrom(const MessageOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MessageOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void MessageOptions::Swap(MessageOptions* other) { + if (other != this) { + std::swap(message_set_wire_format_, other->message_set_wire_format_); + std::swap(no_standard_descriptor_accessor_, other->no_standard_descriptor_accessor_); + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata MessageOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = MessageOptions_descriptor_; + metadata.reflection = MessageOptions_reflection_; + return metadata; +} + + +// =================================================================== + +const ::google::protobuf::EnumDescriptor* FieldOptions_CType_descriptor() { + protobuf_AssignDescriptorsOnce(); + return FieldOptions_CType_descriptor_; +} +bool FieldOptions_CType_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const FieldOptions_CType FieldOptions::STRING; +const FieldOptions_CType FieldOptions::CORD; +const FieldOptions_CType FieldOptions::STRING_PIECE; +const FieldOptions_CType FieldOptions::CType_MIN; +const FieldOptions_CType FieldOptions::CType_MAX; +const int FieldOptions::CType_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int FieldOptions::kCtypeFieldNumber; +const int FieldOptions::kPackedFieldNumber; +const int FieldOptions::kDeprecatedFieldNumber; +const int FieldOptions::kExperimentalMapKeyFieldNumber; +const int FieldOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +FieldOptions::FieldOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void FieldOptions::InitAsDefaultInstance() { +} + +FieldOptions::FieldOptions(const FieldOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void FieldOptions::SharedCtor() { + _cached_size_ = 0; + ctype_ = 0; + packed_ = false; + deprecated_ = false; + experimental_map_key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +FieldOptions::~FieldOptions() { + SharedDtor(); +} + +void FieldOptions::SharedDtor() { + if (experimental_map_key_ != &::google::protobuf::internal::kEmptyString) { + delete experimental_map_key_; + } + if (this != default_instance_) { + } +} + +void FieldOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FieldOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FieldOptions_descriptor_; +} + +const FieldOptions& FieldOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +FieldOptions* FieldOptions::default_instance_ = NULL; + +FieldOptions* FieldOptions::New() const { + return new FieldOptions; +} + +void FieldOptions::Clear() { + _extensions_.Clear(); + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + ctype_ = 0; + packed_ = false; + deprecated_ = false; + if (has_experimental_map_key()) { + if (experimental_map_key_ != &::google::protobuf::internal::kEmptyString) { + experimental_map_key_->clear(); + } + } + } + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool FieldOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::google::protobuf::FieldOptions_CType_IsValid(value)) { + set_ctype(static_cast< ::google::protobuf::FieldOptions_CType >(value)); + } else { + mutable_unknown_fields()->AddVarint(1, value); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_packed; + break; + } + + // optional bool packed = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_packed: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &packed_))); + set_has_packed(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_deprecated; + break; + } + + // optional bool deprecated = 3 [default = false]; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_deprecated: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &deprecated_))); + set_has_deprecated(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(74)) goto parse_experimental_map_key; + break; + } + + // optional string experimental_map_key = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_experimental_map_key: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_experimental_map_key())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->experimental_map_key().data(), this->experimental_map_key().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + break; + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void FieldOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + if (has_ctype()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->ctype(), output); + } + + // optional bool packed = 2; + if (has_packed()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->packed(), output); + } + + // optional bool deprecated = 3 [default = false]; + if (has_deprecated()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->deprecated(), output); + } + + // optional string experimental_map_key = 9; + if (has_experimental_map_key()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->experimental_map_key().data(), this->experimental_map_key().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 9, this->experimental_map_key(), output); + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* FieldOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + if (has_ctype()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 1, this->ctype(), target); + } + + // optional bool packed = 2; + if (has_packed()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->packed(), target); + } + + // optional bool deprecated = 3 [default = false]; + if (has_deprecated()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target); + } + + // optional string experimental_map_key = 9; + if (has_experimental_map_key()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->experimental_map_key().data(), this->experimental_map_key().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 9, this->experimental_map_key(), target); + } + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int FieldOptions::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + if (has_ctype()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->ctype()); + } + + // optional bool packed = 2; + if (has_packed()) { + total_size += 1 + 1; + } + + // optional bool deprecated = 3 [default = false]; + if (has_deprecated()) { + total_size += 1 + 1; + } + + // optional string experimental_map_key = 9; + if (has_experimental_map_key()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->experimental_map_key()); + } + + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FieldOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const FieldOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FieldOptions::MergeFrom(const FieldOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_ctype()) { + set_ctype(from.ctype()); + } + if (from.has_packed()) { + set_packed(from.packed()); + } + if (from.has_deprecated()) { + set_deprecated(from.deprecated()); + } + if (from.has_experimental_map_key()) { + set_experimental_map_key(from.experimental_map_key()); + } + } + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void FieldOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FieldOptions::CopyFrom(const FieldOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FieldOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void FieldOptions::Swap(FieldOptions* other) { + if (other != this) { + std::swap(ctype_, other->ctype_); + std::swap(packed_, other->packed_); + std::swap(deprecated_, other->deprecated_); + std::swap(experimental_map_key_, other->experimental_map_key_); + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata FieldOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FieldOptions_descriptor_; + metadata.reflection = FieldOptions_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int EnumOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +EnumOptions::EnumOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void EnumOptions::InitAsDefaultInstance() { +} + +EnumOptions::EnumOptions(const EnumOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void EnumOptions::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +EnumOptions::~EnumOptions() { + SharedDtor(); +} + +void EnumOptions::SharedDtor() { + if (this != default_instance_) { + } +} + +void EnumOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EnumOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return EnumOptions_descriptor_; +} + +const EnumOptions& EnumOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +EnumOptions* EnumOptions::default_instance_ = NULL; + +EnumOptions* EnumOptions::New() const { + return new EnumOptions; +} + +void EnumOptions::Clear() { + _extensions_.Clear(); + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool EnumOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void EnumOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* EnumOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int EnumOptions::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void EnumOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const EnumOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void EnumOptions::MergeFrom(const EnumOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void EnumOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void EnumOptions::CopyFrom(const EnumOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EnumOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void EnumOptions::Swap(EnumOptions* other) { + if (other != this) { + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata EnumOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = EnumOptions_descriptor_; + metadata.reflection = EnumOptions_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int EnumValueOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +EnumValueOptions::EnumValueOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void EnumValueOptions::InitAsDefaultInstance() { +} + +EnumValueOptions::EnumValueOptions(const EnumValueOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void EnumValueOptions::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +EnumValueOptions::~EnumValueOptions() { + SharedDtor(); +} + +void EnumValueOptions::SharedDtor() { + if (this != default_instance_) { + } +} + +void EnumValueOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EnumValueOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return EnumValueOptions_descriptor_; +} + +const EnumValueOptions& EnumValueOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +EnumValueOptions* EnumValueOptions::default_instance_ = NULL; + +EnumValueOptions* EnumValueOptions::New() const { + return new EnumValueOptions; +} + +void EnumValueOptions::Clear() { + _extensions_.Clear(); + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool EnumValueOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void EnumValueOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* EnumValueOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int EnumValueOptions::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void EnumValueOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const EnumValueOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void EnumValueOptions::MergeFrom(const EnumValueOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void EnumValueOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void EnumValueOptions::CopyFrom(const EnumValueOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EnumValueOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void EnumValueOptions::Swap(EnumValueOptions* other) { + if (other != this) { + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata EnumValueOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = EnumValueOptions_descriptor_; + metadata.reflection = EnumValueOptions_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ServiceOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +ServiceOptions::ServiceOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void ServiceOptions::InitAsDefaultInstance() { +} + +ServiceOptions::ServiceOptions(const ServiceOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void ServiceOptions::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ServiceOptions::~ServiceOptions() { + SharedDtor(); +} + +void ServiceOptions::SharedDtor() { + if (this != default_instance_) { + } +} + +void ServiceOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ServiceOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ServiceOptions_descriptor_; +} + +const ServiceOptions& ServiceOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +ServiceOptions* ServiceOptions::default_instance_ = NULL; + +ServiceOptions* ServiceOptions::New() const { + return new ServiceOptions; +} + +void ServiceOptions::Clear() { + _extensions_.Clear(); + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool ServiceOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void ServiceOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* ServiceOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int ServiceOptions::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ServiceOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const ServiceOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ServiceOptions::MergeFrom(const ServiceOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void ServiceOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ServiceOptions::CopyFrom(const ServiceOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ServiceOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void ServiceOptions::Swap(ServiceOptions* other) { + if (other != this) { + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata ServiceOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ServiceOptions_descriptor_; + metadata.reflection = ServiceOptions_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int MethodOptions::kUninterpretedOptionFieldNumber; +#endif // !_MSC_VER + +MethodOptions::MethodOptions() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void MethodOptions::InitAsDefaultInstance() { +} + +MethodOptions::MethodOptions(const MethodOptions& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void MethodOptions::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +MethodOptions::~MethodOptions() { + SharedDtor(); +} + +void MethodOptions::SharedDtor() { + if (this != default_instance_) { + } +} + +void MethodOptions::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* MethodOptions::descriptor() { + protobuf_AssignDescriptorsOnce(); + return MethodOptions_descriptor_; +} + +const MethodOptions& MethodOptions::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +MethodOptions* MethodOptions::default_instance_ = NULL; + +MethodOptions* MethodOptions::New() const { + return new MethodOptions; +} + +void MethodOptions::Clear() { + _extensions_.Clear(); + uninterpreted_option_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool MethodOptions::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + case 999: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_uninterpreted_option: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_uninterpreted_option())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(7994)) goto parse_uninterpreted_option; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + if ((8000u <= tag)) { + DO_(_extensions_.ParseField(tag, input, default_instance_, + mutable_unknown_fields())); + continue; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void MethodOptions::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 999, this->uninterpreted_option(i), output); + } + + // Extension range [1000, 536870912) + _extensions_.SerializeWithCachedSizes( + 1000, 536870912, output); + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* MethodOptions::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 999, this->uninterpreted_option(i), target); + } + + // Extension range [1000, 536870912) + target = _extensions_.SerializeWithCachedSizesToArray( + 1000, 536870912, target); + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int MethodOptions::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + total_size += 2 * this->uninterpreted_option_size(); + for (int i = 0; i < this->uninterpreted_option_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->uninterpreted_option(i)); + } + + total_size += _extensions_.ByteSize(); + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void MethodOptions::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const MethodOptions* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void MethodOptions::MergeFrom(const MethodOptions& from) { + GOOGLE_CHECK_NE(&from, this); + uninterpreted_option_.MergeFrom(from.uninterpreted_option_); + _extensions_.MergeFrom(from._extensions_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void MethodOptions::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void MethodOptions::CopyFrom(const MethodOptions& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MethodOptions::IsInitialized() const { + + for (int i = 0; i < uninterpreted_option_size(); i++) { + if (!this->uninterpreted_option(i).IsInitialized()) return false; + } + + if (!_extensions_.IsInitialized()) return false; return true; +} + +void MethodOptions::Swap(MethodOptions* other) { + if (other != this) { + uninterpreted_option_.Swap(&other->uninterpreted_option_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + _extensions_.Swap(&other->_extensions_); + } +} + +::google::protobuf::Metadata MethodOptions::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = MethodOptions_descriptor_; + metadata.reflection = MethodOptions_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int UninterpretedOption_NamePart::kNamePartFieldNumber; +const int UninterpretedOption_NamePart::kIsExtensionFieldNumber; +#endif // !_MSC_VER + +UninterpretedOption_NamePart::UninterpretedOption_NamePart() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void UninterpretedOption_NamePart::InitAsDefaultInstance() { +} + +UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void UninterpretedOption_NamePart::SharedCtor() { + _cached_size_ = 0; + name_part_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + is_extension_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +UninterpretedOption_NamePart::~UninterpretedOption_NamePart() { + SharedDtor(); +} + +void UninterpretedOption_NamePart::SharedDtor() { + if (name_part_ != &::google::protobuf::internal::kEmptyString) { + delete name_part_; + } + if (this != default_instance_) { + } +} + +void UninterpretedOption_NamePart::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* UninterpretedOption_NamePart::descriptor() { + protobuf_AssignDescriptorsOnce(); + return UninterpretedOption_NamePart_descriptor_; +} + +const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +UninterpretedOption_NamePart* UninterpretedOption_NamePart::default_instance_ = NULL; + +UninterpretedOption_NamePart* UninterpretedOption_NamePart::New() const { + return new UninterpretedOption_NamePart; +} + +void UninterpretedOption_NamePart::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name_part()) { + if (name_part_ != &::google::protobuf::internal::kEmptyString) { + name_part_->clear(); + } + } + is_extension_ = false; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool UninterpretedOption_NamePart::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string name_part = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name_part())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name_part().data(), this->name_part().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_is_extension; + break; + } + + // required bool is_extension = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_is_extension: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &is_extension_))); + set_has_is_extension(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void UninterpretedOption_NamePart::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string name_part = 1; + if (has_name_part()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name_part().data(), this->name_part().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name_part(), output); + } + + // required bool is_extension = 2; + if (has_is_extension()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->is_extension(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* UninterpretedOption_NamePart::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // required string name_part = 1; + if (has_name_part()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->name_part().data(), this->name_part().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name_part(), target); + } + + // required bool is_extension = 2; + if (has_is_extension()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->is_extension(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int UninterpretedOption_NamePart::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string name_part = 1; + if (has_name_part()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name_part()); + } + + // required bool is_extension = 2; + if (has_is_extension()) { + total_size += 1 + 1; + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void UninterpretedOption_NamePart::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const UninterpretedOption_NamePart* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name_part()) { + set_name_part(from.name_part()); + } + if (from.has_is_extension()) { + set_is_extension(from.is_extension()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void UninterpretedOption_NamePart::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void UninterpretedOption_NamePart::CopyFrom(const UninterpretedOption_NamePart& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool UninterpretedOption_NamePart::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void UninterpretedOption_NamePart::Swap(UninterpretedOption_NamePart* other) { + if (other != this) { + std::swap(name_part_, other->name_part_); + std::swap(is_extension_, other->is_extension_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata UninterpretedOption_NamePart::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = UninterpretedOption_NamePart_descriptor_; + metadata.reflection = UninterpretedOption_NamePart_reflection_; + return metadata; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int UninterpretedOption::kNameFieldNumber; +const int UninterpretedOption::kIdentifierValueFieldNumber; +const int UninterpretedOption::kPositiveIntValueFieldNumber; +const int UninterpretedOption::kNegativeIntValueFieldNumber; +const int UninterpretedOption::kDoubleValueFieldNumber; +const int UninterpretedOption::kStringValueFieldNumber; +const int UninterpretedOption::kAggregateValueFieldNumber; +#endif // !_MSC_VER + +UninterpretedOption::UninterpretedOption() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void UninterpretedOption::InitAsDefaultInstance() { +} + +UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void UninterpretedOption::SharedCtor() { + _cached_size_ = 0; + identifier_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + positive_int_value_ = GOOGLE_ULONGLONG(0); + negative_int_value_ = GOOGLE_LONGLONG(0); + double_value_ = 0; + string_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + aggregate_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +UninterpretedOption::~UninterpretedOption() { + SharedDtor(); +} + +void UninterpretedOption::SharedDtor() { + if (identifier_value_ != &::google::protobuf::internal::kEmptyString) { + delete identifier_value_; + } + if (string_value_ != &::google::protobuf::internal::kEmptyString) { + delete string_value_; + } + if (aggregate_value_ != &::google::protobuf::internal::kEmptyString) { + delete aggregate_value_; + } + if (this != default_instance_) { + } +} + +void UninterpretedOption::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* UninterpretedOption::descriptor() { + protobuf_AssignDescriptorsOnce(); + return UninterpretedOption_descriptor_; +} + +const UninterpretedOption& UninterpretedOption::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +UninterpretedOption* UninterpretedOption::default_instance_ = NULL; + +UninterpretedOption* UninterpretedOption::New() const { + return new UninterpretedOption; +} + +void UninterpretedOption::Clear() { + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (has_identifier_value()) { + if (identifier_value_ != &::google::protobuf::internal::kEmptyString) { + identifier_value_->clear(); + } + } + positive_int_value_ = GOOGLE_ULONGLONG(0); + negative_int_value_ = GOOGLE_LONGLONG(0); + double_value_ = 0; + if (has_string_value()) { + if (string_value_ != &::google::protobuf::internal::kEmptyString) { + string_value_->clear(); + } + } + if (has_aggregate_value()) { + if (aggregate_value_ != &::google::protobuf::internal::kEmptyString) { + aggregate_value_->clear(); + } + } + } + name_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool UninterpretedOption::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_name: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_name())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_name; + if (input->ExpectTag(26)) goto parse_identifier_value; + break; + } + + // optional string identifier_value = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_identifier_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_identifier_value())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->identifier_value().data(), this->identifier_value().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_positive_int_value; + break; + } + + // optional uint64 positive_int_value = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_positive_int_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( + input, &positive_int_value_))); + set_has_positive_int_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(40)) goto parse_negative_int_value; + break; + } + + // optional int64 negative_int_value = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_negative_int_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &negative_int_value_))); + set_has_negative_int_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(49)) goto parse_double_value; + break; + } + + // optional double double_value = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { + parse_double_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &double_value_))); + set_has_double_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_string_value; + break; + } + + // optional bytes string_value = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_string_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_string_value())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_aggregate_value; + break; + } + + // optional string aggregate_value = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_aggregate_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_aggregate_value())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->aggregate_value().data(), this->aggregate_value().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void UninterpretedOption::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + for (int i = 0; i < this->name_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->name(i), output); + } + + // optional string identifier_value = 3; + if (has_identifier_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->identifier_value().data(), this->identifier_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 3, this->identifier_value(), output); + } + + // optional uint64 positive_int_value = 4; + if (has_positive_int_value()) { + ::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->positive_int_value(), output); + } + + // optional int64 negative_int_value = 5; + if (has_negative_int_value()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(5, this->negative_int_value(), output); + } + + // optional double double_value = 6; + if (has_double_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(6, this->double_value(), output); + } + + // optional bytes string_value = 7; + if (has_string_value()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 7, this->string_value(), output); + } + + // optional string aggregate_value = 8; + if (has_aggregate_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->aggregate_value().data(), this->aggregate_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 8, this->aggregate_value(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* UninterpretedOption::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + for (int i = 0; i < this->name_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->name(i), target); + } + + // optional string identifier_value = 3; + if (has_identifier_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->identifier_value().data(), this->identifier_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 3, this->identifier_value(), target); + } + + // optional uint64 positive_int_value = 4; + if (has_positive_int_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->positive_int_value(), target); + } + + // optional int64 negative_int_value = 5; + if (has_negative_int_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(5, this->negative_int_value(), target); + } + + // optional double double_value = 6; + if (has_double_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(6, this->double_value(), target); + } + + // optional bytes string_value = 7; + if (has_string_value()) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 7, this->string_value(), target); + } + + // optional string aggregate_value = 8; + if (has_aggregate_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->aggregate_value().data(), this->aggregate_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 8, this->aggregate_value(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int UninterpretedOption::ByteSize() const { + int total_size = 0; + + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + // optional string identifier_value = 3; + if (has_identifier_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->identifier_value()); + } + + // optional uint64 positive_int_value = 4; + if (has_positive_int_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::UInt64Size( + this->positive_int_value()); + } + + // optional int64 negative_int_value = 5; + if (has_negative_int_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->negative_int_value()); + } + + // optional double double_value = 6; + if (has_double_value()) { + total_size += 1 + 8; + } + + // optional bytes string_value = 7; + if (has_string_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->string_value()); + } + + // optional string aggregate_value = 8; + if (has_aggregate_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->aggregate_value()); + } + + } + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + total_size += 1 * this->name_size(); + for (int i = 0; i < this->name_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->name(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void UninterpretedOption::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const UninterpretedOption* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void UninterpretedOption::MergeFrom(const UninterpretedOption& from) { + GOOGLE_CHECK_NE(&from, this); + name_.MergeFrom(from.name_); + if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (from.has_identifier_value()) { + set_identifier_value(from.identifier_value()); + } + if (from.has_positive_int_value()) { + set_positive_int_value(from.positive_int_value()); + } + if (from.has_negative_int_value()) { + set_negative_int_value(from.negative_int_value()); + } + if (from.has_double_value()) { + set_double_value(from.double_value()); + } + if (from.has_string_value()) { + set_string_value(from.string_value()); + } + if (from.has_aggregate_value()) { + set_aggregate_value(from.aggregate_value()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void UninterpretedOption::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void UninterpretedOption::CopyFrom(const UninterpretedOption& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool UninterpretedOption::IsInitialized() const { + + for (int i = 0; i < name_size(); i++) { + if (!this->name(i).IsInitialized()) return false; + } + return true; +} + +void UninterpretedOption::Swap(UninterpretedOption* other) { + if (other != this) { + name_.Swap(&other->name_); + std::swap(identifier_value_, other->identifier_value_); + std::swap(positive_int_value_, other->positive_int_value_); + std::swap(negative_int_value_, other->negative_int_value_); + std::swap(double_value_, other->double_value_); + std::swap(string_value_, other->string_value_); + std::swap(aggregate_value_, other->aggregate_value_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata UninterpretedOption::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = UninterpretedOption_descriptor_; + metadata.reflection = UninterpretedOption_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int SourceCodeInfo_Location::kPathFieldNumber; +const int SourceCodeInfo_Location::kSpanFieldNumber; +#endif // !_MSC_VER + +SourceCodeInfo_Location::SourceCodeInfo_Location() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void SourceCodeInfo_Location::InitAsDefaultInstance() { +} + +SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void SourceCodeInfo_Location::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +SourceCodeInfo_Location::~SourceCodeInfo_Location() { + SharedDtor(); +} + +void SourceCodeInfo_Location::SharedDtor() { + if (this != default_instance_) { + } +} + +void SourceCodeInfo_Location::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* SourceCodeInfo_Location::descriptor() { + protobuf_AssignDescriptorsOnce(); + return SourceCodeInfo_Location_descriptor_; +} + +const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +SourceCodeInfo_Location* SourceCodeInfo_Location::default_instance_ = NULL; + +SourceCodeInfo_Location* SourceCodeInfo_Location::New() const { + return new SourceCodeInfo_Location; +} + +void SourceCodeInfo_Location::Clear() { + path_.Clear(); + span_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool SourceCodeInfo_Location::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated int32 path = 1 [packed = true]; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_path()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 10, input, this->mutable_path()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_span; + break; + } + + // repeated int32 span = 2 [packed = true]; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_span: + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_span()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 18, input, this->mutable_span()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void SourceCodeInfo_Location::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated int32 path = 1 [packed = true]; + if (this->path_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(_path_cached_byte_size_); + } + for (int i = 0; i < this->path_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( + this->path(i), output); + } + + // repeated int32 span = 2 [packed = true]; + if (this->span_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(_span_cached_byte_size_); + } + for (int i = 0; i < this->span_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( + this->span(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* SourceCodeInfo_Location::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated int32 path = 1 [packed = true]; + if (this->path_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 1, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _path_cached_byte_size_, target); + } + for (int i = 0; i < this->path_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32NoTagToArray(this->path(i), target); + } + + // repeated int32 span = 2 [packed = true]; + if (this->span_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 2, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _span_cached_byte_size_, target); + } + for (int i = 0; i < this->span_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32NoTagToArray(this->span(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int SourceCodeInfo_Location::ByteSize() const { + int total_size = 0; + + // repeated int32 path = 1 [packed = true]; + { + int data_size = 0; + for (int i = 0; i < this->path_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->path(i)); + } + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + _path_cached_byte_size_ = data_size; + total_size += data_size; + } + + // repeated int32 span = 2 [packed = true]; + { + int data_size = 0; + for (int i = 0; i < this->span_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->span(i)); + } + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + _span_cached_byte_size_ = data_size; + total_size += data_size; + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void SourceCodeInfo_Location::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const SourceCodeInfo_Location* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) { + GOOGLE_CHECK_NE(&from, this); + path_.MergeFrom(from.path_); + span_.MergeFrom(from.span_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void SourceCodeInfo_Location::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void SourceCodeInfo_Location::CopyFrom(const SourceCodeInfo_Location& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SourceCodeInfo_Location::IsInitialized() const { + + return true; +} + +void SourceCodeInfo_Location::Swap(SourceCodeInfo_Location* other) { + if (other != this) { + path_.Swap(&other->path_); + span_.Swap(&other->span_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata SourceCodeInfo_Location::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = SourceCodeInfo_Location_descriptor_; + metadata.reflection = SourceCodeInfo_Location_reflection_; + return metadata; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int SourceCodeInfo::kLocationFieldNumber; +#endif // !_MSC_VER + +SourceCodeInfo::SourceCodeInfo() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void SourceCodeInfo::InitAsDefaultInstance() { +} + +SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void SourceCodeInfo::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +SourceCodeInfo::~SourceCodeInfo() { + SharedDtor(); +} + +void SourceCodeInfo::SharedDtor() { + if (this != default_instance_) { + } +} + +void SourceCodeInfo::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* SourceCodeInfo::descriptor() { + protobuf_AssignDescriptorsOnce(); + return SourceCodeInfo_descriptor_; +} + +const SourceCodeInfo& SourceCodeInfo::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; +} + +SourceCodeInfo* SourceCodeInfo::default_instance_ = NULL; + +SourceCodeInfo* SourceCodeInfo::New() const { + return new SourceCodeInfo; +} + +void SourceCodeInfo::Clear() { + location_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool SourceCodeInfo::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_location: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_location())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_location; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void SourceCodeInfo::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + for (int i = 0; i < this->location_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->location(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* SourceCodeInfo::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + for (int i = 0; i < this->location_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->location(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int SourceCodeInfo::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + total_size += 1 * this->location_size(); + for (int i = 0; i < this->location_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->location(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void SourceCodeInfo::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const SourceCodeInfo* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void SourceCodeInfo::MergeFrom(const SourceCodeInfo& from) { + GOOGLE_CHECK_NE(&from, this); + location_.MergeFrom(from.location_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void SourceCodeInfo::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void SourceCodeInfo::CopyFrom(const SourceCodeInfo& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SourceCodeInfo::IsInitialized() const { + + return true; +} + +void SourceCodeInfo::Swap(SourceCodeInfo* other) { + if (other != this) { + location_.Swap(&other->location_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata SourceCodeInfo::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = SourceCodeInfo_descriptor_; + metadata.reflection = SourceCodeInfo_reflection_; + return metadata; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/depends/protobuf/google/protobuf/descriptor.pb.h b/depends/protobuf/google/protobuf/descriptor.pb.h new file mode 100644 index 000000000..95febb813 --- /dev/null +++ b/depends/protobuf/google/protobuf/descriptor.pb.h @@ -0,0 +1,5223 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/descriptor.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2004000 +#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 2004001 < GOOGLE_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. +#endif + +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + +class FileDescriptorSet; +class FileDescriptorProto; +class DescriptorProto; +class DescriptorProto_ExtensionRange; +class FieldDescriptorProto; +class EnumDescriptorProto; +class EnumValueDescriptorProto; +class ServiceDescriptorProto; +class MethodDescriptorProto; +class FileOptions; +class MessageOptions; +class FieldOptions; +class EnumOptions; +class EnumValueOptions; +class ServiceOptions; +class MethodOptions; +class UninterpretedOption; +class UninterpretedOption_NamePart; +class SourceCodeInfo; +class SourceCodeInfo_Location; + +enum FieldDescriptorProto_Type { + FieldDescriptorProto_Type_TYPE_DOUBLE = 1, + FieldDescriptorProto_Type_TYPE_FLOAT = 2, + FieldDescriptorProto_Type_TYPE_INT64 = 3, + FieldDescriptorProto_Type_TYPE_UINT64 = 4, + FieldDescriptorProto_Type_TYPE_INT32 = 5, + FieldDescriptorProto_Type_TYPE_FIXED64 = 6, + FieldDescriptorProto_Type_TYPE_FIXED32 = 7, + FieldDescriptorProto_Type_TYPE_BOOL = 8, + FieldDescriptorProto_Type_TYPE_STRING = 9, + FieldDescriptorProto_Type_TYPE_GROUP = 10, + FieldDescriptorProto_Type_TYPE_MESSAGE = 11, + FieldDescriptorProto_Type_TYPE_BYTES = 12, + FieldDescriptorProto_Type_TYPE_UINT32 = 13, + FieldDescriptorProto_Type_TYPE_ENUM = 14, + FieldDescriptorProto_Type_TYPE_SFIXED32 = 15, + FieldDescriptorProto_Type_TYPE_SFIXED64 = 16, + FieldDescriptorProto_Type_TYPE_SINT32 = 17, + FieldDescriptorProto_Type_TYPE_SINT64 = 18 +}; +LIBPROTOBUF_EXPORT bool FieldDescriptorProto_Type_IsValid(int value); +const FieldDescriptorProto_Type FieldDescriptorProto_Type_Type_MIN = FieldDescriptorProto_Type_TYPE_DOUBLE; +const FieldDescriptorProto_Type FieldDescriptorProto_Type_Type_MAX = FieldDescriptorProto_Type_TYPE_SINT64; +const int FieldDescriptorProto_Type_Type_ARRAYSIZE = FieldDescriptorProto_Type_Type_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor(); +inline const ::std::string& FieldDescriptorProto_Type_Name(FieldDescriptorProto_Type value) { + return ::google::protobuf::internal::NameOfEnum( + FieldDescriptorProto_Type_descriptor(), value); +} +inline bool FieldDescriptorProto_Type_Parse( + const ::std::string& name, FieldDescriptorProto_Type* value) { + return ::google::protobuf::internal::ParseNamedEnum( + FieldDescriptorProto_Type_descriptor(), name, value); +} +enum FieldDescriptorProto_Label { + FieldDescriptorProto_Label_LABEL_OPTIONAL = 1, + FieldDescriptorProto_Label_LABEL_REQUIRED = 2, + FieldDescriptorProto_Label_LABEL_REPEATED = 3 +}; +LIBPROTOBUF_EXPORT bool FieldDescriptorProto_Label_IsValid(int value); +const FieldDescriptorProto_Label FieldDescriptorProto_Label_Label_MIN = FieldDescriptorProto_Label_LABEL_OPTIONAL; +const FieldDescriptorProto_Label FieldDescriptorProto_Label_Label_MAX = FieldDescriptorProto_Label_LABEL_REPEATED; +const int FieldDescriptorProto_Label_Label_ARRAYSIZE = FieldDescriptorProto_Label_Label_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Label_descriptor(); +inline const ::std::string& FieldDescriptorProto_Label_Name(FieldDescriptorProto_Label value) { + return ::google::protobuf::internal::NameOfEnum( + FieldDescriptorProto_Label_descriptor(), value); +} +inline bool FieldDescriptorProto_Label_Parse( + const ::std::string& name, FieldDescriptorProto_Label* value) { + return ::google::protobuf::internal::ParseNamedEnum( + FieldDescriptorProto_Label_descriptor(), name, value); +} +enum FileOptions_OptimizeMode { + FileOptions_OptimizeMode_SPEED = 1, + FileOptions_OptimizeMode_CODE_SIZE = 2, + FileOptions_OptimizeMode_LITE_RUNTIME = 3 +}; +LIBPROTOBUF_EXPORT bool FileOptions_OptimizeMode_IsValid(int value); +const FileOptions_OptimizeMode FileOptions_OptimizeMode_OptimizeMode_MIN = FileOptions_OptimizeMode_SPEED; +const FileOptions_OptimizeMode FileOptions_OptimizeMode_OptimizeMode_MAX = FileOptions_OptimizeMode_LITE_RUNTIME; +const int FileOptions_OptimizeMode_OptimizeMode_ARRAYSIZE = FileOptions_OptimizeMode_OptimizeMode_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* FileOptions_OptimizeMode_descriptor(); +inline const ::std::string& FileOptions_OptimizeMode_Name(FileOptions_OptimizeMode value) { + return ::google::protobuf::internal::NameOfEnum( + FileOptions_OptimizeMode_descriptor(), value); +} +inline bool FileOptions_OptimizeMode_Parse( + const ::std::string& name, FileOptions_OptimizeMode* value) { + return ::google::protobuf::internal::ParseNamedEnum( + FileOptions_OptimizeMode_descriptor(), name, value); +} +enum FieldOptions_CType { + FieldOptions_CType_STRING = 0, + FieldOptions_CType_CORD = 1, + FieldOptions_CType_STRING_PIECE = 2 +}; +LIBPROTOBUF_EXPORT bool FieldOptions_CType_IsValid(int value); +const FieldOptions_CType FieldOptions_CType_CType_MIN = FieldOptions_CType_STRING; +const FieldOptions_CType FieldOptions_CType_CType_MAX = FieldOptions_CType_STRING_PIECE; +const int FieldOptions_CType_CType_ARRAYSIZE = FieldOptions_CType_CType_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* FieldOptions_CType_descriptor(); +inline const ::std::string& FieldOptions_CType_Name(FieldOptions_CType value) { + return ::google::protobuf::internal::NameOfEnum( + FieldOptions_CType_descriptor(), value); +} +inline bool FieldOptions_CType_Parse( + const ::std::string& name, FieldOptions_CType* value) { + return ::google::protobuf::internal::ParseNamedEnum( + FieldOptions_CType_descriptor(), name, value); +} +// =================================================================== + +class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message { + public: + FileDescriptorSet(); + virtual ~FileDescriptorSet(); + + FileDescriptorSet(const FileDescriptorSet& from); + + inline FileDescriptorSet& operator=(const FileDescriptorSet& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileDescriptorSet& default_instance(); + + void Swap(FileDescriptorSet* other); + + // implements Message ---------------------------------------------- + + FileDescriptorSet* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileDescriptorSet& from); + void MergeFrom(const FileDescriptorSet& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.FileDescriptorProto file = 1; + inline int file_size() const; + inline void clear_file(); + static const int kFileFieldNumber = 1; + inline const ::google::protobuf::FileDescriptorProto& file(int index) const; + inline ::google::protobuf::FileDescriptorProto* mutable_file(int index); + inline ::google::protobuf::FileDescriptorProto* add_file(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& + file() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* + mutable_file(); + + // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorSet) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static FileDescriptorSet* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Message { + public: + FileDescriptorProto(); + virtual ~FileDescriptorProto(); + + FileDescriptorProto(const FileDescriptorProto& from); + + inline FileDescriptorProto& operator=(const FileDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileDescriptorProto& default_instance(); + + void Swap(FileDescriptorProto* other); + + // implements Message ---------------------------------------------- + + FileDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileDescriptorProto& from); + void MergeFrom(const FileDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // optional string package = 2; + inline bool has_package() const; + inline void clear_package(); + static const int kPackageFieldNumber = 2; + inline const ::std::string& package() const; + inline void set_package(const ::std::string& value); + inline void set_package(const char* value); + inline void set_package(const char* value, size_t size); + inline ::std::string* mutable_package(); + inline ::std::string* release_package(); + + // repeated string dependency = 3; + inline int dependency_size() const; + inline void clear_dependency(); + static const int kDependencyFieldNumber = 3; + inline const ::std::string& dependency(int index) const; + inline ::std::string* mutable_dependency(int index); + inline void set_dependency(int index, const ::std::string& value); + inline void set_dependency(int index, const char* value); + inline void set_dependency(int index, const char* value, size_t size); + inline ::std::string* add_dependency(); + inline void add_dependency(const ::std::string& value); + inline void add_dependency(const char* value); + inline void add_dependency(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& dependency() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_dependency(); + + // repeated .google.protobuf.DescriptorProto message_type = 4; + inline int message_type_size() const; + inline void clear_message_type(); + static const int kMessageTypeFieldNumber = 4; + inline const ::google::protobuf::DescriptorProto& message_type(int index) const; + inline ::google::protobuf::DescriptorProto* mutable_message_type(int index); + inline ::google::protobuf::DescriptorProto* add_message_type(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& + message_type() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* + mutable_message_type(); + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + inline int enum_type_size() const; + inline void clear_enum_type(); + static const int kEnumTypeFieldNumber = 5; + inline const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const; + inline ::google::protobuf::EnumDescriptorProto* mutable_enum_type(int index); + inline ::google::protobuf::EnumDescriptorProto* add_enum_type(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& + enum_type() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* + mutable_enum_type(); + + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + inline int service_size() const; + inline void clear_service(); + static const int kServiceFieldNumber = 6; + inline const ::google::protobuf::ServiceDescriptorProto& service(int index) const; + inline ::google::protobuf::ServiceDescriptorProto* mutable_service(int index); + inline ::google::protobuf::ServiceDescriptorProto* add_service(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >& + service() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >* + mutable_service(); + + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + inline int extension_size() const; + inline void clear_extension(); + static const int kExtensionFieldNumber = 7; + inline const ::google::protobuf::FieldDescriptorProto& extension(int index) const; + inline ::google::protobuf::FieldDescriptorProto* mutable_extension(int index); + inline ::google::protobuf::FieldDescriptorProto* add_extension(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& + extension() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* + mutable_extension(); + + // optional .google.protobuf.FileOptions options = 8; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 8; + inline const ::google::protobuf::FileOptions& options() const; + inline ::google::protobuf::FileOptions* mutable_options(); + inline ::google::protobuf::FileOptions* release_options(); + + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + inline bool has_source_code_info() const; + inline void clear_source_code_info(); + static const int kSourceCodeInfoFieldNumber = 9; + inline const ::google::protobuf::SourceCodeInfo& source_code_info() const; + inline ::google::protobuf::SourceCodeInfo* mutable_source_code_info(); + inline ::google::protobuf::SourceCodeInfo* release_source_code_info(); + + // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_package(); + inline void clear_has_package(); + inline void set_has_options(); + inline void clear_has_options(); + inline void set_has_source_code_info(); + inline void clear_has_source_code_info(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::std::string* package_; + ::google::protobuf::RepeatedPtrField< ::std::string> dependency_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto > message_type_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto > enum_type_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto > service_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > extension_; + ::google::protobuf::FileOptions* options_; + ::google::protobuf::SourceCodeInfo* source_code_info_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static FileDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::protobuf::Message { + public: + DescriptorProto_ExtensionRange(); + virtual ~DescriptorProto_ExtensionRange(); + + DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from); + + inline DescriptorProto_ExtensionRange& operator=(const DescriptorProto_ExtensionRange& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const DescriptorProto_ExtensionRange& default_instance(); + + void Swap(DescriptorProto_ExtensionRange* other); + + // implements Message ---------------------------------------------- + + DescriptorProto_ExtensionRange* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const DescriptorProto_ExtensionRange& from); + void MergeFrom(const DescriptorProto_ExtensionRange& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 start = 1; + inline bool has_start() const; + inline void clear_start(); + static const int kStartFieldNumber = 1; + inline ::google::protobuf::int32 start() const; + inline void set_start(::google::protobuf::int32 value); + + // optional int32 end = 2; + inline bool has_end() const; + inline void clear_end(); + static const int kEndFieldNumber = 2; + inline ::google::protobuf::int32 end() const; + inline void set_end(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ExtensionRange) + private: + inline void set_has_start(); + inline void clear_has_start(); + inline void set_has_end(); + inline void clear_has_end(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int32 start_; + ::google::protobuf::int32 end_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static DescriptorProto_ExtensionRange* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message { + public: + DescriptorProto(); + virtual ~DescriptorProto(); + + DescriptorProto(const DescriptorProto& from); + + inline DescriptorProto& operator=(const DescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const DescriptorProto& default_instance(); + + void Swap(DescriptorProto* other); + + // implements Message ---------------------------------------------- + + DescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const DescriptorProto& from); + void MergeFrom(const DescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef DescriptorProto_ExtensionRange ExtensionRange; + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // repeated .google.protobuf.FieldDescriptorProto field = 2; + inline int field_size() const; + inline void clear_field(); + static const int kFieldFieldNumber = 2; + inline const ::google::protobuf::FieldDescriptorProto& field(int index) const; + inline ::google::protobuf::FieldDescriptorProto* mutable_field(int index); + inline ::google::protobuf::FieldDescriptorProto* add_field(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& + field() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* + mutable_field(); + + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + inline int extension_size() const; + inline void clear_extension(); + static const int kExtensionFieldNumber = 6; + inline const ::google::protobuf::FieldDescriptorProto& extension(int index) const; + inline ::google::protobuf::FieldDescriptorProto* mutable_extension(int index); + inline ::google::protobuf::FieldDescriptorProto* add_extension(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& + extension() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* + mutable_extension(); + + // repeated .google.protobuf.DescriptorProto nested_type = 3; + inline int nested_type_size() const; + inline void clear_nested_type(); + static const int kNestedTypeFieldNumber = 3; + inline const ::google::protobuf::DescriptorProto& nested_type(int index) const; + inline ::google::protobuf::DescriptorProto* mutable_nested_type(int index); + inline ::google::protobuf::DescriptorProto* add_nested_type(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& + nested_type() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* + mutable_nested_type(); + + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + inline int enum_type_size() const; + inline void clear_enum_type(); + static const int kEnumTypeFieldNumber = 4; + inline const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const; + inline ::google::protobuf::EnumDescriptorProto* mutable_enum_type(int index); + inline ::google::protobuf::EnumDescriptorProto* add_enum_type(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& + enum_type() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* + mutable_enum_type(); + + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + inline int extension_range_size() const; + inline void clear_extension_range(); + static const int kExtensionRangeFieldNumber = 5; + inline const ::google::protobuf::DescriptorProto_ExtensionRange& extension_range(int index) const; + inline ::google::protobuf::DescriptorProto_ExtensionRange* mutable_extension_range(int index); + inline ::google::protobuf::DescriptorProto_ExtensionRange* add_extension_range(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >& + extension_range() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >* + mutable_extension_range(); + + // optional .google.protobuf.MessageOptions options = 7; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 7; + inline const ::google::protobuf::MessageOptions& options() const; + inline ::google::protobuf::MessageOptions* mutable_options(); + inline ::google::protobuf::MessageOptions* release_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_options(); + inline void clear_has_options(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > field_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > extension_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto > nested_type_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto > enum_type_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange > extension_range_; + ::google::protobuf::MessageOptions* options_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static DescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Message { + public: + FieldDescriptorProto(); + virtual ~FieldDescriptorProto(); + + FieldDescriptorProto(const FieldDescriptorProto& from); + + inline FieldDescriptorProto& operator=(const FieldDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FieldDescriptorProto& default_instance(); + + void Swap(FieldDescriptorProto* other); + + // implements Message ---------------------------------------------- + + FieldDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FieldDescriptorProto& from); + void MergeFrom(const FieldDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef FieldDescriptorProto_Type Type; + static const Type TYPE_DOUBLE = FieldDescriptorProto_Type_TYPE_DOUBLE; + static const Type TYPE_FLOAT = FieldDescriptorProto_Type_TYPE_FLOAT; + static const Type TYPE_INT64 = FieldDescriptorProto_Type_TYPE_INT64; + static const Type TYPE_UINT64 = FieldDescriptorProto_Type_TYPE_UINT64; + static const Type TYPE_INT32 = FieldDescriptorProto_Type_TYPE_INT32; + static const Type TYPE_FIXED64 = FieldDescriptorProto_Type_TYPE_FIXED64; + static const Type TYPE_FIXED32 = FieldDescriptorProto_Type_TYPE_FIXED32; + static const Type TYPE_BOOL = FieldDescriptorProto_Type_TYPE_BOOL; + static const Type TYPE_STRING = FieldDescriptorProto_Type_TYPE_STRING; + static const Type TYPE_GROUP = FieldDescriptorProto_Type_TYPE_GROUP; + static const Type TYPE_MESSAGE = FieldDescriptorProto_Type_TYPE_MESSAGE; + static const Type TYPE_BYTES = FieldDescriptorProto_Type_TYPE_BYTES; + static const Type TYPE_UINT32 = FieldDescriptorProto_Type_TYPE_UINT32; + static const Type TYPE_ENUM = FieldDescriptorProto_Type_TYPE_ENUM; + static const Type TYPE_SFIXED32 = FieldDescriptorProto_Type_TYPE_SFIXED32; + static const Type TYPE_SFIXED64 = FieldDescriptorProto_Type_TYPE_SFIXED64; + static const Type TYPE_SINT32 = FieldDescriptorProto_Type_TYPE_SINT32; + static const Type TYPE_SINT64 = FieldDescriptorProto_Type_TYPE_SINT64; + static inline bool Type_IsValid(int value) { + return FieldDescriptorProto_Type_IsValid(value); + } + static const Type Type_MIN = + FieldDescriptorProto_Type_Type_MIN; + static const Type Type_MAX = + FieldDescriptorProto_Type_Type_MAX; + static const int Type_ARRAYSIZE = + FieldDescriptorProto_Type_Type_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* + Type_descriptor() { + return FieldDescriptorProto_Type_descriptor(); + } + static inline const ::std::string& Type_Name(Type value) { + return FieldDescriptorProto_Type_Name(value); + } + static inline bool Type_Parse(const ::std::string& name, + Type* value) { + return FieldDescriptorProto_Type_Parse(name, value); + } + + typedef FieldDescriptorProto_Label Label; + static const Label LABEL_OPTIONAL = FieldDescriptorProto_Label_LABEL_OPTIONAL; + static const Label LABEL_REQUIRED = FieldDescriptorProto_Label_LABEL_REQUIRED; + static const Label LABEL_REPEATED = FieldDescriptorProto_Label_LABEL_REPEATED; + static inline bool Label_IsValid(int value) { + return FieldDescriptorProto_Label_IsValid(value); + } + static const Label Label_MIN = + FieldDescriptorProto_Label_Label_MIN; + static const Label Label_MAX = + FieldDescriptorProto_Label_Label_MAX; + static const int Label_ARRAYSIZE = + FieldDescriptorProto_Label_Label_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* + Label_descriptor() { + return FieldDescriptorProto_Label_descriptor(); + } + static inline const ::std::string& Label_Name(Label value) { + return FieldDescriptorProto_Label_Name(value); + } + static inline bool Label_Parse(const ::std::string& name, + Label* value) { + return FieldDescriptorProto_Label_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // optional int32 number = 3; + inline bool has_number() const; + inline void clear_number(); + static const int kNumberFieldNumber = 3; + inline ::google::protobuf::int32 number() const; + inline void set_number(::google::protobuf::int32 value); + + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + inline bool has_label() const; + inline void clear_label(); + static const int kLabelFieldNumber = 4; + inline ::google::protobuf::FieldDescriptorProto_Label label() const; + inline void set_label(::google::protobuf::FieldDescriptorProto_Label value); + + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + inline bool has_type() const; + inline void clear_type(); + static const int kTypeFieldNumber = 5; + inline ::google::protobuf::FieldDescriptorProto_Type type() const; + inline void set_type(::google::protobuf::FieldDescriptorProto_Type value); + + // optional string type_name = 6; + inline bool has_type_name() const; + inline void clear_type_name(); + static const int kTypeNameFieldNumber = 6; + inline const ::std::string& type_name() const; + inline void set_type_name(const ::std::string& value); + inline void set_type_name(const char* value); + inline void set_type_name(const char* value, size_t size); + inline ::std::string* mutable_type_name(); + inline ::std::string* release_type_name(); + + // optional string extendee = 2; + inline bool has_extendee() const; + inline void clear_extendee(); + static const int kExtendeeFieldNumber = 2; + inline const ::std::string& extendee() const; + inline void set_extendee(const ::std::string& value); + inline void set_extendee(const char* value); + inline void set_extendee(const char* value, size_t size); + inline ::std::string* mutable_extendee(); + inline ::std::string* release_extendee(); + + // optional string default_value = 7; + inline bool has_default_value() const; + inline void clear_default_value(); + static const int kDefaultValueFieldNumber = 7; + inline const ::std::string& default_value() const; + inline void set_default_value(const ::std::string& value); + inline void set_default_value(const char* value); + inline void set_default_value(const char* value, size_t size); + inline ::std::string* mutable_default_value(); + inline ::std::string* release_default_value(); + + // optional .google.protobuf.FieldOptions options = 8; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 8; + inline const ::google::protobuf::FieldOptions& options() const; + inline ::google::protobuf::FieldOptions* mutable_options(); + inline ::google::protobuf::FieldOptions* release_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.FieldDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_number(); + inline void clear_has_number(); + inline void set_has_label(); + inline void clear_has_label(); + inline void set_has_type(); + inline void clear_has_type(); + inline void set_has_type_name(); + inline void clear_has_type_name(); + inline void set_has_extendee(); + inline void clear_has_extendee(); + inline void set_has_default_value(); + inline void clear_has_default_value(); + inline void set_has_options(); + inline void clear_has_options(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::google::protobuf::int32 number_; + int label_; + ::std::string* type_name_; + ::std::string* extendee_; + ::std::string* default_value_; + ::google::protobuf::FieldOptions* options_; + int type_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static FieldDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Message { + public: + EnumDescriptorProto(); + virtual ~EnumDescriptorProto(); + + EnumDescriptorProto(const EnumDescriptorProto& from); + + inline EnumDescriptorProto& operator=(const EnumDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EnumDescriptorProto& default_instance(); + + void Swap(EnumDescriptorProto* other); + + // implements Message ---------------------------------------------- + + EnumDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EnumDescriptorProto& from); + void MergeFrom(const EnumDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + inline int value_size() const; + inline void clear_value(); + static const int kValueFieldNumber = 2; + inline const ::google::protobuf::EnumValueDescriptorProto& value(int index) const; + inline ::google::protobuf::EnumValueDescriptorProto* mutable_value(int index); + inline ::google::protobuf::EnumValueDescriptorProto* add_value(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >& + value() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >* + mutable_value(); + + // optional .google.protobuf.EnumOptions options = 3; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 3; + inline const ::google::protobuf::EnumOptions& options() const; + inline ::google::protobuf::EnumOptions* mutable_options(); + inline ::google::protobuf::EnumOptions* release_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_options(); + inline void clear_has_options(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto > value_; + ::google::protobuf::EnumOptions* options_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static EnumDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::Message { + public: + EnumValueDescriptorProto(); + virtual ~EnumValueDescriptorProto(); + + EnumValueDescriptorProto(const EnumValueDescriptorProto& from); + + inline EnumValueDescriptorProto& operator=(const EnumValueDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EnumValueDescriptorProto& default_instance(); + + void Swap(EnumValueDescriptorProto* other); + + // implements Message ---------------------------------------------- + + EnumValueDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EnumValueDescriptorProto& from); + void MergeFrom(const EnumValueDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // optional int32 number = 2; + inline bool has_number() const; + inline void clear_number(); + static const int kNumberFieldNumber = 2; + inline ::google::protobuf::int32 number() const; + inline void set_number(::google::protobuf::int32 value); + + // optional .google.protobuf.EnumValueOptions options = 3; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 3; + inline const ::google::protobuf::EnumValueOptions& options() const; + inline ::google::protobuf::EnumValueOptions* mutable_options(); + inline ::google::protobuf::EnumValueOptions* release_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_number(); + inline void clear_has_number(); + inline void set_has_options(); + inline void clear_has_options(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::google::protobuf::EnumValueOptions* options_; + ::google::protobuf::int32 number_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static EnumValueDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Message { + public: + ServiceDescriptorProto(); + virtual ~ServiceDescriptorProto(); + + ServiceDescriptorProto(const ServiceDescriptorProto& from); + + inline ServiceDescriptorProto& operator=(const ServiceDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ServiceDescriptorProto& default_instance(); + + void Swap(ServiceDescriptorProto* other); + + // implements Message ---------------------------------------------- + + ServiceDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ServiceDescriptorProto& from); + void MergeFrom(const ServiceDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // repeated .google.protobuf.MethodDescriptorProto method = 2; + inline int method_size() const; + inline void clear_method(); + static const int kMethodFieldNumber = 2; + inline const ::google::protobuf::MethodDescriptorProto& method(int index) const; + inline ::google::protobuf::MethodDescriptorProto* mutable_method(int index); + inline ::google::protobuf::MethodDescriptorProto* add_method(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >& + method() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >* + mutable_method(); + + // optional .google.protobuf.ServiceOptions options = 3; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 3; + inline const ::google::protobuf::ServiceOptions& options() const; + inline ::google::protobuf::ServiceOptions* mutable_options(); + inline ::google::protobuf::ServiceOptions* release_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.ServiceDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_options(); + inline void clear_has_options(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto > method_; + ::google::protobuf::ServiceOptions* options_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static ServiceDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Message { + public: + MethodDescriptorProto(); + virtual ~MethodDescriptorProto(); + + MethodDescriptorProto(const MethodDescriptorProto& from); + + inline MethodDescriptorProto& operator=(const MethodDescriptorProto& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const MethodDescriptorProto& default_instance(); + + void Swap(MethodDescriptorProto* other); + + // implements Message ---------------------------------------------- + + MethodDescriptorProto* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const MethodDescriptorProto& from); + void MergeFrom(const MethodDescriptorProto& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // optional string input_type = 2; + inline bool has_input_type() const; + inline void clear_input_type(); + static const int kInputTypeFieldNumber = 2; + inline const ::std::string& input_type() const; + inline void set_input_type(const ::std::string& value); + inline void set_input_type(const char* value); + inline void set_input_type(const char* value, size_t size); + inline ::std::string* mutable_input_type(); + inline ::std::string* release_input_type(); + + // optional string output_type = 3; + inline bool has_output_type() const; + inline void clear_output_type(); + static const int kOutputTypeFieldNumber = 3; + inline const ::std::string& output_type() const; + inline void set_output_type(const ::std::string& value); + inline void set_output_type(const char* value); + inline void set_output_type(const char* value, size_t size); + inline ::std::string* mutable_output_type(); + inline ::std::string* release_output_type(); + + // optional .google.protobuf.MethodOptions options = 4; + inline bool has_options() const; + inline void clear_options(); + static const int kOptionsFieldNumber = 4; + inline const ::google::protobuf::MethodOptions& options() const; + inline ::google::protobuf::MethodOptions* mutable_options(); + inline ::google::protobuf::MethodOptions* release_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.MethodDescriptorProto) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_input_type(); + inline void clear_has_input_type(); + inline void set_has_output_type(); + inline void clear_has_output_type(); + inline void set_has_options(); + inline void clear_has_options(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_; + ::std::string* input_type_; + ::std::string* output_type_; + ::google::protobuf::MethodOptions* options_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static MethodDescriptorProto* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { + public: + FileOptions(); + virtual ~FileOptions(); + + FileOptions(const FileOptions& from); + + inline FileOptions& operator=(const FileOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileOptions& default_instance(); + + void Swap(FileOptions* other); + + // implements Message ---------------------------------------------- + + FileOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileOptions& from); + void MergeFrom(const FileOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef FileOptions_OptimizeMode OptimizeMode; + static const OptimizeMode SPEED = FileOptions_OptimizeMode_SPEED; + static const OptimizeMode CODE_SIZE = FileOptions_OptimizeMode_CODE_SIZE; + static const OptimizeMode LITE_RUNTIME = FileOptions_OptimizeMode_LITE_RUNTIME; + static inline bool OptimizeMode_IsValid(int value) { + return FileOptions_OptimizeMode_IsValid(value); + } + static const OptimizeMode OptimizeMode_MIN = + FileOptions_OptimizeMode_OptimizeMode_MIN; + static const OptimizeMode OptimizeMode_MAX = + FileOptions_OptimizeMode_OptimizeMode_MAX; + static const int OptimizeMode_ARRAYSIZE = + FileOptions_OptimizeMode_OptimizeMode_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* + OptimizeMode_descriptor() { + return FileOptions_OptimizeMode_descriptor(); + } + static inline const ::std::string& OptimizeMode_Name(OptimizeMode value) { + return FileOptions_OptimizeMode_Name(value); + } + static inline bool OptimizeMode_Parse(const ::std::string& name, + OptimizeMode* value) { + return FileOptions_OptimizeMode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + // optional string java_package = 1; + inline bool has_java_package() const; + inline void clear_java_package(); + static const int kJavaPackageFieldNumber = 1; + inline const ::std::string& java_package() const; + inline void set_java_package(const ::std::string& value); + inline void set_java_package(const char* value); + inline void set_java_package(const char* value, size_t size); + inline ::std::string* mutable_java_package(); + inline ::std::string* release_java_package(); + + // optional string java_outer_classname = 8; + inline bool has_java_outer_classname() const; + inline void clear_java_outer_classname(); + static const int kJavaOuterClassnameFieldNumber = 8; + inline const ::std::string& java_outer_classname() const; + inline void set_java_outer_classname(const ::std::string& value); + inline void set_java_outer_classname(const char* value); + inline void set_java_outer_classname(const char* value, size_t size); + inline ::std::string* mutable_java_outer_classname(); + inline ::std::string* release_java_outer_classname(); + + // optional bool java_multiple_files = 10 [default = false]; + inline bool has_java_multiple_files() const; + inline void clear_java_multiple_files(); + static const int kJavaMultipleFilesFieldNumber = 10; + inline bool java_multiple_files() const; + inline void set_java_multiple_files(bool value); + + // optional bool java_generate_equals_and_hash = 20 [default = false]; + inline bool has_java_generate_equals_and_hash() const; + inline void clear_java_generate_equals_and_hash(); + static const int kJavaGenerateEqualsAndHashFieldNumber = 20; + inline bool java_generate_equals_and_hash() const; + inline void set_java_generate_equals_and_hash(bool value); + + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + inline bool has_optimize_for() const; + inline void clear_optimize_for(); + static const int kOptimizeForFieldNumber = 9; + inline ::google::protobuf::FileOptions_OptimizeMode optimize_for() const; + inline void set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value); + + // optional bool cc_generic_services = 16 [default = false]; + inline bool has_cc_generic_services() const; + inline void clear_cc_generic_services(); + static const int kCcGenericServicesFieldNumber = 16; + inline bool cc_generic_services() const; + inline void set_cc_generic_services(bool value); + + // optional bool java_generic_services = 17 [default = false]; + inline bool has_java_generic_services() const; + inline void clear_java_generic_services(); + static const int kJavaGenericServicesFieldNumber = 17; + inline bool java_generic_services() const; + inline void set_java_generic_services(bool value); + + // optional bool py_generic_services = 18 [default = false]; + inline bool has_py_generic_services() const; + inline void clear_py_generic_services(); + static const int kPyGenericServicesFieldNumber = 18; + inline bool py_generic_services() const; + inline void set_py_generic_services(bool value); + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FileOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.FileOptions) + private: + inline void set_has_java_package(); + inline void clear_has_java_package(); + inline void set_has_java_outer_classname(); + inline void clear_has_java_outer_classname(); + inline void set_has_java_multiple_files(); + inline void clear_has_java_multiple_files(); + inline void set_has_java_generate_equals_and_hash(); + inline void clear_has_java_generate_equals_and_hash(); + inline void set_has_optimize_for(); + inline void clear_has_optimize_for(); + inline void set_has_cc_generic_services(); + inline void clear_has_cc_generic_services(); + inline void set_has_java_generic_services(); + inline void clear_has_java_generic_services(); + inline void set_has_py_generic_services(); + inline void clear_has_py_generic_services(); + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* java_package_; + ::std::string* java_outer_classname_; + int optimize_for_; + bool java_multiple_files_; + bool java_generate_equals_and_hash_; + bool cc_generic_services_; + bool java_generic_services_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + bool py_generic_services_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static FileOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message { + public: + MessageOptions(); + virtual ~MessageOptions(); + + MessageOptions(const MessageOptions& from); + + inline MessageOptions& operator=(const MessageOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const MessageOptions& default_instance(); + + void Swap(MessageOptions* other); + + // implements Message ---------------------------------------------- + + MessageOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const MessageOptions& from); + void MergeFrom(const MessageOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bool message_set_wire_format = 1 [default = false]; + inline bool has_message_set_wire_format() const; + inline void clear_message_set_wire_format(); + static const int kMessageSetWireFormatFieldNumber = 1; + inline bool message_set_wire_format() const; + inline void set_message_set_wire_format(bool value); + + // optional bool no_standard_descriptor_accessor = 2 [default = false]; + inline bool has_no_standard_descriptor_accessor() const; + inline void clear_no_standard_descriptor_accessor(); + static const int kNoStandardDescriptorAccessorFieldNumber = 2; + inline bool no_standard_descriptor_accessor() const; + inline void set_no_standard_descriptor_accessor(bool value); + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MessageOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.MessageOptions) + private: + inline void set_has_message_set_wire_format(); + inline void clear_has_message_set_wire_format(); + inline void set_has_no_standard_descriptor_accessor(); + inline void clear_has_no_standard_descriptor_accessor(); + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + bool message_set_wire_format_; + bool no_standard_descriptor_accessor_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static MessageOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message { + public: + FieldOptions(); + virtual ~FieldOptions(); + + FieldOptions(const FieldOptions& from); + + inline FieldOptions& operator=(const FieldOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FieldOptions& default_instance(); + + void Swap(FieldOptions* other); + + // implements Message ---------------------------------------------- + + FieldOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FieldOptions& from); + void MergeFrom(const FieldOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef FieldOptions_CType CType; + static const CType STRING = FieldOptions_CType_STRING; + static const CType CORD = FieldOptions_CType_CORD; + static const CType STRING_PIECE = FieldOptions_CType_STRING_PIECE; + static inline bool CType_IsValid(int value) { + return FieldOptions_CType_IsValid(value); + } + static const CType CType_MIN = + FieldOptions_CType_CType_MIN; + static const CType CType_MAX = + FieldOptions_CType_CType_MAX; + static const int CType_ARRAYSIZE = + FieldOptions_CType_CType_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* + CType_descriptor() { + return FieldOptions_CType_descriptor(); + } + static inline const ::std::string& CType_Name(CType value) { + return FieldOptions_CType_Name(value); + } + static inline bool CType_Parse(const ::std::string& name, + CType* value) { + return FieldOptions_CType_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + inline bool has_ctype() const; + inline void clear_ctype(); + static const int kCtypeFieldNumber = 1; + inline ::google::protobuf::FieldOptions_CType ctype() const; + inline void set_ctype(::google::protobuf::FieldOptions_CType value); + + // optional bool packed = 2; + inline bool has_packed() const; + inline void clear_packed(); + static const int kPackedFieldNumber = 2; + inline bool packed() const; + inline void set_packed(bool value); + + // optional bool deprecated = 3 [default = false]; + inline bool has_deprecated() const; + inline void clear_deprecated(); + static const int kDeprecatedFieldNumber = 3; + inline bool deprecated() const; + inline void set_deprecated(bool value); + + // optional string experimental_map_key = 9; + inline bool has_experimental_map_key() const; + inline void clear_experimental_map_key(); + static const int kExperimentalMapKeyFieldNumber = 9; + inline const ::std::string& experimental_map_key() const; + inline void set_experimental_map_key(const ::std::string& value); + inline void set_experimental_map_key(const char* value); + inline void set_experimental_map_key(const char* value, size_t size); + inline ::std::string* mutable_experimental_map_key(); + inline ::std::string* release_experimental_map_key(); + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FieldOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.FieldOptions) + private: + inline void set_has_ctype(); + inline void clear_has_ctype(); + inline void set_has_packed(); + inline void clear_has_packed(); + inline void set_has_deprecated(); + inline void clear_has_deprecated(); + inline void set_has_experimental_map_key(); + inline void clear_has_experimental_map_key(); + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + int ctype_; + bool packed_; + bool deprecated_; + ::std::string* experimental_map_key_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static FieldOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message { + public: + EnumOptions(); + virtual ~EnumOptions(); + + EnumOptions(const EnumOptions& from); + + inline EnumOptions& operator=(const EnumOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EnumOptions& default_instance(); + + void Swap(EnumOptions* other); + + // implements Message ---------------------------------------------- + + EnumOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EnumOptions& from); + void MergeFrom(const EnumOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.EnumOptions) + private: + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static EnumOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message { + public: + EnumValueOptions(); + virtual ~EnumValueOptions(); + + EnumValueOptions(const EnumValueOptions& from); + + inline EnumValueOptions& operator=(const EnumValueOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EnumValueOptions& default_instance(); + + void Swap(EnumValueOptions* other); + + // implements Message ---------------------------------------------- + + EnumValueOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EnumValueOptions& from); + void MergeFrom(const EnumValueOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumValueOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueOptions) + private: + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static EnumValueOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message { + public: + ServiceOptions(); + virtual ~ServiceOptions(); + + ServiceOptions(const ServiceOptions& from); + + inline ServiceOptions& operator=(const ServiceOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ServiceOptions& default_instance(); + + void Swap(ServiceOptions* other); + + // implements Message ---------------------------------------------- + + ServiceOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ServiceOptions& from); + void MergeFrom(const ServiceOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ServiceOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.ServiceOptions) + private: + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static ServiceOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message { + public: + MethodOptions(); + virtual ~MethodOptions(); + + MethodOptions(const MethodOptions& from); + + inline MethodOptions& operator=(const MethodOptions& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const MethodOptions& default_instance(); + + void Swap(MethodOptions* other); + + // implements Message ---------------------------------------------- + + MethodOptions* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const MethodOptions& from); + void MergeFrom(const MethodOptions& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + inline int uninterpreted_option_size() const; + inline void clear_uninterpreted_option(); + static const int kUninterpretedOptionFieldNumber = 999; + inline const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; + inline ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); + inline ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& + uninterpreted_option() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* + mutable_uninterpreted_option(); + + GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MethodOptions) + // @@protoc_insertion_point(class_scope:google.protobuf.MethodOptions) + private: + + ::google::protobuf::internal::ExtensionSet _extensions_; + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static MethodOptions* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobuf::Message { + public: + UninterpretedOption_NamePart(); + virtual ~UninterpretedOption_NamePart(); + + UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from); + + inline UninterpretedOption_NamePart& operator=(const UninterpretedOption_NamePart& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const UninterpretedOption_NamePart& default_instance(); + + void Swap(UninterpretedOption_NamePart* other); + + // implements Message ---------------------------------------------- + + UninterpretedOption_NamePart* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const UninterpretedOption_NamePart& from); + void MergeFrom(const UninterpretedOption_NamePart& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string name_part = 1; + inline bool has_name_part() const; + inline void clear_name_part(); + static const int kNamePartFieldNumber = 1; + inline const ::std::string& name_part() const; + inline void set_name_part(const ::std::string& value); + inline void set_name_part(const char* value); + inline void set_name_part(const char* value, size_t size); + inline ::std::string* mutable_name_part(); + inline ::std::string* release_name_part(); + + // required bool is_extension = 2; + inline bool has_is_extension() const; + inline void clear_is_extension(); + static const int kIsExtensionFieldNumber = 2; + inline bool is_extension() const; + inline void set_is_extension(bool value); + + // @@protoc_insertion_point(class_scope:google.protobuf.UninterpretedOption.NamePart) + private: + inline void set_has_name_part(); + inline void clear_has_name_part(); + inline void set_has_is_extension(); + inline void clear_has_is_extension(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* name_part_; + bool is_extension_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static UninterpretedOption_NamePart* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Message { + public: + UninterpretedOption(); + virtual ~UninterpretedOption(); + + UninterpretedOption(const UninterpretedOption& from); + + inline UninterpretedOption& operator=(const UninterpretedOption& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const UninterpretedOption& default_instance(); + + void Swap(UninterpretedOption* other); + + // implements Message ---------------------------------------------- + + UninterpretedOption* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const UninterpretedOption& from); + void MergeFrom(const UninterpretedOption& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef UninterpretedOption_NamePart NamePart; + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + inline int name_size() const; + inline void clear_name(); + static const int kNameFieldNumber = 2; + inline const ::google::protobuf::UninterpretedOption_NamePart& name(int index) const; + inline ::google::protobuf::UninterpretedOption_NamePart* mutable_name(int index); + inline ::google::protobuf::UninterpretedOption_NamePart* add_name(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >& + name() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >* + mutable_name(); + + // optional string identifier_value = 3; + inline bool has_identifier_value() const; + inline void clear_identifier_value(); + static const int kIdentifierValueFieldNumber = 3; + inline const ::std::string& identifier_value() const; + inline void set_identifier_value(const ::std::string& value); + inline void set_identifier_value(const char* value); + inline void set_identifier_value(const char* value, size_t size); + inline ::std::string* mutable_identifier_value(); + inline ::std::string* release_identifier_value(); + + // optional uint64 positive_int_value = 4; + inline bool has_positive_int_value() const; + inline void clear_positive_int_value(); + static const int kPositiveIntValueFieldNumber = 4; + inline ::google::protobuf::uint64 positive_int_value() const; + inline void set_positive_int_value(::google::protobuf::uint64 value); + + // optional int64 negative_int_value = 5; + inline bool has_negative_int_value() const; + inline void clear_negative_int_value(); + static const int kNegativeIntValueFieldNumber = 5; + inline ::google::protobuf::int64 negative_int_value() const; + inline void set_negative_int_value(::google::protobuf::int64 value); + + // optional double double_value = 6; + inline bool has_double_value() const; + inline void clear_double_value(); + static const int kDoubleValueFieldNumber = 6; + inline double double_value() const; + inline void set_double_value(double value); + + // optional bytes string_value = 7; + inline bool has_string_value() const; + inline void clear_string_value(); + static const int kStringValueFieldNumber = 7; + inline const ::std::string& string_value() const; + inline void set_string_value(const ::std::string& value); + inline void set_string_value(const char* value); + inline void set_string_value(const void* value, size_t size); + inline ::std::string* mutable_string_value(); + inline ::std::string* release_string_value(); + + // optional string aggregate_value = 8; + inline bool has_aggregate_value() const; + inline void clear_aggregate_value(); + static const int kAggregateValueFieldNumber = 8; + inline const ::std::string& aggregate_value() const; + inline void set_aggregate_value(const ::std::string& value); + inline void set_aggregate_value(const char* value); + inline void set_aggregate_value(const char* value, size_t size); + inline ::std::string* mutable_aggregate_value(); + inline ::std::string* release_aggregate_value(); + + // @@protoc_insertion_point(class_scope:google.protobuf.UninterpretedOption) + private: + inline void set_has_identifier_value(); + inline void clear_has_identifier_value(); + inline void set_has_positive_int_value(); + inline void clear_has_positive_int_value(); + inline void set_has_negative_int_value(); + inline void clear_has_negative_int_value(); + inline void set_has_double_value(); + inline void clear_has_double_value(); + inline void set_has_string_value(); + inline void clear_has_string_value(); + inline void set_has_aggregate_value(); + inline void clear_has_aggregate_value(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart > name_; + ::std::string* identifier_value_; + ::google::protobuf::uint64 positive_int_value_; + ::google::protobuf::int64 negative_int_value_; + double double_value_; + ::std::string* string_value_; + ::std::string* aggregate_value_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static UninterpretedOption* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Message { + public: + SourceCodeInfo_Location(); + virtual ~SourceCodeInfo_Location(); + + SourceCodeInfo_Location(const SourceCodeInfo_Location& from); + + inline SourceCodeInfo_Location& operator=(const SourceCodeInfo_Location& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SourceCodeInfo_Location& default_instance(); + + void Swap(SourceCodeInfo_Location* other); + + // implements Message ---------------------------------------------- + + SourceCodeInfo_Location* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SourceCodeInfo_Location& from); + void MergeFrom(const SourceCodeInfo_Location& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated int32 path = 1 [packed = true]; + inline int path_size() const; + inline void clear_path(); + static const int kPathFieldNumber = 1; + inline ::google::protobuf::int32 path(int index) const; + inline void set_path(int index, ::google::protobuf::int32 value); + inline void add_path(::google::protobuf::int32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + path() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_path(); + + // repeated int32 span = 2 [packed = true]; + inline int span_size() const; + inline void clear_span(); + static const int kSpanFieldNumber = 2; + inline ::google::protobuf::int32 span(int index) const; + inline void set_span(int index, ::google::protobuf::int32 value); + inline void add_span(::google::protobuf::int32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + span() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_span(); + + // @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo.Location) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_; + mutable int _path_cached_byte_size_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > span_; + mutable int _span_cached_byte_size_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static SourceCodeInfo_Location* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message { + public: + SourceCodeInfo(); + virtual ~SourceCodeInfo(); + + SourceCodeInfo(const SourceCodeInfo& from); + + inline SourceCodeInfo& operator=(const SourceCodeInfo& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SourceCodeInfo& default_instance(); + + void Swap(SourceCodeInfo* other); + + // implements Message ---------------------------------------------- + + SourceCodeInfo* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SourceCodeInfo& from); + void MergeFrom(const SourceCodeInfo& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef SourceCodeInfo_Location Location; + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + inline int location_size() const; + inline void clear_location(); + static const int kLocationFieldNumber = 1; + inline const ::google::protobuf::SourceCodeInfo_Location& location(int index) const; + inline ::google::protobuf::SourceCodeInfo_Location* mutable_location(int index); + inline ::google::protobuf::SourceCodeInfo_Location* add_location(); + inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >& + location() const; + inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >* + mutable_location(); + + // @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location > location_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static SourceCodeInfo* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// FileDescriptorSet + +// repeated .google.protobuf.FileDescriptorProto file = 1; +inline int FileDescriptorSet::file_size() const { + return file_.size(); +} +inline void FileDescriptorSet::clear_file() { + file_.Clear(); +} +inline const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const { + return file_.Get(index); +} +inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) { + return file_.Mutable(index); +} +inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() { + return file_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& +FileDescriptorSet::file() const { + return file_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* +FileDescriptorSet::mutable_file() { + return &file_; +} + +// ------------------------------------------------------------------- + +// FileDescriptorProto + +// optional string name = 1; +inline bool FileDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void FileDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void FileDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void FileDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& FileDescriptorProto::name() const { + return *name_; +} +inline void FileDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void FileDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void FileDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FileDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* FileDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string package = 2; +inline bool FileDescriptorProto::has_package() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void FileDescriptorProto::set_has_package() { + _has_bits_[0] |= 0x00000002u; +} +inline void FileDescriptorProto::clear_has_package() { + _has_bits_[0] &= ~0x00000002u; +} +inline void FileDescriptorProto::clear_package() { + if (package_ != &::google::protobuf::internal::kEmptyString) { + package_->clear(); + } + clear_has_package(); +} +inline const ::std::string& FileDescriptorProto::package() const { + return *package_; +} +inline void FileDescriptorProto::set_package(const ::std::string& value) { + set_has_package(); + if (package_ == &::google::protobuf::internal::kEmptyString) { + package_ = new ::std::string; + } + package_->assign(value); +} +inline void FileDescriptorProto::set_package(const char* value) { + set_has_package(); + if (package_ == &::google::protobuf::internal::kEmptyString) { + package_ = new ::std::string; + } + package_->assign(value); +} +inline void FileDescriptorProto::set_package(const char* value, size_t size) { + set_has_package(); + if (package_ == &::google::protobuf::internal::kEmptyString) { + package_ = new ::std::string; + } + package_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FileDescriptorProto::mutable_package() { + set_has_package(); + if (package_ == &::google::protobuf::internal::kEmptyString) { + package_ = new ::std::string; + } + return package_; +} +inline ::std::string* FileDescriptorProto::release_package() { + clear_has_package(); + if (package_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = package_; + package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated string dependency = 3; +inline int FileDescriptorProto::dependency_size() const { + return dependency_.size(); +} +inline void FileDescriptorProto::clear_dependency() { + dependency_.Clear(); +} +inline const ::std::string& FileDescriptorProto::dependency(int index) const { + return dependency_.Get(index); +} +inline ::std::string* FileDescriptorProto::mutable_dependency(int index) { + return dependency_.Mutable(index); +} +inline void FileDescriptorProto::set_dependency(int index, const ::std::string& value) { + dependency_.Mutable(index)->assign(value); +} +inline void FileDescriptorProto::set_dependency(int index, const char* value) { + dependency_.Mutable(index)->assign(value); +} +inline void FileDescriptorProto::set_dependency(int index, const char* value, size_t size) { + dependency_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* FileDescriptorProto::add_dependency() { + return dependency_.Add(); +} +inline void FileDescriptorProto::add_dependency(const ::std::string& value) { + dependency_.Add()->assign(value); +} +inline void FileDescriptorProto::add_dependency(const char* value) { + dependency_.Add()->assign(value); +} +inline void FileDescriptorProto::add_dependency(const char* value, size_t size) { + dependency_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +FileDescriptorProto::dependency() const { + return dependency_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +FileDescriptorProto::mutable_dependency() { + return &dependency_; +} + +// repeated .google.protobuf.DescriptorProto message_type = 4; +inline int FileDescriptorProto::message_type_size() const { + return message_type_.size(); +} +inline void FileDescriptorProto::clear_message_type() { + message_type_.Clear(); +} +inline const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_type(int index) const { + return message_type_.Get(index); +} +inline ::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) { + return message_type_.Mutable(index); +} +inline ::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() { + return message_type_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& +FileDescriptorProto::message_type() const { + return message_type_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* +FileDescriptorProto::mutable_message_type() { + return &message_type_; +} + +// repeated .google.protobuf.EnumDescriptorProto enum_type = 5; +inline int FileDescriptorProto::enum_type_size() const { + return enum_type_.size(); +} +inline void FileDescriptorProto::clear_enum_type() { + enum_type_.Clear(); +} +inline const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const { + return enum_type_.Get(index); +} +inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) { + return enum_type_.Mutable(index); +} +inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() { + return enum_type_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& +FileDescriptorProto::enum_type() const { + return enum_type_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* +FileDescriptorProto::mutable_enum_type() { + return &enum_type_; +} + +// repeated .google.protobuf.ServiceDescriptorProto service = 6; +inline int FileDescriptorProto::service_size() const { + return service_.size(); +} +inline void FileDescriptorProto::clear_service() { + service_.Clear(); +} +inline const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const { + return service_.Get(index); +} +inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) { + return service_.Mutable(index); +} +inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() { + return service_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >& +FileDescriptorProto::service() const { + return service_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >* +FileDescriptorProto::mutable_service() { + return &service_; +} + +// repeated .google.protobuf.FieldDescriptorProto extension = 7; +inline int FileDescriptorProto::extension_size() const { + return extension_.size(); +} +inline void FileDescriptorProto::clear_extension() { + extension_.Clear(); +} +inline const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const { + return extension_.Get(index); +} +inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) { + return extension_.Mutable(index); +} +inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() { + return extension_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& +FileDescriptorProto::extension() const { + return extension_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* +FileDescriptorProto::mutable_extension() { + return &extension_; +} + +// optional .google.protobuf.FileOptions options = 8; +inline bool FileDescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void FileDescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000080u; +} +inline void FileDescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000080u; +} +inline void FileDescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::FileOptions& FileDescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::FileOptions; + return options_; +} +inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::FileOptions* temp = options_; + options_ = NULL; + return temp; +} + +// optional .google.protobuf.SourceCodeInfo source_code_info = 9; +inline bool FileDescriptorProto::has_source_code_info() const { + return (_has_bits_[0] & 0x00000100u) != 0; +} +inline void FileDescriptorProto::set_has_source_code_info() { + _has_bits_[0] |= 0x00000100u; +} +inline void FileDescriptorProto::clear_has_source_code_info() { + _has_bits_[0] &= ~0x00000100u; +} +inline void FileDescriptorProto::clear_source_code_info() { + if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear(); + clear_has_source_code_info(); +} +inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const { + return source_code_info_ != NULL ? *source_code_info_ : *default_instance_->source_code_info_; +} +inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { + set_has_source_code_info(); + if (source_code_info_ == NULL) source_code_info_ = new ::google::protobuf::SourceCodeInfo; + return source_code_info_; +} +inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { + clear_has_source_code_info(); + ::google::protobuf::SourceCodeInfo* temp = source_code_info_; + source_code_info_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// DescriptorProto_ExtensionRange + +// optional int32 start = 1; +inline bool DescriptorProto_ExtensionRange::has_start() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void DescriptorProto_ExtensionRange::set_has_start() { + _has_bits_[0] |= 0x00000001u; +} +inline void DescriptorProto_ExtensionRange::clear_has_start() { + _has_bits_[0] &= ~0x00000001u; +} +inline void DescriptorProto_ExtensionRange::clear_start() { + start_ = 0; + clear_has_start(); +} +inline ::google::protobuf::int32 DescriptorProto_ExtensionRange::start() const { + return start_; +} +inline void DescriptorProto_ExtensionRange::set_start(::google::protobuf::int32 value) { + set_has_start(); + start_ = value; +} + +// optional int32 end = 2; +inline bool DescriptorProto_ExtensionRange::has_end() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void DescriptorProto_ExtensionRange::set_has_end() { + _has_bits_[0] |= 0x00000002u; +} +inline void DescriptorProto_ExtensionRange::clear_has_end() { + _has_bits_[0] &= ~0x00000002u; +} +inline void DescriptorProto_ExtensionRange::clear_end() { + end_ = 0; + clear_has_end(); +} +inline ::google::protobuf::int32 DescriptorProto_ExtensionRange::end() const { + return end_; +} +inline void DescriptorProto_ExtensionRange::set_end(::google::protobuf::int32 value) { + set_has_end(); + end_ = value; +} + +// ------------------------------------------------------------------- + +// DescriptorProto + +// optional string name = 1; +inline bool DescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void DescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void DescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void DescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& DescriptorProto::name() const { + return *name_; +} +inline void DescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void DescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void DescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* DescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* DescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .google.protobuf.FieldDescriptorProto field = 2; +inline int DescriptorProto::field_size() const { + return field_.size(); +} +inline void DescriptorProto::clear_field() { + field_.Clear(); +} +inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const { + return field_.Get(index); +} +inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) { + return field_.Mutable(index); +} +inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() { + return field_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& +DescriptorProto::field() const { + return field_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* +DescriptorProto::mutable_field() { + return &field_; +} + +// repeated .google.protobuf.FieldDescriptorProto extension = 6; +inline int DescriptorProto::extension_size() const { + return extension_.size(); +} +inline void DescriptorProto::clear_extension() { + extension_.Clear(); +} +inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const { + return extension_.Get(index); +} +inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) { + return extension_.Mutable(index); +} +inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() { + return extension_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& +DescriptorProto::extension() const { + return extension_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* +DescriptorProto::mutable_extension() { + return &extension_; +} + +// repeated .google.protobuf.DescriptorProto nested_type = 3; +inline int DescriptorProto::nested_type_size() const { + return nested_type_.size(); +} +inline void DescriptorProto::clear_nested_type() { + nested_type_.Clear(); +} +inline const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(int index) const { + return nested_type_.Get(index); +} +inline ::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) { + return nested_type_.Mutable(index); +} +inline ::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() { + return nested_type_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& +DescriptorProto::nested_type() const { + return nested_type_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* +DescriptorProto::mutable_nested_type() { + return &nested_type_; +} + +// repeated .google.protobuf.EnumDescriptorProto enum_type = 4; +inline int DescriptorProto::enum_type_size() const { + return enum_type_.size(); +} +inline void DescriptorProto::clear_enum_type() { + enum_type_.Clear(); +} +inline const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type(int index) const { + return enum_type_.Get(index); +} +inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) { + return enum_type_.Mutable(index); +} +inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() { + return enum_type_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& +DescriptorProto::enum_type() const { + return enum_type_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* +DescriptorProto::mutable_enum_type() { + return &enum_type_; +} + +// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; +inline int DescriptorProto::extension_range_size() const { + return extension_range_.size(); +} +inline void DescriptorProto::clear_extension_range() { + extension_range_.Clear(); +} +inline const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const { + return extension_range_.Get(index); +} +inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) { + return extension_range_.Mutable(index); +} +inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() { + return extension_range_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >& +DescriptorProto::extension_range() const { + return extension_range_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >* +DescriptorProto::mutable_extension_range() { + return &extension_range_; +} + +// optional .google.protobuf.MessageOptions options = 7; +inline bool DescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void DescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000040u; +} +inline void DescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000040u; +} +inline void DescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::MessageOptions& DescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::MessageOptions; + return options_; +} +inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::MessageOptions* temp = options_; + options_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// FieldDescriptorProto + +// optional string name = 1; +inline bool FieldDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void FieldDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void FieldDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void FieldDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& FieldDescriptorProto::name() const { + return *name_; +} +inline void FieldDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void FieldDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void FieldDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FieldDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* FieldDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional int32 number = 3; +inline bool FieldDescriptorProto::has_number() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void FieldDescriptorProto::set_has_number() { + _has_bits_[0] |= 0x00000002u; +} +inline void FieldDescriptorProto::clear_has_number() { + _has_bits_[0] &= ~0x00000002u; +} +inline void FieldDescriptorProto::clear_number() { + number_ = 0; + clear_has_number(); +} +inline ::google::protobuf::int32 FieldDescriptorProto::number() const { + return number_; +} +inline void FieldDescriptorProto::set_number(::google::protobuf::int32 value) { + set_has_number(); + number_ = value; +} + +// optional .google.protobuf.FieldDescriptorProto.Label label = 4; +inline bool FieldDescriptorProto::has_label() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void FieldDescriptorProto::set_has_label() { + _has_bits_[0] |= 0x00000004u; +} +inline void FieldDescriptorProto::clear_has_label() { + _has_bits_[0] &= ~0x00000004u; +} +inline void FieldDescriptorProto::clear_label() { + label_ = 1; + clear_has_label(); +} +inline ::google::protobuf::FieldDescriptorProto_Label FieldDescriptorProto::label() const { + return static_cast< ::google::protobuf::FieldDescriptorProto_Label >(label_); +} +inline void FieldDescriptorProto::set_label(::google::protobuf::FieldDescriptorProto_Label value) { + GOOGLE_DCHECK(::google::protobuf::FieldDescriptorProto_Label_IsValid(value)); + set_has_label(); + label_ = value; +} + +// optional .google.protobuf.FieldDescriptorProto.Type type = 5; +inline bool FieldDescriptorProto::has_type() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void FieldDescriptorProto::set_has_type() { + _has_bits_[0] |= 0x00000008u; +} +inline void FieldDescriptorProto::clear_has_type() { + _has_bits_[0] &= ~0x00000008u; +} +inline void FieldDescriptorProto::clear_type() { + type_ = 1; + clear_has_type(); +} +inline ::google::protobuf::FieldDescriptorProto_Type FieldDescriptorProto::type() const { + return static_cast< ::google::protobuf::FieldDescriptorProto_Type >(type_); +} +inline void FieldDescriptorProto::set_type(::google::protobuf::FieldDescriptorProto_Type value) { + GOOGLE_DCHECK(::google::protobuf::FieldDescriptorProto_Type_IsValid(value)); + set_has_type(); + type_ = value; +} + +// optional string type_name = 6; +inline bool FieldDescriptorProto::has_type_name() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void FieldDescriptorProto::set_has_type_name() { + _has_bits_[0] |= 0x00000010u; +} +inline void FieldDescriptorProto::clear_has_type_name() { + _has_bits_[0] &= ~0x00000010u; +} +inline void FieldDescriptorProto::clear_type_name() { + if (type_name_ != &::google::protobuf::internal::kEmptyString) { + type_name_->clear(); + } + clear_has_type_name(); +} +inline const ::std::string& FieldDescriptorProto::type_name() const { + return *type_name_; +} +inline void FieldDescriptorProto::set_type_name(const ::std::string& value) { + set_has_type_name(); + if (type_name_ == &::google::protobuf::internal::kEmptyString) { + type_name_ = new ::std::string; + } + type_name_->assign(value); +} +inline void FieldDescriptorProto::set_type_name(const char* value) { + set_has_type_name(); + if (type_name_ == &::google::protobuf::internal::kEmptyString) { + type_name_ = new ::std::string; + } + type_name_->assign(value); +} +inline void FieldDescriptorProto::set_type_name(const char* value, size_t size) { + set_has_type_name(); + if (type_name_ == &::google::protobuf::internal::kEmptyString) { + type_name_ = new ::std::string; + } + type_name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FieldDescriptorProto::mutable_type_name() { + set_has_type_name(); + if (type_name_ == &::google::protobuf::internal::kEmptyString) { + type_name_ = new ::std::string; + } + return type_name_; +} +inline ::std::string* FieldDescriptorProto::release_type_name() { + clear_has_type_name(); + if (type_name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = type_name_; + type_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string extendee = 2; +inline bool FieldDescriptorProto::has_extendee() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void FieldDescriptorProto::set_has_extendee() { + _has_bits_[0] |= 0x00000020u; +} +inline void FieldDescriptorProto::clear_has_extendee() { + _has_bits_[0] &= ~0x00000020u; +} +inline void FieldDescriptorProto::clear_extendee() { + if (extendee_ != &::google::protobuf::internal::kEmptyString) { + extendee_->clear(); + } + clear_has_extendee(); +} +inline const ::std::string& FieldDescriptorProto::extendee() const { + return *extendee_; +} +inline void FieldDescriptorProto::set_extendee(const ::std::string& value) { + set_has_extendee(); + if (extendee_ == &::google::protobuf::internal::kEmptyString) { + extendee_ = new ::std::string; + } + extendee_->assign(value); +} +inline void FieldDescriptorProto::set_extendee(const char* value) { + set_has_extendee(); + if (extendee_ == &::google::protobuf::internal::kEmptyString) { + extendee_ = new ::std::string; + } + extendee_->assign(value); +} +inline void FieldDescriptorProto::set_extendee(const char* value, size_t size) { + set_has_extendee(); + if (extendee_ == &::google::protobuf::internal::kEmptyString) { + extendee_ = new ::std::string; + } + extendee_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FieldDescriptorProto::mutable_extendee() { + set_has_extendee(); + if (extendee_ == &::google::protobuf::internal::kEmptyString) { + extendee_ = new ::std::string; + } + return extendee_; +} +inline ::std::string* FieldDescriptorProto::release_extendee() { + clear_has_extendee(); + if (extendee_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = extendee_; + extendee_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string default_value = 7; +inline bool FieldDescriptorProto::has_default_value() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void FieldDescriptorProto::set_has_default_value() { + _has_bits_[0] |= 0x00000040u; +} +inline void FieldDescriptorProto::clear_has_default_value() { + _has_bits_[0] &= ~0x00000040u; +} +inline void FieldDescriptorProto::clear_default_value() { + if (default_value_ != &::google::protobuf::internal::kEmptyString) { + default_value_->clear(); + } + clear_has_default_value(); +} +inline const ::std::string& FieldDescriptorProto::default_value() const { + return *default_value_; +} +inline void FieldDescriptorProto::set_default_value(const ::std::string& value) { + set_has_default_value(); + if (default_value_ == &::google::protobuf::internal::kEmptyString) { + default_value_ = new ::std::string; + } + default_value_->assign(value); +} +inline void FieldDescriptorProto::set_default_value(const char* value) { + set_has_default_value(); + if (default_value_ == &::google::protobuf::internal::kEmptyString) { + default_value_ = new ::std::string; + } + default_value_->assign(value); +} +inline void FieldDescriptorProto::set_default_value(const char* value, size_t size) { + set_has_default_value(); + if (default_value_ == &::google::protobuf::internal::kEmptyString) { + default_value_ = new ::std::string; + } + default_value_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FieldDescriptorProto::mutable_default_value() { + set_has_default_value(); + if (default_value_ == &::google::protobuf::internal::kEmptyString) { + default_value_ = new ::std::string; + } + return default_value_; +} +inline ::std::string* FieldDescriptorProto::release_default_value() { + clear_has_default_value(); + if (default_value_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = default_value_; + default_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional .google.protobuf.FieldOptions options = 8; +inline bool FieldDescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void FieldDescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000080u; +} +inline void FieldDescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000080u; +} +inline void FieldDescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::FieldOptions; + return options_; +} +inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::FieldOptions* temp = options_; + options_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// EnumDescriptorProto + +// optional string name = 1; +inline bool EnumDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void EnumDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void EnumDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void EnumDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& EnumDescriptorProto::name() const { + return *name_; +} +inline void EnumDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void EnumDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void EnumDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* EnumDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* EnumDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .google.protobuf.EnumValueDescriptorProto value = 2; +inline int EnumDescriptorProto::value_size() const { + return value_.size(); +} +inline void EnumDescriptorProto::clear_value() { + value_.Clear(); +} +inline const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const { + return value_.Get(index); +} +inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) { + return value_.Mutable(index); +} +inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() { + return value_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >& +EnumDescriptorProto::value() const { + return value_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >* +EnumDescriptorProto::mutable_value() { + return &value_; +} + +// optional .google.protobuf.EnumOptions options = 3; +inline bool EnumDescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void EnumDescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000004u; +} +inline void EnumDescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000004u; +} +inline void EnumDescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::EnumOptions; + return options_; +} +inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::EnumOptions* temp = options_; + options_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// EnumValueDescriptorProto + +// optional string name = 1; +inline bool EnumValueDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void EnumValueDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void EnumValueDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void EnumValueDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& EnumValueDescriptorProto::name() const { + return *name_; +} +inline void EnumValueDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void EnumValueDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void EnumValueDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* EnumValueDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* EnumValueDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional int32 number = 2; +inline bool EnumValueDescriptorProto::has_number() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void EnumValueDescriptorProto::set_has_number() { + _has_bits_[0] |= 0x00000002u; +} +inline void EnumValueDescriptorProto::clear_has_number() { + _has_bits_[0] &= ~0x00000002u; +} +inline void EnumValueDescriptorProto::clear_number() { + number_ = 0; + clear_has_number(); +} +inline ::google::protobuf::int32 EnumValueDescriptorProto::number() const { + return number_; +} +inline void EnumValueDescriptorProto::set_number(::google::protobuf::int32 value) { + set_has_number(); + number_ = value; +} + +// optional .google.protobuf.EnumValueOptions options = 3; +inline bool EnumValueDescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void EnumValueDescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000004u; +} +inline void EnumValueDescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000004u; +} +inline void EnumValueDescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::EnumValueOptions; + return options_; +} +inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::EnumValueOptions* temp = options_; + options_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// ServiceDescriptorProto + +// optional string name = 1; +inline bool ServiceDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ServiceDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void ServiceDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ServiceDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& ServiceDescriptorProto::name() const { + return *name_; +} +inline void ServiceDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ServiceDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ServiceDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ServiceDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* ServiceDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .google.protobuf.MethodDescriptorProto method = 2; +inline int ServiceDescriptorProto::method_size() const { + return method_.size(); +} +inline void ServiceDescriptorProto::clear_method() { + method_.Clear(); +} +inline const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const { + return method_.Get(index); +} +inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) { + return method_.Mutable(index); +} +inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() { + return method_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >& +ServiceDescriptorProto::method() const { + return method_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >* +ServiceDescriptorProto::mutable_method() { + return &method_; +} + +// optional .google.protobuf.ServiceOptions options = 3; +inline bool ServiceDescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ServiceDescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000004u; +} +inline void ServiceDescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ServiceDescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::ServiceOptions; + return options_; +} +inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::ServiceOptions* temp = options_; + options_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// MethodDescriptorProto + +// optional string name = 1; +inline bool MethodDescriptorProto::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void MethodDescriptorProto::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void MethodDescriptorProto::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void MethodDescriptorProto::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& MethodDescriptorProto::name() const { + return *name_; +} +inline void MethodDescriptorProto::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void MethodDescriptorProto::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void MethodDescriptorProto::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* MethodDescriptorProto::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* MethodDescriptorProto::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string input_type = 2; +inline bool MethodDescriptorProto::has_input_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void MethodDescriptorProto::set_has_input_type() { + _has_bits_[0] |= 0x00000002u; +} +inline void MethodDescriptorProto::clear_has_input_type() { + _has_bits_[0] &= ~0x00000002u; +} +inline void MethodDescriptorProto::clear_input_type() { + if (input_type_ != &::google::protobuf::internal::kEmptyString) { + input_type_->clear(); + } + clear_has_input_type(); +} +inline const ::std::string& MethodDescriptorProto::input_type() const { + return *input_type_; +} +inline void MethodDescriptorProto::set_input_type(const ::std::string& value) { + set_has_input_type(); + if (input_type_ == &::google::protobuf::internal::kEmptyString) { + input_type_ = new ::std::string; + } + input_type_->assign(value); +} +inline void MethodDescriptorProto::set_input_type(const char* value) { + set_has_input_type(); + if (input_type_ == &::google::protobuf::internal::kEmptyString) { + input_type_ = new ::std::string; + } + input_type_->assign(value); +} +inline void MethodDescriptorProto::set_input_type(const char* value, size_t size) { + set_has_input_type(); + if (input_type_ == &::google::protobuf::internal::kEmptyString) { + input_type_ = new ::std::string; + } + input_type_->assign(reinterpret_cast(value), size); +} +inline ::std::string* MethodDescriptorProto::mutable_input_type() { + set_has_input_type(); + if (input_type_ == &::google::protobuf::internal::kEmptyString) { + input_type_ = new ::std::string; + } + return input_type_; +} +inline ::std::string* MethodDescriptorProto::release_input_type() { + clear_has_input_type(); + if (input_type_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = input_type_; + input_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string output_type = 3; +inline bool MethodDescriptorProto::has_output_type() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void MethodDescriptorProto::set_has_output_type() { + _has_bits_[0] |= 0x00000004u; +} +inline void MethodDescriptorProto::clear_has_output_type() { + _has_bits_[0] &= ~0x00000004u; +} +inline void MethodDescriptorProto::clear_output_type() { + if (output_type_ != &::google::protobuf::internal::kEmptyString) { + output_type_->clear(); + } + clear_has_output_type(); +} +inline const ::std::string& MethodDescriptorProto::output_type() const { + return *output_type_; +} +inline void MethodDescriptorProto::set_output_type(const ::std::string& value) { + set_has_output_type(); + if (output_type_ == &::google::protobuf::internal::kEmptyString) { + output_type_ = new ::std::string; + } + output_type_->assign(value); +} +inline void MethodDescriptorProto::set_output_type(const char* value) { + set_has_output_type(); + if (output_type_ == &::google::protobuf::internal::kEmptyString) { + output_type_ = new ::std::string; + } + output_type_->assign(value); +} +inline void MethodDescriptorProto::set_output_type(const char* value, size_t size) { + set_has_output_type(); + if (output_type_ == &::google::protobuf::internal::kEmptyString) { + output_type_ = new ::std::string; + } + output_type_->assign(reinterpret_cast(value), size); +} +inline ::std::string* MethodDescriptorProto::mutable_output_type() { + set_has_output_type(); + if (output_type_ == &::google::protobuf::internal::kEmptyString) { + output_type_ = new ::std::string; + } + return output_type_; +} +inline ::std::string* MethodDescriptorProto::release_output_type() { + clear_has_output_type(); + if (output_type_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = output_type_; + output_type_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional .google.protobuf.MethodOptions options = 4; +inline bool MethodDescriptorProto::has_options() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void MethodDescriptorProto::set_has_options() { + _has_bits_[0] |= 0x00000008u; +} +inline void MethodDescriptorProto::clear_has_options() { + _has_bits_[0] &= ~0x00000008u; +} +inline void MethodDescriptorProto::clear_options() { + if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear(); + clear_has_options(); +} +inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const { + return options_ != NULL ? *options_ : *default_instance_->options_; +} +inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) options_ = new ::google::protobuf::MethodOptions; + return options_; +} +inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() { + clear_has_options(); + ::google::protobuf::MethodOptions* temp = options_; + options_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// FileOptions + +// optional string java_package = 1; +inline bool FileOptions::has_java_package() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void FileOptions::set_has_java_package() { + _has_bits_[0] |= 0x00000001u; +} +inline void FileOptions::clear_has_java_package() { + _has_bits_[0] &= ~0x00000001u; +} +inline void FileOptions::clear_java_package() { + if (java_package_ != &::google::protobuf::internal::kEmptyString) { + java_package_->clear(); + } + clear_has_java_package(); +} +inline const ::std::string& FileOptions::java_package() const { + return *java_package_; +} +inline void FileOptions::set_java_package(const ::std::string& value) { + set_has_java_package(); + if (java_package_ == &::google::protobuf::internal::kEmptyString) { + java_package_ = new ::std::string; + } + java_package_->assign(value); +} +inline void FileOptions::set_java_package(const char* value) { + set_has_java_package(); + if (java_package_ == &::google::protobuf::internal::kEmptyString) { + java_package_ = new ::std::string; + } + java_package_->assign(value); +} +inline void FileOptions::set_java_package(const char* value, size_t size) { + set_has_java_package(); + if (java_package_ == &::google::protobuf::internal::kEmptyString) { + java_package_ = new ::std::string; + } + java_package_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FileOptions::mutable_java_package() { + set_has_java_package(); + if (java_package_ == &::google::protobuf::internal::kEmptyString) { + java_package_ = new ::std::string; + } + return java_package_; +} +inline ::std::string* FileOptions::release_java_package() { + clear_has_java_package(); + if (java_package_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = java_package_; + java_package_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string java_outer_classname = 8; +inline bool FileOptions::has_java_outer_classname() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void FileOptions::set_has_java_outer_classname() { + _has_bits_[0] |= 0x00000002u; +} +inline void FileOptions::clear_has_java_outer_classname() { + _has_bits_[0] &= ~0x00000002u; +} +inline void FileOptions::clear_java_outer_classname() { + if (java_outer_classname_ != &::google::protobuf::internal::kEmptyString) { + java_outer_classname_->clear(); + } + clear_has_java_outer_classname(); +} +inline const ::std::string& FileOptions::java_outer_classname() const { + return *java_outer_classname_; +} +inline void FileOptions::set_java_outer_classname(const ::std::string& value) { + set_has_java_outer_classname(); + if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + java_outer_classname_ = new ::std::string; + } + java_outer_classname_->assign(value); +} +inline void FileOptions::set_java_outer_classname(const char* value) { + set_has_java_outer_classname(); + if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + java_outer_classname_ = new ::std::string; + } + java_outer_classname_->assign(value); +} +inline void FileOptions::set_java_outer_classname(const char* value, size_t size) { + set_has_java_outer_classname(); + if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + java_outer_classname_ = new ::std::string; + } + java_outer_classname_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FileOptions::mutable_java_outer_classname() { + set_has_java_outer_classname(); + if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + java_outer_classname_ = new ::std::string; + } + return java_outer_classname_; +} +inline ::std::string* FileOptions::release_java_outer_classname() { + clear_has_java_outer_classname(); + if (java_outer_classname_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = java_outer_classname_; + java_outer_classname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bool java_multiple_files = 10 [default = false]; +inline bool FileOptions::has_java_multiple_files() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void FileOptions::set_has_java_multiple_files() { + _has_bits_[0] |= 0x00000004u; +} +inline void FileOptions::clear_has_java_multiple_files() { + _has_bits_[0] &= ~0x00000004u; +} +inline void FileOptions::clear_java_multiple_files() { + java_multiple_files_ = false; + clear_has_java_multiple_files(); +} +inline bool FileOptions::java_multiple_files() const { + return java_multiple_files_; +} +inline void FileOptions::set_java_multiple_files(bool value) { + set_has_java_multiple_files(); + java_multiple_files_ = value; +} + +// optional bool java_generate_equals_and_hash = 20 [default = false]; +inline bool FileOptions::has_java_generate_equals_and_hash() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void FileOptions::set_has_java_generate_equals_and_hash() { + _has_bits_[0] |= 0x00000008u; +} +inline void FileOptions::clear_has_java_generate_equals_and_hash() { + _has_bits_[0] &= ~0x00000008u; +} +inline void FileOptions::clear_java_generate_equals_and_hash() { + java_generate_equals_and_hash_ = false; + clear_has_java_generate_equals_and_hash(); +} +inline bool FileOptions::java_generate_equals_and_hash() const { + return java_generate_equals_and_hash_; +} +inline void FileOptions::set_java_generate_equals_and_hash(bool value) { + set_has_java_generate_equals_and_hash(); + java_generate_equals_and_hash_ = value; +} + +// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; +inline bool FileOptions::has_optimize_for() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void FileOptions::set_has_optimize_for() { + _has_bits_[0] |= 0x00000010u; +} +inline void FileOptions::clear_has_optimize_for() { + _has_bits_[0] &= ~0x00000010u; +} +inline void FileOptions::clear_optimize_for() { + optimize_for_ = 1; + clear_has_optimize_for(); +} +inline ::google::protobuf::FileOptions_OptimizeMode FileOptions::optimize_for() const { + return static_cast< ::google::protobuf::FileOptions_OptimizeMode >(optimize_for_); +} +inline void FileOptions::set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) { + GOOGLE_DCHECK(::google::protobuf::FileOptions_OptimizeMode_IsValid(value)); + set_has_optimize_for(); + optimize_for_ = value; +} + +// optional bool cc_generic_services = 16 [default = false]; +inline bool FileOptions::has_cc_generic_services() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void FileOptions::set_has_cc_generic_services() { + _has_bits_[0] |= 0x00000020u; +} +inline void FileOptions::clear_has_cc_generic_services() { + _has_bits_[0] &= ~0x00000020u; +} +inline void FileOptions::clear_cc_generic_services() { + cc_generic_services_ = false; + clear_has_cc_generic_services(); +} +inline bool FileOptions::cc_generic_services() const { + return cc_generic_services_; +} +inline void FileOptions::set_cc_generic_services(bool value) { + set_has_cc_generic_services(); + cc_generic_services_ = value; +} + +// optional bool java_generic_services = 17 [default = false]; +inline bool FileOptions::has_java_generic_services() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void FileOptions::set_has_java_generic_services() { + _has_bits_[0] |= 0x00000040u; +} +inline void FileOptions::clear_has_java_generic_services() { + _has_bits_[0] &= ~0x00000040u; +} +inline void FileOptions::clear_java_generic_services() { + java_generic_services_ = false; + clear_has_java_generic_services(); +} +inline bool FileOptions::java_generic_services() const { + return java_generic_services_; +} +inline void FileOptions::set_java_generic_services(bool value) { + set_has_java_generic_services(); + java_generic_services_ = value; +} + +// optional bool py_generic_services = 18 [default = false]; +inline bool FileOptions::has_py_generic_services() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void FileOptions::set_has_py_generic_services() { + _has_bits_[0] |= 0x00000080u; +} +inline void FileOptions::clear_has_py_generic_services() { + _has_bits_[0] &= ~0x00000080u; +} +inline void FileOptions::clear_py_generic_services() { + py_generic_services_ = false; + clear_has_py_generic_services(); +} +inline bool FileOptions::py_generic_services() const { + return py_generic_services_; +} +inline void FileOptions::set_py_generic_services(bool value) { + set_has_py_generic_services(); + py_generic_services_ = value; +} + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int FileOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void FileOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +FileOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +FileOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// MessageOptions + +// optional bool message_set_wire_format = 1 [default = false]; +inline bool MessageOptions::has_message_set_wire_format() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void MessageOptions::set_has_message_set_wire_format() { + _has_bits_[0] |= 0x00000001u; +} +inline void MessageOptions::clear_has_message_set_wire_format() { + _has_bits_[0] &= ~0x00000001u; +} +inline void MessageOptions::clear_message_set_wire_format() { + message_set_wire_format_ = false; + clear_has_message_set_wire_format(); +} +inline bool MessageOptions::message_set_wire_format() const { + return message_set_wire_format_; +} +inline void MessageOptions::set_message_set_wire_format(bool value) { + set_has_message_set_wire_format(); + message_set_wire_format_ = value; +} + +// optional bool no_standard_descriptor_accessor = 2 [default = false]; +inline bool MessageOptions::has_no_standard_descriptor_accessor() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void MessageOptions::set_has_no_standard_descriptor_accessor() { + _has_bits_[0] |= 0x00000002u; +} +inline void MessageOptions::clear_has_no_standard_descriptor_accessor() { + _has_bits_[0] &= ~0x00000002u; +} +inline void MessageOptions::clear_no_standard_descriptor_accessor() { + no_standard_descriptor_accessor_ = false; + clear_has_no_standard_descriptor_accessor(); +} +inline bool MessageOptions::no_standard_descriptor_accessor() const { + return no_standard_descriptor_accessor_; +} +inline void MessageOptions::set_no_standard_descriptor_accessor(bool value) { + set_has_no_standard_descriptor_accessor(); + no_standard_descriptor_accessor_ = value; +} + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int MessageOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void MessageOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +MessageOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +MessageOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// FieldOptions + +// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; +inline bool FieldOptions::has_ctype() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void FieldOptions::set_has_ctype() { + _has_bits_[0] |= 0x00000001u; +} +inline void FieldOptions::clear_has_ctype() { + _has_bits_[0] &= ~0x00000001u; +} +inline void FieldOptions::clear_ctype() { + ctype_ = 0; + clear_has_ctype(); +} +inline ::google::protobuf::FieldOptions_CType FieldOptions::ctype() const { + return static_cast< ::google::protobuf::FieldOptions_CType >(ctype_); +} +inline void FieldOptions::set_ctype(::google::protobuf::FieldOptions_CType value) { + GOOGLE_DCHECK(::google::protobuf::FieldOptions_CType_IsValid(value)); + set_has_ctype(); + ctype_ = value; +} + +// optional bool packed = 2; +inline bool FieldOptions::has_packed() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void FieldOptions::set_has_packed() { + _has_bits_[0] |= 0x00000002u; +} +inline void FieldOptions::clear_has_packed() { + _has_bits_[0] &= ~0x00000002u; +} +inline void FieldOptions::clear_packed() { + packed_ = false; + clear_has_packed(); +} +inline bool FieldOptions::packed() const { + return packed_; +} +inline void FieldOptions::set_packed(bool value) { + set_has_packed(); + packed_ = value; +} + +// optional bool deprecated = 3 [default = false]; +inline bool FieldOptions::has_deprecated() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void FieldOptions::set_has_deprecated() { + _has_bits_[0] |= 0x00000004u; +} +inline void FieldOptions::clear_has_deprecated() { + _has_bits_[0] &= ~0x00000004u; +} +inline void FieldOptions::clear_deprecated() { + deprecated_ = false; + clear_has_deprecated(); +} +inline bool FieldOptions::deprecated() const { + return deprecated_; +} +inline void FieldOptions::set_deprecated(bool value) { + set_has_deprecated(); + deprecated_ = value; +} + +// optional string experimental_map_key = 9; +inline bool FieldOptions::has_experimental_map_key() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void FieldOptions::set_has_experimental_map_key() { + _has_bits_[0] |= 0x00000008u; +} +inline void FieldOptions::clear_has_experimental_map_key() { + _has_bits_[0] &= ~0x00000008u; +} +inline void FieldOptions::clear_experimental_map_key() { + if (experimental_map_key_ != &::google::protobuf::internal::kEmptyString) { + experimental_map_key_->clear(); + } + clear_has_experimental_map_key(); +} +inline const ::std::string& FieldOptions::experimental_map_key() const { + return *experimental_map_key_; +} +inline void FieldOptions::set_experimental_map_key(const ::std::string& value) { + set_has_experimental_map_key(); + if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + experimental_map_key_ = new ::std::string; + } + experimental_map_key_->assign(value); +} +inline void FieldOptions::set_experimental_map_key(const char* value) { + set_has_experimental_map_key(); + if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + experimental_map_key_ = new ::std::string; + } + experimental_map_key_->assign(value); +} +inline void FieldOptions::set_experimental_map_key(const char* value, size_t size) { + set_has_experimental_map_key(); + if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + experimental_map_key_ = new ::std::string; + } + experimental_map_key_->assign(reinterpret_cast(value), size); +} +inline ::std::string* FieldOptions::mutable_experimental_map_key() { + set_has_experimental_map_key(); + if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + experimental_map_key_ = new ::std::string; + } + return experimental_map_key_; +} +inline ::std::string* FieldOptions::release_experimental_map_key() { + clear_has_experimental_map_key(); + if (experimental_map_key_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = experimental_map_key_; + experimental_map_key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int FieldOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void FieldOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +FieldOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +FieldOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// EnumOptions + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int EnumOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void EnumOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +EnumOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +EnumOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// EnumValueOptions + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int EnumValueOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void EnumValueOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +EnumValueOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +EnumValueOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// ServiceOptions + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int ServiceOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void ServiceOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +ServiceOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +ServiceOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// MethodOptions + +// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; +inline int MethodOptions::uninterpreted_option_size() const { + return uninterpreted_option_.size(); +} +inline void MethodOptions::clear_uninterpreted_option() { + uninterpreted_option_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} +inline ::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) { + return uninterpreted_option_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() { + return uninterpreted_option_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& +MethodOptions::uninterpreted_option() const { + return uninterpreted_option_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* +MethodOptions::mutable_uninterpreted_option() { + return &uninterpreted_option_; +} + +// ------------------------------------------------------------------- + +// UninterpretedOption_NamePart + +// required string name_part = 1; +inline bool UninterpretedOption_NamePart::has_name_part() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void UninterpretedOption_NamePart::set_has_name_part() { + _has_bits_[0] |= 0x00000001u; +} +inline void UninterpretedOption_NamePart::clear_has_name_part() { + _has_bits_[0] &= ~0x00000001u; +} +inline void UninterpretedOption_NamePart::clear_name_part() { + if (name_part_ != &::google::protobuf::internal::kEmptyString) { + name_part_->clear(); + } + clear_has_name_part(); +} +inline const ::std::string& UninterpretedOption_NamePart::name_part() const { + return *name_part_; +} +inline void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) { + set_has_name_part(); + if (name_part_ == &::google::protobuf::internal::kEmptyString) { + name_part_ = new ::std::string; + } + name_part_->assign(value); +} +inline void UninterpretedOption_NamePart::set_name_part(const char* value) { + set_has_name_part(); + if (name_part_ == &::google::protobuf::internal::kEmptyString) { + name_part_ = new ::std::string; + } + name_part_->assign(value); +} +inline void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) { + set_has_name_part(); + if (name_part_ == &::google::protobuf::internal::kEmptyString) { + name_part_ = new ::std::string; + } + name_part_->assign(reinterpret_cast(value), size); +} +inline ::std::string* UninterpretedOption_NamePart::mutable_name_part() { + set_has_name_part(); + if (name_part_ == &::google::protobuf::internal::kEmptyString) { + name_part_ = new ::std::string; + } + return name_part_; +} +inline ::std::string* UninterpretedOption_NamePart::release_name_part() { + clear_has_name_part(); + if (name_part_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_part_; + name_part_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required bool is_extension = 2; +inline bool UninterpretedOption_NamePart::has_is_extension() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void UninterpretedOption_NamePart::set_has_is_extension() { + _has_bits_[0] |= 0x00000002u; +} +inline void UninterpretedOption_NamePart::clear_has_is_extension() { + _has_bits_[0] &= ~0x00000002u; +} +inline void UninterpretedOption_NamePart::clear_is_extension() { + is_extension_ = false; + clear_has_is_extension(); +} +inline bool UninterpretedOption_NamePart::is_extension() const { + return is_extension_; +} +inline void UninterpretedOption_NamePart::set_is_extension(bool value) { + set_has_is_extension(); + is_extension_ = value; +} + +// ------------------------------------------------------------------- + +// UninterpretedOption + +// repeated .google.protobuf.UninterpretedOption.NamePart name = 2; +inline int UninterpretedOption::name_size() const { + return name_.size(); +} +inline void UninterpretedOption::clear_name() { + name_.Clear(); +} +inline const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const { + return name_.Get(index); +} +inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) { + return name_.Mutable(index); +} +inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() { + return name_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >& +UninterpretedOption::name() const { + return name_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >* +UninterpretedOption::mutable_name() { + return &name_; +} + +// optional string identifier_value = 3; +inline bool UninterpretedOption::has_identifier_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void UninterpretedOption::set_has_identifier_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void UninterpretedOption::clear_has_identifier_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void UninterpretedOption::clear_identifier_value() { + if (identifier_value_ != &::google::protobuf::internal::kEmptyString) { + identifier_value_->clear(); + } + clear_has_identifier_value(); +} +inline const ::std::string& UninterpretedOption::identifier_value() const { + return *identifier_value_; +} +inline void UninterpretedOption::set_identifier_value(const ::std::string& value) { + set_has_identifier_value(); + if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + identifier_value_ = new ::std::string; + } + identifier_value_->assign(value); +} +inline void UninterpretedOption::set_identifier_value(const char* value) { + set_has_identifier_value(); + if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + identifier_value_ = new ::std::string; + } + identifier_value_->assign(value); +} +inline void UninterpretedOption::set_identifier_value(const char* value, size_t size) { + set_has_identifier_value(); + if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + identifier_value_ = new ::std::string; + } + identifier_value_->assign(reinterpret_cast(value), size); +} +inline ::std::string* UninterpretedOption::mutable_identifier_value() { + set_has_identifier_value(); + if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + identifier_value_ = new ::std::string; + } + return identifier_value_; +} +inline ::std::string* UninterpretedOption::release_identifier_value() { + clear_has_identifier_value(); + if (identifier_value_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = identifier_value_; + identifier_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional uint64 positive_int_value = 4; +inline bool UninterpretedOption::has_positive_int_value() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void UninterpretedOption::set_has_positive_int_value() { + _has_bits_[0] |= 0x00000004u; +} +inline void UninterpretedOption::clear_has_positive_int_value() { + _has_bits_[0] &= ~0x00000004u; +} +inline void UninterpretedOption::clear_positive_int_value() { + positive_int_value_ = GOOGLE_ULONGLONG(0); + clear_has_positive_int_value(); +} +inline ::google::protobuf::uint64 UninterpretedOption::positive_int_value() const { + return positive_int_value_; +} +inline void UninterpretedOption::set_positive_int_value(::google::protobuf::uint64 value) { + set_has_positive_int_value(); + positive_int_value_ = value; +} + +// optional int64 negative_int_value = 5; +inline bool UninterpretedOption::has_negative_int_value() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void UninterpretedOption::set_has_negative_int_value() { + _has_bits_[0] |= 0x00000008u; +} +inline void UninterpretedOption::clear_has_negative_int_value() { + _has_bits_[0] &= ~0x00000008u; +} +inline void UninterpretedOption::clear_negative_int_value() { + negative_int_value_ = GOOGLE_LONGLONG(0); + clear_has_negative_int_value(); +} +inline ::google::protobuf::int64 UninterpretedOption::negative_int_value() const { + return negative_int_value_; +} +inline void UninterpretedOption::set_negative_int_value(::google::protobuf::int64 value) { + set_has_negative_int_value(); + negative_int_value_ = value; +} + +// optional double double_value = 6; +inline bool UninterpretedOption::has_double_value() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void UninterpretedOption::set_has_double_value() { + _has_bits_[0] |= 0x00000010u; +} +inline void UninterpretedOption::clear_has_double_value() { + _has_bits_[0] &= ~0x00000010u; +} +inline void UninterpretedOption::clear_double_value() { + double_value_ = 0; + clear_has_double_value(); +} +inline double UninterpretedOption::double_value() const { + return double_value_; +} +inline void UninterpretedOption::set_double_value(double value) { + set_has_double_value(); + double_value_ = value; +} + +// optional bytes string_value = 7; +inline bool UninterpretedOption::has_string_value() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void UninterpretedOption::set_has_string_value() { + _has_bits_[0] |= 0x00000020u; +} +inline void UninterpretedOption::clear_has_string_value() { + _has_bits_[0] &= ~0x00000020u; +} +inline void UninterpretedOption::clear_string_value() { + if (string_value_ != &::google::protobuf::internal::kEmptyString) { + string_value_->clear(); + } + clear_has_string_value(); +} +inline const ::std::string& UninterpretedOption::string_value() const { + return *string_value_; +} +inline void UninterpretedOption::set_string_value(const ::std::string& value) { + set_has_string_value(); + if (string_value_ == &::google::protobuf::internal::kEmptyString) { + string_value_ = new ::std::string; + } + string_value_->assign(value); +} +inline void UninterpretedOption::set_string_value(const char* value) { + set_has_string_value(); + if (string_value_ == &::google::protobuf::internal::kEmptyString) { + string_value_ = new ::std::string; + } + string_value_->assign(value); +} +inline void UninterpretedOption::set_string_value(const void* value, size_t size) { + set_has_string_value(); + if (string_value_ == &::google::protobuf::internal::kEmptyString) { + string_value_ = new ::std::string; + } + string_value_->assign(reinterpret_cast(value), size); +} +inline ::std::string* UninterpretedOption::mutable_string_value() { + set_has_string_value(); + if (string_value_ == &::google::protobuf::internal::kEmptyString) { + string_value_ = new ::std::string; + } + return string_value_; +} +inline ::std::string* UninterpretedOption::release_string_value() { + clear_has_string_value(); + if (string_value_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = string_value_; + string_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string aggregate_value = 8; +inline bool UninterpretedOption::has_aggregate_value() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void UninterpretedOption::set_has_aggregate_value() { + _has_bits_[0] |= 0x00000040u; +} +inline void UninterpretedOption::clear_has_aggregate_value() { + _has_bits_[0] &= ~0x00000040u; +} +inline void UninterpretedOption::clear_aggregate_value() { + if (aggregate_value_ != &::google::protobuf::internal::kEmptyString) { + aggregate_value_->clear(); + } + clear_has_aggregate_value(); +} +inline const ::std::string& UninterpretedOption::aggregate_value() const { + return *aggregate_value_; +} +inline void UninterpretedOption::set_aggregate_value(const ::std::string& value) { + set_has_aggregate_value(); + if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + aggregate_value_ = new ::std::string; + } + aggregate_value_->assign(value); +} +inline void UninterpretedOption::set_aggregate_value(const char* value) { + set_has_aggregate_value(); + if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + aggregate_value_ = new ::std::string; + } + aggregate_value_->assign(value); +} +inline void UninterpretedOption::set_aggregate_value(const char* value, size_t size) { + set_has_aggregate_value(); + if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + aggregate_value_ = new ::std::string; + } + aggregate_value_->assign(reinterpret_cast(value), size); +} +inline ::std::string* UninterpretedOption::mutable_aggregate_value() { + set_has_aggregate_value(); + if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + aggregate_value_ = new ::std::string; + } + return aggregate_value_; +} +inline ::std::string* UninterpretedOption::release_aggregate_value() { + clear_has_aggregate_value(); + if (aggregate_value_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = aggregate_value_; + aggregate_value_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// SourceCodeInfo_Location + +// repeated int32 path = 1 [packed = true]; +inline int SourceCodeInfo_Location::path_size() const { + return path_.size(); +} +inline void SourceCodeInfo_Location::clear_path() { + path_.Clear(); +} +inline ::google::protobuf::int32 SourceCodeInfo_Location::path(int index) const { + return path_.Get(index); +} +inline void SourceCodeInfo_Location::set_path(int index, ::google::protobuf::int32 value) { + path_.Set(index, value); +} +inline void SourceCodeInfo_Location::add_path(::google::protobuf::int32 value) { + path_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +SourceCodeInfo_Location::path() const { + return path_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +SourceCodeInfo_Location::mutable_path() { + return &path_; +} + +// repeated int32 span = 2 [packed = true]; +inline int SourceCodeInfo_Location::span_size() const { + return span_.size(); +} +inline void SourceCodeInfo_Location::clear_span() { + span_.Clear(); +} +inline ::google::protobuf::int32 SourceCodeInfo_Location::span(int index) const { + return span_.Get(index); +} +inline void SourceCodeInfo_Location::set_span(int index, ::google::protobuf::int32 value) { + span_.Set(index, value); +} +inline void SourceCodeInfo_Location::add_span(::google::protobuf::int32 value) { + span_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +SourceCodeInfo_Location::span() const { + return span_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +SourceCodeInfo_Location::mutable_span() { + return &span_; +} + +// ------------------------------------------------------------------- + +// SourceCodeInfo + +// repeated .google.protobuf.SourceCodeInfo.Location location = 1; +inline int SourceCodeInfo::location_size() const { + return location_.size(); +} +inline void SourceCodeInfo::clear_location() { + location_.Clear(); +} +inline const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const { + return location_.Get(index); +} +inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) { + return location_.Mutable(index); +} +inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() { + return location_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >& +SourceCodeInfo::location() const { + return location_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >* +SourceCodeInfo::mutable_location() { + return &location_; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +#ifndef SWIG +namespace google { +namespace protobuf { + +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldDescriptorProto_Type>() { + return ::google::protobuf::FieldDescriptorProto_Type_descriptor(); +} +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldDescriptorProto_Label>() { + return ::google::protobuf::FieldDescriptorProto_Label_descriptor(); +} +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FileOptions_OptimizeMode>() { + return ::google::protobuf::FileOptions_OptimizeMode_descriptor(); +} +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::FieldOptions_CType>() { + return ::google::protobuf::FieldOptions_CType_descriptor(); +} + +} // namespace google +} // namespace protobuf +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED diff --git a/depends/protobuf/google/protobuf/descriptor_database.cc b/depends/protobuf/google/protobuf/descriptor_database.cc new file mode 100644 index 000000000..23e48a67f --- /dev/null +++ b/depends/protobuf/google/protobuf/descriptor_database.cc @@ -0,0 +1,541 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { + +DescriptorDatabase::~DescriptorDatabase() {} + +// =================================================================== + +template +bool SimpleDescriptorDatabase::DescriptorIndex::AddFile( + const FileDescriptorProto& file, + Value value) { + if (!InsertIfNotPresent(&by_name_, file.name(), value)) { + GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name(); + return false; + } + + // We must be careful here -- calling file.package() if file.has_package() is + // false could access an uninitialized static-storage variable if we are being + // run at startup time. + string path = file.has_package() ? file.package() : string(); + if (!path.empty()) path += '.'; + + for (int i = 0; i < file.message_type_size(); i++) { + if (!AddSymbol(path + file.message_type(i).name(), value)) return false; + if (!AddNestedExtensions(file.message_type(i), value)) return false; + } + for (int i = 0; i < file.enum_type_size(); i++) { + if (!AddSymbol(path + file.enum_type(i).name(), value)) return false; + } + for (int i = 0; i < file.extension_size(); i++) { + if (!AddSymbol(path + file.extension(i).name(), value)) return false; + if (!AddExtension(file.extension(i), value)) return false; + } + for (int i = 0; i < file.service_size(); i++) { + if (!AddSymbol(path + file.service(i).name(), value)) return false; + } + + return true; +} + +template +bool SimpleDescriptorDatabase::DescriptorIndex::AddSymbol( + const string& name, Value value) { + // We need to make sure not to violate our map invariant. + + // If the symbol name is invalid it could break our lookup algorithm (which + // relies on the fact that '.' sorts before all other characters that are + // valid in symbol names). + if (!ValidateSymbolName(name)) { + GOOGLE_LOG(ERROR) << "Invalid symbol name: " << name; + return false; + } + + // Try to look up the symbol to make sure a super-symbol doesn't already + // exist. + typename map::iterator iter = FindLastLessOrEqual(name); + + if (iter == by_symbol_.end()) { + // Apparently the map is currently empty. Just insert and be done with it. + by_symbol_.insert(typename map::value_type(name, value)); + return true; + } + + if (IsSubSymbol(iter->first, name)) { + GOOGLE_LOG(ERROR) << "Symbol name \"" << name << "\" conflicts with the existing " + "symbol \"" << iter->first << "\"."; + return false; + } + + // OK, that worked. Now we have to make sure that no symbol in the map is + // a sub-symbol of the one we are inserting. The only symbol which could + // be so is the first symbol that is greater than the new symbol. Since + // |iter| points at the last symbol that is less than or equal, we just have + // to increment it. + ++iter; + + if (iter != by_symbol_.end() && IsSubSymbol(name, iter->first)) { + GOOGLE_LOG(ERROR) << "Symbol name \"" << name << "\" conflicts with the existing " + "symbol \"" << iter->first << "\"."; + return false; + } + + // OK, no conflicts. + + // Insert the new symbol using the iterator as a hint, the new entry will + // appear immediately before the one the iterator is pointing at. + by_symbol_.insert(iter, typename map::value_type(name, value)); + + return true; +} + +template +bool SimpleDescriptorDatabase::DescriptorIndex::AddNestedExtensions( + const DescriptorProto& message_type, + Value value) { + for (int i = 0; i < message_type.nested_type_size(); i++) { + if (!AddNestedExtensions(message_type.nested_type(i), value)) return false; + } + for (int i = 0; i < message_type.extension_size(); i++) { + if (!AddExtension(message_type.extension(i), value)) return false; + } + return true; +} + +template +bool SimpleDescriptorDatabase::DescriptorIndex::AddExtension( + const FieldDescriptorProto& field, + Value value) { + if (!field.extendee().empty() && field.extendee()[0] == '.') { + // The extension is fully-qualified. We can use it as a lookup key in + // the by_symbol_ table. + if (!InsertIfNotPresent(&by_extension_, + make_pair(field.extendee().substr(1), + field.number()), + value)) { + GOOGLE_LOG(ERROR) << "Extension conflicts with extension already in database: " + "extend " << field.extendee() << " { " + << field.name() << " = " << field.number() << " }"; + return false; + } + } else { + // Not fully-qualified. We can't really do anything here, unfortunately. + // We don't consider this an error, though, because the descriptor is + // valid. + } + return true; +} + +template +Value SimpleDescriptorDatabase::DescriptorIndex::FindFile( + const string& filename) { + return FindWithDefault(by_name_, filename, Value()); +} + +template +Value SimpleDescriptorDatabase::DescriptorIndex::FindSymbol( + const string& name) { + typename map::iterator iter = FindLastLessOrEqual(name); + + return (iter != by_symbol_.end() && IsSubSymbol(iter->first, name)) ? + iter->second : Value(); +} + +template +Value SimpleDescriptorDatabase::DescriptorIndex::FindExtension( + const string& containing_type, + int field_number) { + return FindWithDefault(by_extension_, + make_pair(containing_type, field_number), + Value()); +} + +template +bool SimpleDescriptorDatabase::DescriptorIndex::FindAllExtensionNumbers( + const string& containing_type, + vector* output) { + typename map, Value >::const_iterator it = + by_extension_.lower_bound(make_pair(containing_type, 0)); + bool success = false; + + for (; it != by_extension_.end() && it->first.first == containing_type; + ++it) { + output->push_back(it->first.second); + success = true; + } + + return success; +} + +template +typename map::iterator +SimpleDescriptorDatabase::DescriptorIndex::FindLastLessOrEqual( + const string& name) { + // Find the last key in the map which sorts less than or equal to the + // symbol name. Since upper_bound() returns the *first* key that sorts + // *greater* than the input, we want the element immediately before that. + typename map::iterator iter = by_symbol_.upper_bound(name); + if (iter != by_symbol_.begin()) --iter; + return iter; +} + +template +bool SimpleDescriptorDatabase::DescriptorIndex::IsSubSymbol( + const string& sub_symbol, const string& super_symbol) { + return sub_symbol == super_symbol || + (HasPrefixString(super_symbol, sub_symbol) && + super_symbol[sub_symbol.size()] == '.'); +} + +template +bool SimpleDescriptorDatabase::DescriptorIndex::ValidateSymbolName( + const string& name) { + for (int i = 0; i < name.size(); i++) { + // I don't trust ctype.h due to locales. :( + if (name[i] != '.' && name[i] != '_' && + (name[i] < '0' || name[i] > '9') && + (name[i] < 'A' || name[i] > 'Z') && + (name[i] < 'a' || name[i] > 'z')) { + return false; + } + } + return true; +} + +// ------------------------------------------------------------------- + +SimpleDescriptorDatabase::SimpleDescriptorDatabase() {} +SimpleDescriptorDatabase::~SimpleDescriptorDatabase() { + STLDeleteElements(&files_to_delete_); +} + +bool SimpleDescriptorDatabase::Add(const FileDescriptorProto& file) { + FileDescriptorProto* new_file = new FileDescriptorProto; + new_file->CopyFrom(file); + return AddAndOwn(new_file); +} + +bool SimpleDescriptorDatabase::AddAndOwn(const FileDescriptorProto* file) { + files_to_delete_.push_back(file); + return index_.AddFile(*file, file); +} + +bool SimpleDescriptorDatabase::FindFileByName( + const string& filename, + FileDescriptorProto* output) { + return MaybeCopy(index_.FindFile(filename), output); +} + +bool SimpleDescriptorDatabase::FindFileContainingSymbol( + const string& symbol_name, + FileDescriptorProto* output) { + return MaybeCopy(index_.FindSymbol(symbol_name), output); +} + +bool SimpleDescriptorDatabase::FindFileContainingExtension( + const string& containing_type, + int field_number, + FileDescriptorProto* output) { + return MaybeCopy(index_.FindExtension(containing_type, field_number), output); +} + +bool SimpleDescriptorDatabase::FindAllExtensionNumbers( + const string& extendee_type, + vector* output) { + return index_.FindAllExtensionNumbers(extendee_type, output); +} + +bool SimpleDescriptorDatabase::MaybeCopy(const FileDescriptorProto* file, + FileDescriptorProto* output) { + if (file == NULL) return false; + output->CopyFrom(*file); + return true; +} + +// ------------------------------------------------------------------- + +EncodedDescriptorDatabase::EncodedDescriptorDatabase() {} +EncodedDescriptorDatabase::~EncodedDescriptorDatabase() { + for (int i = 0; i < files_to_delete_.size(); i++) { + operator delete(files_to_delete_[i]); + } +} + +bool EncodedDescriptorDatabase::Add( + const void* encoded_file_descriptor, int size) { + FileDescriptorProto file; + if (file.ParseFromArray(encoded_file_descriptor, size)) { + return index_.AddFile(file, make_pair(encoded_file_descriptor, size)); + } else { + GOOGLE_LOG(ERROR) << "Invalid file descriptor data passed to " + "EncodedDescriptorDatabase::Add()."; + return false; + } +} + +bool EncodedDescriptorDatabase::AddCopy( + const void* encoded_file_descriptor, int size) { + void* copy = operator new(size); + memcpy(copy, encoded_file_descriptor, size); + files_to_delete_.push_back(copy); + return Add(copy, size); +} + +bool EncodedDescriptorDatabase::FindFileByName( + const string& filename, + FileDescriptorProto* output) { + return MaybeParse(index_.FindFile(filename), output); +} + +bool EncodedDescriptorDatabase::FindFileContainingSymbol( + const string& symbol_name, + FileDescriptorProto* output) { + return MaybeParse(index_.FindSymbol(symbol_name), output); +} + +bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol( + const string& symbol_name, + string* output) { + pair encoded_file = index_.FindSymbol(symbol_name); + if (encoded_file.first == NULL) return false; + + // Optimization: The name should be the first field in the encoded message. + // Try to just read it directly. + io::CodedInputStream input(reinterpret_cast(encoded_file.first), + encoded_file.second); + + const uint32 kNameTag = internal::WireFormatLite::MakeTag( + FileDescriptorProto::kNameFieldNumber, + internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + + if (input.ReadTag() == kNameTag) { + // Success! + return internal::WireFormatLite::ReadString(&input, output); + } else { + // Slow path. Parse whole message. + FileDescriptorProto file_proto; + if (!file_proto.ParseFromArray(encoded_file.first, encoded_file.second)) { + return false; + } + *output = file_proto.name(); + return true; + } +} + +bool EncodedDescriptorDatabase::FindFileContainingExtension( + const string& containing_type, + int field_number, + FileDescriptorProto* output) { + return MaybeParse(index_.FindExtension(containing_type, field_number), + output); +} + +bool EncodedDescriptorDatabase::FindAllExtensionNumbers( + const string& extendee_type, + vector* output) { + return index_.FindAllExtensionNumbers(extendee_type, output); +} + +bool EncodedDescriptorDatabase::MaybeParse( + pair encoded_file, + FileDescriptorProto* output) { + if (encoded_file.first == NULL) return false; + return output->ParseFromArray(encoded_file.first, encoded_file.second); +} + +// =================================================================== + +DescriptorPoolDatabase::DescriptorPoolDatabase(const DescriptorPool& pool) + : pool_(pool) {} +DescriptorPoolDatabase::~DescriptorPoolDatabase() {} + +bool DescriptorPoolDatabase::FindFileByName( + const string& filename, + FileDescriptorProto* output) { + const FileDescriptor* file = pool_.FindFileByName(filename); + if (file == NULL) return false; + output->Clear(); + file->CopyTo(output); + return true; +} + +bool DescriptorPoolDatabase::FindFileContainingSymbol( + const string& symbol_name, + FileDescriptorProto* output) { + const FileDescriptor* file = pool_.FindFileContainingSymbol(symbol_name); + if (file == NULL) return false; + output->Clear(); + file->CopyTo(output); + return true; +} + +bool DescriptorPoolDatabase::FindFileContainingExtension( + const string& containing_type, + int field_number, + FileDescriptorProto* output) { + const Descriptor* extendee = pool_.FindMessageTypeByName(containing_type); + if (extendee == NULL) return false; + + const FieldDescriptor* extension = + pool_.FindExtensionByNumber(extendee, field_number); + if (extension == NULL) return false; + + output->Clear(); + extension->file()->CopyTo(output); + return true; +} + +bool DescriptorPoolDatabase::FindAllExtensionNumbers( + const string& extendee_type, + vector* output) { + const Descriptor* extendee = pool_.FindMessageTypeByName(extendee_type); + if (extendee == NULL) return false; + + vector extensions; + pool_.FindAllExtensions(extendee, &extensions); + + for (int i = 0; i < extensions.size(); ++i) { + output->push_back(extensions[i]->number()); + } + + return true; +} + +// =================================================================== + +MergedDescriptorDatabase::MergedDescriptorDatabase( + DescriptorDatabase* source1, + DescriptorDatabase* source2) { + sources_.push_back(source1); + sources_.push_back(source2); +} +MergedDescriptorDatabase::MergedDescriptorDatabase( + const vector& sources) + : sources_(sources) {} +MergedDescriptorDatabase::~MergedDescriptorDatabase() {} + +bool MergedDescriptorDatabase::FindFileByName( + const string& filename, + FileDescriptorProto* output) { + for (int i = 0; i < sources_.size(); i++) { + if (sources_[i]->FindFileByName(filename, output)) { + return true; + } + } + return false; +} + +bool MergedDescriptorDatabase::FindFileContainingSymbol( + const string& symbol_name, + FileDescriptorProto* output) { + for (int i = 0; i < sources_.size(); i++) { + if (sources_[i]->FindFileContainingSymbol(symbol_name, output)) { + // The symbol was found in source i. However, if one of the previous + // sources defines a file with the same name (which presumably doesn't + // contain the symbol, since it wasn't found in that source), then we + // must hide it from the caller. + FileDescriptorProto temp; + for (int j = 0; j < i; j++) { + if (sources_[j]->FindFileByName(output->name(), &temp)) { + // Found conflicting file in a previous source. + return false; + } + } + return true; + } + } + return false; +} + +bool MergedDescriptorDatabase::FindFileContainingExtension( + const string& containing_type, + int field_number, + FileDescriptorProto* output) { + for (int i = 0; i < sources_.size(); i++) { + if (sources_[i]->FindFileContainingExtension( + containing_type, field_number, output)) { + // The symbol was found in source i. However, if one of the previous + // sources defines a file with the same name (which presumably doesn't + // contain the symbol, since it wasn't found in that source), then we + // must hide it from the caller. + FileDescriptorProto temp; + for (int j = 0; j < i; j++) { + if (sources_[j]->FindFileByName(output->name(), &temp)) { + // Found conflicting file in a previous source. + return false; + } + } + return true; + } + } + return false; +} + +bool MergedDescriptorDatabase::FindAllExtensionNumbers( + const string& extendee_type, + vector* output) { + set merged_results; + vector results; + bool success = false; + + for (int i = 0; i < sources_.size(); i++) { + if (sources_[i]->FindAllExtensionNumbers(extendee_type, &results)) { + copy(results.begin(), results.end(), + insert_iterator >(merged_results, merged_results.begin())); + success = true; + } + results.clear(); + } + + copy(merged_results.begin(), merged_results.end(), + insert_iterator >(*output, output->end())); + + return success; +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/descriptor_database.h b/depends/protobuf/google/protobuf/descriptor_database.h similarity index 64% rename from depends/protobuf/src/google/protobuf/descriptor_database.h rename to depends/protobuf/google/protobuf/descriptor_database.h index f4f06bbfa..f32b1db93 100644 --- a/depends/protobuf/src/google/protobuf/descriptor_database.h +++ b/depends/protobuf/google/protobuf/descriptor_database.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,22 +37,12 @@ #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_DATABASE_H__ #define GOOGLE_PROTOBUF_DESCRIPTOR_DATABASE_H__ - #include #include #include #include - -#include #include -// Must be included last. -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - namespace google { namespace protobuf { @@ -71,27 +61,27 @@ class MergedDescriptorDatabase; // calling DescriptorPool::BuildFile() for each one. Instead, a DescriptorPool // can be created which wraps a DescriptorDatabase and only builds particular // descriptors when they are needed. -class PROTOBUF_EXPORT DescriptorDatabase { +class LIBPROTOBUF_EXPORT DescriptorDatabase { public: inline DescriptorDatabase() {} virtual ~DescriptorDatabase(); // Find a file by file name. Fills in in *output and returns true if found. // Otherwise, returns false, leaving the contents of *output undefined. - virtual bool FindFileByName(const std::string& filename, + virtual bool FindFileByName(const string& filename, FileDescriptorProto* output) = 0; // Find the file that declares the given fully-qualified symbol name. // If found, fills in *output and returns true, otherwise returns false // and leaves *output undefined. - virtual bool FindFileContainingSymbol(const std::string& symbol_name, + virtual bool FindFileContainingSymbol(const string& symbol_name, FileDescriptorProto* output) = 0; // Find the file which defines an extension extending the given message type // with the given field number. If found, fills in *output and returns true, // otherwise returns false and leaves *output undefined. containing_type // must be a fully-qualified type name. - virtual bool FindFileContainingExtension(const std::string& containing_type, + virtual bool FindFileContainingExtension(const string& containing_type, int field_number, FileDescriptorProto* output) = 0; @@ -105,38 +95,11 @@ class PROTOBUF_EXPORT DescriptorDatabase { // // This method has a default implementation that always returns // false. - virtual bool FindAllExtensionNumbers(const std::string& /* extendee_type */, - std::vector* /* output */) { + virtual bool FindAllExtensionNumbers(const string& extendee_type, + vector* output) { return false; } - - // Finds the file names and appends them to the output in an - // undefined order. This method is best-effort: it's not guaranteed that the - // database will find all files. Returns true if the database supports - // searching all file names, otherwise returns false and leaves output - // unchanged. - // - // This method has a default implementation that always returns - // false. - virtual bool FindAllFileNames(std::vector* /*output*/) { - return false; - } - - // Finds the package names and appends them to the output in an - // undefined order. This method is best-effort: it's not guaranteed that the - // database will find all packages. Returns true if the database supports - // searching all package names, otherwise returns false and leaves output - // unchanged. - bool FindAllPackageNames(std::vector* output); - - // Finds the message names and appends them to the output in an - // undefined order. This method is best-effort: it's not guaranteed that the - // database will find all messages. Returns true if the database supports - // searching all message names, otherwise returns false and leaves output - // unchanged. - bool FindAllMessageNames(std::vector* output); - private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorDatabase); }; @@ -162,10 +125,10 @@ class PROTOBUF_EXPORT DescriptorDatabase { // FileDescriptor::CopyTo()) will always use fully-qualified names for all // types. You only need to worry if you are constructing FileDescriptorProtos // yourself, or are calling compiler::Parser directly. -class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { +class LIBPROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { public: SimpleDescriptorDatabase(); - ~SimpleDescriptorDatabase() override; + ~SimpleDescriptorDatabase(); // Adds the FileDescriptorProto to the database, making a copy. The object // can be deleted after Add() returns. Returns false if the file conflicted @@ -177,19 +140,20 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { bool AddAndOwn(const FileDescriptorProto* file); // implements DescriptorDatabase ----------------------------------- - bool FindFileByName(const std::string& filename, - FileDescriptorProto* output) override; - bool FindFileContainingSymbol(const std::string& symbol_name, - FileDescriptorProto* output) override; - bool FindFileContainingExtension(const std::string& containing_type, + bool FindFileByName(const string& filename, + FileDescriptorProto* output); + bool FindFileContainingSymbol(const string& symbol_name, + FileDescriptorProto* output); + bool FindFileContainingExtension(const string& containing_type, int field_number, - FileDescriptorProto* output) override; - bool FindAllExtensionNumbers(const std::string& extendee_type, - std::vector* output) override; - - bool FindAllFileNames(std::vector* output) override; + FileDescriptorProto* output); + bool FindAllExtensionNumbers(const string& extendee_type, + vector* output); private: + // So that it can use DescriptorIndex. + friend class EncodedDescriptorDatabase; + // An index mapping file names, symbol names, and extension numbers to // some sort of values. template @@ -197,24 +161,24 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { public: // Helpers to recursively add particular descriptors and all their contents // to the index. - bool AddFile(const FileDescriptorProto& file, Value value); - bool AddSymbol(const std::string& name, Value value); - bool AddNestedExtensions(const std::string& filename, - const DescriptorProto& message_type, Value value); - bool AddExtension(const std::string& filename, - const FieldDescriptorProto& field, Value value); - - Value FindFile(const std::string& filename); - Value FindSymbol(const std::string& name); - Value FindExtension(const std::string& containing_type, int field_number); - bool FindAllExtensionNumbers(const std::string& containing_type, - std::vector* output); - void FindAllFileNames(std::vector* output); + bool AddFile(const FileDescriptorProto& file, + Value value); + bool AddSymbol(const string& name, Value value); + bool AddNestedExtensions(const DescriptorProto& message_type, + Value value); + bool AddExtension(const FieldDescriptorProto& field, + Value value); + + Value FindFile(const string& filename); + Value FindSymbol(const string& name); + Value FindExtension(const string& containing_type, int field_number); + bool FindAllExtensionNumbers(const string& containing_type, + vector* output); private: - std::map by_name_; - std::map by_symbol_; - std::map, Value> by_extension_; + map by_name_; + map by_symbol_; + map, Value> by_extension_; // Invariant: The by_symbol_ map does not contain any symbols which are // prefixes of other symbols in the map. For example, "foo.bar" is a @@ -236,7 +200,7 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { // will find it. Proof: // 1) Define the "search key" to be the key we are looking for, the "found // key" to be the key found in step (1), and the "match key" to be the - // key which actually matches the search key (i.e. the key we're trying + // key which actually matches the serach key (i.e. the key we're trying // to find). // 2) The found key must be less than or equal to the search key by // definition. @@ -266,14 +230,30 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { // That symbol cannot be a super-symbol of the search key since if it were, // then it would be a match, and we're assuming the match key doesn't exist. // Therefore, step 2 will correctly return no match. + + // Find the last entry in the by_symbol_ map whose key is less than or + // equal to the given name. + typename map::iterator FindLastLessOrEqual( + const string& name); + + // True if either the arguments are equal or super_symbol identifies a + // parent symbol of sub_symbol (e.g. "foo.bar" is a parent of + // "foo.bar.baz", but not a parent of "foo.barbaz"). + bool IsSubSymbol(const string& sub_symbol, const string& super_symbol); + + // Returns true if and only if all characters in the name are alphanumerics, + // underscores, or periods. + bool ValidateSymbolName(const string& name); }; + DescriptorIndex index_; - std::vector> files_to_delete_; + vector files_to_delete_; - // If file is non-nullptr, copy it into *output and return true, otherwise + // If file is non-NULL, copy it into *output and return true, otherwise // return false. - bool MaybeCopy(const FileDescriptorProto* file, FileDescriptorProto* output); + bool MaybeCopy(const FileDescriptorProto* file, + FileDescriptorProto* output); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SimpleDescriptorDatabase); }; @@ -283,10 +263,10 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { // // The same caveats regarding FindFileContainingExtension() apply as with // SimpleDescriptorDatabase. -class PROTOBUF_EXPORT EncodedDescriptorDatabase : public DescriptorDatabase { +class LIBPROTOBUF_EXPORT EncodedDescriptorDatabase : public DescriptorDatabase { public: EncodedDescriptorDatabase(); - ~EncodedDescriptorDatabase() override; + ~EncodedDescriptorDatabase(); // Adds the FileDescriptorProto to the database. The descriptor is provided // in encoded form. The database does not make a copy of the bytes, nor @@ -301,52 +281,48 @@ class PROTOBUF_EXPORT EncodedDescriptorDatabase : public DescriptorDatabase { bool AddCopy(const void* encoded_file_descriptor, int size); // Like FindFileContainingSymbol but returns only the name of the file. - bool FindNameOfFileContainingSymbol(const std::string& symbol_name, - std::string* output); + bool FindNameOfFileContainingSymbol(const string& symbol_name, + string* output); // implements DescriptorDatabase ----------------------------------- - bool FindFileByName(const std::string& filename, - FileDescriptorProto* output) override; - bool FindFileContainingSymbol(const std::string& symbol_name, - FileDescriptorProto* output) override; - bool FindFileContainingExtension(const std::string& containing_type, + bool FindFileByName(const string& filename, + FileDescriptorProto* output); + bool FindFileContainingSymbol(const string& symbol_name, + FileDescriptorProto* output); + bool FindFileContainingExtension(const string& containing_type, int field_number, - FileDescriptorProto* output) override; - bool FindAllExtensionNumbers(const std::string& extendee_type, - std::vector* output) override; - bool FindAllFileNames(std::vector* output) override; + FileDescriptorProto* output); + bool FindAllExtensionNumbers(const string& extendee_type, + vector* output); private: - class DescriptorIndex; - // Keep DescriptorIndex by pointer to hide the implementation to keep a - // cleaner header. - std::unique_ptr index_; - std::vector files_to_delete_; - - // If encoded_file.first is non-nullptr, parse the data into *output and - // return true, otherwise return false. - bool MaybeParse(std::pair encoded_file, + SimpleDescriptorDatabase::DescriptorIndex > index_; + vector files_to_delete_; + + // If encoded_file.first is non-NULL, parse the data into *output and return + // true, otherwise return false. + bool MaybeParse(pair encoded_file, FileDescriptorProto* output); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EncodedDescriptorDatabase); }; // A DescriptorDatabase that fetches files from a given pool. -class PROTOBUF_EXPORT DescriptorPoolDatabase : public DescriptorDatabase { +class LIBPROTOBUF_EXPORT DescriptorPoolDatabase : public DescriptorDatabase { public: - explicit DescriptorPoolDatabase(const DescriptorPool& pool); - ~DescriptorPoolDatabase() override; + DescriptorPoolDatabase(const DescriptorPool& pool); + ~DescriptorPoolDatabase(); // implements DescriptorDatabase ----------------------------------- - bool FindFileByName(const std::string& filename, - FileDescriptorProto* output) override; - bool FindFileContainingSymbol(const std::string& symbol_name, - FileDescriptorProto* output) override; - bool FindFileContainingExtension(const std::string& containing_type, + bool FindFileByName(const string& filename, + FileDescriptorProto* output); + bool FindFileContainingSymbol(const string& symbol_name, + FileDescriptorProto* output); + bool FindFileContainingExtension(const string& containing_type, int field_number, - FileDescriptorProto* output) override; - bool FindAllExtensionNumbers(const std::string& extendee_type, - std::vector* output) override; + FileDescriptorProto* output); + bool FindAllExtensionNumbers(const string& extendee_type, + vector* output); private: const DescriptorPool& pool_; @@ -355,7 +331,7 @@ class PROTOBUF_EXPORT DescriptorPoolDatabase : public DescriptorDatabase { // A DescriptorDatabase that wraps two or more others. It first searches the // first database and, if that fails, tries the second, and so on. -class PROTOBUF_EXPORT MergedDescriptorDatabase : public DescriptorDatabase { +class LIBPROTOBUF_EXPORT MergedDescriptorDatabase : public DescriptorDatabase { public: // Merge just two databases. The sources remain property of the caller. MergedDescriptorDatabase(DescriptorDatabase* source1, @@ -363,36 +339,28 @@ class PROTOBUF_EXPORT MergedDescriptorDatabase : public DescriptorDatabase { // Merge more than two databases. The sources remain property of the caller. // The vector may be deleted after the constructor returns but the // DescriptorDatabases need to stick around. - explicit MergedDescriptorDatabase( - const std::vector& sources); - ~MergedDescriptorDatabase() override; + MergedDescriptorDatabase(const vector& sources); + ~MergedDescriptorDatabase(); // implements DescriptorDatabase ----------------------------------- - bool FindFileByName(const std::string& filename, - FileDescriptorProto* output) override; - bool FindFileContainingSymbol(const std::string& symbol_name, - FileDescriptorProto* output) override; - bool FindFileContainingExtension(const std::string& containing_type, + bool FindFileByName(const string& filename, + FileDescriptorProto* output); + bool FindFileContainingSymbol(const string& symbol_name, + FileDescriptorProto* output); + bool FindFileContainingExtension(const string& containing_type, int field_number, - FileDescriptorProto* output) override; + FileDescriptorProto* output); // Merges the results of calling all databases. Returns true iff any // of the databases returned true. - bool FindAllExtensionNumbers(const std::string& extendee_type, - std::vector* output) override; - - - // This function is best-effort. Returns true if at least one underlying - // DescriptorDatabase returns true. - bool FindAllFileNames(std::vector* output) override; + bool FindAllExtensionNumbers(const string& extendee_type, + vector* output); private: - std::vector sources_; + vector sources_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MergedDescriptorDatabase); }; } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_DESCRIPTOR_DATABASE_H__ diff --git a/depends/protobuf/google/protobuf/dynamic_message.cc b/depends/protobuf/google/protobuf/dynamic_message.cc new file mode 100644 index 000000000..c711a2da4 --- /dev/null +++ b/depends/protobuf/google/protobuf/dynamic_message.cc @@ -0,0 +1,558 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// DynamicMessage is implemented by constructing a data structure which +// has roughly the same memory layout as a generated message would have. +// Then, we use GeneratedMessageReflection to implement our reflection +// interface. All the other operations we need to implement (e.g. +// parsing, copying, etc.) are already implemented in terms of +// Reflection, so the rest is easy. +// +// The up side of this strategy is that it's very efficient. We don't +// need to use hash_maps or generic representations of fields. The +// down side is that this is a low-level memory management hack which +// can be tricky to get right. +// +// As mentioned in the header, we only expose a DynamicMessageFactory +// publicly, not the DynamicMessage class itself. This is because +// GenericMessageReflection wants to have a pointer to a "default" +// copy of the class, with all fields initialized to their default +// values. We only want to construct one of these per message type, +// so DynamicMessageFactory stores a cache of default messages for +// each type it sees (each unique Descriptor pointer). The code +// refers to the "default" copy of the class as the "prototype". +// +// Note on memory allocation: This module often calls "operator new()" +// to allocate untyped memory, rather than calling something like +// "new uint8[]". This is because "operator new()" means "Give me some +// space which I can use as I please." while "new uint8[]" means "Give +// me an array of 8-bit integers.". In practice, the later may return +// a pointer that is not aligned correctly for general use. I believe +// Item 8 of "More Effective C++" discusses this in more detail, though +// I don't have the book on me right now so I'm not sure. + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { + +using internal::WireFormat; +using internal::ExtensionSet; +using internal::GeneratedMessageReflection; + + +// =================================================================== +// Some helper tables and functions... + +namespace { + +// Compute the byte size of the in-memory representation of the field. +int FieldSpaceUsed(const FieldDescriptor* field) { + typedef FieldDescriptor FD; // avoid line wrapping + if (field->label() == FD::LABEL_REPEATED) { + switch (field->cpp_type()) { + case FD::CPPTYPE_INT32 : return sizeof(RepeatedField); + case FD::CPPTYPE_INT64 : return sizeof(RepeatedField); + case FD::CPPTYPE_UINT32 : return sizeof(RepeatedField); + case FD::CPPTYPE_UINT64 : return sizeof(RepeatedField); + case FD::CPPTYPE_DOUBLE : return sizeof(RepeatedField); + case FD::CPPTYPE_FLOAT : return sizeof(RepeatedField); + case FD::CPPTYPE_BOOL : return sizeof(RepeatedField); + case FD::CPPTYPE_ENUM : return sizeof(RepeatedField); + case FD::CPPTYPE_MESSAGE: return sizeof(RepeatedPtrField); + + case FD::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + return sizeof(RepeatedPtrField); + } + break; + } + } else { + switch (field->cpp_type()) { + case FD::CPPTYPE_INT32 : return sizeof(int32 ); + case FD::CPPTYPE_INT64 : return sizeof(int64 ); + case FD::CPPTYPE_UINT32 : return sizeof(uint32 ); + case FD::CPPTYPE_UINT64 : return sizeof(uint64 ); + case FD::CPPTYPE_DOUBLE : return sizeof(double ); + case FD::CPPTYPE_FLOAT : return sizeof(float ); + case FD::CPPTYPE_BOOL : return sizeof(bool ); + case FD::CPPTYPE_ENUM : return sizeof(int ); + case FD::CPPTYPE_MESSAGE: return sizeof(Message*); + + case FD::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + return sizeof(string*); + } + break; + } + } + + GOOGLE_LOG(DFATAL) << "Can't get here."; + return 0; +} + +inline int DivideRoundingUp(int i, int j) { + return (i + (j - 1)) / j; +} + +static const int kSafeAlignment = sizeof(uint64); + +inline int AlignTo(int offset, int alignment) { + return DivideRoundingUp(offset, alignment) * alignment; +} + +// Rounds the given byte offset up to the next offset aligned such that any +// type may be stored at it. +inline int AlignOffset(int offset) { + return AlignTo(offset, kSafeAlignment); +} + +#define bitsizeof(T) (sizeof(T) * 8) + +} // namespace + +// =================================================================== + +class DynamicMessage : public Message { + public: + struct TypeInfo { + int size; + int has_bits_offset; + int unknown_fields_offset; + int extensions_offset; + + // Not owned by the TypeInfo. + DynamicMessageFactory* factory; // The factory that created this object. + const DescriptorPool* pool; // The factory's DescriptorPool. + const Descriptor* type; // Type of this DynamicMessage. + + // Warning: The order in which the following pointers are defined is + // important (the prototype must be deleted *before* the offsets). + scoped_array offsets; + scoped_ptr reflection; + scoped_ptr prototype; + }; + + DynamicMessage(const TypeInfo* type_info); + ~DynamicMessage(); + + // Called on the prototype after construction to initialize message fields. + void CrossLinkPrototypes(); + + // implements Message ---------------------------------------------- + + Message* New() const; + + int GetCachedSize() const; + void SetCachedSize(int size) const; + + Metadata GetMetadata() const; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DynamicMessage); + + inline bool is_prototype() const { + return type_info_->prototype == this || + // If type_info_->prototype is NULL, then we must be constructing + // the prototype now, which means we must be the prototype. + type_info_->prototype == NULL; + } + + inline void* OffsetToPointer(int offset) { + return reinterpret_cast(this) + offset; + } + inline const void* OffsetToPointer(int offset) const { + return reinterpret_cast(this) + offset; + } + + const TypeInfo* type_info_; + + // TODO(kenton): Make this an atomic when C++ supports it. + mutable int cached_byte_size_; +}; + +DynamicMessage::DynamicMessage(const TypeInfo* type_info) + : type_info_(type_info), + cached_byte_size_(0) { + // We need to call constructors for various fields manually and set + // default values where appropriate. We use placement new to call + // constructors. If you haven't heard of placement new, I suggest Googling + // it now. We use placement new even for primitive types that don't have + // constructors for consistency. (In theory, placement new should be used + // any time you are trying to convert untyped memory to typed memory, though + // in practice that's not strictly necessary for types that don't have a + // constructor.) + + const Descriptor* descriptor = type_info_->type; + + new(OffsetToPointer(type_info_->unknown_fields_offset)) UnknownFieldSet; + + if (type_info_->extensions_offset != -1) { + new(OffsetToPointer(type_info_->extensions_offset)) ExtensionSet; + } + + for (int i = 0; i < descriptor->field_count(); i++) { + const FieldDescriptor* field = descriptor->field(i); + void* field_ptr = OffsetToPointer(type_info_->offsets[i]); + switch (field->cpp_type()) { +#define HANDLE_TYPE(CPPTYPE, TYPE) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + if (!field->is_repeated()) { \ + new(field_ptr) TYPE(field->default_value_##TYPE()); \ + } else { \ + new(field_ptr) RepeatedField(); \ + } \ + break; + + HANDLE_TYPE(INT32 , int32 ); + HANDLE_TYPE(INT64 , int64 ); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE(FLOAT , float ); + HANDLE_TYPE(BOOL , bool ); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_ENUM: + if (!field->is_repeated()) { + new(field_ptr) int(field->default_value_enum()->number()); + } else { + new(field_ptr) RepeatedField(); + } + break; + + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + if (!field->is_repeated()) { + if (is_prototype()) { + new(field_ptr) const string*(&field->default_value_string()); + } else { + string* default_value = + *reinterpret_cast( + type_info_->prototype->OffsetToPointer( + type_info_->offsets[i])); + new(field_ptr) string*(default_value); + } + } else { + new(field_ptr) RepeatedPtrField(); + } + break; + } + break; + + case FieldDescriptor::CPPTYPE_MESSAGE: { + if (!field->is_repeated()) { + new(field_ptr) Message*(NULL); + } else { + new(field_ptr) RepeatedPtrField(); + } + break; + } + } + } +} + +DynamicMessage::~DynamicMessage() { + const Descriptor* descriptor = type_info_->type; + + reinterpret_cast( + OffsetToPointer(type_info_->unknown_fields_offset))->~UnknownFieldSet(); + + if (type_info_->extensions_offset != -1) { + reinterpret_cast( + OffsetToPointer(type_info_->extensions_offset))->~ExtensionSet(); + } + + // We need to manually run the destructors for repeated fields and strings, + // just as we ran their constructors in the the DynamicMessage constructor. + // Additionally, if any singular embedded messages have been allocated, we + // need to delete them, UNLESS we are the prototype message of this type, + // in which case any embedded messages are other prototypes and shouldn't + // be touched. + for (int i = 0; i < descriptor->field_count(); i++) { + const FieldDescriptor* field = descriptor->field(i); + void* field_ptr = OffsetToPointer(type_info_->offsets[i]); + + if (field->is_repeated()) { + switch (field->cpp_type()) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE : \ + reinterpret_cast*>(field_ptr) \ + ->~RepeatedField(); \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, int); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + reinterpret_cast*>(field_ptr) + ->~RepeatedPtrField(); + break; + } + break; + + case FieldDescriptor::CPPTYPE_MESSAGE: + reinterpret_cast*>(field_ptr) + ->~RepeatedPtrField(); + break; + } + + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: { + string* ptr = *reinterpret_cast(field_ptr); + if (ptr != &field->default_value_string()) { + delete ptr; + } + break; + } + } + } else if ((field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) && + !is_prototype()) { + Message* message = *reinterpret_cast(field_ptr); + if (message != NULL) { + delete message; + } + } + } +} + +void DynamicMessage::CrossLinkPrototypes() { + // This should only be called on the prototype message. + GOOGLE_CHECK(is_prototype()); + + DynamicMessageFactory* factory = type_info_->factory; + const Descriptor* descriptor = type_info_->type; + + // Cross-link default messages. + for (int i = 0; i < descriptor->field_count(); i++) { + const FieldDescriptor* field = descriptor->field(i); + void* field_ptr = OffsetToPointer(type_info_->offsets[i]); + + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + !field->is_repeated()) { + // For fields with message types, we need to cross-link with the + // prototype for the field's type. + // For singular fields, the field is just a pointer which should + // point to the prototype. + *reinterpret_cast(field_ptr) = + factory->GetPrototypeNoLock(field->message_type()); + } + } +} + +Message* DynamicMessage::New() const { + void* new_base = reinterpret_cast(operator new(type_info_->size)); + memset(new_base, 0, type_info_->size); + return new(new_base) DynamicMessage(type_info_); +} + +int DynamicMessage::GetCachedSize() const { + return cached_byte_size_; +} + +void DynamicMessage::SetCachedSize(int size) const { + // This is theoretically not thread-compatible, but in practice it works + // because if multiple threads write this simultaneously, they will be + // writing the exact same value. + cached_byte_size_ = size; +} + +Metadata DynamicMessage::GetMetadata() const { + Metadata metadata; + metadata.descriptor = type_info_->type; + metadata.reflection = type_info_->reflection.get(); + return metadata; +} + +// =================================================================== + +struct DynamicMessageFactory::PrototypeMap { + typedef hash_map Map; + Map map_; +}; + +DynamicMessageFactory::DynamicMessageFactory() + : pool_(NULL), delegate_to_generated_factory_(false), + prototypes_(new PrototypeMap) { +} + +DynamicMessageFactory::DynamicMessageFactory(const DescriptorPool* pool) + : pool_(pool), delegate_to_generated_factory_(false), + prototypes_(new PrototypeMap) { +} + +DynamicMessageFactory::~DynamicMessageFactory() { + for (PrototypeMap::Map::iterator iter = prototypes_->map_.begin(); + iter != prototypes_->map_.end(); ++iter) { + delete iter->second; + } +} + +const Message* DynamicMessageFactory::GetPrototype(const Descriptor* type) { + MutexLock lock(&prototypes_mutex_); + return GetPrototypeNoLock(type); +} + +const Message* DynamicMessageFactory::GetPrototypeNoLock( + const Descriptor* type) { + if (delegate_to_generated_factory_ && + type->file()->pool() == DescriptorPool::generated_pool()) { + return MessageFactory::generated_factory()->GetPrototype(type); + } + + const DynamicMessage::TypeInfo** target = &prototypes_->map_[type]; + if (*target != NULL) { + // Already exists. + return (*target)->prototype.get(); + } + + DynamicMessage::TypeInfo* type_info = new DynamicMessage::TypeInfo; + *target = type_info; + + type_info->type = type; + type_info->pool = (pool_ == NULL) ? type->file()->pool() : pool_; + type_info->factory = this; + + // We need to construct all the structures passed to + // GeneratedMessageReflection's constructor. This includes: + // - A block of memory that contains space for all the message's fields. + // - An array of integers indicating the byte offset of each field within + // this block. + // - A big bitfield containing a bit for each field indicating whether + // or not that field is set. + + // Compute size and offsets. + int* offsets = new int[type->field_count()]; + type_info->offsets.reset(offsets); + + // Decide all field offsets by packing in order. + // We place the DynamicMessage object itself at the beginning of the allocated + // space. + int size = sizeof(DynamicMessage); + size = AlignOffset(size); + + // Next the has_bits, which is an array of uint32s. + type_info->has_bits_offset = size; + int has_bits_array_size = + DivideRoundingUp(type->field_count(), bitsizeof(uint32)); + size += has_bits_array_size * sizeof(uint32); + size = AlignOffset(size); + + // The ExtensionSet, if any. + if (type->extension_range_count() > 0) { + type_info->extensions_offset = size; + size += sizeof(ExtensionSet); + size = AlignOffset(size); + } else { + // No extensions. + type_info->extensions_offset = -1; + } + + // All the fields. + for (int i = 0; i < type->field_count(); i++) { + // Make sure field is aligned to avoid bus errors. + int field_size = FieldSpaceUsed(type->field(i)); + size = AlignTo(size, min(kSafeAlignment, field_size)); + offsets[i] = size; + size += field_size; + } + + // Add the UnknownFieldSet to the end. + size = AlignOffset(size); + type_info->unknown_fields_offset = size; + size += sizeof(UnknownFieldSet); + + // Align the final size to make sure no clever allocators think that + // alignment is not necessary. + size = AlignOffset(size); + type_info->size = size; + + // Allocate the prototype. + void* base = operator new(size); + memset(base, 0, size); + DynamicMessage* prototype = new(base) DynamicMessage(type_info); + type_info->prototype.reset(prototype); + + // Construct the reflection object. + type_info->reflection.reset( + new GeneratedMessageReflection( + type_info->type, + type_info->prototype.get(), + type_info->offsets.get(), + type_info->has_bits_offset, + type_info->unknown_fields_offset, + type_info->extensions_offset, + type_info->pool, + this, + type_info->size)); + + // Cross link prototypes. + prototype->CrossLinkPrototypes(); + + return prototype; +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/dynamic_message.h b/depends/protobuf/google/protobuf/dynamic_message.h similarity index 57% rename from depends/protobuf/src/google/protobuf/dynamic_message.h rename to depends/protobuf/google/protobuf/dynamic_message.h index 6fa64259e..81dd2c639 100644 --- a/depends/protobuf/src/google/protobuf/dynamic_message.h +++ b/depends/protobuf/google/protobuf/dynamic_message.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -38,31 +38,15 @@ #ifndef GOOGLE_PROTOBUF_DYNAMIC_MESSAGE_H__ #define GOOGLE_PROTOBUF_DYNAMIC_MESSAGE_H__ - -#include -#include -#include -#include - -#include -#include #include -#include -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -// Must be included last. -#include +#include namespace google { namespace protobuf { // Defined in other files. -class Descriptor; // descriptor.h -class DescriptorPool; // descriptor.h +class Descriptor; // descriptor.h +class DescriptorPool; // descriptor.h // Constructs implementations of Message which can emulate types which are not // known at compile-time. @@ -81,10 +65,10 @@ class DescriptorPool; // descriptor.h // encapsulates this "cache". All DynamicMessages of the same type created // from the same factory will share the same support data. Any Descriptors // used with a particular factory must outlive the factory. -class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { +class LIBPROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { public: // Construct a DynamicMessageFactory that will search for extensions in - // the DescriptorPool in which the extendee is defined. + // the DescriptorPool in which the exendee is defined. DynamicMessageFactory(); // Construct a DynamicMessageFactory that will search for extensions in @@ -96,7 +80,7 @@ class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { // the zero-arg constructor. DynamicMessageFactory(const DescriptorPool* pool); - ~DynamicMessageFactory() override; + ~DynamicMessageFactory(); // Call this to tell the DynamicMessageFactory that if it is given a // Descriptor d for which: @@ -118,22 +102,27 @@ class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { // object. The returned object remains property of the factory and will // be destroyed when the factory is destroyed. Also, any objects created // by calling the prototype's New() method share some data with the - // prototype, so these must be destroyed before the DynamicMessageFactory + // prototype, so these must be destoyed before the DynamicMessageFactory // is destroyed. // // The given descriptor must outlive the returned message, and hence must // outlive the DynamicMessageFactory. // // The method is thread-safe. - const Message* GetPrototype(const Descriptor* type) override; + const Message* GetPrototype(const Descriptor* type); private: const DescriptorPool* pool_; bool delegate_to_generated_factory_; - struct TypeInfo; - std::unordered_map prototypes_; - mutable internal::WrappedMutex prototypes_mutex_; + // This struct just contains a hash_map. We can't #include from + // this header due to hacks needed for hash_map portability in the open source + // release. Namely, stubs/hash.h, which defines hash_map portably, is not a + // public header (for good reason), but dynamic_message.h is, and public + // headers may only #include other public headers. + struct PrototypeMap; + scoped_ptr prototypes_; + mutable Mutex prototypes_mutex_; friend class DynamicMessage; const Message* GetPrototypeNoLock(const Descriptor* type); @@ -141,87 +130,7 @@ class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DynamicMessageFactory); }; -// Helper for computing a sorted list of map entries via reflection. -class PROTOBUF_EXPORT DynamicMapSorter { - public: - static std::vector Sort(const Message& message, int map_size, - const Reflection* reflection, - const FieldDescriptor* field) { - std::vector result; - result.reserve(map_size); - RepeatedFieldRef map_field = - reflection->GetRepeatedFieldRef(message, field); - for (auto it = map_field.begin(); it != map_field.end(); ++it) { - result.push_back(&*it); - } - MapEntryMessageComparator comparator(field->message_type()); - std::stable_sort(result.begin(), result.end(), comparator); - // Complain if the keys aren't in ascending order. -#ifndef NDEBUG - for (size_t j = 1; j < static_cast(map_size); j++) { - if (!comparator(result[j - 1], result[j])) { - GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1]) - ? "internal error in map key sorting" - : "map keys are not unique"); - } - } -#endif - return result; - } - - private: - class PROTOBUF_EXPORT MapEntryMessageComparator { - public: - explicit MapEntryMessageComparator(const Descriptor* descriptor) - : field_(descriptor->field(0)) {} - - bool operator()(const Message* a, const Message* b) { - const Reflection* reflection = a->GetReflection(); - switch (field_->cpp_type()) { - case FieldDescriptor::CPPTYPE_BOOL: { - bool first = reflection->GetBool(*a, field_); - bool second = reflection->GetBool(*b, field_); - return first < second; - } - case FieldDescriptor::CPPTYPE_INT32: { - int32_t first = reflection->GetInt32(*a, field_); - int32_t second = reflection->GetInt32(*b, field_); - return first < second; - } - case FieldDescriptor::CPPTYPE_INT64: { - int64_t first = reflection->GetInt64(*a, field_); - int64_t second = reflection->GetInt64(*b, field_); - return first < second; - } - case FieldDescriptor::CPPTYPE_UINT32: { - uint32_t first = reflection->GetUInt32(*a, field_); - uint32_t second = reflection->GetUInt32(*b, field_); - return first < second; - } - case FieldDescriptor::CPPTYPE_UINT64: { - uint64_t first = reflection->GetUInt64(*a, field_); - uint64_t second = reflection->GetUInt64(*b, field_); - return first < second; - } - case FieldDescriptor::CPPTYPE_STRING: { - std::string first = reflection->GetString(*a, field_); - std::string second = reflection->GetString(*b, field_); - return first < second; - } - default: - GOOGLE_LOG(DFATAL) << "Invalid key for map field."; - return true; - } - } - - private: - const FieldDescriptor* field_; - }; -}; - } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_DYNAMIC_MESSAGE_H__ diff --git a/depends/protobuf/google/protobuf/extension_set.cc b/depends/protobuf/google/protobuf/extension_set.cc new file mode 100644 index 000000000..1a6f5dfc2 --- /dev/null +++ b/depends/protobuf/google/protobuf/extension_set.cc @@ -0,0 +1,1464 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace internal { + +namespace { + +inline WireFormatLite::FieldType real_type(FieldType type) { + GOOGLE_DCHECK(type > 0 && type <= WireFormatLite::MAX_FIELD_TYPE); + return static_cast(type); +} + +inline WireFormatLite::CppType cpp_type(FieldType type) { + return WireFormatLite::FieldTypeToCppType(real_type(type)); +} + +// Registry stuff. +typedef hash_map, + ExtensionInfo> ExtensionRegistry; +ExtensionRegistry* registry_ = NULL; +GOOGLE_PROTOBUF_DECLARE_ONCE(registry_init_); + +void DeleteRegistry() { + delete registry_; + registry_ = NULL; +} + +void InitRegistry() { + registry_ = new ExtensionRegistry; + internal::OnShutdown(&DeleteRegistry); +} + +// This function is only called at startup, so there is no need for thread- +// safety. +void Register(const MessageLite* containing_type, + int number, ExtensionInfo info) { + ::google::protobuf::GoogleOnceInit(®istry_init_, &InitRegistry); + + if (!InsertIfNotPresent(registry_, make_pair(containing_type, number), + info)) { + GOOGLE_LOG(FATAL) << "Multiple extension registrations for type \"" + << containing_type->GetTypeName() + << "\", field number " << number << "."; + } +} + +const ExtensionInfo* FindRegisteredExtension( + const MessageLite* containing_type, int number) { + return (registry_ == NULL) ? NULL : + FindOrNull(*registry_, make_pair(containing_type, number)); +} + +} // namespace + +ExtensionFinder::~ExtensionFinder() {} + +bool GeneratedExtensionFinder::Find(int number, ExtensionInfo* output) { + const ExtensionInfo* extension = + FindRegisteredExtension(containing_type_, number); + if (extension == NULL) { + return false; + } else { + *output = *extension; + return true; + } +} + +void ExtensionSet::RegisterExtension(const MessageLite* containing_type, + int number, FieldType type, + bool is_repeated, bool is_packed) { + GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_ENUM); + GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_MESSAGE); + GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_GROUP); + ExtensionInfo info(type, is_repeated, is_packed); + Register(containing_type, number, info); +} + +static bool CallNoArgValidityFunc(const void* arg, int number) { + // Note: Must use C-style cast here rather than reinterpret_cast because + // the C++ standard at one point did not allow casts between function and + // data pointers and some compilers enforce this for C++-style casts. No + // compiler enforces it for C-style casts since lots of C-style code has + // relied on these kinds of casts for a long time, despite being + // technically undefined. See: + // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195 + // Also note: Some compilers do not allow function pointers to be "const". + // Which makes sense, I suppose, because it's meaningless. + return ((EnumValidityFunc*)arg)(number); +} + +void ExtensionSet::RegisterEnumExtension(const MessageLite* containing_type, + int number, FieldType type, + bool is_repeated, bool is_packed, + EnumValidityFunc* is_valid) { + GOOGLE_CHECK_EQ(type, WireFormatLite::TYPE_ENUM); + ExtensionInfo info(type, is_repeated, is_packed); + info.enum_validity_check.func = CallNoArgValidityFunc; + // See comment in CallNoArgValidityFunc() about why we use a c-style cast. + info.enum_validity_check.arg = (void*)is_valid; + Register(containing_type, number, info); +} + +void ExtensionSet::RegisterMessageExtension(const MessageLite* containing_type, + int number, FieldType type, + bool is_repeated, bool is_packed, + const MessageLite* prototype) { + GOOGLE_CHECK(type == WireFormatLite::TYPE_MESSAGE || + type == WireFormatLite::TYPE_GROUP); + ExtensionInfo info(type, is_repeated, is_packed); + info.message_prototype = prototype; + Register(containing_type, number, info); +} + + +// =================================================================== +// Constructors and basic methods. + +ExtensionSet::ExtensionSet() {} + +ExtensionSet::~ExtensionSet() { + for (map::iterator iter = extensions_.begin(); + iter != extensions_.end(); ++iter) { + iter->second.Free(); + } +} + +// Defined in extension_set_heavy.cc. +// void ExtensionSet::AppendToList(const Descriptor* containing_type, +// const DescriptorPool* pool, +// vector* output) const + +bool ExtensionSet::Has(int number) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end()) return false; + GOOGLE_DCHECK(!iter->second.is_repeated); + return !iter->second.is_cleared; +} + +int ExtensionSet::ExtensionSize(int number) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end()) return false; + return iter->second.GetSize(); +} + +FieldType ExtensionSet::ExtensionType(int number) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end()) { + GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (1). "; + return 0; + } + if (iter->second.is_cleared) { + GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (2). "; + } + return iter->second.type; +} + +void ExtensionSet::ClearExtension(int number) { + map::iterator iter = extensions_.find(number); + if (iter == extensions_.end()) return; + iter->second.Clear(); +} + +// =================================================================== +// Field accessors + +namespace { + +enum Cardinality { + REPEATED, + OPTIONAL +}; + +} // namespace + +#define GOOGLE_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \ + GOOGLE_DCHECK_EQ((EXTENSION).is_repeated ? REPEATED : OPTIONAL, LABEL); \ + GOOGLE_DCHECK_EQ(cpp_type((EXTENSION).type), WireFormatLite::CPPTYPE_##CPPTYPE) + +// ------------------------------------------------------------------- +// Primitives + +#define PRIMITIVE_ACCESSORS(UPPERCASE, LOWERCASE, CAMELCASE) \ + \ +LOWERCASE ExtensionSet::Get##CAMELCASE(int number, \ + LOWERCASE default_value) const { \ + map::const_iterator iter = extensions_.find(number); \ + if (iter == extensions_.end() || iter->second.is_cleared) { \ + return default_value; \ + } else { \ + GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, UPPERCASE); \ + return iter->second.LOWERCASE##_value; \ + } \ +} \ + \ +void ExtensionSet::Set##CAMELCASE(int number, FieldType type, \ + LOWERCASE value, \ + const FieldDescriptor* descriptor) { \ + Extension* extension; \ + if (MaybeNewExtension(number, descriptor, &extension)) { \ + extension->type = type; \ + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_##UPPERCASE); \ + extension->is_repeated = false; \ + } else { \ + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, UPPERCASE); \ + } \ + extension->is_cleared = false; \ + extension->LOWERCASE##_value = value; \ +} \ + \ +LOWERCASE ExtensionSet::GetRepeated##CAMELCASE(int number, int index) const { \ + map::const_iterator iter = extensions_.find(number); \ + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; \ + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, UPPERCASE); \ + return iter->second.repeated_##LOWERCASE##_value->Get(index); \ +} \ + \ +void ExtensionSet::SetRepeated##CAMELCASE( \ + int number, int index, LOWERCASE value) { \ + map::iterator iter = extensions_.find(number); \ + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; \ + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, UPPERCASE); \ + iter->second.repeated_##LOWERCASE##_value->Set(index, value); \ +} \ + \ +void ExtensionSet::Add##CAMELCASE(int number, FieldType type, \ + bool packed, LOWERCASE value, \ + const FieldDescriptor* descriptor) { \ + Extension* extension; \ + if (MaybeNewExtension(number, descriptor, &extension)) { \ + extension->type = type; \ + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_##UPPERCASE); \ + extension->is_repeated = true; \ + extension->is_packed = packed; \ + extension->repeated_##LOWERCASE##_value = new RepeatedField(); \ + } else { \ + GOOGLE_DCHECK_TYPE(*extension, REPEATED, UPPERCASE); \ + GOOGLE_DCHECK_EQ(extension->is_packed, packed); \ + } \ + extension->repeated_##LOWERCASE##_value->Add(value); \ +} + +PRIMITIVE_ACCESSORS( INT32, int32, Int32) +PRIMITIVE_ACCESSORS( INT64, int64, Int64) +PRIMITIVE_ACCESSORS(UINT32, uint32, UInt32) +PRIMITIVE_ACCESSORS(UINT64, uint64, UInt64) +PRIMITIVE_ACCESSORS( FLOAT, float, Float) +PRIMITIVE_ACCESSORS(DOUBLE, double, Double) +PRIMITIVE_ACCESSORS( BOOL, bool, Bool) + +#undef PRIMITIVE_ACCESSORS + +// ------------------------------------------------------------------- +// Enums + +int ExtensionSet::GetEnum(int number, int default_value) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end() || iter->second.is_cleared) { + // Not present. Return the default value. + return default_value; + } else { + GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, ENUM); + return iter->second.enum_value; + } +} + +void ExtensionSet::SetEnum(int number, FieldType type, int value, + const FieldDescriptor* descriptor) { + Extension* extension; + if (MaybeNewExtension(number, descriptor, &extension)) { + extension->type = type; + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_ENUM); + extension->is_repeated = false; + } else { + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, ENUM); + } + extension->is_cleared = false; + extension->enum_value = value; +} + +int ExtensionSet::GetRepeatedEnum(int number, int index) const { + map::const_iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, ENUM); + return iter->second.repeated_enum_value->Get(index); +} + +void ExtensionSet::SetRepeatedEnum(int number, int index, int value) { + map::iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, ENUM); + iter->second.repeated_enum_value->Set(index, value); +} + +void ExtensionSet::AddEnum(int number, FieldType type, + bool packed, int value, + const FieldDescriptor* descriptor) { + Extension* extension; + if (MaybeNewExtension(number, descriptor, &extension)) { + extension->type = type; + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_ENUM); + extension->is_repeated = true; + extension->is_packed = packed; + extension->repeated_enum_value = new RepeatedField(); + } else { + GOOGLE_DCHECK_TYPE(*extension, REPEATED, ENUM); + GOOGLE_DCHECK_EQ(extension->is_packed, packed); + } + extension->repeated_enum_value->Add(value); +} + +// ------------------------------------------------------------------- +// Strings + +const string& ExtensionSet::GetString(int number, + const string& default_value) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end() || iter->second.is_cleared) { + // Not present. Return the default value. + return default_value; + } else { + GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, STRING); + return *iter->second.string_value; + } +} + +string* ExtensionSet::MutableString(int number, FieldType type, + const FieldDescriptor* descriptor) { + Extension* extension; + if (MaybeNewExtension(number, descriptor, &extension)) { + extension->type = type; + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_STRING); + extension->is_repeated = false; + extension->string_value = new string; + } else { + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, STRING); + } + extension->is_cleared = false; + return extension->string_value; +} + +const string& ExtensionSet::GetRepeatedString(int number, int index) const { + map::const_iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, STRING); + return iter->second.repeated_string_value->Get(index); +} + +string* ExtensionSet::MutableRepeatedString(int number, int index) { + map::iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, STRING); + return iter->second.repeated_string_value->Mutable(index); +} + +string* ExtensionSet::AddString(int number, FieldType type, + const FieldDescriptor* descriptor) { + Extension* extension; + if (MaybeNewExtension(number, descriptor, &extension)) { + extension->type = type; + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_STRING); + extension->is_repeated = true; + extension->is_packed = false; + extension->repeated_string_value = new RepeatedPtrField(); + } else { + GOOGLE_DCHECK_TYPE(*extension, REPEATED, STRING); + } + return extension->repeated_string_value->Add(); +} + +// ------------------------------------------------------------------- +// Messages + +const MessageLite& ExtensionSet::GetMessage( + int number, const MessageLite& default_value) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end()) { + // Not present. Return the default value. + return default_value; + } else { + GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE); + return *iter->second.message_value; + } +} + +// Defined in extension_set_heavy.cc. +// const MessageLite& ExtensionSet::GetMessage(int number, +// const Descriptor* message_type, +// MessageFactory* factory) const + +MessageLite* ExtensionSet::MutableMessage(int number, FieldType type, + const MessageLite& prototype, + const FieldDescriptor* descriptor) { + Extension* extension; + if (MaybeNewExtension(number, descriptor, &extension)) { + extension->type = type; + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); + extension->is_repeated = false; + extension->message_value = prototype.New(); + } else { + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); + } + extension->is_cleared = false; + return extension->message_value; +} + +// Defined in extension_set_heavy.cc. +// MessageLite* ExtensionSet::MutableMessage(int number, FieldType type, +// const Descriptor* message_type, +// MessageFactory* factory) + +const MessageLite& ExtensionSet::GetRepeatedMessage( + int number, int index) const { + map::const_iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, MESSAGE); + return iter->second.repeated_message_value->Get(index); +} + +MessageLite* ExtensionSet::MutableRepeatedMessage(int number, int index) { + map::iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + GOOGLE_DCHECK_TYPE(iter->second, REPEATED, MESSAGE); + return iter->second.repeated_message_value->Mutable(index); +} + +MessageLite* ExtensionSet::AddMessage(int number, FieldType type, + const MessageLite& prototype, + const FieldDescriptor* descriptor) { + Extension* extension; + if (MaybeNewExtension(number, descriptor, &extension)) { + extension->type = type; + GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); + extension->is_repeated = true; + extension->repeated_message_value = + new RepeatedPtrField(); + } else { + GOOGLE_DCHECK_TYPE(*extension, REPEATED, MESSAGE); + } + + // RepeatedPtrField does not know how to Add() since it cannot + // allocate an abstract object, so we have to be tricky. + MessageLite* result = extension->repeated_message_value + ->AddFromCleared >(); + if (result == NULL) { + result = prototype.New(); + extension->repeated_message_value->AddAllocated(result); + } + return result; +} + +// Defined in extension_set_heavy.cc. +// MessageLite* ExtensionSet::AddMessage(int number, FieldType type, +// const Descriptor* message_type, +// MessageFactory* factory) + +#undef GOOGLE_DCHECK_TYPE + +void ExtensionSet::RemoveLast(int number) { + map::iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + + Extension* extension = &iter->second; + GOOGLE_DCHECK(extension->is_repeated); + + switch(cpp_type(extension->type)) { + case WireFormatLite::CPPTYPE_INT32: + extension->repeated_int32_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_INT64: + extension->repeated_int64_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_UINT32: + extension->repeated_uint32_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_UINT64: + extension->repeated_uint64_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_FLOAT: + extension->repeated_float_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_DOUBLE: + extension->repeated_double_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_BOOL: + extension->repeated_bool_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_ENUM: + extension->repeated_enum_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_STRING: + extension->repeated_string_value->RemoveLast(); + break; + case WireFormatLite::CPPTYPE_MESSAGE: + extension->repeated_message_value->RemoveLast(); + break; + } +} + +void ExtensionSet::SwapElements(int number, int index1, int index2) { + map::iterator iter = extensions_.find(number); + GOOGLE_CHECK(iter != extensions_.end()) << "Index out-of-bounds (field is empty)."; + + Extension* extension = &iter->second; + GOOGLE_DCHECK(extension->is_repeated); + + switch(cpp_type(extension->type)) { + case WireFormatLite::CPPTYPE_INT32: + extension->repeated_int32_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_INT64: + extension->repeated_int64_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_UINT32: + extension->repeated_uint32_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_UINT64: + extension->repeated_uint64_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_FLOAT: + extension->repeated_float_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_DOUBLE: + extension->repeated_double_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_BOOL: + extension->repeated_bool_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_ENUM: + extension->repeated_enum_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_STRING: + extension->repeated_string_value->SwapElements(index1, index2); + break; + case WireFormatLite::CPPTYPE_MESSAGE: + extension->repeated_message_value->SwapElements(index1, index2); + break; + } +} + +// =================================================================== + +void ExtensionSet::Clear() { + for (map::iterator iter = extensions_.begin(); + iter != extensions_.end(); ++iter) { + iter->second.Clear(); + } +} + +void ExtensionSet::MergeFrom(const ExtensionSet& other) { + for (map::const_iterator iter = other.extensions_.begin(); + iter != other.extensions_.end(); ++iter) { + const Extension& other_extension = iter->second; + + if (other_extension.is_repeated) { + Extension* extension; + bool is_new = MaybeNewExtension(iter->first, other_extension.descriptor, + &extension); + if (is_new) { + // Extension did not already exist in set. + extension->type = other_extension.type; + extension->is_repeated = true; + } else { + GOOGLE_DCHECK_EQ(extension->type, other_extension.type); + GOOGLE_DCHECK(extension->is_repeated); + } + + switch (cpp_type(other_extension.type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE, REPEATED_TYPE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + if (is_new) { \ + extension->repeated_##LOWERCASE##_value = \ + new REPEATED_TYPE; \ + } \ + extension->repeated_##LOWERCASE##_value->MergeFrom( \ + *other_extension.repeated_##LOWERCASE##_value); \ + break; + + HANDLE_TYPE( INT32, int32, RepeatedField < int32>); + HANDLE_TYPE( INT64, int64, RepeatedField < int64>); + HANDLE_TYPE( UINT32, uint32, RepeatedField < uint32>); + HANDLE_TYPE( UINT64, uint64, RepeatedField < uint64>); + HANDLE_TYPE( FLOAT, float, RepeatedField < float>); + HANDLE_TYPE( DOUBLE, double, RepeatedField < double>); + HANDLE_TYPE( BOOL, bool, RepeatedField < bool>); + HANDLE_TYPE( ENUM, enum, RepeatedField < int>); + HANDLE_TYPE( STRING, string, RepeatedPtrField< string>); +#undef HANDLE_TYPE + + case WireFormatLite::CPPTYPE_MESSAGE: + if (is_new) { + extension->repeated_message_value = + new RepeatedPtrField(); + } + // We can't call RepeatedPtrField::MergeFrom() because + // it would attempt to allocate new objects. + RepeatedPtrField* other_repeated_message = + other_extension.repeated_message_value; + for (int i = 0; i < other_repeated_message->size(); i++) { + const MessageLite& other_message = other_repeated_message->Get(i); + MessageLite* target = extension->repeated_message_value + ->AddFromCleared >(); + if (target == NULL) { + target = other_message.New(); + extension->repeated_message_value->AddAllocated(target); + } + target->CheckTypeAndMergeFrom(other_message); + } + break; + } + } else { + if (!other_extension.is_cleared) { + switch (cpp_type(other_extension.type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE, CAMELCASE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + Set##CAMELCASE(iter->first, other_extension.type, \ + other_extension.LOWERCASE##_value, \ + other_extension.descriptor); \ + break; + + HANDLE_TYPE( INT32, int32, Int32); + HANDLE_TYPE( INT64, int64, Int64); + HANDLE_TYPE(UINT32, uint32, UInt32); + HANDLE_TYPE(UINT64, uint64, UInt64); + HANDLE_TYPE( FLOAT, float, Float); + HANDLE_TYPE(DOUBLE, double, Double); + HANDLE_TYPE( BOOL, bool, Bool); + HANDLE_TYPE( ENUM, enum, Enum); +#undef HANDLE_TYPE + case WireFormatLite::CPPTYPE_STRING: + SetString(iter->first, other_extension.type, + *other_extension.string_value, + other_extension.descriptor); + break; + case WireFormatLite::CPPTYPE_MESSAGE: + MutableMessage(iter->first, other_extension.type, + *other_extension.message_value, + other_extension.descriptor) + ->CheckTypeAndMergeFrom(*other_extension.message_value); + break; + } + } + } + } +} + +void ExtensionSet::Swap(ExtensionSet* x) { + extensions_.swap(x->extensions_); +} + +bool ExtensionSet::IsInitialized() const { + // Extensions are never required. However, we need to check that all + // embedded messages are initialized. + for (map::const_iterator iter = extensions_.begin(); + iter != extensions_.end(); ++iter) { + const Extension& extension = iter->second; + if (cpp_type(extension.type) == WireFormatLite::CPPTYPE_MESSAGE) { + if (extension.is_repeated) { + for (int i = 0; i < extension.repeated_message_value->size(); i++) { + if (!extension.repeated_message_value->Get(i).IsInitialized()) { + return false; + } + } + } else { + if (!extension.is_cleared) { + if (!extension.message_value->IsInitialized()) return false; + } + } + } + } + + return true; +} + +bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, + ExtensionFinder* extension_finder, + FieldSkipper* field_skipper) { + int number = WireFormatLite::GetTagFieldNumber(tag); + WireFormatLite::WireType wire_type = WireFormatLite::GetTagWireType(tag); + + ExtensionInfo extension; + bool is_unknown; + if (!extension_finder->Find(number, &extension)) { + is_unknown = true; + } else if (extension.is_packed) { + is_unknown = (wire_type != WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + } else { + WireFormatLite::WireType expected_wire_type = + WireFormatLite::WireTypeForFieldType(real_type(extension.type)); + is_unknown = (wire_type != expected_wire_type); + } + + if (is_unknown) { + field_skipper->SkipField(input, tag); + } else if (extension.is_packed) { + uint32 size; + if (!input->ReadVarint32(&size)) return false; + io::CodedInputStream::Limit limit = input->PushLimit(size); + + switch (extension.type) { +#define HANDLE_TYPE(UPPERCASE, CPP_CAMELCASE, CPP_LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + while (input->BytesUntilLimit() > 0) { \ + CPP_LOWERCASE value; \ + if (!WireFormatLite::ReadPrimitive< \ + CPP_LOWERCASE, WireFormatLite::TYPE_##UPPERCASE>( \ + input, &value)) return false; \ + Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \ + true, value, extension.descriptor); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, Int32, int32); + HANDLE_TYPE( SINT64, Int64, int64); + HANDLE_TYPE( FIXED32, UInt32, uint32); + HANDLE_TYPE( FIXED64, UInt64, uint64); + HANDLE_TYPE(SFIXED32, Int32, int32); + HANDLE_TYPE(SFIXED64, Int64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); +#undef HANDLE_TYPE + + case WireFormatLite::TYPE_ENUM: + while (input->BytesUntilLimit() > 0) { + int value; + if (!WireFormatLite::ReadPrimitive( + input, &value)) return false; + if (extension.enum_validity_check.func( + extension.enum_validity_check.arg, value)) { + AddEnum(number, WireFormatLite::TYPE_ENUM, true, value, + extension.descriptor); + } + } + break; + + case WireFormatLite::TYPE_STRING: + case WireFormatLite::TYPE_BYTES: + case WireFormatLite::TYPE_GROUP: + case WireFormatLite::TYPE_MESSAGE: + GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + break; + } + + input->PopLimit(limit); + } else { + switch (extension.type) { +#define HANDLE_TYPE(UPPERCASE, CPP_CAMELCASE, CPP_LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: { \ + CPP_LOWERCASE value; \ + if (!WireFormatLite::ReadPrimitive< \ + CPP_LOWERCASE, WireFormatLite::TYPE_##UPPERCASE>( \ + input, &value)) return false; \ + if (extension.is_repeated) { \ + Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \ + false, value, extension.descriptor); \ + } else { \ + Set##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, value, \ + extension.descriptor); \ + } \ + } break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, Int32, int32); + HANDLE_TYPE( SINT64, Int64, int64); + HANDLE_TYPE( FIXED32, UInt32, uint32); + HANDLE_TYPE( FIXED64, UInt64, uint64); + HANDLE_TYPE(SFIXED32, Int32, int32); + HANDLE_TYPE(SFIXED64, Int64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); +#undef HANDLE_TYPE + + case WireFormatLite::TYPE_ENUM: { + int value; + if (!WireFormatLite::ReadPrimitive( + input, &value)) return false; + + if (!extension.enum_validity_check.func( + extension.enum_validity_check.arg, value)) { + // Invalid value. Treat as unknown. + field_skipper->SkipUnknownEnum(number, value); + } else if (extension.is_repeated) { + AddEnum(number, WireFormatLite::TYPE_ENUM, false, value, + extension.descriptor); + } else { + SetEnum(number, WireFormatLite::TYPE_ENUM, value, + extension.descriptor); + } + break; + } + + case WireFormatLite::TYPE_STRING: { + string* value = extension.is_repeated ? + AddString(number, WireFormatLite::TYPE_STRING, extension.descriptor) : + MutableString(number, WireFormatLite::TYPE_STRING, + extension.descriptor); + if (!WireFormatLite::ReadString(input, value)) return false; + break; + } + + case WireFormatLite::TYPE_BYTES: { + string* value = extension.is_repeated ? + AddString(number, WireFormatLite::TYPE_STRING, extension.descriptor) : + MutableString(number, WireFormatLite::TYPE_STRING, + extension.descriptor); + if (!WireFormatLite::ReadBytes(input, value)) return false; + break; + } + + case WireFormatLite::TYPE_GROUP: { + MessageLite* value = extension.is_repeated ? + AddMessage(number, WireFormatLite::TYPE_GROUP, + *extension.message_prototype, extension.descriptor) : + MutableMessage(number, WireFormatLite::TYPE_GROUP, + *extension.message_prototype, extension.descriptor); + if (!WireFormatLite::ReadGroup(number, input, value)) return false; + break; + } + + case WireFormatLite::TYPE_MESSAGE: { + MessageLite* value = extension.is_repeated ? + AddMessage(number, WireFormatLite::TYPE_MESSAGE, + *extension.message_prototype, extension.descriptor) : + MutableMessage(number, WireFormatLite::TYPE_MESSAGE, + *extension.message_prototype, extension.descriptor); + if (!WireFormatLite::ReadMessage(input, value)) return false; + break; + } + } + } + + return true; +} + +bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, + const MessageLite* containing_type) { + FieldSkipper skipper; + GeneratedExtensionFinder finder(containing_type); + return ParseField(tag, input, &finder, &skipper); +} + +// Defined in extension_set_heavy.cc. +// bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, +// const MessageLite* containing_type, +// UnknownFieldSet* unknown_fields) + +bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, + ExtensionFinder* extension_finder, + FieldSkipper* field_skipper) { + while (true) { + uint32 tag = input->ReadTag(); + switch (tag) { + case 0: + return true; + case WireFormatLite::kMessageSetItemStartTag: + if (!ParseMessageSetItem(input, extension_finder, field_skipper)) { + return false; + } + break; + default: + if (!ParseField(tag, input, extension_finder, field_skipper)) { + return false; + } + break; + } + } +} + +bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, + const MessageLite* containing_type) { + FieldSkipper skipper; + GeneratedExtensionFinder finder(containing_type); + return ParseMessageSet(input, &finder, &skipper); +} + +// Defined in extension_set_heavy.cc. +// bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, +// const MessageLite* containing_type, +// UnknownFieldSet* unknown_fields); + +bool ExtensionSet::ParseMessageSetItem(io::CodedInputStream* input, + ExtensionFinder* extension_finder, + FieldSkipper* field_skipper) { + // TODO(kenton): It would be nice to share code between this and + // WireFormatLite::ParseAndMergeMessageSetItem(), but I think the + // differences would be hard to factor out. + + // This method parses a group which should contain two fields: + // required int32 type_id = 2; + // required data message = 3; + + // Once we see a type_id, we'll construct a fake tag for this extension + // which is the tag it would have had under the proto2 extensions wire + // format. + uint32 fake_tag = 0; + + // If we see message data before the type_id, we'll append it to this so + // we can parse it later. This will probably never happen in practice, + // as no MessageSet encoder I know of writes the message before the type ID. + // But, it's technically valid so we should allow it. + // TODO(kenton): Use a Cord instead? Do I care? + string message_data; + + while (true) { + uint32 tag = input->ReadTag(); + if (tag == 0) return false; + + switch (tag) { + case WireFormatLite::kMessageSetTypeIdTag: { + uint32 type_id; + if (!input->ReadVarint32(&type_id)) return false; + fake_tag = WireFormatLite::MakeTag(type_id, + WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + + if (!message_data.empty()) { + // We saw some message data before the type_id. Have to parse it + // now. + io::CodedInputStream sub_input( + reinterpret_cast(message_data.data()), + message_data.size()); + if (!ParseField(fake_tag, &sub_input, + extension_finder, field_skipper)) { + return false; + } + message_data.clear(); + } + + break; + } + + case WireFormatLite::kMessageSetMessageTag: { + if (fake_tag == 0) { + // We haven't seen a type_id yet. Append this data to message_data. + string temp; + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (!input->ReadString(&temp, length)) return false; + message_data.append(temp); + } else { + // Already saw type_id, so we can parse this directly. + if (!ParseField(fake_tag, input, + extension_finder, field_skipper)) { + return false; + } + } + + break; + } + + case WireFormatLite::kMessageSetItemEndTag: { + return true; + } + + default: { + if (!field_skipper->SkipField(input, tag)) return false; + } + } + } +} + +void ExtensionSet::SerializeWithCachedSizes( + int start_field_number, int end_field_number, + io::CodedOutputStream* output) const { + map::const_iterator iter; + for (iter = extensions_.lower_bound(start_field_number); + iter != extensions_.end() && iter->first < end_field_number; + ++iter) { + iter->second.SerializeFieldWithCachedSizes(iter->first, output); + } +} + +void ExtensionSet::SerializeMessageSetWithCachedSizes( + io::CodedOutputStream* output) const { + map::const_iterator iter; + for (iter = extensions_.begin(); iter != extensions_.end(); ++iter) { + iter->second.SerializeMessageSetItemWithCachedSizes(iter->first, output); + } +} + +int ExtensionSet::ByteSize() const { + int total_size = 0; + + for (map::const_iterator iter = extensions_.begin(); + iter != extensions_.end(); ++iter) { + total_size += iter->second.ByteSize(iter->first); + } + + return total_size; +} + +int ExtensionSet::MessageSetByteSize() const { + int total_size = 0; + + for (map::const_iterator iter = extensions_.begin(); + iter != extensions_.end(); ++iter) { + total_size += iter->second.MessageSetItemByteSize(iter->first); + } + + return total_size; +} + +// Defined in extension_set_heavy.cc. +// int ExtensionSet::SpaceUsedExcludingSelf() const + +bool ExtensionSet::MaybeNewExtension(int number, + const FieldDescriptor* descriptor, + Extension** result) { + pair::iterator, bool> insert_result = + extensions_.insert(make_pair(number, Extension())); + *result = &insert_result.first->second; + (*result)->descriptor = descriptor; + return insert_result.second; +} + +// =================================================================== +// Methods of ExtensionSet::Extension + +void ExtensionSet::Extension::Clear() { + if (is_repeated) { + switch (cpp_type(type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + repeated_##LOWERCASE##_value->Clear(); \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE( UINT32, uint32); + HANDLE_TYPE( UINT64, uint64); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( DOUBLE, double); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, enum); + HANDLE_TYPE( STRING, string); + HANDLE_TYPE(MESSAGE, message); +#undef HANDLE_TYPE + } + } else { + if (!is_cleared) { + switch (cpp_type(type)) { + case WireFormatLite::CPPTYPE_STRING: + string_value->clear(); + break; + case WireFormatLite::CPPTYPE_MESSAGE: + message_value->Clear(); + break; + default: + // No need to do anything. Get*() will return the default value + // as long as is_cleared is true and Set*() will overwrite the + // previous value. + break; + } + + is_cleared = true; + } + } +} + +void ExtensionSet::Extension::SerializeFieldWithCachedSizes( + int number, + io::CodedOutputStream* output) const { + if (is_repeated) { + if (is_packed) { + if (cached_size == 0) return; + + WireFormatLite::WriteTag(number, + WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(cached_size); + + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \ + WireFormatLite::Write##CAMELCASE##NoTag( \ + repeated_##LOWERCASE##_value->Get(i), output); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, SInt32, int32); + HANDLE_TYPE( SINT64, SInt64, int64); + HANDLE_TYPE( FIXED32, Fixed32, uint32); + HANDLE_TYPE( FIXED64, Fixed64, uint64); + HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); + HANDLE_TYPE( ENUM, Enum, enum); +#undef HANDLE_TYPE + + case WireFormatLite::TYPE_STRING: + case WireFormatLite::TYPE_BYTES: + case WireFormatLite::TYPE_GROUP: + case WireFormatLite::TYPE_MESSAGE: + GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + break; + } + } else { + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \ + WireFormatLite::Write##CAMELCASE(number, \ + repeated_##LOWERCASE##_value->Get(i), output); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, SInt32, int32); + HANDLE_TYPE( SINT64, SInt64, int64); + HANDLE_TYPE( FIXED32, Fixed32, uint32); + HANDLE_TYPE( FIXED64, Fixed64, uint64); + HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); + HANDLE_TYPE( STRING, String, string); + HANDLE_TYPE( BYTES, Bytes, string); + HANDLE_TYPE( ENUM, Enum, enum); + HANDLE_TYPE( GROUP, Group, message); + HANDLE_TYPE( MESSAGE, Message, message); +#undef HANDLE_TYPE + } + } + } else if (!is_cleared) { + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, VALUE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + WireFormatLite::Write##CAMELCASE(number, VALUE, output); \ + break + + HANDLE_TYPE( INT32, Int32, int32_value); + HANDLE_TYPE( INT64, Int64, int64_value); + HANDLE_TYPE( UINT32, UInt32, uint32_value); + HANDLE_TYPE( UINT64, UInt64, uint64_value); + HANDLE_TYPE( SINT32, SInt32, int32_value); + HANDLE_TYPE( SINT64, SInt64, int64_value); + HANDLE_TYPE( FIXED32, Fixed32, uint32_value); + HANDLE_TYPE( FIXED64, Fixed64, uint64_value); + HANDLE_TYPE(SFIXED32, SFixed32, int32_value); + HANDLE_TYPE(SFIXED64, SFixed64, int64_value); + HANDLE_TYPE( FLOAT, Float, float_value); + HANDLE_TYPE( DOUBLE, Double, double_value); + HANDLE_TYPE( BOOL, Bool, bool_value); + HANDLE_TYPE( STRING, String, *string_value); + HANDLE_TYPE( BYTES, Bytes, *string_value); + HANDLE_TYPE( ENUM, Enum, enum_value); + HANDLE_TYPE( GROUP, Group, *message_value); + HANDLE_TYPE( MESSAGE, Message, *message_value); +#undef HANDLE_TYPE + } + } +} + +void ExtensionSet::Extension::SerializeMessageSetItemWithCachedSizes( + int number, + io::CodedOutputStream* output) const { + if (type != WireFormatLite::TYPE_MESSAGE || is_repeated) { + // Not a valid MessageSet extension, but serialize it the normal way. + SerializeFieldWithCachedSizes(number, output); + return; + } + + if (is_cleared) return; + + // Start group. + output->WriteTag(WireFormatLite::kMessageSetItemStartTag); + + // Write type ID. + WireFormatLite::WriteUInt32(WireFormatLite::kMessageSetTypeIdNumber, + number, + output); + // Write message. + WireFormatLite::WriteMessageMaybeToArray( + WireFormatLite::kMessageSetMessageNumber, + *message_value, + output); + + // End group. + output->WriteTag(WireFormatLite::kMessageSetItemEndTag); +} + +int ExtensionSet::Extension::ByteSize(int number) const { + int result = 0; + + if (is_repeated) { + if (is_packed) { + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \ + result += WireFormatLite::CAMELCASE##Size( \ + repeated_##LOWERCASE##_value->Get(i)); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, SInt32, int32); + HANDLE_TYPE( SINT64, SInt64, int64); + HANDLE_TYPE( ENUM, Enum, enum); +#undef HANDLE_TYPE + + // Stuff with fixed size. +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + result += WireFormatLite::k##CAMELCASE##Size * \ + repeated_##LOWERCASE##_value->size(); \ + break + HANDLE_TYPE( FIXED32, Fixed32, uint32); + HANDLE_TYPE( FIXED64, Fixed64, uint64); + HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); +#undef HANDLE_TYPE + + case WireFormatLite::TYPE_STRING: + case WireFormatLite::TYPE_BYTES: + case WireFormatLite::TYPE_GROUP: + case WireFormatLite::TYPE_MESSAGE: + GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + break; + } + + cached_size = result; + if (result > 0) { + result += io::CodedOutputStream::VarintSize32(result); + result += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(number, + WireFormatLite::WIRETYPE_LENGTH_DELIMITED)); + } + } else { + int tag_size = WireFormatLite::TagSize(number, real_type(type)); + + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + result += tag_size * repeated_##LOWERCASE##_value->size(); \ + for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \ + result += WireFormatLite::CAMELCASE##Size( \ + repeated_##LOWERCASE##_value->Get(i)); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, SInt32, int32); + HANDLE_TYPE( SINT64, SInt64, int64); + HANDLE_TYPE( STRING, String, string); + HANDLE_TYPE( BYTES, Bytes, string); + HANDLE_TYPE( ENUM, Enum, enum); + HANDLE_TYPE( GROUP, Group, message); + HANDLE_TYPE( MESSAGE, Message, message); +#undef HANDLE_TYPE + + // Stuff with fixed size. +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + result += (tag_size + WireFormatLite::k##CAMELCASE##Size) * \ + repeated_##LOWERCASE##_value->size(); \ + break + HANDLE_TYPE( FIXED32, Fixed32, uint32); + HANDLE_TYPE( FIXED64, Fixed64, uint64); + HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); +#undef HANDLE_TYPE + } + } + } else if (!is_cleared) { + result += WireFormatLite::TagSize(number, real_type(type)); + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + result += WireFormatLite::CAMELCASE##Size(LOWERCASE); \ + break + + HANDLE_TYPE( INT32, Int32, int32_value); + HANDLE_TYPE( INT64, Int64, int64_value); + HANDLE_TYPE( UINT32, UInt32, uint32_value); + HANDLE_TYPE( UINT64, UInt64, uint64_value); + HANDLE_TYPE( SINT32, SInt32, int32_value); + HANDLE_TYPE( SINT64, SInt64, int64_value); + HANDLE_TYPE( STRING, String, *string_value); + HANDLE_TYPE( BYTES, Bytes, *string_value); + HANDLE_TYPE( ENUM, Enum, enum_value); + HANDLE_TYPE( GROUP, Group, *message_value); + HANDLE_TYPE( MESSAGE, Message, *message_value); +#undef HANDLE_TYPE + + // Stuff with fixed size. +#define HANDLE_TYPE(UPPERCASE, CAMELCASE) \ + case WireFormatLite::TYPE_##UPPERCASE: \ + result += WireFormatLite::k##CAMELCASE##Size; \ + break + HANDLE_TYPE( FIXED32, Fixed32); + HANDLE_TYPE( FIXED64, Fixed64); + HANDLE_TYPE(SFIXED32, SFixed32); + HANDLE_TYPE(SFIXED64, SFixed64); + HANDLE_TYPE( FLOAT, Float); + HANDLE_TYPE( DOUBLE, Double); + HANDLE_TYPE( BOOL, Bool); +#undef HANDLE_TYPE + } + } + + return result; +} + +int ExtensionSet::Extension::MessageSetItemByteSize(int number) const { + if (type != WireFormatLite::TYPE_MESSAGE || is_repeated) { + // Not a valid MessageSet extension, but compute the byte size for it the + // normal way. + return ByteSize(number); + } + + if (is_cleared) return 0; + + int our_size = WireFormatLite::kMessageSetItemTagsSize; + + // type_id + our_size += io::CodedOutputStream::VarintSize32(number); + + // message + int message_size = message_value->ByteSize(); + + our_size += io::CodedOutputStream::VarintSize32(message_size); + our_size += message_size; + + return our_size; +} + +int ExtensionSet::Extension::GetSize() const { + GOOGLE_DCHECK(is_repeated); + switch (cpp_type(type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + return repeated_##LOWERCASE##_value->size() + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE( UINT32, uint32); + HANDLE_TYPE( UINT64, uint64); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( DOUBLE, double); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, enum); + HANDLE_TYPE( STRING, string); + HANDLE_TYPE(MESSAGE, message); +#undef HANDLE_TYPE + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return 0; +} + +void ExtensionSet::Extension::Free() { + if (is_repeated) { + switch (cpp_type(type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + delete repeated_##LOWERCASE##_value; \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE( UINT32, uint32); + HANDLE_TYPE( UINT64, uint64); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( DOUBLE, double); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, enum); + HANDLE_TYPE( STRING, string); + HANDLE_TYPE(MESSAGE, message); +#undef HANDLE_TYPE + } + } else { + switch (cpp_type(type)) { + case WireFormatLite::CPPTYPE_STRING: + delete string_value; + break; + case WireFormatLite::CPPTYPE_MESSAGE: + delete message_value; + break; + default: + break; + } + } +} + +// Defined in extension_set_heavy.cc. +// int ExtensionSet::Extension::SpaceUsedExcludingSelf() const + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/extension_set.h b/depends/protobuf/google/protobuf/extension_set.h new file mode 100644 index 000000000..ac1ada029 --- /dev/null +++ b/depends/protobuf/google/protobuf/extension_set.h @@ -0,0 +1,904 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 header is logically internal, but is made public because it is used +// from protocol-compiler-generated code, which may reside in other components. + +#ifndef GOOGLE_PROTOBUF_EXTENSION_SET_H__ +#define GOOGLE_PROTOBUF_EXTENSION_SET_H__ + +#include +#include +#include +#include + + +#include + +namespace google { + +namespace protobuf { + class Descriptor; // descriptor.h + class FieldDescriptor; // descriptor.h + class DescriptorPool; // descriptor.h + class MessageLite; // message_lite.h + class Message; // message.h + class MessageFactory; // message.h + class UnknownFieldSet; // unknown_field_set.h + namespace io { + class CodedInputStream; // coded_stream.h + class CodedOutputStream; // coded_stream.h + } + namespace internal { + class FieldSkipper; // wire_format_lite.h + class RepeatedPtrFieldBase; // repeated_field.h + } + template class RepeatedField; // repeated_field.h + template class RepeatedPtrField; // repeated_field.h +} + +namespace protobuf { +namespace internal { + +// Used to store values of type WireFormatLite::FieldType without having to +// #include wire_format_lite.h. Also, ensures that we use only one byte to +// store these values, which is important to keep the layout of +// ExtensionSet::Extension small. +typedef uint8 FieldType; + +// A function which, given an integer value, returns true if the number +// matches one of the defined values for the corresponding enum type. This +// is used with RegisterEnumExtension, below. +typedef bool EnumValidityFunc(int number); + +// Version of the above which takes an argument. This is needed to deal with +// extensions that are not compiled in. +typedef bool EnumValidityFuncWithArg(const void* arg, int number); + +// Information about a registered extension. +struct ExtensionInfo { + inline ExtensionInfo() {} + inline ExtensionInfo(FieldType type, bool is_repeated, bool is_packed) + : type(type), is_repeated(is_repeated), is_packed(is_packed), + descriptor(NULL) {} + + FieldType type; + bool is_repeated; + bool is_packed; + + struct EnumValidityCheck { + EnumValidityFuncWithArg* func; + const void* arg; + }; + + union { + EnumValidityCheck enum_validity_check; + const MessageLite* message_prototype; + }; + + // The descriptor for this extension, if one exists and is known. May be + // NULL. Must not be NULL if the descriptor for the extension does not + // live in the same pool as the descriptor for the containing type. + const FieldDescriptor* descriptor; +}; + +// Abstract interface for an object which looks up extension definitions. Used +// when parsing. +class LIBPROTOBUF_EXPORT ExtensionFinder { + public: + virtual ~ExtensionFinder(); + + // Find the extension with the given containing type and number. + virtual bool Find(int number, ExtensionInfo* output) = 0; +}; + +// Implementation of ExtensionFinder which finds extensions defined in .proto +// files which have been compiled into the binary. +class LIBPROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder { + public: + GeneratedExtensionFinder(const MessageLite* containing_type) + : containing_type_(containing_type) {} + virtual ~GeneratedExtensionFinder() {} + + // Returns true and fills in *output if found, otherwise returns false. + virtual bool Find(int number, ExtensionInfo* output); + + private: + const MessageLite* containing_type_; +}; + +// Note: extension_set_heavy.cc defines DescriptorPoolExtensionFinder for +// finding extensions from a DescriptorPool. + +// This is an internal helper class intended for use within the protocol buffer +// library and generated classes. Clients should not use it directly. Instead, +// use the generated accessors such as GetExtension() of the class being +// extended. +// +// This class manages extensions for a protocol message object. The +// message's HasExtension(), GetExtension(), MutableExtension(), and +// ClearExtension() methods are just thin wrappers around the embedded +// ExtensionSet. When parsing, if a tag number is encountered which is +// inside one of the message type's extension ranges, the tag is passed +// off to the ExtensionSet for parsing. Etc. +class LIBPROTOBUF_EXPORT ExtensionSet { + public: + ExtensionSet(); + ~ExtensionSet(); + + // These are called at startup by protocol-compiler-generated code to + // register known extensions. The registrations are used by ParseField() + // to look up extensions for parsed field numbers. Note that dynamic parsing + // does not use ParseField(); only protocol-compiler-generated parsing + // methods do. + static void RegisterExtension(const MessageLite* containing_type, + int number, FieldType type, + bool is_repeated, bool is_packed); + static void RegisterEnumExtension(const MessageLite* containing_type, + int number, FieldType type, + bool is_repeated, bool is_packed, + EnumValidityFunc* is_valid); + static void RegisterMessageExtension(const MessageLite* containing_type, + int number, FieldType type, + bool is_repeated, bool is_packed, + const MessageLite* prototype); + + // ================================================================= + + // Add all fields which are currently present to the given vector. This + // is useful to implement Reflection::ListFields(). + void AppendToList(const Descriptor* containing_type, + const DescriptorPool* pool, + vector* output) const; + + // ================================================================= + // Accessors + // + // Generated message classes include type-safe templated wrappers around + // these methods. Generally you should use those rather than call these + // directly, unless you are doing low-level memory management. + // + // When calling any of these accessors, the extension number requested + // MUST exist in the DescriptorPool provided to the constructor. Otheriwse, + // the method will fail an assert. Normally, though, you would not call + // these directly; you would either call the generated accessors of your + // message class (e.g. GetExtension()) or you would call the accessors + // of the reflection interface. In both cases, it is impossible to + // trigger this assert failure: the generated accessors only accept + // linked-in extension types as parameters, while the Reflection interface + // requires you to provide the FieldDescriptor describing the extension. + // + // When calling any of these accessors, a protocol-compiler-generated + // implementation of the extension corresponding to the number MUST + // be linked in, and the FieldDescriptor used to refer to it MUST be + // the one generated by that linked-in code. Otherwise, the method will + // die on an assert failure. The message objects returned by the message + // accessors are guaranteed to be of the correct linked-in type. + // + // These methods pretty much match Reflection except that: + // - They're not virtual. + // - They identify fields by number rather than FieldDescriptors. + // - They identify enum values using integers rather than descriptors. + // - Strings provide Mutable() in addition to Set() accessors. + + bool Has(int number) const; + int ExtensionSize(int number) const; // Size of a repeated extension. + FieldType ExtensionType(int number) const; + void ClearExtension(int number); + + // singular fields ------------------------------------------------- + + int32 GetInt32 (int number, int32 default_value) const; + int64 GetInt64 (int number, int64 default_value) const; + uint32 GetUInt32(int number, uint32 default_value) const; + uint64 GetUInt64(int number, uint64 default_value) const; + float GetFloat (int number, float default_value) const; + double GetDouble(int number, double default_value) const; + bool GetBool (int number, bool default_value) const; + int GetEnum (int number, int default_value) const; + const string & GetString (int number, const string& default_value) const; + const MessageLite& GetMessage(int number, + const MessageLite& default_value) const; + const MessageLite& GetMessage(int number, const Descriptor* message_type, + MessageFactory* factory) const; + + // |descriptor| may be NULL so long as it is known that the descriptor for + // the extension lives in the same pool as the descriptor for the containing + // type. +#define desc const FieldDescriptor* descriptor // avoid line wrapping + void SetInt32 (int number, FieldType type, int32 value, desc); + void SetInt64 (int number, FieldType type, int64 value, desc); + void SetUInt32(int number, FieldType type, uint32 value, desc); + void SetUInt64(int number, FieldType type, uint64 value, desc); + void SetFloat (int number, FieldType type, float value, desc); + void SetDouble(int number, FieldType type, double value, desc); + void SetBool (int number, FieldType type, bool value, desc); + void SetEnum (int number, FieldType type, int value, desc); + void SetString(int number, FieldType type, const string& value, desc); + string * MutableString (int number, FieldType type, desc); + MessageLite* MutableMessage(int number, FieldType type, + const MessageLite& prototype, desc); + MessageLite* MutableMessage(const FieldDescriptor* decsriptor, + MessageFactory* factory); +#undef desc + + // repeated fields ------------------------------------------------- + + int32 GetRepeatedInt32 (int number, int index) const; + int64 GetRepeatedInt64 (int number, int index) const; + uint32 GetRepeatedUInt32(int number, int index) const; + uint64 GetRepeatedUInt64(int number, int index) const; + float GetRepeatedFloat (int number, int index) const; + double GetRepeatedDouble(int number, int index) const; + bool GetRepeatedBool (int number, int index) const; + int GetRepeatedEnum (int number, int index) const; + const string & GetRepeatedString (int number, int index) const; + const MessageLite& GetRepeatedMessage(int number, int index) const; + + void SetRepeatedInt32 (int number, int index, int32 value); + void SetRepeatedInt64 (int number, int index, int64 value); + void SetRepeatedUInt32(int number, int index, uint32 value); + void SetRepeatedUInt64(int number, int index, uint64 value); + void SetRepeatedFloat (int number, int index, float value); + void SetRepeatedDouble(int number, int index, double value); + void SetRepeatedBool (int number, int index, bool value); + void SetRepeatedEnum (int number, int index, int value); + void SetRepeatedString(int number, int index, const string& value); + string * MutableRepeatedString (int number, int index); + MessageLite* MutableRepeatedMessage(int number, int index); + +#define desc const FieldDescriptor* descriptor // avoid line wrapping + void AddInt32 (int number, FieldType type, bool packed, int32 value, desc); + void AddInt64 (int number, FieldType type, bool packed, int64 value, desc); + void AddUInt32(int number, FieldType type, bool packed, uint32 value, desc); + void AddUInt64(int number, FieldType type, bool packed, uint64 value, desc); + void AddFloat (int number, FieldType type, bool packed, float value, desc); + void AddDouble(int number, FieldType type, bool packed, double value, desc); + void AddBool (int number, FieldType type, bool packed, bool value, desc); + void AddEnum (int number, FieldType type, bool packed, int value, desc); + void AddString(int number, FieldType type, const string& value, desc); + string * AddString (int number, FieldType type, desc); + MessageLite* AddMessage(int number, FieldType type, + const MessageLite& prototype, desc); + MessageLite* AddMessage(const FieldDescriptor* descriptor, + MessageFactory* factory); +#undef desc + + void RemoveLast(int number); + void SwapElements(int number, int index1, int index2); + + // ----------------------------------------------------------------- + // TODO(kenton): Hardcore memory management accessors + + // ================================================================= + // convenience methods for implementing methods of Message + // + // These could all be implemented in terms of the other methods of this + // class, but providing them here helps keep the generated code size down. + + void Clear(); + void MergeFrom(const ExtensionSet& other); + void Swap(ExtensionSet* other); + bool IsInitialized() const; + + // Parses a single extension from the input. The input should start out + // positioned immediately after the tag. |containing_type| is the default + // instance for the containing message; it is used only to look up the + // extension by number. See RegisterExtension(), above. Unlike the other + // methods of ExtensionSet, this only works for generated message types -- + // it looks up extensions registered using RegisterExtension(). + bool ParseField(uint32 tag, io::CodedInputStream* input, + ExtensionFinder* extension_finder, + FieldSkipper* field_skipper); + + // Specific versions for lite or full messages (constructs the appropriate + // FieldSkipper automatically). + bool ParseField(uint32 tag, io::CodedInputStream* input, + const MessageLite* containing_type); + bool ParseField(uint32 tag, io::CodedInputStream* input, + const Message* containing_type, + UnknownFieldSet* unknown_fields); + + // Parse an entire message in MessageSet format. Such messages have no + // fields, only extensions. + bool ParseMessageSet(io::CodedInputStream* input, + ExtensionFinder* extension_finder, + FieldSkipper* field_skipper); + + // Specific versions for lite or full messages (constructs the appropriate + // FieldSkipper automatically). + bool ParseMessageSet(io::CodedInputStream* input, + const MessageLite* containing_type); + bool ParseMessageSet(io::CodedInputStream* input, + const Message* containing_type, + UnknownFieldSet* unknown_fields); + + // Write all extension fields with field numbers in the range + // [start_field_number, end_field_number) + // to the output stream, using the cached sizes computed when ByteSize() was + // last called. Note that the range bounds are inclusive-exclusive. + void SerializeWithCachedSizes(int start_field_number, + int end_field_number, + io::CodedOutputStream* output) const; + + // Same as SerializeWithCachedSizes, but without any bounds checking. + // The caller must ensure that target has sufficient capacity for the + // serialized extensions. + // + // Returns a pointer past the last written byte. + uint8* SerializeWithCachedSizesToArray(int start_field_number, + int end_field_number, + uint8* target) const; + + // Like above but serializes in MessageSet format. + void SerializeMessageSetWithCachedSizes(io::CodedOutputStream* output) const; + uint8* SerializeMessageSetWithCachedSizesToArray(uint8* target) const; + + // Returns the total serialized size of all the extensions. + int ByteSize() const; + + // Like ByteSize() but uses MessageSet format. + int MessageSetByteSize() const; + + // Returns (an estimate of) the total number of bytes used for storing the + // extensions in memory, excluding sizeof(*this). If the ExtensionSet is + // for a lite message (and thus possibly contains lite messages), the results + // are undefined (might work, might crash, might corrupt data, might not even + // be linked in). It's up to the protocol compiler to avoid calling this on + // such ExtensionSets (easy enough since lite messages don't implement + // SpaceUsed()). + int SpaceUsedExcludingSelf() const; + + private: + + struct Extension { + union { + int32 int32_value; + int64 int64_value; + uint32 uint32_value; + uint64 uint64_value; + float float_value; + double double_value; + bool bool_value; + int enum_value; + string* string_value; + MessageLite* message_value; + + RepeatedField * repeated_int32_value; + RepeatedField * repeated_int64_value; + RepeatedField * repeated_uint32_value; + RepeatedField * repeated_uint64_value; + RepeatedField * repeated_float_value; + RepeatedField * repeated_double_value; + RepeatedField * repeated_bool_value; + RepeatedField * repeated_enum_value; + RepeatedPtrField* repeated_string_value; + RepeatedPtrField* repeated_message_value; + }; + + FieldType type; + bool is_repeated; + + // For singular types, indicates if the extension is "cleared". This + // happens when an extension is set and then later cleared by the caller. + // We want to keep the Extension object around for reuse, so instead of + // removing it from the map, we just set is_cleared = true. This has no + // meaning for repeated types; for those, the size of the RepeatedField + // simply becomes zero when cleared. + bool is_cleared; + + // For repeated types, this indicates if the [packed=true] option is set. + bool is_packed; + + // The descriptor for this extension, if one exists and is known. May be + // NULL. Must not be NULL if the descriptor for the extension does not + // live in the same pool as the descriptor for the containing type. + const FieldDescriptor* descriptor; + + // For packed fields, the size of the packed data is recorded here when + // ByteSize() is called then used during serialization. + // TODO(kenton): Use atomic when C++ supports it. + mutable int cached_size; + + // Some helper methods for operations on a single Extension. + void SerializeFieldWithCachedSizes( + int number, + io::CodedOutputStream* output) const; + uint8* SerializeFieldWithCachedSizesToArray( + int number, + uint8* target) const; + void SerializeMessageSetItemWithCachedSizes( + int number, + io::CodedOutputStream* output) const; + uint8* SerializeMessageSetItemWithCachedSizesToArray( + int number, + uint8* target) const; + int ByteSize(int number) const; + int MessageSetItemByteSize(int number) const; + void Clear(); + int GetSize() const; + void Free(); + int SpaceUsedExcludingSelf() const; + }; + + + // Gets the extension with the given number, creating it if it does not + // already exist. Returns true if the extension did not already exist. + bool MaybeNewExtension(int number, const FieldDescriptor* descriptor, + Extension** result); + + // Parse a single MessageSet item -- called just after the item group start + // tag has been read. + bool ParseMessageSetItem(io::CodedInputStream* input, + ExtensionFinder* extension_finder, + FieldSkipper* field_skipper); + + + // Hack: RepeatedPtrFieldBase declares ExtensionSet as a friend. This + // friendship should automatically extend to ExtensionSet::Extension, but + // unfortunately some older compilers (e.g. GCC 3.4.4) do not implement this + // correctly. So, we must provide helpers for calling methods of that + // class. + + // Defined in extension_set_heavy.cc. + static inline int RepeatedMessage_SpaceUsedExcludingSelf( + RepeatedPtrFieldBase* field); + + // The Extension struct is small enough to be passed by value, so we use it + // directly as the value type in the map rather than use pointers. We use + // a map rather than hash_map here because we expect most ExtensionSets will + // only contain a small number of extensions whereas hash_map is optimized + // for 100 elements or more. Also, we want AppendToList() to order fields + // by field number. + map extensions_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet); +}; + +// These are just for convenience... +inline void ExtensionSet::SetString(int number, FieldType type, + const string& value, + const FieldDescriptor* descriptor) { + MutableString(number, type, descriptor)->assign(value); +} +inline void ExtensionSet::SetRepeatedString(int number, int index, + const string& value) { + MutableRepeatedString(number, index)->assign(value); +} +inline void ExtensionSet::AddString(int number, FieldType type, + const string& value, + const FieldDescriptor* descriptor) { + AddString(number, type, descriptor)->assign(value); +} + +// =================================================================== +// Glue for generated extension accessors + +// ------------------------------------------------------------------- +// Template magic + +// First we have a set of classes representing "type traits" for different +// field types. A type traits class knows how to implement basic accessors +// for extensions of a particular type given an ExtensionSet. The signature +// for a type traits class looks like this: +// +// class TypeTraits { +// public: +// typedef ? ConstType; +// typedef ? MutableType; +// +// static inline ConstType Get(int number, const ExtensionSet& set); +// static inline void Set(int number, ConstType value, ExtensionSet* set); +// static inline MutableType Mutable(int number, ExtensionSet* set); +// +// // Variants for repeated fields. +// static inline ConstType Get(int number, const ExtensionSet& set, +// int index); +// static inline void Set(int number, int index, +// ConstType value, ExtensionSet* set); +// static inline MutableType Mutable(int number, int index, +// ExtensionSet* set); +// static inline void Add(int number, ConstType value, ExtensionSet* set); +// static inline MutableType Add(int number, ExtensionSet* set); +// }; +// +// Not all of these methods make sense for all field types. For example, the +// "Mutable" methods only make sense for strings and messages, and the +// repeated methods only make sense for repeated types. So, each type +// traits class implements only the set of methods from this signature that it +// actually supports. This will cause a compiler error if the user tries to +// access an extension using a method that doesn't make sense for its type. +// For example, if "foo" is an extension of type "optional int32", then if you +// try to write code like: +// my_message.MutableExtension(foo) +// you will get a compile error because PrimitiveTypeTraits does not +// have a "Mutable()" method. + +// ------------------------------------------------------------------- +// PrimitiveTypeTraits + +// Since the ExtensionSet has different methods for each primitive type, +// we must explicitly define the methods of the type traits class for each +// known type. +template +class PrimitiveTypeTraits { + public: + typedef Type ConstType; + + static inline ConstType Get(int number, const ExtensionSet& set, + ConstType default_value); + static inline void Set(int number, FieldType field_type, + ConstType value, ExtensionSet* set); +}; + +template +class RepeatedPrimitiveTypeTraits { + public: + typedef Type ConstType; + + static inline Type Get(int number, const ExtensionSet& set, int index); + static inline void Set(int number, int index, Type value, ExtensionSet* set); + static inline void Add(int number, FieldType field_type, + bool is_packed, Type value, ExtensionSet* set); +}; + +#define PROTOBUF_DEFINE_PRIMITIVE_TYPE(TYPE, METHOD) \ +template<> inline TYPE PrimitiveTypeTraits::Get( \ + int number, const ExtensionSet& set, TYPE default_value) { \ + return set.Get##METHOD(number, default_value); \ +} \ +template<> inline void PrimitiveTypeTraits::Set( \ + int number, FieldType field_type, TYPE value, ExtensionSet* set) { \ + set->Set##METHOD(number, field_type, value, NULL); \ +} \ + \ +template<> inline TYPE RepeatedPrimitiveTypeTraits::Get( \ + int number, const ExtensionSet& set, int index) { \ + return set.GetRepeated##METHOD(number, index); \ +} \ +template<> inline void RepeatedPrimitiveTypeTraits::Set( \ + int number, int index, TYPE value, ExtensionSet* set) { \ + set->SetRepeated##METHOD(number, index, value); \ +} \ +template<> inline void RepeatedPrimitiveTypeTraits::Add( \ + int number, FieldType field_type, bool is_packed, \ + TYPE value, ExtensionSet* set) { \ + set->Add##METHOD(number, field_type, is_packed, value, NULL); \ +} + +PROTOBUF_DEFINE_PRIMITIVE_TYPE( int32, Int32) +PROTOBUF_DEFINE_PRIMITIVE_TYPE( int64, Int64) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint32, UInt32) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint64, UInt64) +PROTOBUF_DEFINE_PRIMITIVE_TYPE( float, Float) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(double, Double) +PROTOBUF_DEFINE_PRIMITIVE_TYPE( bool, Bool) + +#undef PROTOBUF_DEFINE_PRIMITIVE_TYPE + +// ------------------------------------------------------------------- +// StringTypeTraits + +// Strings support both Set() and Mutable(). +class LIBPROTOBUF_EXPORT StringTypeTraits { + public: + typedef const string& ConstType; + typedef string* MutableType; + + static inline const string& Get(int number, const ExtensionSet& set, + ConstType default_value) { + return set.GetString(number, default_value); + } + static inline void Set(int number, FieldType field_type, + const string& value, ExtensionSet* set) { + set->SetString(number, field_type, value, NULL); + } + static inline string* Mutable(int number, FieldType field_type, + ExtensionSet* set) { + return set->MutableString(number, field_type, NULL); + } +}; + +class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits { + public: + typedef const string& ConstType; + typedef string* MutableType; + + static inline const string& Get(int number, const ExtensionSet& set, + int index) { + return set.GetRepeatedString(number, index); + } + static inline void Set(int number, int index, + const string& value, ExtensionSet* set) { + set->SetRepeatedString(number, index, value); + } + static inline string* Mutable(int number, int index, ExtensionSet* set) { + return set->MutableRepeatedString(number, index); + } + static inline void Add(int number, FieldType field_type, + bool /*is_packed*/, const string& value, + ExtensionSet* set) { + set->AddString(number, field_type, value, NULL); + } + static inline string* Add(int number, FieldType field_type, + ExtensionSet* set) { + return set->AddString(number, field_type, NULL); + } +}; + +// ------------------------------------------------------------------- +// EnumTypeTraits + +// ExtensionSet represents enums using integers internally, so we have to +// static_cast around. +template +class EnumTypeTraits { + public: + typedef Type ConstType; + + static inline ConstType Get(int number, const ExtensionSet& set, + ConstType default_value) { + return static_cast(set.GetEnum(number, default_value)); + } + static inline void Set(int number, FieldType field_type, + ConstType value, ExtensionSet* set) { + GOOGLE_DCHECK(IsValid(value)); + set->SetEnum(number, field_type, value, NULL); + } +}; + +template +class RepeatedEnumTypeTraits { + public: + typedef Type ConstType; + + static inline ConstType Get(int number, const ExtensionSet& set, int index) { + return static_cast(set.GetRepeatedEnum(number, index)); + } + static inline void Set(int number, int index, + ConstType value, ExtensionSet* set) { + GOOGLE_DCHECK(IsValid(value)); + set->SetRepeatedEnum(number, index, value); + } + static inline void Add(int number, FieldType field_type, + bool is_packed, ConstType value, ExtensionSet* set) { + GOOGLE_DCHECK(IsValid(value)); + set->AddEnum(number, field_type, is_packed, value, NULL); + } +}; + +// ------------------------------------------------------------------- +// MessageTypeTraits + +// ExtensionSet guarantees that when manipulating extensions with message +// types, the implementation used will be the compiled-in class representing +// that type. So, we can static_cast down to the exact type we expect. +template +class MessageTypeTraits { + public: + typedef const Type& ConstType; + typedef Type* MutableType; + + static inline ConstType Get(int number, const ExtensionSet& set, + ConstType default_value) { + return static_cast( + set.GetMessage(number, default_value)); + } + static inline MutableType Mutable(int number, FieldType field_type, + ExtensionSet* set) { + return static_cast( + set->MutableMessage(number, field_type, Type::default_instance(), NULL)); + } +}; + +template +class RepeatedMessageTypeTraits { + public: + typedef const Type& ConstType; + typedef Type* MutableType; + + static inline ConstType Get(int number, const ExtensionSet& set, int index) { + return static_cast(set.GetRepeatedMessage(number, index)); + } + static inline MutableType Mutable(int number, int index, ExtensionSet* set) { + return static_cast(set->MutableRepeatedMessage(number, index)); + } + static inline MutableType Add(int number, FieldType field_type, + ExtensionSet* set) { + return static_cast( + set->AddMessage(number, field_type, Type::default_instance(), NULL)); + } +}; + +// ------------------------------------------------------------------- +// ExtensionIdentifier + +// This is the type of actual extension objects. E.g. if you have: +// extends Foo with optional int32 bar = 1234; +// then "bar" will be defined in C++ as: +// ExtensionIdentifier, 1, false> bar(1234); +// +// Note that we could, in theory, supply the field number as a template +// parameter, and thus make an instance of ExtensionIdentifier have no +// actual contents. However, if we did that, then using at extension +// identifier would not necessarily cause the compiler to output any sort +// of reference to any simple defined in the extension's .pb.o file. Some +// linkers will actually drop object files that are not explicitly referenced, +// but that would be bad because it would cause this extension to not be +// registered at static initialization, and therefore using it would crash. + +template +class ExtensionIdentifier { + public: + typedef TypeTraitsType TypeTraits; + typedef ExtendeeType Extendee; + + ExtensionIdentifier(int number, typename TypeTraits::ConstType default_value) + : number_(number), default_value_(default_value) {} + inline int number() const { return number_; } + typename TypeTraits::ConstType default_value() const { + return default_value_; + } + + private: + const int number_; + typename TypeTraits::ConstType default_value_; +}; + +// ------------------------------------------------------------------- +// Generated accessors + +// This macro should be expanded in the context of a generated type which +// has 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. +#define GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(CLASSNAME) \ + /* Has, Size, Clear */ \ + template \ + inline bool HasExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id) const { \ + return _extensions_.Has(id.number()); \ + } \ + \ + template \ + inline void ClearExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id) { \ + _extensions_.ClearExtension(id.number()); \ + } \ + \ + template \ + inline int ExtensionSize( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id) const { \ + return _extensions_.ExtensionSize(id.number()); \ + } \ + \ + /* Singular accessors */ \ + template \ + inline typename _proto_TypeTraits::ConstType GetExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id) const { \ + return _proto_TypeTraits::Get(id.number(), _extensions_, \ + id.default_value()); \ + } \ + \ + template \ + inline typename _proto_TypeTraits::MutableType MutableExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id) { \ + return _proto_TypeTraits::Mutable(id.number(), field_type, &_extensions_);\ + } \ + \ + template \ + inline void SetExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id, \ + typename _proto_TypeTraits::ConstType value) { \ + _proto_TypeTraits::Set(id.number(), field_type, value, &_extensions_); \ + } \ + \ + /* Repeated accessors */ \ + template \ + inline typename _proto_TypeTraits::ConstType GetExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id, \ + int index) const { \ + return _proto_TypeTraits::Get(id.number(), _extensions_, index); \ + } \ + \ + template \ + inline typename _proto_TypeTraits::MutableType MutableExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id, \ + int index) { \ + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); \ + } \ + \ + template \ + inline void SetExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id, \ + int index, typename _proto_TypeTraits::ConstType value) { \ + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); \ + } \ + \ + template \ + inline typename _proto_TypeTraits::MutableType AddExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id) { \ + return _proto_TypeTraits::Add(id.number(), field_type, &_extensions_); \ + } \ + \ + template \ + inline void AddExtension( \ + const ::google::protobuf::internal::ExtensionIdentifier< \ + CLASSNAME, _proto_TypeTraits, field_type, is_packed>& id, \ + typename _proto_TypeTraits::ConstType value) { \ + _proto_TypeTraits::Add(id.number(), field_type, is_packed, \ + value, &_extensions_); \ + } + +} // namespace internal +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_EXTENSION_SET_H__ diff --git a/depends/protobuf/google/protobuf/extension_set_heavy.cc b/depends/protobuf/google/protobuf/extension_set_heavy.cc new file mode 100644 index 000000000..2721f15dc --- /dev/null +++ b/depends/protobuf/google/protobuf/extension_set_heavy.cc @@ -0,0 +1,457 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Contains methods defined in extension_set.h which cannot be part of the +// lite library because they use descriptors or reflection. + +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace internal { + +// Implementation of ExtensionFinder which finds extensions in a given +// DescriptorPool, using the given MessageFactory to construct sub-objects. +// This class is implemented in extension_set_heavy.cc. +class DescriptorPoolExtensionFinder : public ExtensionFinder { + public: + DescriptorPoolExtensionFinder(const DescriptorPool* pool, + MessageFactory* factory, + const Descriptor* containing_type) + : pool_(pool), factory_(factory), containing_type_(containing_type) {} + virtual ~DescriptorPoolExtensionFinder() {} + + virtual bool Find(int number, ExtensionInfo* output); + + private: + const DescriptorPool* pool_; + MessageFactory* factory_; + const Descriptor* containing_type_; +}; + +void ExtensionSet::AppendToList(const Descriptor* containing_type, + const DescriptorPool* pool, + vector* output) const { + for (map::const_iterator iter = extensions_.begin(); + iter != extensions_.end(); ++iter) { + bool has = false; + if (iter->second.is_repeated) { + has = iter->second.GetSize() > 0; + } else { + has = !iter->second.is_cleared; + } + + if (has) { + // TODO(kenton): Looking up each field by number is somewhat unfortunate. + // Is there a better way? The problem is that descriptors are lazily- + // initialized, so they might not even be constructed until + // AppendToList() is called. + + if (iter->second.descriptor == NULL) { + output->push_back(pool->FindExtensionByNumber( + containing_type, iter->first)); + } else { + output->push_back(iter->second.descriptor); + } + } + } +} + +inline FieldDescriptor::Type real_type(FieldType type) { + GOOGLE_DCHECK(type > 0 && type <= FieldDescriptor::MAX_TYPE); + return static_cast(type); +} + +inline FieldDescriptor::CppType cpp_type(FieldType type) { + return FieldDescriptor::TypeToCppType( + static_cast(type)); +} + +#define GOOGLE_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \ + GOOGLE_DCHECK_EQ((EXTENSION).is_repeated ? FieldDescriptor::LABEL_REPEATED \ + : FieldDescriptor::LABEL_OPTIONAL, \ + FieldDescriptor::LABEL_##LABEL); \ + GOOGLE_DCHECK_EQ(cpp_type((EXTENSION).type), FieldDescriptor::CPPTYPE_##CPPTYPE) + +const MessageLite& ExtensionSet::GetMessage(int number, + const Descriptor* message_type, + MessageFactory* factory) const { + map::const_iterator iter = extensions_.find(number); + if (iter == extensions_.end() || iter->second.is_cleared) { + // Not present. Return the default value. + return *factory->GetPrototype(message_type); + } else { + GOOGLE_DCHECK_TYPE(iter->second, OPTIONAL, MESSAGE); + return *iter->second.message_value; + } +} + +MessageLite* ExtensionSet::MutableMessage(const FieldDescriptor* descriptor, + MessageFactory* factory) { + Extension* extension; + if (MaybeNewExtension(descriptor->number(), descriptor, &extension)) { + extension->type = descriptor->type(); + GOOGLE_DCHECK_EQ(cpp_type(extension->type), FieldDescriptor::CPPTYPE_MESSAGE); + extension->is_repeated = false; + extension->is_packed = false; + const MessageLite* prototype = + factory->GetPrototype(descriptor->message_type()); + GOOGLE_CHECK(prototype != NULL); + extension->message_value = prototype->New(); + } else { + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); + } + extension->is_cleared = false; + return extension->message_value; +} + +MessageLite* ExtensionSet::AddMessage(const FieldDescriptor* descriptor, + MessageFactory* factory) { + Extension* extension; + if (MaybeNewExtension(descriptor->number(), descriptor, &extension)) { + extension->type = descriptor->type(); + GOOGLE_DCHECK_EQ(cpp_type(extension->type), FieldDescriptor::CPPTYPE_MESSAGE); + extension->is_repeated = true; + extension->repeated_message_value = + new RepeatedPtrField(); + } else { + GOOGLE_DCHECK_TYPE(*extension, REPEATED, MESSAGE); + } + + // RepeatedPtrField does not know how to Add() since it cannot + // allocate an abstract object, so we have to be tricky. + MessageLite* result = extension->repeated_message_value + ->AddFromCleared >(); + if (result == NULL) { + const MessageLite* prototype; + if (extension->repeated_message_value->size() == 0) { + prototype = factory->GetPrototype(descriptor->message_type()); + GOOGLE_CHECK(prototype != NULL); + } else { + prototype = &extension->repeated_message_value->Get(0); + } + result = prototype->New(); + extension->repeated_message_value->AddAllocated(result); + } + return result; +} + +static bool ValidateEnumUsingDescriptor(const void* arg, int number) { + return reinterpret_cast(arg) + ->FindValueByNumber(number) != NULL; +} + +bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { + const FieldDescriptor* extension = + pool_->FindExtensionByNumber(containing_type_, number); + if (extension == NULL) { + return false; + } else { + output->type = extension->type(); + output->is_repeated = extension->is_repeated(); + output->is_packed = extension->options().packed(); + output->descriptor = extension; + if (extension->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + output->message_prototype = + factory_->GetPrototype(extension->message_type()); + GOOGLE_CHECK(output->message_prototype != NULL) + << "Extension factory's GetPrototype() returned NULL for extension: " + << extension->full_name(); + } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { + output->enum_validity_check.func = ValidateEnumUsingDescriptor; + output->enum_validity_check.arg = extension->enum_type(); + } + + return true; + } +} + +bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, + const Message* containing_type, + UnknownFieldSet* unknown_fields) { + UnknownFieldSetFieldSkipper skipper(unknown_fields); + if (input->GetExtensionPool() == NULL) { + GeneratedExtensionFinder finder(containing_type); + return ParseField(tag, input, &finder, &skipper); + } else { + DescriptorPoolExtensionFinder finder(input->GetExtensionPool(), + input->GetExtensionFactory(), + containing_type->GetDescriptor()); + return ParseField(tag, input, &finder, &skipper); + } +} + +bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, + const Message* containing_type, + UnknownFieldSet* unknown_fields) { + UnknownFieldSetFieldSkipper skipper(unknown_fields); + if (input->GetExtensionPool() == NULL) { + GeneratedExtensionFinder finder(containing_type); + return ParseMessageSet(input, &finder, &skipper); + } else { + DescriptorPoolExtensionFinder finder(input->GetExtensionPool(), + input->GetExtensionFactory(), + containing_type->GetDescriptor()); + return ParseMessageSet(input, &finder, &skipper); + } +} + +int ExtensionSet::SpaceUsedExcludingSelf() const { + int total_size = + extensions_.size() * sizeof(map::value_type); + for (map::const_iterator iter = extensions_.begin(), + end = extensions_.end(); + iter != end; + ++iter) { + total_size += iter->second.SpaceUsedExcludingSelf(); + } + return total_size; +} + +inline int ExtensionSet::RepeatedMessage_SpaceUsedExcludingSelf( + RepeatedPtrFieldBase* field) { + return field->SpaceUsedExcludingSelf >(); +} + +int ExtensionSet::Extension::SpaceUsedExcludingSelf() const { + int total_size = 0; + if (is_repeated) { + switch (cpp_type(type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE: \ + total_size += sizeof(*repeated_##LOWERCASE##_value) + \ + repeated_##LOWERCASE##_value->SpaceUsedExcludingSelf();\ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE( UINT32, uint32); + HANDLE_TYPE( UINT64, uint64); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( DOUBLE, double); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, enum); + HANDLE_TYPE( STRING, string); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_MESSAGE: + // repeated_message_value is actually a RepeatedPtrField, + // but MessageLite has no SpaceUsed(), so we must directly call + // RepeatedPtrFieldBase::SpaceUsedExcludingSelf() with a different type + // handler. + total_size += sizeof(*repeated_message_value) + + RepeatedMessage_SpaceUsedExcludingSelf(repeated_message_value); + break; + } + } else { + switch (cpp_type(type)) { + case FieldDescriptor::CPPTYPE_STRING: + total_size += sizeof(*string_value) + + StringSpaceUsedExcludingSelf(*string_value); + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + total_size += down_cast(message_value)->SpaceUsed(); + break; + default: + // No extra storage costs for primitive types. + break; + } + } + return total_size; +} + +// The Serialize*ToArray methods are only needed in the heavy library, as +// the lite library only generates SerializeWithCachedSizes. +uint8* ExtensionSet::SerializeWithCachedSizesToArray( + int start_field_number, int end_field_number, + uint8* target) const { + map::const_iterator iter; + for (iter = extensions_.lower_bound(start_field_number); + iter != extensions_.end() && iter->first < end_field_number; + ++iter) { + target = iter->second.SerializeFieldWithCachedSizesToArray(iter->first, + target); + } + return target; +} + +uint8* ExtensionSet::SerializeMessageSetWithCachedSizesToArray( + uint8* target) const { + map::const_iterator iter; + for (iter = extensions_.begin(); iter != extensions_.end(); ++iter) { + target = iter->second.SerializeMessageSetItemWithCachedSizesToArray( + iter->first, target); + } + return target; +} + +uint8* ExtensionSet::Extension::SerializeFieldWithCachedSizesToArray( + int number, uint8* target) const { + if (is_repeated) { + if (is_packed) { + if (cached_size == 0) return target; + + target = WireFormatLite::WriteTagToArray(number, + WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); + target = WireFormatLite::WriteInt32NoTagToArray(cached_size, target); + + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case FieldDescriptor::TYPE_##UPPERCASE: \ + for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \ + target = WireFormatLite::Write##CAMELCASE##NoTagToArray( \ + repeated_##LOWERCASE##_value->Get(i), target); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, SInt32, int32); + HANDLE_TYPE( SINT64, SInt64, int64); + HANDLE_TYPE( FIXED32, Fixed32, uint32); + HANDLE_TYPE( FIXED64, Fixed64, uint64); + HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); + HANDLE_TYPE( ENUM, Enum, enum); +#undef HANDLE_TYPE + + case WireFormatLite::TYPE_STRING: + case WireFormatLite::TYPE_BYTES: + case WireFormatLite::TYPE_GROUP: + case WireFormatLite::TYPE_MESSAGE: + GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + break; + } + } else { + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \ + case FieldDescriptor::TYPE_##UPPERCASE: \ + for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \ + target = WireFormatLite::Write##CAMELCASE##ToArray(number, \ + repeated_##LOWERCASE##_value->Get(i), target); \ + } \ + break + + HANDLE_TYPE( INT32, Int32, int32); + HANDLE_TYPE( INT64, Int64, int64); + HANDLE_TYPE( UINT32, UInt32, uint32); + HANDLE_TYPE( UINT64, UInt64, uint64); + HANDLE_TYPE( SINT32, SInt32, int32); + HANDLE_TYPE( SINT64, SInt64, int64); + HANDLE_TYPE( FIXED32, Fixed32, uint32); + HANDLE_TYPE( FIXED64, Fixed64, uint64); + HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED64, SFixed64, int64); + HANDLE_TYPE( FLOAT, Float, float); + HANDLE_TYPE( DOUBLE, Double, double); + HANDLE_TYPE( BOOL, Bool, bool); + HANDLE_TYPE( STRING, String, string); + HANDLE_TYPE( BYTES, Bytes, string); + HANDLE_TYPE( ENUM, Enum, enum); + HANDLE_TYPE( GROUP, Group, message); + HANDLE_TYPE( MESSAGE, Message, message); +#undef HANDLE_TYPE + } + } + } else if (!is_cleared) { + switch (real_type(type)) { +#define HANDLE_TYPE(UPPERCASE, CAMELCASE, VALUE) \ + case FieldDescriptor::TYPE_##UPPERCASE: \ + target = WireFormatLite::Write##CAMELCASE##ToArray( \ + number, VALUE, target); \ + break + + HANDLE_TYPE( INT32, Int32, int32_value); + HANDLE_TYPE( INT64, Int64, int64_value); + HANDLE_TYPE( UINT32, UInt32, uint32_value); + HANDLE_TYPE( UINT64, UInt64, uint64_value); + HANDLE_TYPE( SINT32, SInt32, int32_value); + HANDLE_TYPE( SINT64, SInt64, int64_value); + HANDLE_TYPE( FIXED32, Fixed32, uint32_value); + HANDLE_TYPE( FIXED64, Fixed64, uint64_value); + HANDLE_TYPE(SFIXED32, SFixed32, int32_value); + HANDLE_TYPE(SFIXED64, SFixed64, int64_value); + HANDLE_TYPE( FLOAT, Float, float_value); + HANDLE_TYPE( DOUBLE, Double, double_value); + HANDLE_TYPE( BOOL, Bool, bool_value); + HANDLE_TYPE( STRING, String, *string_value); + HANDLE_TYPE( BYTES, Bytes, *string_value); + HANDLE_TYPE( ENUM, Enum, enum_value); + HANDLE_TYPE( GROUP, Group, *message_value); + HANDLE_TYPE( MESSAGE, Message, *message_value); +#undef HANDLE_TYPE + } + } + return target; +} + +uint8* ExtensionSet::Extension::SerializeMessageSetItemWithCachedSizesToArray( + int number, + uint8* target) const { + if (type != WireFormatLite::TYPE_MESSAGE || is_repeated) { + // Not a valid MessageSet extension, but serialize it the normal way. + GOOGLE_LOG(WARNING) << "Invalid message set extension."; + return SerializeFieldWithCachedSizesToArray(number, target); + } + + if (is_cleared) return target; + + // Start group. + target = io::CodedOutputStream::WriteTagToArray( + WireFormatLite::kMessageSetItemStartTag, target); + // Write type ID. + target = WireFormatLite::WriteUInt32ToArray( + WireFormatLite::kMessageSetTypeIdNumber, number, target); + // Write message. + target = WireFormatLite::WriteMessageToArray( + WireFormatLite::kMessageSetMessageNumber, *message_value, target); + // End group. + target = io::CodedOutputStream::WriteTagToArray( + WireFormatLite::kMessageSetItemEndTag, target); + return target; +} + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/extension_set_unittest.cc b/depends/protobuf/google/protobuf/extension_set_unittest.cc new file mode 100644 index 000000000..000f846c7 --- /dev/null +++ b/depends/protobuf/google/protobuf/extension_set_unittest.cc @@ -0,0 +1,642 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 internal { +namespace { + +// This test closely mirrors google/protobuf/compiler/cpp/unittest.cc +// except that it uses extensions rather than regular fields. + +TEST(ExtensionSetTest, Defaults) { + // Check that all default values are set correctly in the initial message. + unittest::TestAllExtensions message; + + TestUtil::ExpectExtensionsClear(message); + + // Messages should return pointers to default instances until first use. + // (This is not checked by ExpectClear() since it is not actually true after + // the fields have been set and then cleared.) + EXPECT_EQ(&unittest::OptionalGroup_extension::default_instance(), + &message.GetExtension(unittest::optionalgroup_extension)); + EXPECT_EQ(&unittest::TestAllTypes::NestedMessage::default_instance(), + &message.GetExtension(unittest::optional_nested_message_extension)); + EXPECT_EQ(&unittest::ForeignMessage::default_instance(), + &message.GetExtension( + unittest::optional_foreign_message_extension)); + EXPECT_EQ(&unittest_import::ImportMessage::default_instance(), + &message.GetExtension(unittest::optional_import_message_extension)); +} + +TEST(ExtensionSetTest, Accessors) { + // Set every field to a unique value then go back and check all those + // values. + unittest::TestAllExtensions message; + + TestUtil::SetAllExtensions(&message); + TestUtil::ExpectAllExtensionsSet(message); + + TestUtil::ModifyRepeatedExtensions(&message); + TestUtil::ExpectRepeatedExtensionsModified(message); +} + +TEST(ExtensionSetTest, Clear) { + // Set every field to a unique value, clear the message, then check that + // it is cleared. + unittest::TestAllExtensions message; + + TestUtil::SetAllExtensions(&message); + message.Clear(); + TestUtil::ExpectExtensionsClear(message); + + // Unlike with the defaults test, we do NOT expect that requesting embedded + // messages will return a pointer to the default instance. Instead, they + // should return the objects that were created when mutable_blah() was + // called. + EXPECT_NE(&unittest::OptionalGroup_extension::default_instance(), + &message.GetExtension(unittest::optionalgroup_extension)); + EXPECT_NE(&unittest::TestAllTypes::NestedMessage::default_instance(), + &message.GetExtension(unittest::optional_nested_message_extension)); + EXPECT_NE(&unittest::ForeignMessage::default_instance(), + &message.GetExtension( + unittest::optional_foreign_message_extension)); + EXPECT_NE(&unittest_import::ImportMessage::default_instance(), + &message.GetExtension(unittest::optional_import_message_extension)); + + // Make sure setting stuff again after clearing works. (This takes slightly + // different code paths since the objects are reused.) + TestUtil::SetAllExtensions(&message); + TestUtil::ExpectAllExtensionsSet(message); +} + +TEST(ExtensionSetTest, ClearOneField) { + // Set every field to a unique value, then clear one value and insure that + // only that one value is cleared. + unittest::TestAllExtensions message; + + TestUtil::SetAllExtensions(&message); + int64 original_value = + message.GetExtension(unittest::optional_int64_extension); + + // Clear the field and make sure it shows up as cleared. + message.ClearExtension(unittest::optional_int64_extension); + EXPECT_FALSE(message.HasExtension(unittest::optional_int64_extension)); + EXPECT_EQ(0, message.GetExtension(unittest::optional_int64_extension)); + + // Other adjacent fields should not be cleared. + EXPECT_TRUE(message.HasExtension(unittest::optional_int32_extension)); + EXPECT_TRUE(message.HasExtension(unittest::optional_uint32_extension)); + + // Make sure if we set it again, then all fields are set. + message.SetExtension(unittest::optional_int64_extension, original_value); + TestUtil::ExpectAllExtensionsSet(message); +} + +TEST(ExtensionSetTest, CopyFrom) { + unittest::TestAllExtensions message1, message2; + string data; + + TestUtil::SetAllExtensions(&message1); + message2.CopyFrom(message1); + TestUtil::ExpectAllExtensionsSet(message2); +} + +TEST(ExtensionSetTest, CopyFromUpcasted) { + unittest::TestAllExtensions message1, message2; + string data; + const Message& upcasted_message = message1; + + TestUtil::SetAllExtensions(&message1); + message2.CopyFrom(upcasted_message); + TestUtil::ExpectAllExtensionsSet(message2); +} + +TEST(ExtensionSetTest, SwapWithEmpty) { + unittest::TestAllExtensions message1, message2; + TestUtil::SetAllExtensions(&message1); + + TestUtil::ExpectAllExtensionsSet(message1); + TestUtil::ExpectExtensionsClear(message2); + message1.Swap(&message2); + TestUtil::ExpectAllExtensionsSet(message2); + TestUtil::ExpectExtensionsClear(message1); +} + +TEST(ExtensionSetTest, SwapWithSelf) { + unittest::TestAllExtensions message; + TestUtil::SetAllExtensions(&message); + + TestUtil::ExpectAllExtensionsSet(message); + message.Swap(&message); + TestUtil::ExpectAllExtensionsSet(message); +} + +TEST(ExtensionSetTest, SerializationToArray) { + // Serialize as TestAllExtensions and parse as TestAllTypes to insure wire + // compatibility of extensions. + // + // This checks serialization to a flat array by explicitly reserving space in + // the string and calling the generated message's + // SerializeWithCachedSizesToArray. + unittest::TestAllExtensions source; + unittest::TestAllTypes destination; + TestUtil::SetAllExtensions(&source); + int size = source.ByteSize(); + string data; + data.resize(size); + uint8* target = reinterpret_cast(string_as_array(&data)); + uint8* end = source.SerializeWithCachedSizesToArray(target); + EXPECT_EQ(size, end - target); + EXPECT_TRUE(destination.ParseFromString(data)); + TestUtil::ExpectAllFieldsSet(destination); +} + +TEST(ExtensionSetTest, SerializationToStream) { + // Serialize as TestAllExtensions and parse as TestAllTypes to insure wire + // compatibility of extensions. + // + // This checks serialization to an output stream by creating an array output + // stream that can only buffer 1 byte at a time - this prevents the message + // from ever jumping to the fast path, ensuring that serialization happens via + // the CodedOutputStream. + unittest::TestAllExtensions source; + unittest::TestAllTypes destination; + TestUtil::SetAllExtensions(&source); + int size = source.ByteSize(); + string data; + data.resize(size); + { + io::ArrayOutputStream array_stream(string_as_array(&data), size, 1); + io::CodedOutputStream output_stream(&array_stream); + source.SerializeWithCachedSizes(&output_stream); + ASSERT_FALSE(output_stream.HadError()); + } + EXPECT_TRUE(destination.ParseFromString(data)); + TestUtil::ExpectAllFieldsSet(destination); +} + +TEST(ExtensionSetTest, PackedSerializationToArray) { + // Serialize as TestPackedExtensions and parse as TestPackedTypes to insure + // wire compatibility of extensions. + // + // This checks serialization to a flat array by explicitly reserving space in + // the string and calling the generated message's + // SerializeWithCachedSizesToArray. + unittest::TestPackedExtensions source; + unittest::TestPackedTypes destination; + TestUtil::SetPackedExtensions(&source); + int size = source.ByteSize(); + string data; + data.resize(size); + uint8* target = reinterpret_cast(string_as_array(&data)); + uint8* end = source.SerializeWithCachedSizesToArray(target); + EXPECT_EQ(size, end - target); + EXPECT_TRUE(destination.ParseFromString(data)); + TestUtil::ExpectPackedFieldsSet(destination); +} + +TEST(ExtensionSetTest, PackedSerializationToStream) { + // Serialize as TestPackedExtensions and parse as TestPackedTypes to insure + // wire compatibility of extensions. + // + // This checks serialization to an output stream by creating an array output + // stream that can only buffer 1 byte at a time - this prevents the message + // from ever jumping to the fast path, ensuring that serialization happens via + // the CodedOutputStream. + unittest::TestPackedExtensions source; + unittest::TestPackedTypes destination; + TestUtil::SetPackedExtensions(&source); + int size = source.ByteSize(); + string data; + data.resize(size); + { + io::ArrayOutputStream array_stream(string_as_array(&data), size, 1); + io::CodedOutputStream output_stream(&array_stream); + source.SerializeWithCachedSizes(&output_stream); + ASSERT_FALSE(output_stream.HadError()); + } + EXPECT_TRUE(destination.ParseFromString(data)); + TestUtil::ExpectPackedFieldsSet(destination); +} + +TEST(ExtensionSetTest, Parsing) { + // Serialize as TestAllTypes and parse as TestAllExtensions. + unittest::TestAllTypes source; + unittest::TestAllExtensions destination; + string data; + + TestUtil::SetAllFields(&source); + source.SerializeToString(&data); + EXPECT_TRUE(destination.ParseFromString(data)); + TestUtil::ExpectAllExtensionsSet(destination); +} + +TEST(ExtensionSetTest, PackedParsing) { + // Serialize as TestPackedTypes and parse as TestPackedExtensions. + unittest::TestPackedTypes source; + unittest::TestPackedExtensions destination; + string data; + + TestUtil::SetPackedFields(&source); + source.SerializeToString(&data); + EXPECT_TRUE(destination.ParseFromString(data)); + TestUtil::ExpectPackedExtensionsSet(destination); +} + +TEST(ExtensionSetTest, IsInitialized) { + // Test that IsInitialized() returns false if required fields in nested + // extensions are missing. + unittest::TestAllExtensions message; + + EXPECT_TRUE(message.IsInitialized()); + + message.MutableExtension(unittest::TestRequired::single); + EXPECT_FALSE(message.IsInitialized()); + + message.MutableExtension(unittest::TestRequired::single)->set_a(1); + EXPECT_FALSE(message.IsInitialized()); + message.MutableExtension(unittest::TestRequired::single)->set_b(2); + EXPECT_FALSE(message.IsInitialized()); + message.MutableExtension(unittest::TestRequired::single)->set_c(3); + EXPECT_TRUE(message.IsInitialized()); + + message.AddExtension(unittest::TestRequired::multi); + EXPECT_FALSE(message.IsInitialized()); + + message.MutableExtension(unittest::TestRequired::multi, 0)->set_a(1); + EXPECT_FALSE(message.IsInitialized()); + message.MutableExtension(unittest::TestRequired::multi, 0)->set_b(2); + EXPECT_FALSE(message.IsInitialized()); + message.MutableExtension(unittest::TestRequired::multi, 0)->set_c(3); + EXPECT_TRUE(message.IsInitialized()); +} + +TEST(ExtensionSetTest, MutableString) { + // Test the mutable string accessors. + unittest::TestAllExtensions message; + + message.MutableExtension(unittest::optional_string_extension)->assign("foo"); + EXPECT_TRUE(message.HasExtension(unittest::optional_string_extension)); + EXPECT_EQ("foo", message.GetExtension(unittest::optional_string_extension)); + + message.AddExtension(unittest::repeated_string_extension)->assign("bar"); + ASSERT_EQ(1, message.ExtensionSize(unittest::repeated_string_extension)); + EXPECT_EQ("bar", + message.GetExtension(unittest::repeated_string_extension, 0)); +} + +TEST(ExtensionSetTest, SpaceUsedExcludingSelf) { + // Scalar primitive extensions should increase the extension set size by a + // minimum of the size of the primitive type. +#define TEST_SCALAR_EXTENSIONS_SPACE_USED(type, value) \ + do { \ + unittest::TestAllExtensions message; \ + const int base_size = message.SpaceUsed(); \ + message.SetExtension(unittest::optional_##type##_extension, value); \ + int min_expected_size = base_size + \ + sizeof(message.GetExtension(unittest::optional_##type##_extension)); \ + EXPECT_LE(min_expected_size, message.SpaceUsed()); \ + } while (0) + + TEST_SCALAR_EXTENSIONS_SPACE_USED(int32 , 101); + TEST_SCALAR_EXTENSIONS_SPACE_USED(int64 , 102); + TEST_SCALAR_EXTENSIONS_SPACE_USED(uint32 , 103); + TEST_SCALAR_EXTENSIONS_SPACE_USED(uint64 , 104); + TEST_SCALAR_EXTENSIONS_SPACE_USED(sint32 , 105); + TEST_SCALAR_EXTENSIONS_SPACE_USED(sint64 , 106); + TEST_SCALAR_EXTENSIONS_SPACE_USED(fixed32 , 107); + TEST_SCALAR_EXTENSIONS_SPACE_USED(fixed64 , 108); + TEST_SCALAR_EXTENSIONS_SPACE_USED(sfixed32, 109); + TEST_SCALAR_EXTENSIONS_SPACE_USED(sfixed64, 110); + TEST_SCALAR_EXTENSIONS_SPACE_USED(float , 111); + TEST_SCALAR_EXTENSIONS_SPACE_USED(double , 112); + TEST_SCALAR_EXTENSIONS_SPACE_USED(bool , true); +#undef TEST_SCALAR_EXTENSIONS_SPACE_USED + { + unittest::TestAllExtensions message; + const int base_size = message.SpaceUsed(); + message.SetExtension(unittest::optional_nested_enum_extension, + unittest::TestAllTypes::FOO); + int min_expected_size = base_size + + sizeof(message.GetExtension(unittest::optional_nested_enum_extension)); + EXPECT_LE(min_expected_size, message.SpaceUsed()); + } + { + // Strings may cause extra allocations depending on their length; ensure + // that gets included as well. + unittest::TestAllExtensions message; + const int base_size = message.SpaceUsed(); + const string s("this is a fairly large string that will cause some " + "allocation in order to store it in the extension"); + message.SetExtension(unittest::optional_string_extension, s); + int min_expected_size = base_size + s.length(); + EXPECT_LE(min_expected_size, message.SpaceUsed()); + } + { + // Messages also have additional allocation that need to be counted. + unittest::TestAllExtensions message; + const int base_size = message.SpaceUsed(); + unittest::ForeignMessage foreign; + foreign.set_c(42); + message.MutableExtension(unittest::optional_foreign_message_extension)-> + CopyFrom(foreign); + int min_expected_size = base_size + foreign.SpaceUsed(); + EXPECT_LE(min_expected_size, message.SpaceUsed()); + } + + // Repeated primitive extensions will increase space used by at least a + // RepeatedField, and will cause additional allocations when the array + // gets too big for the initial space. + // This macro: + // - Adds a value to the repeated extension, then clears it, establishing + // the base size. + // - Adds a small number of values, testing that it doesn't increase the + // SpaceUsed() + // - Adds a large number of values (requiring allocation in the repeated + // field), and ensures that that allocation is included in SpaceUsed() +#define TEST_REPEATED_EXTENSIONS_SPACE_USED(type, cpptype, value) \ + do { \ + unittest::TestAllExtensions message; \ + const int base_size = message.SpaceUsed(); \ + int min_expected_size = sizeof(RepeatedField) + base_size; \ + message.AddExtension(unittest::repeated_##type##_extension, value); \ + message.ClearExtension(unittest::repeated_##type##_extension); \ + const int empty_repeated_field_size = message.SpaceUsed(); \ + EXPECT_LE(min_expected_size, empty_repeated_field_size) << #type; \ + message.AddExtension(unittest::repeated_##type##_extension, value); \ + message.AddExtension(unittest::repeated_##type##_extension, value); \ + EXPECT_EQ(empty_repeated_field_size, message.SpaceUsed()) << #type; \ + message.ClearExtension(unittest::repeated_##type##_extension); \ + for (int i = 0; i < 16; ++i) { \ + message.AddExtension(unittest::repeated_##type##_extension, value); \ + } \ + int expected_size = sizeof(cpptype) * 16 + empty_repeated_field_size; \ + EXPECT_EQ(expected_size, message.SpaceUsed()) << #type; \ + } while (0) + + TEST_REPEATED_EXTENSIONS_SPACE_USED(int32 , int32 , 101); + TEST_REPEATED_EXTENSIONS_SPACE_USED(int64 , int64 , 102); + TEST_REPEATED_EXTENSIONS_SPACE_USED(uint32 , uint32, 103); + TEST_REPEATED_EXTENSIONS_SPACE_USED(uint64 , uint64, 104); + TEST_REPEATED_EXTENSIONS_SPACE_USED(sint32 , int32 , 105); + TEST_REPEATED_EXTENSIONS_SPACE_USED(sint64 , int64 , 106); + TEST_REPEATED_EXTENSIONS_SPACE_USED(fixed32 , uint32, 107); + TEST_REPEATED_EXTENSIONS_SPACE_USED(fixed64 , uint64, 108); + TEST_REPEATED_EXTENSIONS_SPACE_USED(sfixed32, int32 , 109); + TEST_REPEATED_EXTENSIONS_SPACE_USED(sfixed64, int64 , 110); + TEST_REPEATED_EXTENSIONS_SPACE_USED(float , float , 111); + TEST_REPEATED_EXTENSIONS_SPACE_USED(double , double, 112); + TEST_REPEATED_EXTENSIONS_SPACE_USED(bool , bool , true); + TEST_REPEATED_EXTENSIONS_SPACE_USED(nested_enum, int, + unittest::TestAllTypes::FOO); +#undef TEST_REPEATED_EXTENSIONS_SPACE_USED + // Repeated strings + { + unittest::TestAllExtensions message; + const int base_size = message.SpaceUsed(); + int min_expected_size = sizeof(RepeatedPtrField) + base_size; + const string value(256, 'x'); + // Once items are allocated, they may stick around even when cleared so + // without the hardcore memory management accessors there isn't a notion of + // the empty repeated field memory usage as there is with primitive types. + for (int i = 0; i < 16; ++i) { + message.AddExtension(unittest::repeated_string_extension, value); + } + min_expected_size += (sizeof(value) + value.size()) * 16; + EXPECT_LE(min_expected_size, message.SpaceUsed()); + } + // Repeated messages + { + unittest::TestAllExtensions message; + const int base_size = message.SpaceUsed(); + int min_expected_size = sizeof(RepeatedPtrField) + + base_size; + unittest::ForeignMessage prototype; + prototype.set_c(2); + for (int i = 0; i < 16; ++i) { + message.AddExtension(unittest::repeated_foreign_message_extension)-> + CopyFrom(prototype); + } + min_expected_size += 16 * prototype.SpaceUsed(); + EXPECT_LE(min_expected_size, message.SpaceUsed()); + } +} + +#ifdef GTEST_HAS_DEATH_TEST + +TEST(ExtensionSetTest, InvalidEnumDeath) { + unittest::TestAllExtensions message; + EXPECT_DEBUG_DEATH( + message.SetExtension(unittest::optional_foreign_enum_extension, + static_cast(53)), + "IsValid"); +} + +#endif // GTEST_HAS_DEATH_TEST + +TEST(ExtensionSetTest, DynamicExtensions) { + // Test adding a dynamic extension to a compiled-in message object. + + FileDescriptorProto dynamic_proto; + dynamic_proto.set_name("dynamic_extensions_test.proto"); + dynamic_proto.add_dependency( + unittest::TestAllExtensions::descriptor()->file()->name()); + dynamic_proto.set_package("dynamic_extensions"); + + // Copy the fields and nested types from TestDynamicExtensions into our new + // proto, converting the fields into extensions. + const Descriptor* template_descriptor = + unittest::TestDynamicExtensions::descriptor(); + DescriptorProto template_descriptor_proto; + template_descriptor->CopyTo(&template_descriptor_proto); + dynamic_proto.mutable_message_type()->MergeFrom( + template_descriptor_proto.nested_type()); + dynamic_proto.mutable_enum_type()->MergeFrom( + template_descriptor_proto.enum_type()); + dynamic_proto.mutable_extension()->MergeFrom( + template_descriptor_proto.field()); + + // For each extension that we added... + for (int i = 0; i < dynamic_proto.extension_size(); i++) { + // Set its extendee to TestAllExtensions. + FieldDescriptorProto* extension = dynamic_proto.mutable_extension(i); + extension->set_extendee( + unittest::TestAllExtensions::descriptor()->full_name()); + + // If the field refers to one of the types nested in TestDynamicExtensions, + // make it refer to the type in our dynamic proto instead. + string prefix = "." + template_descriptor->full_name() + "."; + if (extension->has_type_name()) { + string* type_name = extension->mutable_type_name(); + if (HasPrefixString(*type_name, prefix)) { + type_name->replace(0, prefix.size(), ".dynamic_extensions."); + } + } + } + + // Now build the file, using the generated pool as an underlay. + DescriptorPool dynamic_pool(DescriptorPool::generated_pool()); + const FileDescriptor* file = dynamic_pool.BuildFile(dynamic_proto); + ASSERT_TRUE(file != NULL); + DynamicMessageFactory dynamic_factory(&dynamic_pool); + dynamic_factory.SetDelegateToGeneratedFactory(true); + + // Construct a message that we can parse with the extensions we defined. + // Since the extensions were based off of the fields of TestDynamicExtensions, + // we can use that message to create this test message. + string data; + { + unittest::TestDynamicExtensions message; + message.set_scalar_extension(123); + message.set_enum_extension(unittest::FOREIGN_BAR); + message.set_dynamic_enum_extension( + unittest::TestDynamicExtensions::DYNAMIC_BAZ); + message.mutable_message_extension()->set_c(456); + message.mutable_dynamic_message_extension()->set_dynamic_field(789); + message.add_repeated_extension("foo"); + message.add_repeated_extension("bar"); + message.add_packed_extension(12); + message.add_packed_extension(-34); + message.add_packed_extension(56); + message.add_packed_extension(-78); + + // Also add some unknown fields. + + // An unknown enum value (for a known field). + message.mutable_unknown_fields()->AddVarint( + unittest::TestDynamicExtensions::kDynamicEnumExtensionFieldNumber, + 12345); + // A regular unknown field. + message.mutable_unknown_fields()->AddLengthDelimited(54321, "unknown"); + + message.SerializeToString(&data); + } + + // Now we can parse this using our dynamic extension definitions... + unittest::TestAllExtensions message; + { + io::ArrayInputStream raw_input(data.data(), data.size()); + io::CodedInputStream input(&raw_input); + input.SetExtensionRegistry(&dynamic_pool, &dynamic_factory); + ASSERT_TRUE(message.ParseFromCodedStream(&input)); + ASSERT_TRUE(input.ConsumedEntireMessage()); + } + + // Can we print it? + EXPECT_EQ( + "[dynamic_extensions.scalar_extension]: 123\n" + "[dynamic_extensions.enum_extension]: FOREIGN_BAR\n" + "[dynamic_extensions.dynamic_enum_extension]: DYNAMIC_BAZ\n" + "[dynamic_extensions.message_extension] {\n" + " c: 456\n" + "}\n" + "[dynamic_extensions.dynamic_message_extension] {\n" + " dynamic_field: 789\n" + "}\n" + "[dynamic_extensions.repeated_extension]: \"foo\"\n" + "[dynamic_extensions.repeated_extension]: \"bar\"\n" + "[dynamic_extensions.packed_extension]: 12\n" + "[dynamic_extensions.packed_extension]: -34\n" + "[dynamic_extensions.packed_extension]: 56\n" + "[dynamic_extensions.packed_extension]: -78\n" + "2002: 12345\n" + "54321: \"unknown\"\n", + message.DebugString()); + + // Can we serialize it? + // (Don't use EXPECT_EQ because we don't want to dump raw binary data to the + // terminal on failure.) + EXPECT_TRUE(message.SerializeAsString() == data); + + // What if we parse using the reflection-based parser? + { + unittest::TestAllExtensions message2; + io::ArrayInputStream raw_input(data.data(), data.size()); + io::CodedInputStream input(&raw_input); + input.SetExtensionRegistry(&dynamic_pool, &dynamic_factory); + ASSERT_TRUE(WireFormat::ParseAndMergePartial(&input, &message2)); + ASSERT_TRUE(input.ConsumedEntireMessage()); + EXPECT_EQ(message.DebugString(), message2.DebugString()); + } + + // Are the embedded generated types actually using the generated objects? + { + const FieldDescriptor* message_extension = + file->FindExtensionByName("message_extension"); + ASSERT_TRUE(message_extension != NULL); + const Message& sub_message = + message.GetReflection()->GetMessage(message, message_extension); + const unittest::ForeignMessage* typed_sub_message = + dynamic_cast(&sub_message); + ASSERT_TRUE(typed_sub_message != NULL); + EXPECT_EQ(456, typed_sub_message->c()); + } + + // What does GetMessage() return for the embedded dynamic type if it isn't + // present? + { + const FieldDescriptor* dynamic_message_extension = + file->FindExtensionByName("dynamic_message_extension"); + ASSERT_TRUE(dynamic_message_extension != NULL); + const Message& parent = unittest::TestAllExtensions::default_instance(); + const Message& sub_message = + parent.GetReflection()->GetMessage(parent, dynamic_message_extension, + &dynamic_factory); + const Message* prototype = + dynamic_factory.GetPrototype(dynamic_message_extension->message_type()); + EXPECT_EQ(prototype, &sub_message); + } +} + +} // namespace +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/generated_message_reflection.cc b/depends/protobuf/google/protobuf/generated_message_reflection.cc new file mode 100644 index 000000000..a0dd75c65 --- /dev/null +++ b/depends/protobuf/google/protobuf/generated_message_reflection.cc @@ -0,0 +1,1228 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace internal { + +int StringSpaceUsedExcludingSelf(const string& str) { + const void* start = &str; + const void* end = &str + 1; + + if (start <= str.data() && str.data() <= end) { + // The string's data is stored inside the string object itself. + return 0; + } else { + return str.capacity(); + } +} + +bool ParseNamedEnum(const EnumDescriptor* descriptor, + const string& name, + int* value) { + const EnumValueDescriptor* d = descriptor->FindValueByName(name); + if (d == NULL) return false; + *value = d->number(); + return true; +} + +const string& NameOfEnum(const EnumDescriptor* descriptor, int value) { + const EnumValueDescriptor* d = descriptor->FindValueByNumber(value); + return (d == NULL ? kEmptyString : d->name()); +} + +// =================================================================== +// Helpers for reporting usage errors (e.g. trying to use GetInt32() on +// a string field). + +namespace { + +void ReportReflectionUsageError( + const Descriptor* descriptor, const FieldDescriptor* field, + const char* method, const char* description) { + GOOGLE_LOG(FATAL) + << "Protocol Buffer reflection usage error:\n" + " Method : google::protobuf::Reflection::" << method << "\n" + " Message type: " << descriptor->full_name() << "\n" + " Field : " << field->full_name() << "\n" + " Problem : " << description; +} + +const char* cpptype_names_[FieldDescriptor::MAX_CPPTYPE + 1] = { + "INVALID_CPPTYPE", + "CPPTYPE_INT32", + "CPPTYPE_INT64", + "CPPTYPE_UINT32", + "CPPTYPE_UINT64", + "CPPTYPE_DOUBLE", + "CPPTYPE_FLOAT", + "CPPTYPE_BOOL", + "CPPTYPE_ENUM", + "CPPTYPE_STRING", + "CPPTYPE_MESSAGE" +}; + +static void ReportReflectionUsageTypeError( + const Descriptor* descriptor, const FieldDescriptor* field, + const char* method, + FieldDescriptor::CppType expected_type) { + GOOGLE_LOG(FATAL) + << "Protocol Buffer reflection usage error:\n" + " Method : google::protobuf::Reflection::" << method << "\n" + " Message type: " << descriptor->full_name() << "\n" + " Field : " << field->full_name() << "\n" + " Problem : Field is not the right type for this message:\n" + " Expected : " << cpptype_names_[expected_type] << "\n" + " Field type: " << cpptype_names_[field->cpp_type()]; +} + +static void ReportReflectionUsageEnumTypeError( + const Descriptor* descriptor, const FieldDescriptor* field, + const char* method, const EnumValueDescriptor* value) { + GOOGLE_LOG(FATAL) + << "Protocol Buffer reflection usage error:\n" + " Method : google::protobuf::Reflection::" << method << "\n" + " Message type: " << descriptor->full_name() << "\n" + " Field : " << field->full_name() << "\n" + " Problem : Enum value did not match field type:\n" + " Expected : " << field->enum_type()->full_name() << "\n" + " Actual : " << value->full_name(); +} + +#define USAGE_CHECK(CONDITION, METHOD, ERROR_DESCRIPTION) \ + if (!(CONDITION)) \ + ReportReflectionUsageError(descriptor_, field, #METHOD, ERROR_DESCRIPTION) +#define USAGE_CHECK_EQ(A, B, METHOD, ERROR_DESCRIPTION) \ + USAGE_CHECK((A) == (B), METHOD, ERROR_DESCRIPTION) +#define USAGE_CHECK_NE(A, B, METHOD, ERROR_DESCRIPTION) \ + USAGE_CHECK((A) != (B), METHOD, ERROR_DESCRIPTION) + +#define USAGE_CHECK_TYPE(METHOD, CPPTYPE) \ + if (field->cpp_type() != FieldDescriptor::CPPTYPE_##CPPTYPE) \ + ReportReflectionUsageTypeError(descriptor_, field, #METHOD, \ + FieldDescriptor::CPPTYPE_##CPPTYPE) + +#define USAGE_CHECK_ENUM_VALUE(METHOD) \ + if (value->type() != field->enum_type()) \ + ReportReflectionUsageEnumTypeError(descriptor_, field, #METHOD, value) + +#define USAGE_CHECK_MESSAGE_TYPE(METHOD) \ + USAGE_CHECK_EQ(field->containing_type(), descriptor_, \ + METHOD, "Field does not match message type."); +#define USAGE_CHECK_SINGULAR(METHOD) \ + USAGE_CHECK_NE(field->label(), FieldDescriptor::LABEL_REPEATED, METHOD, \ + "Field is repeated; the method requires a singular field.") +#define USAGE_CHECK_REPEATED(METHOD) \ + USAGE_CHECK_EQ(field->label(), FieldDescriptor::LABEL_REPEATED, METHOD, \ + "Field is singular; the method requires a repeated field.") + +#define USAGE_CHECK_ALL(METHOD, LABEL, CPPTYPE) \ + USAGE_CHECK_MESSAGE_TYPE(METHOD); \ + USAGE_CHECK_##LABEL(METHOD); \ + USAGE_CHECK_TYPE(METHOD, CPPTYPE) + +} // namespace + +// =================================================================== + +GeneratedMessageReflection::GeneratedMessageReflection( + const Descriptor* descriptor, + const Message* default_instance, + const int offsets[], + int has_bits_offset, + int unknown_fields_offset, + int extensions_offset, + const DescriptorPool* descriptor_pool, + MessageFactory* factory, + int object_size) + : descriptor_ (descriptor), + default_instance_ (default_instance), + offsets_ (offsets), + has_bits_offset_ (has_bits_offset), + unknown_fields_offset_(unknown_fields_offset), + extensions_offset_(extensions_offset), + object_size_ (object_size), + descriptor_pool_ ((descriptor_pool == NULL) ? + DescriptorPool::generated_pool() : + descriptor_pool), + message_factory_ (factory) { +} + +GeneratedMessageReflection::~GeneratedMessageReflection() {} + +const UnknownFieldSet& GeneratedMessageReflection::GetUnknownFields( + const Message& message) const { + const void* ptr = reinterpret_cast(&message) + + unknown_fields_offset_; + return *reinterpret_cast(ptr); +} +UnknownFieldSet* GeneratedMessageReflection::MutableUnknownFields( + Message* message) const { + void* ptr = reinterpret_cast(message) + unknown_fields_offset_; + return reinterpret_cast(ptr); +} + +int GeneratedMessageReflection::SpaceUsed(const Message& message) const { + // object_size_ already includes the in-memory representation of each field + // in the message, so we only need to account for additional memory used by + // the fields. + int total_size = object_size_; + + total_size += GetUnknownFields(message).SpaceUsedExcludingSelf(); + + if (extensions_offset_ != -1) { + total_size += GetExtensionSet(message).SpaceUsedExcludingSelf(); + } + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (field->is_repeated()) { + switch (field->cpp_type()) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE : \ + total_size += GetRaw >(message, field) \ + .SpaceUsedExcludingSelf(); \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, int); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + total_size += GetRaw >(message, field) + .SpaceUsedExcludingSelf(); + break; + } + break; + + case FieldDescriptor::CPPTYPE_MESSAGE: + // We don't know which subclass of RepeatedPtrFieldBase the type is, + // so we use RepeatedPtrFieldBase directly. + total_size += + GetRaw(message, field) + .SpaceUsedExcludingSelf >(); + break; + } + } else { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32 : + case FieldDescriptor::CPPTYPE_INT64 : + case FieldDescriptor::CPPTYPE_UINT32: + case FieldDescriptor::CPPTYPE_UINT64: + case FieldDescriptor::CPPTYPE_DOUBLE: + case FieldDescriptor::CPPTYPE_FLOAT : + case FieldDescriptor::CPPTYPE_BOOL : + case FieldDescriptor::CPPTYPE_ENUM : + // Field is inline, so we've already counted it. + break; + + case FieldDescriptor::CPPTYPE_STRING: { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: { + const string* ptr = GetField(message, field); + + // Initially, the string points to the default value stored in + // the prototype. Only count the string if it has been changed + // from the default value. + const string* default_ptr = DefaultRaw(field); + + if (ptr != default_ptr) { + // string fields are represented by just a pointer, so also + // include sizeof(string) as well. + total_size += sizeof(*ptr) + StringSpaceUsedExcludingSelf(*ptr); + } + break; + } + } + break; + } + + case FieldDescriptor::CPPTYPE_MESSAGE: + if (&message == default_instance_) { + // For singular fields, the prototype just stores a pointer to the + // external type's prototype, so there is no extra memory usage. + } else { + const Message* sub_message = GetRaw(message, field); + if (sub_message != NULL) { + total_size += sub_message->SpaceUsed(); + } + } + break; + } + } + } + + return total_size; +} + +void GeneratedMessageReflection::Swap( + Message* message1, + Message* message2) const { + if (message1 == message2) return; + + // TODO(kenton): Other Reflection methods should probably check this too. + GOOGLE_CHECK_EQ(message1->GetReflection(), this) + << "First argument to Swap() (of type \"" + << message1->GetDescriptor()->full_name() + << "\") is not compatible with this reflection object (which is for type \"" + << descriptor_->full_name() + << "\"). Note that the exact same class is required; not just the same " + "descriptor."; + GOOGLE_CHECK_EQ(message2->GetReflection(), this) + << "Second argument to Swap() (of type \"" + << message1->GetDescriptor()->full_name() + << "\") is not compatible with this reflection object (which is for type \"" + << descriptor_->full_name() + << "\"). Note that the exact same class is required; not just the same " + "descriptor."; + + uint32* has_bits1 = MutableHasBits(message1); + uint32* has_bits2 = MutableHasBits(message2); + int has_bits_size = (descriptor_->field_count() + 31) / 32; + + for (int i = 0; i < has_bits_size; i++) { + std::swap(has_bits1[i], has_bits2[i]); + } + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + if (field->is_repeated()) { + switch (field->cpp_type()) { +#define SWAP_ARRAYS(CPPTYPE, TYPE) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + MutableRaw >(message1, field)->Swap( \ + MutableRaw >(message2, field)); \ + break; + + SWAP_ARRAYS(INT32 , int32 ); + SWAP_ARRAYS(INT64 , int64 ); + SWAP_ARRAYS(UINT32, uint32); + SWAP_ARRAYS(UINT64, uint64); + SWAP_ARRAYS(FLOAT , float ); + SWAP_ARRAYS(DOUBLE, double); + SWAP_ARRAYS(BOOL , bool ); + SWAP_ARRAYS(ENUM , int ); +#undef SWAP_ARRAYS + + case FieldDescriptor::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_MESSAGE: + MutableRaw(message1, field)->Swap( + MutableRaw(message2, field)); + break; + + default: + GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); + } + } else { + switch (field->cpp_type()) { +#define SWAP_VALUES(CPPTYPE, TYPE) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + std::swap(*MutableRaw(message1, field), \ + *MutableRaw(message2, field)); \ + break; + + SWAP_VALUES(INT32 , int32 ); + SWAP_VALUES(INT64 , int64 ); + SWAP_VALUES(UINT32, uint32); + SWAP_VALUES(UINT64, uint64); + SWAP_VALUES(FLOAT , float ); + SWAP_VALUES(DOUBLE, double); + SWAP_VALUES(BOOL , bool ); + SWAP_VALUES(ENUM , int ); + SWAP_VALUES(MESSAGE, Message*); +#undef SWAP_VALUES + + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + std::swap(*MutableRaw(message1, field), + *MutableRaw(message2, field)); + break; + } + break; + + default: + GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); + } + } + } + + if (extensions_offset_ != -1) { + MutableExtensionSet(message1)->Swap(MutableExtensionSet(message2)); + } + + MutableUnknownFields(message1)->Swap(MutableUnknownFields(message2)); +} + +// ------------------------------------------------------------------- + +bool GeneratedMessageReflection::HasField(const Message& message, + const FieldDescriptor* field) const { + USAGE_CHECK_MESSAGE_TYPE(HasField); + USAGE_CHECK_SINGULAR(HasField); + + if (field->is_extension()) { + return GetExtensionSet(message).Has(field->number()); + } else { + return HasBit(message, field); + } +} + +int GeneratedMessageReflection::FieldSize(const Message& message, + const FieldDescriptor* field) const { + USAGE_CHECK_MESSAGE_TYPE(FieldSize); + USAGE_CHECK_REPEATED(FieldSize); + + if (field->is_extension()) { + return GetExtensionSet(message).ExtensionSize(field->number()); + } else { + switch (field->cpp_type()) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE : \ + return GetRaw >(message, field).size() + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, int); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_MESSAGE: + return GetRaw(message, field).size(); + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return 0; + } +} + +void GeneratedMessageReflection::ClearField( + Message* message, const FieldDescriptor* field) const { + USAGE_CHECK_MESSAGE_TYPE(ClearField); + + if (field->is_extension()) { + MutableExtensionSet(message)->ClearExtension(field->number()); + } else if (!field->is_repeated()) { + if (HasBit(*message, field)) { + ClearBit(message, field); + + // We need to set the field back to its default value. + switch (field->cpp_type()) { +#define CLEAR_TYPE(CPPTYPE, TYPE) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + *MutableRaw(message, field) = \ + field->default_value_##TYPE(); \ + break; + + CLEAR_TYPE(INT32 , int32 ); + CLEAR_TYPE(INT64 , int64 ); + CLEAR_TYPE(UINT32, uint32); + CLEAR_TYPE(UINT64, uint64); + CLEAR_TYPE(FLOAT , float ); + CLEAR_TYPE(DOUBLE, double); + CLEAR_TYPE(BOOL , bool ); +#undef CLEAR_TYPE + + case FieldDescriptor::CPPTYPE_ENUM: + *MutableRaw(message, field) = + field->default_value_enum()->number(); + break; + + case FieldDescriptor::CPPTYPE_STRING: { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + const string* default_ptr = DefaultRaw(field); + string** value = MutableRaw(message, field); + if (*value != default_ptr) { + if (field->has_default_value()) { + (*value)->assign(field->default_value_string()); + } else { + (*value)->clear(); + } + } + break; + } + break; + } + + case FieldDescriptor::CPPTYPE_MESSAGE: + (*MutableRaw(message, field))->Clear(); + break; + } + } + } else { + switch (field->cpp_type()) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE : \ + MutableRaw >(message, field)->Clear(); \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, int); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_STRING: { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + MutableRaw >(message, field)->Clear(); + break; + } + break; + } + + case FieldDescriptor::CPPTYPE_MESSAGE: { + // We don't know which subclass of RepeatedPtrFieldBase the type is, + // so we use RepeatedPtrFieldBase directly. + MutableRaw(message, field) + ->Clear >(); + break; + } + } + } +} + +void GeneratedMessageReflection::RemoveLast( + Message* message, + const FieldDescriptor* field) const { + USAGE_CHECK_MESSAGE_TYPE(RemoveLast); + USAGE_CHECK_REPEATED(RemoveLast); + + if (field->is_extension()) { + MutableExtensionSet(message)->RemoveLast(field->number()); + } else { + switch (field->cpp_type()) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE : \ + MutableRaw >(message, field)->RemoveLast(); \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, int); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_STRING: + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + MutableRaw >(message, field)->RemoveLast(); + break; + } + break; + + case FieldDescriptor::CPPTYPE_MESSAGE: + MutableRaw(message, field) + ->RemoveLast >(); + break; + } + } +} + +void GeneratedMessageReflection::SwapElements( + Message* message, + const FieldDescriptor* field, + int index1, + int index2) const { + USAGE_CHECK_MESSAGE_TYPE(Swap); + USAGE_CHECK_REPEATED(Swap); + + if (field->is_extension()) { + MutableExtensionSet(message)->SwapElements(field->number(), index1, index2); + } else { + switch (field->cpp_type()) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case FieldDescriptor::CPPTYPE_##UPPERCASE : \ + MutableRaw >(message, field) \ + ->SwapElements(index1, index2); \ + break + + HANDLE_TYPE( INT32, int32); + HANDLE_TYPE( INT64, int64); + HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE( FLOAT, float); + HANDLE_TYPE( BOOL, bool); + HANDLE_TYPE( ENUM, int); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_MESSAGE: + MutableRaw(message, field) + ->SwapElements(index1, index2); + break; + } + } +} + +namespace { +// Comparison functor for sorting FieldDescriptors by field number. +struct FieldNumberSorter { + bool operator()(const FieldDescriptor* left, + const FieldDescriptor* right) const { + return left->number() < right->number(); + } +}; +} // namespace + +void GeneratedMessageReflection::ListFields( + const Message& message, + vector* output) const { + output->clear(); + + // Optimization: The default instance never has any fields set. + if (&message == default_instance_) return; + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + if (field->is_repeated()) { + if (FieldSize(message, field) > 0) { + output->push_back(field); + } + } else { + if (HasBit(message, field)) { + output->push_back(field); + } + } + } + + if (extensions_offset_ != -1) { + GetExtensionSet(message).AppendToList(descriptor_, descriptor_pool_, + output); + } + + // ListFields() must sort output by field number. + sort(output->begin(), output->end(), FieldNumberSorter()); +} + +// ------------------------------------------------------------------- + +#undef DEFINE_PRIMITIVE_ACCESSORS +#define DEFINE_PRIMITIVE_ACCESSORS(TYPENAME, TYPE, PASSTYPE, CPPTYPE) \ + PASSTYPE GeneratedMessageReflection::Get##TYPENAME( \ + const Message& message, const FieldDescriptor* field) const { \ + USAGE_CHECK_ALL(Get##TYPENAME, SINGULAR, CPPTYPE); \ + if (field->is_extension()) { \ + return GetExtensionSet(message).Get##TYPENAME( \ + field->number(), field->default_value_##PASSTYPE()); \ + } else { \ + return GetField(message, field); \ + } \ + } \ + \ + void GeneratedMessageReflection::Set##TYPENAME( \ + Message* message, const FieldDescriptor* field, \ + PASSTYPE value) const { \ + USAGE_CHECK_ALL(Set##TYPENAME, SINGULAR, CPPTYPE); \ + if (field->is_extension()) { \ + return MutableExtensionSet(message)->Set##TYPENAME( \ + field->number(), field->type(), value, field); \ + } else { \ + SetField(message, field, value); \ + } \ + } \ + \ + PASSTYPE GeneratedMessageReflection::GetRepeated##TYPENAME( \ + const Message& message, \ + const FieldDescriptor* field, int index) const { \ + USAGE_CHECK_ALL(GetRepeated##TYPENAME, REPEATED, CPPTYPE); \ + if (field->is_extension()) { \ + return GetExtensionSet(message).GetRepeated##TYPENAME( \ + field->number(), index); \ + } else { \ + return GetRepeatedField(message, field, index); \ + } \ + } \ + \ + void GeneratedMessageReflection::SetRepeated##TYPENAME( \ + Message* message, const FieldDescriptor* field, \ + int index, PASSTYPE value) const { \ + USAGE_CHECK_ALL(SetRepeated##TYPENAME, REPEATED, CPPTYPE); \ + if (field->is_extension()) { \ + MutableExtensionSet(message)->SetRepeated##TYPENAME( \ + field->number(), index, value); \ + } else { \ + SetRepeatedField(message, field, index, value); \ + } \ + } \ + \ + void GeneratedMessageReflection::Add##TYPENAME( \ + Message* message, const FieldDescriptor* field, \ + PASSTYPE value) const { \ + USAGE_CHECK_ALL(Add##TYPENAME, REPEATED, CPPTYPE); \ + if (field->is_extension()) { \ + MutableExtensionSet(message)->Add##TYPENAME( \ + field->number(), field->type(), field->options().packed(), value, \ + field); \ + } else { \ + AddField(message, field, value); \ + } \ + } + +DEFINE_PRIMITIVE_ACCESSORS(Int32 , int32 , int32 , INT32 ) +DEFINE_PRIMITIVE_ACCESSORS(Int64 , int64 , int64 , INT64 ) +DEFINE_PRIMITIVE_ACCESSORS(UInt32, uint32, uint32, UINT32) +DEFINE_PRIMITIVE_ACCESSORS(UInt64, uint64, uint64, UINT64) +DEFINE_PRIMITIVE_ACCESSORS(Float , float , float , FLOAT ) +DEFINE_PRIMITIVE_ACCESSORS(Double, double, double, DOUBLE) +DEFINE_PRIMITIVE_ACCESSORS(Bool , bool , bool , BOOL ) +#undef DEFINE_PRIMITIVE_ACCESSORS + +// ------------------------------------------------------------------- + +string GeneratedMessageReflection::GetString( + const Message& message, const FieldDescriptor* field) const { + USAGE_CHECK_ALL(GetString, SINGULAR, STRING); + if (field->is_extension()) { + return GetExtensionSet(message).GetString(field->number(), + field->default_value_string()); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + return *GetField(message, field); + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return kEmptyString; // Make compiler happy. + } +} + +const string& GeneratedMessageReflection::GetStringReference( + const Message& message, + const FieldDescriptor* field, string* scratch) const { + USAGE_CHECK_ALL(GetStringReference, SINGULAR, STRING); + if (field->is_extension()) { + return GetExtensionSet(message).GetString(field->number(), + field->default_value_string()); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + return *GetField(message, field); + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return kEmptyString; // Make compiler happy. + } +} + + +void GeneratedMessageReflection::SetString( + Message* message, const FieldDescriptor* field, + const string& value) const { + USAGE_CHECK_ALL(SetString, SINGULAR, STRING); + if (field->is_extension()) { + return MutableExtensionSet(message)->SetString(field->number(), + field->type(), value, field); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: { + string** ptr = MutableField(message, field); + if (*ptr == DefaultRaw(field)) { + *ptr = new string(value); + } else { + (*ptr)->assign(value); + } + break; + } + } + } +} + + +string GeneratedMessageReflection::GetRepeatedString( + const Message& message, const FieldDescriptor* field, int index) const { + USAGE_CHECK_ALL(GetRepeatedString, REPEATED, STRING); + if (field->is_extension()) { + return GetExtensionSet(message).GetRepeatedString(field->number(), index); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + return GetRepeatedPtrField(message, field, index); + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return kEmptyString; // Make compiler happy. + } +} + +const string& GeneratedMessageReflection::GetRepeatedStringReference( + const Message& message, const FieldDescriptor* field, + int index, string* scratch) const { + USAGE_CHECK_ALL(GetRepeatedStringReference, REPEATED, STRING); + if (field->is_extension()) { + return GetExtensionSet(message).GetRepeatedString(field->number(), index); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + return GetRepeatedPtrField(message, field, index); + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return kEmptyString; // Make compiler happy. + } +} + + +void GeneratedMessageReflection::SetRepeatedString( + Message* message, const FieldDescriptor* field, + int index, const string& value) const { + USAGE_CHECK_ALL(SetRepeatedString, REPEATED, STRING); + if (field->is_extension()) { + MutableExtensionSet(message)->SetRepeatedString( + field->number(), index, value); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + *MutableRepeatedField(message, field, index) = value; + break; + } + } +} + + +void GeneratedMessageReflection::AddString( + Message* message, const FieldDescriptor* field, + const string& value) const { + USAGE_CHECK_ALL(AddString, REPEATED, STRING); + if (field->is_extension()) { + MutableExtensionSet(message)->AddString(field->number(), + field->type(), value, field); + } else { + switch (field->options().ctype()) { + default: // TODO(kenton): Support other string reps. + case FieldOptions::STRING: + *AddField(message, field) = value; + break; + } + } +} + + +// ------------------------------------------------------------------- + +const EnumValueDescriptor* GeneratedMessageReflection::GetEnum( + const Message& message, const FieldDescriptor* field) const { + USAGE_CHECK_ALL(GetEnum, SINGULAR, ENUM); + + int value; + if (field->is_extension()) { + value = GetExtensionSet(message).GetEnum( + field->number(), field->default_value_enum()->number()); + } else { + value = GetField(message, field); + } + const EnumValueDescriptor* result = + field->enum_type()->FindValueByNumber(value); + GOOGLE_CHECK(result != NULL); + return result; +} + +void GeneratedMessageReflection::SetEnum( + Message* message, const FieldDescriptor* field, + const EnumValueDescriptor* value) const { + USAGE_CHECK_ALL(SetEnum, SINGULAR, ENUM); + USAGE_CHECK_ENUM_VALUE(SetEnum); + + if (field->is_extension()) { + MutableExtensionSet(message)->SetEnum(field->number(), field->type(), + value->number(), field); + } else { + SetField(message, field, value->number()); + } +} + +const EnumValueDescriptor* GeneratedMessageReflection::GetRepeatedEnum( + const Message& message, const FieldDescriptor* field, int index) const { + USAGE_CHECK_ALL(GetRepeatedEnum, REPEATED, ENUM); + + int value; + if (field->is_extension()) { + value = GetExtensionSet(message).GetRepeatedEnum(field->number(), index); + } else { + value = GetRepeatedField(message, field, index); + } + const EnumValueDescriptor* result = + field->enum_type()->FindValueByNumber(value); + GOOGLE_CHECK(result != NULL); + return result; +} + +void GeneratedMessageReflection::SetRepeatedEnum( + Message* message, + const FieldDescriptor* field, int index, + const EnumValueDescriptor* value) const { + USAGE_CHECK_ALL(SetRepeatedEnum, REPEATED, ENUM); + USAGE_CHECK_ENUM_VALUE(SetRepeatedEnum); + + if (field->is_extension()) { + MutableExtensionSet(message)->SetRepeatedEnum( + field->number(), index, value->number()); + } else { + SetRepeatedField(message, field, index, value->number()); + } +} + +void GeneratedMessageReflection::AddEnum( + Message* message, const FieldDescriptor* field, + const EnumValueDescriptor* value) const { + USAGE_CHECK_ALL(AddEnum, REPEATED, ENUM); + USAGE_CHECK_ENUM_VALUE(AddEnum); + + if (field->is_extension()) { + MutableExtensionSet(message)->AddEnum(field->number(), field->type(), + field->options().packed(), + value->number(), field); + } else { + AddField(message, field, value->number()); + } +} + +// ------------------------------------------------------------------- + +const Message& GeneratedMessageReflection::GetMessage( + const Message& message, const FieldDescriptor* field, + MessageFactory* factory) const { + USAGE_CHECK_ALL(GetMessage, SINGULAR, MESSAGE); + + if (field->is_extension()) { + return static_cast( + GetExtensionSet(message).GetMessage( + field->number(), field->message_type(), + factory == NULL ? message_factory_ : factory)); + } else { + const Message* result = GetRaw(message, field); + if (result == NULL) { + result = DefaultRaw(field); + } + return *result; + } +} + +Message* GeneratedMessageReflection::MutableMessage( + Message* message, const FieldDescriptor* field, + MessageFactory* factory) const { + USAGE_CHECK_ALL(MutableMessage, SINGULAR, MESSAGE); + + if (field->is_extension()) { + return static_cast( + MutableExtensionSet(message)->MutableMessage(field, + factory == NULL ? message_factory_ : factory)); + } else { + Message** result = MutableField(message, field); + if (*result == NULL) { + const Message* default_message = DefaultRaw(field); + *result = default_message->New(); + } + return *result; + } +} + +const Message& GeneratedMessageReflection::GetRepeatedMessage( + const Message& message, const FieldDescriptor* field, int index) const { + USAGE_CHECK_ALL(GetRepeatedMessage, REPEATED, MESSAGE); + + if (field->is_extension()) { + return static_cast( + GetExtensionSet(message).GetRepeatedMessage(field->number(), index)); + } else { + return GetRaw(message, field) + .Get >(index); + } +} + +Message* GeneratedMessageReflection::MutableRepeatedMessage( + Message* message, const FieldDescriptor* field, int index) const { + USAGE_CHECK_ALL(MutableRepeatedMessage, REPEATED, MESSAGE); + + if (field->is_extension()) { + return static_cast( + MutableExtensionSet(message)->MutableRepeatedMessage( + field->number(), index)); + } else { + return MutableRaw(message, field) + ->Mutable >(index); + } +} + +Message* GeneratedMessageReflection::AddMessage( + Message* message, const FieldDescriptor* field, + MessageFactory* factory) const { + USAGE_CHECK_ALL(AddMessage, REPEATED, MESSAGE); + + if (factory == NULL) factory = message_factory_; + + if (field->is_extension()) { + return static_cast( + MutableExtensionSet(message)->AddMessage(field, factory)); + } else { + // We can't use AddField() because RepeatedPtrFieldBase doesn't + // know how to allocate one. + RepeatedPtrFieldBase* repeated = + MutableRaw(message, field); + Message* result = repeated->AddFromCleared >(); + if (result == NULL) { + // We must allocate a new object. + const Message* prototype; + if (repeated->size() == 0) { + prototype = factory->GetPrototype(field->message_type()); + } else { + prototype = &repeated->Get >(0); + } + result = prototype->New(); + repeated->AddAllocated >(result); + } + return result; + } +} + +// ------------------------------------------------------------------- + +const FieldDescriptor* GeneratedMessageReflection::FindKnownExtensionByName( + const string& name) const { + if (extensions_offset_ == -1) return NULL; + + const FieldDescriptor* result = descriptor_pool_->FindExtensionByName(name); + if (result != NULL && result->containing_type() == descriptor_) { + return result; + } + + if (descriptor_->options().message_set_wire_format()) { + // MessageSet extensions may be identified by type name. + const Descriptor* type = descriptor_pool_->FindMessageTypeByName(name); + if (type != NULL) { + // Look for a matching extension in the foreign type's scope. + for (int i = 0; i < type->extension_count(); i++) { + const FieldDescriptor* extension = type->extension(i); + if (extension->containing_type() == descriptor_ && + extension->type() == FieldDescriptor::TYPE_MESSAGE && + extension->is_optional() && + extension->message_type() == type) { + // Found it. + return extension; + } + } + } + } + + return NULL; +} + +const FieldDescriptor* GeneratedMessageReflection::FindKnownExtensionByNumber( + int number) const { + if (extensions_offset_ == -1) return NULL; + return descriptor_pool_->FindExtensionByNumber(descriptor_, number); +} + +// =================================================================== +// Some private helpers. + +// These simple template accessors obtain pointers (or references) to +// the given field. +template +inline const Type& GeneratedMessageReflection::GetRaw( + const Message& message, const FieldDescriptor* field) const { + const void* ptr = reinterpret_cast(&message) + + offsets_[field->index()]; + return *reinterpret_cast(ptr); +} + +template +inline Type* GeneratedMessageReflection::MutableRaw( + Message* message, const FieldDescriptor* field) const { + void* ptr = reinterpret_cast(message) + offsets_[field->index()]; + return reinterpret_cast(ptr); +} + +template +inline const Type& GeneratedMessageReflection::DefaultRaw( + const FieldDescriptor* field) const { + const void* ptr = reinterpret_cast(default_instance_) + + offsets_[field->index()]; + return *reinterpret_cast(ptr); +} + +inline const uint32* GeneratedMessageReflection::GetHasBits( + const Message& message) const { + const void* ptr = reinterpret_cast(&message) + has_bits_offset_; + return reinterpret_cast(ptr); +} +inline uint32* GeneratedMessageReflection::MutableHasBits( + Message* message) const { + void* ptr = reinterpret_cast(message) + has_bits_offset_; + return reinterpret_cast(ptr); +} + +inline const ExtensionSet& GeneratedMessageReflection::GetExtensionSet( + const Message& message) const { + GOOGLE_DCHECK_NE(extensions_offset_, -1); + const void* ptr = reinterpret_cast(&message) + + extensions_offset_; + return *reinterpret_cast(ptr); +} +inline ExtensionSet* GeneratedMessageReflection::MutableExtensionSet( + Message* message) const { + GOOGLE_DCHECK_NE(extensions_offset_, -1); + void* ptr = reinterpret_cast(message) + extensions_offset_; + return reinterpret_cast(ptr); +} + +// Simple accessors for manipulating has_bits_. +inline bool GeneratedMessageReflection::HasBit( + const Message& message, const FieldDescriptor* field) const { + return GetHasBits(message)[field->index() / 32] & + (1 << (field->index() % 32)); +} + +inline void GeneratedMessageReflection::SetBit( + Message* message, const FieldDescriptor* field) const { + MutableHasBits(message)[field->index() / 32] |= (1 << (field->index() % 32)); +} + +inline void GeneratedMessageReflection::ClearBit( + Message* message, const FieldDescriptor* field) const { + MutableHasBits(message)[field->index() / 32] &= ~(1 << (field->index() % 32)); +} + +// Template implementations of basic accessors. Inline because each +// template instance is only called from one location. These are +// used for all types except messages. +template +inline const Type& GeneratedMessageReflection::GetField( + const Message& message, const FieldDescriptor* field) const { + return GetRaw(message, field); +} + +template +inline void GeneratedMessageReflection::SetField( + Message* message, const FieldDescriptor* field, const Type& value) const { + *MutableRaw(message, field) = value; + SetBit(message, field); +} + +template +inline Type* GeneratedMessageReflection::MutableField( + Message* message, const FieldDescriptor* field) const { + SetBit(message, field); + return MutableRaw(message, field); +} + +template +inline const Type& GeneratedMessageReflection::GetRepeatedField( + const Message& message, const FieldDescriptor* field, int index) const { + return GetRaw >(message, field).Get(index); +} + +template +inline const Type& GeneratedMessageReflection::GetRepeatedPtrField( + const Message& message, const FieldDescriptor* field, int index) const { + return GetRaw >(message, field).Get(index); +} + +template +inline void GeneratedMessageReflection::SetRepeatedField( + Message* message, const FieldDescriptor* field, + int index, Type value) const { + MutableRaw >(message, field)->Set(index, value); +} + +template +inline Type* GeneratedMessageReflection::MutableRepeatedField( + Message* message, const FieldDescriptor* field, int index) const { + RepeatedPtrField* repeated = + MutableRaw >(message, field); + return repeated->Mutable(index); +} + +template +inline void GeneratedMessageReflection::AddField( + Message* message, const FieldDescriptor* field, const Type& value) const { + MutableRaw >(message, field)->Add(value); +} + +template +inline Type* GeneratedMessageReflection::AddField( + Message* message, const FieldDescriptor* field) const { + RepeatedPtrField* repeated = + MutableRaw >(message, field); + return repeated->Add(); +} + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/generated_message_reflection.h b/depends/protobuf/google/protobuf/generated_message_reflection.h new file mode 100644 index 000000000..b545fa1a2 --- /dev/null +++ b/depends/protobuf/google/protobuf/generated_message_reflection.h @@ -0,0 +1,424 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 header is logically internal, but is made public because it is used +// from protocol-compiler-generated code, which may reside in other components. + +#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__ +#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__ + +#include +#include +#include +#include + + +namespace google { +namespace protobuf { + class DescriptorPool; + // Generated code needs these to have been forward-declared. Easier to do it + // here than to print them inside every .pb.h file. + class FileDescriptor; + class EnumDescriptor; +} + +namespace protobuf { +namespace internal { + +// Defined in this file. +class GeneratedMessageReflection; + +// Defined in other files. +class ExtensionSet; // extension_set.h + +// THIS CLASS IS NOT INTENDED FOR DIRECT USE. It is intended for use +// by generated code. This class is just a big hack that reduces code +// size. +// +// A GeneratedMessageReflection is an implementation of Reflection +// which expects all fields to be backed by simple variables located in +// memory. The locations are given using a base pointer and a set of +// offsets. +// +// It is required that the user represents fields of each type in a standard +// way, so that GeneratedMessageReflection can cast the void* pointer to +// the appropriate type. For primitive fields and string fields, each field +// should be represented using the obvious C++ primitive type. Enums and +// Messages are different: +// - Singular Message fields are stored as a pointer to a Message. These +// should start out NULL, except for in the default instance where they +// should start out pointing to other default instances. +// - Enum fields are stored as an int. This int must always contain +// a valid value, such that EnumDescriptor::FindValueByNumber() would +// not return NULL. +// - Repeated fields are stored as RepeatedFields or RepeatedPtrFields +// of whatever type the individual field would be. Strings and +// Messages use RepeatedPtrFields while everything else uses +// RepeatedFields. +class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { + public: + // Constructs a GeneratedMessageReflection. + // Parameters: + // descriptor: The descriptor for the message type being implemented. + // default_instance: The default instance of the message. This is only + // used to obtain pointers to default instances of embedded + // messages, which GetMessage() will return if the particular + // sub-message has not been initialized yet. (Thus, all + // embedded message fields *must* have non-NULL pointers + // in the default instance.) + // offsets: An array of ints giving the byte offsets, relative to + // the start of the message object, of each field. These can + // be computed at compile time using the + // GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET() macro, defined + // below. + // has_bits_offset: Offset in the message of an array of uint32s of size + // descriptor->field_count()/32, rounded up. This is a + // bitfield where each bit indicates whether or not the + // corresponding field of the message has been initialized. + // The bit for field index i is obtained by the expression: + // has_bits[i / 32] & (1 << (i % 32)) + // unknown_fields_offset: Offset in the message of the UnknownFieldSet for + // the message. + // extensions_offset: Offset in the message of the ExtensionSet for the + // message, or -1 if the message type has no extension + // ranges. + // pool: DescriptorPool to search for extension definitions. Only + // used by FindKnownExtensionByName() and + // FindKnownExtensionByNumber(). + // factory: MessageFactory to use to construct extension messages. + // object_size: The size of a message object of this type, as measured + // by sizeof(). + GeneratedMessageReflection(const Descriptor* descriptor, + const Message* default_instance, + const int offsets[], + int has_bits_offset, + int unknown_fields_offset, + int extensions_offset, + const DescriptorPool* pool, + MessageFactory* factory, + int object_size); + ~GeneratedMessageReflection(); + + // implements Reflection ------------------------------------------- + + const UnknownFieldSet& GetUnknownFields(const Message& message) const; + UnknownFieldSet* MutableUnknownFields(Message* message) const; + + int SpaceUsed(const Message& message) const; + + bool HasField(const Message& message, const FieldDescriptor* field) const; + int FieldSize(const Message& message, const FieldDescriptor* field) const; + void ClearField(Message* message, const FieldDescriptor* field) const; + void RemoveLast(Message* message, const FieldDescriptor* field) const; + void Swap(Message* message1, Message* message2) const; + void SwapElements(Message* message, const FieldDescriptor* field, + int index1, int index2) const; + void ListFields(const Message& message, + vector* output) const; + + int32 GetInt32 (const Message& message, + const FieldDescriptor* field) const; + int64 GetInt64 (const Message& message, + const FieldDescriptor* field) const; + uint32 GetUInt32(const Message& message, + const FieldDescriptor* field) const; + uint64 GetUInt64(const Message& message, + const FieldDescriptor* field) const; + float GetFloat (const Message& message, + const FieldDescriptor* field) const; + double GetDouble(const Message& message, + const FieldDescriptor* field) const; + bool GetBool (const Message& message, + const FieldDescriptor* field) const; + string GetString(const Message& message, + const FieldDescriptor* field) const; + const string& GetStringReference(const Message& message, + const FieldDescriptor* field, + string* scratch) const; + const EnumValueDescriptor* GetEnum(const Message& message, + const FieldDescriptor* field) const; + const Message& GetMessage(const Message& message, + const FieldDescriptor* field, + MessageFactory* factory = NULL) const; + + void SetInt32 (Message* message, + const FieldDescriptor* field, int32 value) const; + void SetInt64 (Message* message, + const FieldDescriptor* field, int64 value) const; + void SetUInt32(Message* message, + const FieldDescriptor* field, uint32 value) const; + void SetUInt64(Message* message, + const FieldDescriptor* field, uint64 value) const; + void SetFloat (Message* message, + const FieldDescriptor* field, float value) const; + void SetDouble(Message* message, + const FieldDescriptor* field, double value) const; + void SetBool (Message* message, + const FieldDescriptor* field, bool value) const; + void SetString(Message* message, + const FieldDescriptor* field, + const string& value) const; + void SetEnum (Message* message, const FieldDescriptor* field, + const EnumValueDescriptor* value) const; + Message* MutableMessage(Message* message, const FieldDescriptor* field, + MessageFactory* factory = NULL) const; + + int32 GetRepeatedInt32 (const Message& message, + const FieldDescriptor* field, int index) const; + int64 GetRepeatedInt64 (const Message& message, + const FieldDescriptor* field, int index) const; + uint32 GetRepeatedUInt32(const Message& message, + const FieldDescriptor* field, int index) const; + uint64 GetRepeatedUInt64(const Message& message, + const FieldDescriptor* field, int index) const; + float GetRepeatedFloat (const Message& message, + const FieldDescriptor* field, int index) const; + double GetRepeatedDouble(const Message& message, + const FieldDescriptor* field, int index) const; + bool GetRepeatedBool (const Message& message, + const FieldDescriptor* field, int index) const; + string GetRepeatedString(const Message& message, + const FieldDescriptor* field, int index) const; + const string& GetRepeatedStringReference(const Message& message, + const FieldDescriptor* field, + int index, string* scratch) const; + const EnumValueDescriptor* GetRepeatedEnum(const Message& message, + const FieldDescriptor* field, + int index) const; + const Message& GetRepeatedMessage(const Message& message, + const FieldDescriptor* field, + int index) const; + + // Set the value of a field. + void SetRepeatedInt32 (Message* message, + const FieldDescriptor* field, int index, int32 value) const; + void SetRepeatedInt64 (Message* message, + const FieldDescriptor* field, int index, int64 value) const; + void SetRepeatedUInt32(Message* message, + const FieldDescriptor* field, int index, uint32 value) const; + void SetRepeatedUInt64(Message* message, + const FieldDescriptor* field, int index, uint64 value) const; + void SetRepeatedFloat (Message* message, + const FieldDescriptor* field, int index, float value) const; + void SetRepeatedDouble(Message* message, + const FieldDescriptor* field, int index, double value) const; + void SetRepeatedBool (Message* message, + const FieldDescriptor* field, int index, bool value) const; + void SetRepeatedString(Message* message, + const FieldDescriptor* field, int index, + const string& value) const; + void SetRepeatedEnum(Message* message, const FieldDescriptor* field, + int index, const EnumValueDescriptor* value) const; + // Get a mutable pointer to a field with a message type. + Message* MutableRepeatedMessage(Message* message, + const FieldDescriptor* field, + int index) const; + + void AddInt32 (Message* message, + const FieldDescriptor* field, int32 value) const; + void AddInt64 (Message* message, + const FieldDescriptor* field, int64 value) const; + void AddUInt32(Message* message, + const FieldDescriptor* field, uint32 value) const; + void AddUInt64(Message* message, + const FieldDescriptor* field, uint64 value) const; + void AddFloat (Message* message, + const FieldDescriptor* field, float value) const; + void AddDouble(Message* message, + const FieldDescriptor* field, double value) const; + void AddBool (Message* message, + const FieldDescriptor* field, bool value) const; + void AddString(Message* message, + const FieldDescriptor* field, const string& value) const; + void AddEnum(Message* message, + const FieldDescriptor* field, + const EnumValueDescriptor* value) const; + Message* AddMessage(Message* message, const FieldDescriptor* field, + MessageFactory* factory = NULL) const; + + const FieldDescriptor* FindKnownExtensionByName(const string& name) const; + const FieldDescriptor* FindKnownExtensionByNumber(int number) const; + + private: + friend class GeneratedMessage; + + const Descriptor* descriptor_; + const Message* default_instance_; + const int* offsets_; + + int has_bits_offset_; + int unknown_fields_offset_; + int extensions_offset_; + int object_size_; + + const DescriptorPool* descriptor_pool_; + MessageFactory* message_factory_; + + template + inline const Type& GetRaw(const Message& message, + const FieldDescriptor* field) const; + template + inline Type* MutableRaw(Message* message, + const FieldDescriptor* field) const; + template + inline const Type& DefaultRaw(const FieldDescriptor* field) const; + inline const Message* GetMessagePrototype(const FieldDescriptor* field) const; + + inline const uint32* GetHasBits(const Message& message) const; + inline uint32* MutableHasBits(Message* message) const; + inline const ExtensionSet& GetExtensionSet(const Message& message) const; + inline ExtensionSet* MutableExtensionSet(Message* message) const; + + inline bool HasBit(const Message& message, + const FieldDescriptor* field) const; + inline void SetBit(Message* message, + const FieldDescriptor* field) const; + inline void ClearBit(Message* message, + const FieldDescriptor* field) const; + + template + inline const Type& GetField(const Message& message, + const FieldDescriptor* field) const; + template + inline void SetField(Message* message, + const FieldDescriptor* field, const Type& value) const; + template + inline Type* MutableField(Message* message, + const FieldDescriptor* field) const; + template + inline const Type& GetRepeatedField(const Message& message, + const FieldDescriptor* field, + int index) const; + template + inline const Type& GetRepeatedPtrField(const Message& message, + const FieldDescriptor* field, + int index) const; + template + inline void SetRepeatedField(Message* message, + const FieldDescriptor* field, int index, + Type value) const; + template + inline Type* MutableRepeatedField(Message* message, + const FieldDescriptor* field, + int index) const; + template + inline void AddField(Message* message, + const FieldDescriptor* field, const Type& value) const; + template + inline Type* AddField(Message* message, + const FieldDescriptor* field) const; + + int GetExtensionNumberOrDie(const Descriptor* type) const; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratedMessageReflection); +}; + +// 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. +// +// 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 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TYPE, FIELD) \ + static_cast( \ + reinterpret_cast( \ + &reinterpret_cast(16)->FIELD) - \ + reinterpret_cast(16)) + +// There are some places in proto2 where dynamic_cast would be useful as an +// optimization. For example, take Message::MergeFrom(const Message& other). +// For a given generated message FooMessage, we generate these two methods: +// void MergeFrom(const FooMessage& other); +// void MergeFrom(const Message& other); +// The former method can be implemented directly in terms of FooMessage's +// inline accessors, but the latter method must work with the reflection +// interface. However, if the parameter to the latter method is actually of +// type FooMessage, then we'd like to be able to just call the other method +// as an optimization. So, we use dynamic_cast to check this. +// +// That said, dynamic_cast requires RTTI, which many people like to disable +// for performance and code size reasons. When RTTI is not available, we +// still need to produce correct results. So, in this case we have to fall +// back to using reflection, which is what we would have done anyway if the +// objects were not of the exact same class. +// +// dynamic_cast_if_available() implements this logic. If RTTI is +// enabled, it does a dynamic_cast. If RTTI is disabled, it just returns +// NULL. +// +// If you need to compile without RTTI, simply #define GOOGLE_PROTOBUF_NO_RTTI. +// On MSVC, this should be detected automatically. +template +inline To dynamic_cast_if_available(From from) { +#if defined(GOOGLE_PROTOBUF_NO_RTTI) || (defined(_MSC_VER)&&!defined(_CPPRTTI)) + return NULL; +#else + return dynamic_cast(from); +#endif +} + +// Helper for EnumType_Parse functions: try to parse the string 'name' as an +// enum name of the given type, returning true and filling in value on success, +// or returning false and leaving value unchanged on failure. +LIBPROTOBUF_EXPORT bool ParseNamedEnum(const EnumDescriptor* descriptor, + const string& name, + int* value); + +template +bool ParseNamedEnum(const EnumDescriptor* descriptor, + const string& name, + EnumType* value) { + int tmp; + if (!ParseNamedEnum(descriptor, name, &tmp)) return false; + *value = static_cast(tmp); + return true; +} + +// Just a wrapper around printing the name of a value. The main point of this +// function is not to be inlined, so that you can do this without including +// descriptor.h. +LIBPROTOBUF_EXPORT const string& NameOfEnum(const EnumDescriptor* descriptor, int value); + +} // namespace internal +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__ diff --git a/depends/protobuf/src/google/protobuf/map.cc b/depends/protobuf/google/protobuf/generated_message_util.cc similarity index 80% rename from depends/protobuf/src/google/protobuf/map.cc rename to depends/protobuf/google/protobuf/generated_message_util.cc index d60a9a285..76e547bb8 100644 --- a/depends/protobuf/src/google/protobuf/map.cc +++ b/depends/protobuf/google/protobuf/generated_message_util.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -28,13 +28,27 @@ // (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 +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include + +#include namespace google { namespace protobuf { namespace internal { -void* const kGlobalEmptyTable[kGlobalEmptyTableSize] = {nullptr}; +double Infinity() { + return std::numeric_limits::infinity(); +} +double NaN() { + return std::numeric_limits::quiet_NaN(); +} + +const ::std::string kEmptyString; + } // namespace internal } // namespace protobuf diff --git a/depends/protobuf/src/google/protobuf/repeated_field.cc b/depends/protobuf/google/protobuf/generated_message_util.h similarity index 58% rename from depends/protobuf/src/google/protobuf/repeated_field.cc rename to depends/protobuf/google/protobuf/generated_message_util.h index 7264d0a1e..239daea59 100644 --- a/depends/protobuf/src/google/protobuf/repeated_field.cc +++ b/depends/protobuf/google/protobuf/generated_message_util.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -31,41 +31,52 @@ // Author: kenton@google.com (Kenton Varda) // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +// +// This file contains miscellaneous helper code used by generated code -- +// including lite types -- but which should not be used directly by users. -#include +#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ +#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ -#include +#include -#include #include -// Must be included last. -#include namespace google { namespace protobuf { + namespace io { + class CodedInputStream; // coded_stream.h + } +} +namespace protobuf { +namespace internal { -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedPtrField; +// Annotation for the compiler to emit a deprecation message if a field marked +// with option 'deprecated=true' is used in the code, or for other things in +// generated code which are deprecated. +// +// For internal use in the pb.cc files, deprecation warnings are suppressed +// there. +#undef DEPRECATED_PROTOBUF_FIELD +#if !defined(INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION) +# define PROTOBUF_DEPRECATED GOOGLE_ATTRIBUTE_DEPRECATED +#else +# define PROTOBUF_DEPRECATED +#endif -namespace internal { -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -} // namespace internal +// Constants for special floating point values. +double Infinity(); +double NaN(); + +// Constant used for empty default strings. +extern LIBPROTOBUF_EXPORT const ::std::string kEmptyString; + + +} // namespace internal } // namespace protobuf -} // namespace google -#include +} // namespace google +#endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ diff --git a/depends/protobuf/google/protobuf/io/coded_stream.cc b/depends/protobuf/google/protobuf/io/coded_stream.cc new file mode 100644 index 000000000..57d486f95 --- /dev/null +++ b/depends/protobuf/google/protobuf/io/coded_stream.cc @@ -0,0 +1,839 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 implementation is heavily optimized to make reads and writes +// of small values (especially varints) as fast as possible. In +// particular, we optimize for the common case that a read or a write +// will not cross the end of the buffer, since we can avoid a lot +// of branching in this case. + +#include +#include +#include +#include +#include +#include + + +namespace google { +namespace protobuf { +namespace io { + +namespace { + +static const int kMaxVarintBytes = 10; +static const int kMaxVarint32Bytes = 5; + + +inline bool NextNonEmpty(ZeroCopyInputStream* input, + const void** data, int* size) { + bool success; + do { + success = input->Next(data, size); + } while (success && *size == 0); + return success; +} + +} // namespace + +// CodedInputStream ================================================== + + +void CodedInputStream::BackUpInputToCurrentPosition() { + int backup_bytes = BufferSize() + buffer_size_after_limit_ + overflow_bytes_; + if (backup_bytes > 0) { + input_->BackUp(backup_bytes); + + // total_bytes_read_ doesn't include overflow_bytes_. + total_bytes_read_ -= BufferSize() + buffer_size_after_limit_; + buffer_end_ = buffer_; + buffer_size_after_limit_ = 0; + overflow_bytes_ = 0; + } +} + +inline void CodedInputStream::RecomputeBufferLimits() { + buffer_end_ += buffer_size_after_limit_; + int closest_limit = min(current_limit_, total_bytes_limit_); + if (closest_limit < total_bytes_read_) { + // The limit position is in the current buffer. We must adjust + // the buffer size accordingly. + buffer_size_after_limit_ = total_bytes_read_ - closest_limit; + buffer_end_ -= buffer_size_after_limit_; + } else { + buffer_size_after_limit_ = 0; + } +} + +CodedInputStream::Limit CodedInputStream::PushLimit(int byte_limit) { + // Current position relative to the beginning of the stream. + int current_position = total_bytes_read_ - + (BufferSize() + buffer_size_after_limit_); + + Limit old_limit = current_limit_; + + // security: byte_limit is possibly evil, so check for negative values + // and overflow. + if (byte_limit >= 0 && + byte_limit <= INT_MAX - current_position) { + current_limit_ = current_position + byte_limit; + } else { + // Negative or overflow. + current_limit_ = INT_MAX; + } + + // We need to enforce all limits, not just the new one, so if the previous + // limit was before the new requested limit, we continue to enforce the + // previous limit. + current_limit_ = min(current_limit_, old_limit); + + RecomputeBufferLimits(); + return old_limit; +} + +void CodedInputStream::PopLimit(Limit limit) { + // The limit passed in is actually the *old* limit, which we returned from + // PushLimit(). + current_limit_ = limit; + RecomputeBufferLimits(); + + // We may no longer be at a legitimate message end. ReadTag() needs to be + // called again to find out. + legitimate_message_end_ = false; +} + +int CodedInputStream::BytesUntilLimit() { + if (current_limit_ == INT_MAX) return -1; + int current_position = total_bytes_read_ - + (BufferSize() + buffer_size_after_limit_); + + return current_limit_ - current_position; +} + +void CodedInputStream::SetTotalBytesLimit( + int total_bytes_limit, int warning_threshold) { + // Make sure the limit isn't already past, since this could confuse other + // code. + int current_position = total_bytes_read_ - + (BufferSize() + buffer_size_after_limit_); + total_bytes_limit_ = max(current_position, total_bytes_limit); + total_bytes_warning_threshold_ = warning_threshold; + RecomputeBufferLimits(); +} + +void CodedInputStream::PrintTotalBytesLimitError() { + GOOGLE_LOG(ERROR) << "A protocol message was rejected because it was too " + "big (more than " << total_bytes_limit_ + << " bytes). To increase the limit (or to disable these " + "warnings), see CodedInputStream::SetTotalBytesLimit() " + "in google/protobuf/io/coded_stream.h."; +} + +bool CodedInputStream::Skip(int count) { + if (count < 0) return false; // security: count is often user-supplied + + const int original_buffer_size = BufferSize(); + + if (count <= original_buffer_size) { + // Just skipping within the current buffer. Easy. + Advance(count); + return true; + } + + if (buffer_size_after_limit_ > 0) { + // We hit a limit inside this buffer. Advance to the limit and fail. + Advance(original_buffer_size); + return false; + } + + count -= original_buffer_size; + buffer_ = NULL; + buffer_end_ = buffer_; + + // Make sure this skip doesn't try to skip past the current limit. + int closest_limit = min(current_limit_, total_bytes_limit_); + int bytes_until_limit = closest_limit - total_bytes_read_; + if (bytes_until_limit < count) { + // We hit the limit. Skip up to it then fail. + if (bytes_until_limit > 0) { + total_bytes_read_ = closest_limit; + input_->Skip(bytes_until_limit); + } + return false; + } + + total_bytes_read_ += count; + return input_->Skip(count); +} + +bool CodedInputStream::GetDirectBufferPointer(const void** data, int* size) { + if (BufferSize() == 0 && !Refresh()) return false; + + *data = buffer_; + *size = BufferSize(); + return true; +} + +bool CodedInputStream::ReadRaw(void* buffer, int size) { + int current_buffer_size; + while ((current_buffer_size = BufferSize()) < size) { + // Reading past end of buffer. Copy what we have, then refresh. + memcpy(buffer, buffer_, current_buffer_size); + buffer = reinterpret_cast(buffer) + current_buffer_size; + size -= current_buffer_size; + Advance(current_buffer_size); + if (!Refresh()) return false; + } + + memcpy(buffer, buffer_, size); + Advance(size); + + return true; +} + +bool CodedInputStream::ReadString(string* buffer, int size) { + if (size < 0) return false; // security: size is often user-supplied + return InternalReadStringInline(buffer, size); +} + +bool CodedInputStream::ReadStringFallback(string* buffer, int size) { + if (!buffer->empty()) { + buffer->clear(); + } + + int current_buffer_size; + while ((current_buffer_size = BufferSize()) < size) { + // Some STL implementations "helpfully" crash on buffer->append(NULL, 0). + if (current_buffer_size != 0) { + // Note: string1.append(string2) is O(string2.size()) (as opposed to + // O(string1.size() + string2.size()), which would be bad). + buffer->append(reinterpret_cast(buffer_), + current_buffer_size); + } + size -= current_buffer_size; + Advance(current_buffer_size); + if (!Refresh()) return false; + } + + buffer->append(reinterpret_cast(buffer_), size); + Advance(size); + + return true; +} + + +bool CodedInputStream::ReadLittleEndian32Fallback(uint32* value) { + uint8 bytes[sizeof(*value)]; + + const uint8* ptr; + if (BufferSize() >= sizeof(*value)) { + // Fast path: Enough bytes in the buffer to read directly. + ptr = buffer_; + Advance(sizeof(*value)); + } else { + // Slow path: Had to read past the end of the buffer. + if (!ReadRaw(bytes, sizeof(*value))) return false; + ptr = bytes; + } + ReadLittleEndian32FromArray(ptr, value); + return true; +} + +bool CodedInputStream::ReadLittleEndian64Fallback(uint64* value) { + uint8 bytes[sizeof(*value)]; + + const uint8* ptr; + if (BufferSize() >= sizeof(*value)) { + // Fast path: Enough bytes in the buffer to read directly. + ptr = buffer_; + Advance(sizeof(*value)); + } else { + // Slow path: Had to read past the end of the buffer. + if (!ReadRaw(bytes, sizeof(*value))) return false; + ptr = bytes; + } + ReadLittleEndian64FromArray(ptr, value); + return true; +} + +namespace { + +inline const uint8* ReadVarint32FromArray( + const uint8* buffer, uint32* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; +inline const uint8* ReadVarint32FromArray(const uint8* buffer, uint32* value) { + // Fast path: We have enough bytes left in the buffer to guarantee that + // this read won't cross the end, so we can skip the checks. + const uint8* ptr = buffer; + uint32 b; + uint32 result; + + b = *(ptr++); result = (b & 0x7F) ; if (!(b & 0x80)) goto done; + b = *(ptr++); result |= (b & 0x7F) << 7; if (!(b & 0x80)) goto done; + b = *(ptr++); result |= (b & 0x7F) << 14; if (!(b & 0x80)) goto done; + b = *(ptr++); result |= (b & 0x7F) << 21; if (!(b & 0x80)) goto done; + b = *(ptr++); result |= b << 28; if (!(b & 0x80)) goto done; + + // If the input is larger than 32 bits, we still need to read it all + // and discard the high-order bits. + for (int i = 0; i < kMaxVarintBytes - kMaxVarint32Bytes; i++) { + b = *(ptr++); if (!(b & 0x80)) goto done; + } + + // We have overrun the maximum size of a varint (10 bytes). Assume + // the data is corrupt. + return NULL; + + done: + *value = result; + return ptr; +} + +} // namespace + +bool CodedInputStream::ReadVarint32Slow(uint32* value) { + uint64 result; + // Directly invoke ReadVarint64Fallback, since we already tried to optimize + // for one-byte varints. + if (!ReadVarint64Fallback(&result)) return false; + *value = (uint32)result; + return true; +} + +bool CodedInputStream::ReadVarint32Fallback(uint32* value) { + if (BufferSize() >= kMaxVarintBytes || + // Optimization: If the varint ends at exactly the end of the buffer, + // we can detect that and still use the fast path. + (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { + const uint8* end = ReadVarint32FromArray(buffer_, value); + if (end == NULL) return false; + buffer_ = end; + return true; + } else { + // Really slow case: we will incur the cost of an extra function call here, + // but moving this out of line reduces the size of this function, which + // improves the common case. In micro benchmarks, this is worth about 10-15% + return ReadVarint32Slow(value); + } +} + +uint32 CodedInputStream::ReadTagSlow() { + if (buffer_ == buffer_end_) { + // Call refresh. + if (!Refresh()) { + // Refresh failed. Make sure that it failed due to EOF, not because + // we hit total_bytes_limit_, which, unlike normal limits, is not a + // valid place to end a message. + int current_position = total_bytes_read_ - buffer_size_after_limit_; + if (current_position >= total_bytes_limit_) { + // Hit total_bytes_limit_. But if we also hit the normal limit, + // we're still OK. + legitimate_message_end_ = current_limit_ == total_bytes_limit_; + } else { + legitimate_message_end_ = true; + } + return 0; + } + } + + // For the slow path, just do a 64-bit read. Try to optimize for one-byte tags + // again, since we have now refreshed the buffer. + uint64 result; + if (!ReadVarint64(&result)) return 0; + return static_cast(result); +} + +uint32 CodedInputStream::ReadTagFallback() { + if (BufferSize() >= kMaxVarintBytes || + // Optimization: If the varint ends at exactly the end of the buffer, + // we can detect that and still use the fast path. + (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { + uint32 tag; + const uint8* end = ReadVarint32FromArray(buffer_, &tag); + if (end == NULL) { + return 0; + } + buffer_ = end; + return tag; + } else { + // We are commonly at a limit when attempting to read tags. Try to quickly + // detect this case without making another function call. + if (buffer_ == buffer_end_ && buffer_size_after_limit_ > 0 && + // Make sure that the limit we hit is not total_bytes_limit_, since + // in that case we still need to call Refresh() so that it prints an + // error. + total_bytes_read_ - buffer_size_after_limit_ < total_bytes_limit_) { + // We hit a byte limit. + legitimate_message_end_ = true; + return 0; + } + return ReadTagSlow(); + } +} + +bool CodedInputStream::ReadVarint64Slow(uint64* value) { + // Slow path: This read might cross the end of the buffer, so we + // need to check and refresh the buffer if and when it does. + + uint64 result = 0; + int count = 0; + uint32 b; + + do { + if (count == kMaxVarintBytes) return false; + while (buffer_ == buffer_end_) { + if (!Refresh()) return false; + } + b = *buffer_; + result |= static_cast(b & 0x7F) << (7 * count); + Advance(1); + ++count; + } while (b & 0x80); + + *value = result; + return true; +} + +bool CodedInputStream::ReadVarint64Fallback(uint64* value) { + if (BufferSize() >= kMaxVarintBytes || + // Optimization: If the varint ends at exactly the end of the buffer, + // we can detect that and still use the fast path. + (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { + // Fast path: We have enough bytes left in the buffer to guarantee that + // this read won't cross the end, so we can skip the checks. + + const uint8* ptr = buffer_; + uint32 b; + + // Splitting into 32-bit pieces gives better performance on 32-bit + // processors. + uint32 part0 = 0, part1 = 0, part2 = 0; + + b = *(ptr++); part0 = (b & 0x7F) ; if (!(b & 0x80)) goto done; + b = *(ptr++); part0 |= (b & 0x7F) << 7; if (!(b & 0x80)) goto done; + b = *(ptr++); part0 |= (b & 0x7F) << 14; if (!(b & 0x80)) goto done; + b = *(ptr++); part0 |= (b & 0x7F) << 21; if (!(b & 0x80)) goto done; + b = *(ptr++); part1 = (b & 0x7F) ; if (!(b & 0x80)) goto done; + b = *(ptr++); part1 |= (b & 0x7F) << 7; if (!(b & 0x80)) goto done; + b = *(ptr++); part1 |= (b & 0x7F) << 14; if (!(b & 0x80)) goto done; + b = *(ptr++); part1 |= (b & 0x7F) << 21; if (!(b & 0x80)) goto done; + b = *(ptr++); part2 = (b & 0x7F) ; if (!(b & 0x80)) goto done; + b = *(ptr++); part2 |= (b & 0x7F) << 7; if (!(b & 0x80)) goto done; + + // We have overrun the maximum size of a varint (10 bytes). The data + // must be corrupt. + return NULL; + + done: + Advance(ptr - buffer_); + *value = (static_cast(part0) ) | + (static_cast(part1) << 28) | + (static_cast(part2) << 56); + return true; + } else { + return ReadVarint64Slow(value); + } +} + +bool CodedInputStream::Refresh() { + GOOGLE_DCHECK_EQ(0, BufferSize()); + + if (buffer_size_after_limit_ > 0 || overflow_bytes_ > 0 || + total_bytes_read_ == current_limit_) { + // We've hit a limit. Stop. + int current_position = total_bytes_read_ - buffer_size_after_limit_; + + if (current_position >= total_bytes_limit_ && + total_bytes_limit_ != current_limit_) { + // Hit total_bytes_limit_. + PrintTotalBytesLimitError(); + } + + return false; + } + + if (total_bytes_warning_threshold_ >= 0 && + total_bytes_read_ >= total_bytes_warning_threshold_) { + GOOGLE_LOG(WARNING) << "Reading dangerously large protocol message. If the " + "message turns out to be larger than " + << total_bytes_limit_ << " bytes, parsing will be halted " + "for security reasons. To increase the limit (or to " + "disable these warnings), see " + "CodedInputStream::SetTotalBytesLimit() in " + "google/protobuf/io/coded_stream.h."; + + // Don't warn again for this stream. + total_bytes_warning_threshold_ = -1; + } + + const void* void_buffer; + int buffer_size; + if (NextNonEmpty(input_, &void_buffer, &buffer_size)) { + buffer_ = reinterpret_cast(void_buffer); + buffer_end_ = buffer_ + buffer_size; + GOOGLE_CHECK_GE(buffer_size, 0); + + if (total_bytes_read_ <= INT_MAX - buffer_size) { + total_bytes_read_ += buffer_size; + } else { + // Overflow. Reset buffer_end_ to not include the bytes beyond INT_MAX. + // We can't get that far anyway, because total_bytes_limit_ is guaranteed + // to be less than it. We need to keep track of the number of bytes + // we discarded, though, so that we can call input_->BackUp() to back + // up over them on destruction. + + // The following line is equivalent to: + // overflow_bytes_ = total_bytes_read_ + buffer_size - INT_MAX; + // except that it avoids overflows. Signed integer overflow has + // undefined results according to the C standard. + overflow_bytes_ = total_bytes_read_ - (INT_MAX - buffer_size); + buffer_end_ -= overflow_bytes_; + total_bytes_read_ = INT_MAX; + } + + RecomputeBufferLimits(); + return true; + } else { + buffer_ = NULL; + buffer_end_ = NULL; + return false; + } +} + +// CodedOutputStream ================================================= + +CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output) + : output_(output), + buffer_(NULL), + buffer_size_(0), + total_bytes_(0), + had_error_(false) { + // Eagerly Refresh() so buffer space is immediately available. + Refresh(); + // The Refresh() may have failed. If the client doesn't write any data, + // though, don't consider this an error. If the client does write data, then + // another Refresh() will be attempted and it will set the error once again. + had_error_ = false; +} + +CodedOutputStream::~CodedOutputStream() { + if (buffer_size_ > 0) { + output_->BackUp(buffer_size_); + } +} + +bool CodedOutputStream::Skip(int count) { + if (count < 0) return false; + + while (count > buffer_size_) { + count -= buffer_size_; + if (!Refresh()) return false; + } + + Advance(count); + return true; +} + +bool CodedOutputStream::GetDirectBufferPointer(void** data, int* size) { + if (buffer_size_ == 0 && !Refresh()) return false; + + *data = buffer_; + *size = buffer_size_; + return true; +} + +void CodedOutputStream::WriteRaw(const void* data, int size) { + while (buffer_size_ < size) { + memcpy(buffer_, data, buffer_size_); + size -= buffer_size_; + data = reinterpret_cast(data) + buffer_size_; + if (!Refresh()) return; + } + + memcpy(buffer_, data, size); + Advance(size); +} + +uint8* CodedOutputStream::WriteRawToArray( + const void* data, int size, uint8* target) { + memcpy(target, data, size); + return target + size; +} + + +void CodedOutputStream::WriteLittleEndian32(uint32 value) { + uint8 bytes[sizeof(value)]; + + bool use_fast = buffer_size_ >= sizeof(value); + uint8* ptr = use_fast ? buffer_ : bytes; + + WriteLittleEndian32ToArray(value, ptr); + + if (use_fast) { + Advance(sizeof(value)); + } else { + WriteRaw(bytes, sizeof(value)); + } +} + +void CodedOutputStream::WriteLittleEndian64(uint64 value) { + uint8 bytes[sizeof(value)]; + + bool use_fast = buffer_size_ >= sizeof(value); + uint8* ptr = use_fast ? buffer_ : bytes; + + WriteLittleEndian64ToArray(value, ptr); + + if (use_fast) { + Advance(sizeof(value)); + } else { + WriteRaw(bytes, sizeof(value)); + } +} + +inline uint8* CodedOutputStream::WriteVarint32FallbackToArrayInline( + uint32 value, uint8* target) { + target[0] = static_cast(value | 0x80); + if (value >= (1 << 7)) { + target[1] = static_cast((value >> 7) | 0x80); + if (value >= (1 << 14)) { + target[2] = static_cast((value >> 14) | 0x80); + if (value >= (1 << 21)) { + target[3] = static_cast((value >> 21) | 0x80); + if (value >= (1 << 28)) { + target[4] = static_cast(value >> 28); + return target + 5; + } else { + target[3] &= 0x7F; + return target + 4; + } + } else { + target[2] &= 0x7F; + return target + 3; + } + } else { + target[1] &= 0x7F; + return target + 2; + } + } else { + target[0] &= 0x7F; + return target + 1; + } +} + +void CodedOutputStream::WriteVarint32(uint32 value) { + if (buffer_size_ >= kMaxVarint32Bytes) { + // Fast path: We have enough bytes left in the buffer to guarantee that + // this write won't cross the end, so we can skip the checks. + uint8* target = buffer_; + uint8* end = WriteVarint32FallbackToArrayInline(value, target); + int size = end - target; + Advance(size); + } else { + // Slow path: This write might cross the end of the buffer, so we + // compose the bytes first then use WriteRaw(). + uint8 bytes[kMaxVarint32Bytes]; + int size = 0; + while (value > 0x7F) { + bytes[size++] = (static_cast(value) & 0x7F) | 0x80; + value >>= 7; + } + bytes[size++] = static_cast(value) & 0x7F; + WriteRaw(bytes, size); + } +} + +uint8* CodedOutputStream::WriteVarint32FallbackToArray( + uint32 value, uint8* target) { + return WriteVarint32FallbackToArrayInline(value, target); +} + +inline uint8* CodedOutputStream::WriteVarint64ToArrayInline( + uint64 value, uint8* target) { + // Splitting into 32-bit pieces gives better performance on 32-bit + // processors. + uint32 part0 = static_cast(value ); + uint32 part1 = static_cast(value >> 28); + uint32 part2 = static_cast(value >> 56); + + int size; + + // Here we can't really optimize for small numbers, since the value is + // split into three parts. Cheking for numbers < 128, for instance, + // would require three comparisons, since you'd have to make sure part1 + // and part2 are zero. However, if the caller is using 64-bit integers, + // it is likely that they expect the numbers to often be very large, so + // we probably don't want to optimize for small numbers anyway. Thus, + // we end up with a hardcoded binary search tree... + if (part2 == 0) { + if (part1 == 0) { + if (part0 < (1 << 14)) { + if (part0 < (1 << 7)) { + size = 1; goto size1; + } else { + size = 2; goto size2; + } + } else { + if (part0 < (1 << 21)) { + size = 3; goto size3; + } else { + size = 4; goto size4; + } + } + } else { + if (part1 < (1 << 14)) { + if (part1 < (1 << 7)) { + size = 5; goto size5; + } else { + size = 6; goto size6; + } + } else { + if (part1 < (1 << 21)) { + size = 7; goto size7; + } else { + size = 8; goto size8; + } + } + } + } else { + if (part2 < (1 << 7)) { + size = 9; goto size9; + } else { + size = 10; goto size10; + } + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + + size10: target[9] = static_cast((part2 >> 7) | 0x80); + size9 : target[8] = static_cast((part2 ) | 0x80); + size8 : target[7] = static_cast((part1 >> 21) | 0x80); + size7 : target[6] = static_cast((part1 >> 14) | 0x80); + size6 : target[5] = static_cast((part1 >> 7) | 0x80); + size5 : target[4] = static_cast((part1 ) | 0x80); + size4 : target[3] = static_cast((part0 >> 21) | 0x80); + size3 : target[2] = static_cast((part0 >> 14) | 0x80); + size2 : target[1] = static_cast((part0 >> 7) | 0x80); + size1 : target[0] = static_cast((part0 ) | 0x80); + + target[size-1] &= 0x7F; + return target + size; +} + +void CodedOutputStream::WriteVarint64(uint64 value) { + if (buffer_size_ >= kMaxVarintBytes) { + // Fast path: We have enough bytes left in the buffer to guarantee that + // this write won't cross the end, so we can skip the checks. + uint8* target = buffer_; + + uint8* end = WriteVarint64ToArrayInline(value, target); + int size = end - target; + Advance(size); + } else { + // Slow path: This write might cross the end of the buffer, so we + // compose the bytes first then use WriteRaw(). + uint8 bytes[kMaxVarintBytes]; + int size = 0; + while (value > 0x7F) { + bytes[size++] = (static_cast(value) & 0x7F) | 0x80; + value >>= 7; + } + bytes[size++] = static_cast(value) & 0x7F; + WriteRaw(bytes, size); + } +} + +uint8* CodedOutputStream::WriteVarint64ToArray( + uint64 value, uint8* target) { + return WriteVarint64ToArrayInline(value, target); +} + +bool CodedOutputStream::Refresh() { + void* void_buffer; + if (output_->Next(&void_buffer, &buffer_size_)) { + buffer_ = reinterpret_cast(void_buffer); + total_bytes_ += buffer_size_; + return true; + } else { + buffer_ = NULL; + buffer_size_ = 0; + had_error_ = true; + return false; + } +} + +int CodedOutputStream::VarintSize32Fallback(uint32 value) { + if (value < (1 << 7)) { + return 1; + } else if (value < (1 << 14)) { + return 2; + } else if (value < (1 << 21)) { + return 3; + } else if (value < (1 << 28)) { + return 4; + } else { + return 5; + } +} + +int CodedOutputStream::VarintSize64(uint64 value) { + if (value < (1ull << 35)) { + if (value < (1ull << 7)) { + return 1; + } else if (value < (1ull << 14)) { + return 2; + } else if (value < (1ull << 21)) { + return 3; + } else if (value < (1ull << 28)) { + return 4; + } else { + return 5; + } + } else { + if (value < (1ull << 42)) { + return 6; + } else if (value < (1ull << 49)) { + return 7; + } else if (value < (1ull << 56)) { + return 8; + } else if (value < (1ull << 63)) { + return 9; + } else { + return 10; + } + } +} + +} // namespace io +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/io/coded_stream.h b/depends/protobuf/google/protobuf/io/coded_stream.h new file mode 100644 index 000000000..1b6b4e18b --- /dev/null +++ b/depends/protobuf/google/protobuf/io/coded_stream.h @@ -0,0 +1,1102 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 file contains the CodedInputStream and CodedOutputStream classes, +// which wrap a ZeroCopyInputStream or ZeroCopyOutputStream, respectively, +// and allow you to read or write individual pieces of data in various +// formats. In particular, these implement the varint encoding for +// integers, a simple variable-length encoding in which smaller numbers +// take fewer bytes. +// +// Typically these classes will only be used internally by the protocol +// buffer library in order to encode and decode protocol buffers. Clients +// of the library only need to know about this class if they wish to write +// custom message parsing or serialization procedures. +// +// CodedOutputStream example: +// // Write some data to "myfile". First we write a 4-byte "magic number" +// // to identify the file type, then write a length-delimited string. The +// // string is composed of a varint giving the length followed by the raw +// // bytes. +// int fd = open("myfile", O_WRONLY); +// ZeroCopyOutputStream* raw_output = new FileOutputStream(fd); +// CodedOutputStream* coded_output = new CodedOutputStream(raw_output); +// +// int magic_number = 1234; +// char text[] = "Hello world!"; +// coded_output->WriteLittleEndian32(magic_number); +// coded_output->WriteVarint32(strlen(text)); +// coded_output->WriteRaw(text, strlen(text)); +// +// delete coded_output; +// delete raw_output; +// close(fd); +// +// CodedInputStream example: +// // Read a file created by the above code. +// int fd = open("myfile", O_RDONLY); +// ZeroCopyInputStream* raw_input = new FileInputStream(fd); +// CodedInputStream coded_input = new CodedInputStream(raw_input); +// +// coded_input->ReadLittleEndian32(&magic_number); +// if (magic_number != 1234) { +// cerr << "File not in expected format." << endl; +// return; +// } +// +// uint32 size; +// coded_input->ReadVarint32(&size); +// +// char* text = new char[size + 1]; +// coded_input->ReadRaw(buffer, size); +// text[size] = '\0'; +// +// delete coded_input; +// delete raw_input; +// close(fd); +// +// cout << "Text is: " << text << endl; +// delete [] text; +// +// For those who are interested, varint encoding is defined as follows: +// +// The encoding operates on unsigned integers of up to 64 bits in length. +// Each byte of the encoded value has the format: +// * bits 0-6: Seven bits of the number being encoded. +// * bit 7: Zero if this is the last byte in the encoding (in which +// case all remaining bits of the number are zero) or 1 if +// more bytes follow. +// The first byte contains the least-significant 7 bits of the number, the +// second byte (if present) contains the next-least-significant 7 bits, +// and so on. So, the binary number 1011000101011 would be encoded in two +// bytes as "10101011 00101100". +// +// In theory, varint could be used to encode integers of any length. +// However, for practicality we set a limit at 64 bits. The maximum encoded +// length of a number is thus 10 bytes. + +#ifndef GOOGLE_PROTOBUF_IO_CODED_STREAM_H__ +#define GOOGLE_PROTOBUF_IO_CODED_STREAM_H__ + +#include +#ifdef _MSC_VER + #if defined(_M_IX86) && \ + !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) + #define PROTOBUF_LITTLE_ENDIAN 1 + #endif + #if _MSC_VER >= 1300 + // If MSVC has "/RTCc" set, it will complain about truncating casts at + // runtime. This file contains some intentional truncating casts. + #pragma runtime_checks("c", off) + #endif +#else + #include // __BYTE_ORDER + #if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && \ + !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) + #define PROTOBUF_LITTLE_ENDIAN 1 + #endif +#endif +#include + + +namespace google { +namespace protobuf { + +class DescriptorPool; +class MessageFactory; + +namespace io { + +// Defined in this file. +class CodedInputStream; +class CodedOutputStream; + +// Defined in other files. +class ZeroCopyInputStream; // zero_copy_stream.h +class ZeroCopyOutputStream; // zero_copy_stream.h + +// Class which reads and decodes binary data which is composed of varint- +// encoded integers and fixed-width pieces. Wraps a ZeroCopyInputStream. +// Most users will not need to deal with CodedInputStream. +// +// Most methods of CodedInputStream that return a bool return false if an +// underlying I/O error occurs or if the data is malformed. Once such a +// failure occurs, the CodedInputStream is broken and is no longer useful. +class LIBPROTOBUF_EXPORT CodedInputStream { + public: + // Create a CodedInputStream that reads from the given ZeroCopyInputStream. + explicit CodedInputStream(ZeroCopyInputStream* input); + + // Create a CodedInputStream that reads from the given flat array. This is + // faster than using an ArrayInputStream. PushLimit(size) is implied by + // this constructor. + explicit CodedInputStream(const uint8* buffer, int size); + + // Destroy the CodedInputStream and position the underlying + // ZeroCopyInputStream at the first unread byte. If an error occurred while + // reading (causing a method to return false), then the exact position of + // the input stream may be anywhere between the last value that was read + // successfully and the stream's byte limit. + ~CodedInputStream(); + + + // Skips a number of bytes. Returns false if an underlying read error + // occurs. + bool Skip(int count); + + // Sets *data to point directly at the unread part of the CodedInputStream's + // underlying buffer, and *size to the size of that buffer, but does not + // advance the stream's current position. This will always either produce + // a non-empty buffer or return false. If the caller consumes any of + // this data, it should then call Skip() to skip over the consumed bytes. + // This may be useful for implementing external fast parsing routines for + // types of data not covered by the CodedInputStream interface. + bool GetDirectBufferPointer(const void** data, int* size); + + // Like GetDirectBufferPointer, but this method is inlined, and does not + // attempt to Refresh() if the buffer is currently empty. + inline void GetDirectBufferPointerInline(const void** data, + int* size) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + // Read raw bytes, copying them into the given buffer. + bool ReadRaw(void* buffer, int size); + + // Like ReadRaw, but reads into a string. + // + // Implementation Note: ReadString() grows the string gradually as it + // reads in the data, rather than allocating the entire requested size + // upfront. This prevents denial-of-service attacks in which a client + // could claim that a string is going to be MAX_INT bytes long in order to + // crash the server because it can't allocate this much space at once. + bool ReadString(string* buffer, int size); + // Like the above, with inlined optimizations. This should only be used + // by the protobuf implementation. + inline bool InternalReadStringInline(string* buffer, + int size) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + + // Read a 32-bit little-endian integer. + bool ReadLittleEndian32(uint32* value); + // Read a 64-bit little-endian integer. + bool ReadLittleEndian64(uint64* value); + + // These methods read from an externally provided buffer. The caller is + // responsible for ensuring that the buffer has sufficient space. + // Read a 32-bit little-endian integer. + static const uint8* ReadLittleEndian32FromArray(const uint8* buffer, + uint32* value); + // Read a 64-bit little-endian integer. + static const uint8* ReadLittleEndian64FromArray(const uint8* buffer, + uint64* value); + + // Read an unsigned integer with Varint encoding, truncating to 32 bits. + // Reading a 32-bit value is equivalent to reading a 64-bit one and casting + // it to uint32, but may be more efficient. + bool ReadVarint32(uint32* value); + // Read an unsigned integer with Varint encoding. + bool ReadVarint64(uint64* value); + + // Read a tag. This calls ReadVarint32() and returns the result, or returns + // zero (which is not a valid tag) if ReadVarint32() fails. Also, it updates + // the last tag value, which can be checked with LastTagWas(). + // Always inline because this is only called in once place per parse loop + // but it is called for every iteration of said loop, so it should be fast. + // GCC doesn't want to inline this by default. + uint32 ReadTag() GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + // Usually returns true if calling ReadVarint32() now would produce the given + // value. Will always return false if ReadVarint32() would not return the + // given value. If ExpectTag() returns true, it also advances past + // the varint. For best performance, use a compile-time constant as the + // parameter. + // Always inline because this collapses to a small number of instructions + // when given a constant parameter, but GCC doesn't want to inline by default. + bool ExpectTag(uint32 expected) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + // Like above, except this reads from the specified buffer. The caller is + // responsible for ensuring that the buffer is large enough to read a varint + // of the expected size. For best performance, use a compile-time constant as + // the expected tag parameter. + // + // Returns a pointer beyond the expected tag if it was found, or NULL if it + // was not. + static const uint8* ExpectTagFromArray( + const uint8* buffer, + uint32 expected) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + // Usually returns true if no more bytes can be read. Always returns false + // if more bytes can be read. If ExpectAtEnd() returns true, a subsequent + // call to LastTagWas() will act as if ReadTag() had been called and returned + // zero, and ConsumedEntireMessage() will return true. + bool ExpectAtEnd(); + + // If the last call to ReadTag() returned the given value, returns true. + // Otherwise, returns false; + // + // This is needed because parsers for some types of embedded messages + // (with field type TYPE_GROUP) don't actually know that they've reached the + // end of a message until they see an ENDGROUP tag, which was actually part + // of the enclosing message. The enclosing message would like to check that + // tag to make sure it had the right number, so it calls LastTagWas() on + // return from the embedded parser to check. + bool LastTagWas(uint32 expected); + + // When parsing message (but NOT a group), this method must be called + // immediately after MergeFromCodedStream() returns (if it returns true) + // to further verify that the message ended in a legitimate way. For + // example, this verifies that parsing did not end on an end-group tag. + // It also checks for some cases where, due to optimizations, + // MergeFromCodedStream() can incorrectly return true. + bool ConsumedEntireMessage(); + + // Limits ---------------------------------------------------------- + // Limits are used when parsing length-delimited embedded messages. + // After the message's length is read, PushLimit() is used to prevent + // the CodedInputStream from reading beyond that length. Once the + // embedded message has been parsed, PopLimit() is called to undo the + // limit. + + // Opaque type used with PushLimit() and PopLimit(). Do not modify + // values of this type yourself. The only reason that this isn't a + // struct with private internals is for efficiency. + typedef int Limit; + + // Places a limit on the number of bytes that the stream may read, + // starting from the current position. Once the stream hits this limit, + // it will act like the end of the input has been reached until PopLimit() + // is called. + // + // As the names imply, the stream conceptually has a stack of limits. The + // shortest limit on the stack is always enforced, even if it is not the + // top limit. + // + // The value returned by PushLimit() is opaque to the caller, and must + // be passed unchanged to the corresponding call to PopLimit(). + Limit PushLimit(int byte_limit); + + // Pops the last limit pushed by PushLimit(). The input must be the value + // returned by that call to PushLimit(). + void PopLimit(Limit limit); + + // Returns the number of bytes left until the nearest limit on the + // stack is hit, or -1 if no limits are in place. + int BytesUntilLimit(); + + // Total Bytes Limit ----------------------------------------------- + // To prevent malicious users from sending excessively large messages + // and causing integer overflows or memory exhaustion, CodedInputStream + // imposes a hard limit on the total number of bytes it will read. + + // Sets the maximum number of bytes that this CodedInputStream will read + // before refusing to continue. To prevent integer overflows in the + // protocol buffers implementation, as well as to prevent servers from + // allocating enormous amounts of memory to hold parsed messages, the + // maximum message length should be limited to the shortest length that + // will not harm usability. The theoretical shortest message that could + // cause integer overflows is 512MB. The default limit is 64MB. Apps + // should set shorter limits if possible. If warning_threshold is not -1, + // a warning will be printed to stderr after warning_threshold bytes are + // read. An error will always be printed to stderr if the limit is + // reached. + // + // This is unrelated to PushLimit()/PopLimit(). + // + // Hint: If you are reading this because your program is printing a + // warning about dangerously large protocol messages, you may be + // confused about what to do next. The best option is to change your + // design such that excessively large messages are not necessary. + // For example, try to design file formats to consist of many small + // messages rather than a single large one. If this is infeasible, + // you will need to increase the limit. Chances are, though, that + // your code never constructs a CodedInputStream on which the limit + // can be set. You probably parse messages by calling things like + // Message::ParseFromString(). In this case, you will need to change + // your code to instead construct some sort of ZeroCopyInputStream + // (e.g. an ArrayInputStream), construct a CodedInputStream around + // that, then call Message::ParseFromCodedStream() instead. Then + // you can adjust the limit. Yes, it's more work, but you're doing + // something unusual. + void SetTotalBytesLimit(int total_bytes_limit, int warning_threshold); + + // Recursion Limit ------------------------------------------------- + // To prevent corrupt or malicious messages from causing stack overflows, + // we must keep track of the depth of recursion when parsing embedded + // messages and groups. CodedInputStream keeps track of this because it + // is the only object that is passed down the stack during parsing. + + // Sets the maximum recursion depth. The default is 64. + void SetRecursionLimit(int limit); + + // Increments the current recursion depth. Returns true if the depth is + // under the limit, false if it has gone over. + bool IncrementRecursionDepth(); + + // Decrements the recursion depth. + void DecrementRecursionDepth(); + + // Extension Registry ---------------------------------------------- + // ADVANCED USAGE: 99.9% of people can ignore this section. + // + // By default, when parsing extensions, the parser looks for extension + // definitions in the pool which owns the outer message's Descriptor. + // However, you may call SetExtensionRegistry() to provide an alternative + // pool instead. This makes it possible, for example, to parse a message + // using a generated class, but represent some extensions using + // DynamicMessage. + + // Set the pool used to look up extensions. Most users do not need to call + // this as the correct pool will be chosen automatically. + // + // WARNING: It is very easy to misuse this. Carefully read the requirements + // below. Do not use this unless you are sure you need it. Almost no one + // does. + // + // Let's say you are parsing a message into message object m, and you want + // to take advantage of SetExtensionRegistry(). You must follow these + // requirements: + // + // The given DescriptorPool must contain m->GetDescriptor(). It is not + // sufficient for it to simply contain a descriptor that has the same name + // and content -- it must be the *exact object*. In other words: + // assert(pool->FindMessageTypeByName(m->GetDescriptor()->full_name()) == + // m->GetDescriptor()); + // There are two ways to satisfy this requirement: + // 1) Use m->GetDescriptor()->pool() as the pool. This is generally useless + // because this is the pool that would be used anyway if you didn't call + // SetExtensionRegistry() at all. + // 2) Use a DescriptorPool which has m->GetDescriptor()->pool() as an + // "underlay". Read the documentation for DescriptorPool for more + // information about underlays. + // + // You must also provide a MessageFactory. This factory will be used to + // construct Message objects representing extensions. The factory's + // GetPrototype() MUST return non-NULL for any Descriptor which can be found + // through the provided pool. + // + // If the provided factory might return instances of protocol-compiler- + // generated (i.e. compiled-in) types, or if the outer message object m is + // a generated type, then the given factory MUST have this property: If + // GetPrototype() is given a Descriptor which resides in + // DescriptorPool::generated_pool(), the factory MUST return the same + // prototype which MessageFactory::generated_factory() would return. That + // is, given a descriptor for a generated type, the factory must return an + // instance of the generated class (NOT DynamicMessage). However, when + // given a descriptor for a type that is NOT in generated_pool, the factory + // is free to return any implementation. + // + // The reason for this requirement is that generated sub-objects may be + // accessed via the standard (non-reflection) extension accessor methods, + // and these methods will down-cast the object to the generated class type. + // If the object is not actually of that type, the results would be undefined. + // On the other hand, if an extension is not compiled in, then there is no + // way the code could end up accessing it via the standard accessors -- the + // only way to access the extension is via reflection. When using reflection, + // DynamicMessage and generated messages are indistinguishable, so it's fine + // if these objects are represented using DynamicMessage. + // + // Using DynamicMessageFactory on which you have called + // SetDelegateToGeneratedFactory(true) should be sufficient to satisfy the + // above requirement. + // + // If either pool or factory is NULL, both must be NULL. + // + // Note that this feature is ignored when parsing "lite" messages as they do + // not have descriptors. + void SetExtensionRegistry(DescriptorPool* pool, MessageFactory* factory); + + // Get the DescriptorPool set via SetExtensionRegistry(), or NULL if no pool + // has been provided. + const DescriptorPool* GetExtensionPool(); + + // Get the MessageFactory set via SetExtensionRegistry(), or NULL if no + // factory has been provided. + MessageFactory* GetExtensionFactory(); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedInputStream); + + ZeroCopyInputStream* input_; + const uint8* buffer_; + const uint8* buffer_end_; // pointer to the end of the buffer. + int total_bytes_read_; // total bytes read from input_, including + // the current buffer + + // If total_bytes_read_ surpasses INT_MAX, we record the extra bytes here + // so that we can BackUp() on destruction. + int overflow_bytes_; + + // LastTagWas() stuff. + uint32 last_tag_; // result of last ReadTag(). + + // This is set true by ReadTag{Fallback/Slow}() if it is called when exactly + // at EOF, or by ExpectAtEnd() when it returns true. This happens when we + // reach the end of a message and attempt to read another tag. + bool legitimate_message_end_; + + // See EnableAliasing(). + bool aliasing_enabled_; + + // Limits + Limit current_limit_; // if position = -1, no limit is applied + + // For simplicity, if the current buffer crosses a limit (either a normal + // limit created by PushLimit() or the total bytes limit), buffer_size_ + // only tracks the number of bytes before that limit. This field + // contains the number of bytes after it. Note that this implies that if + // buffer_size_ == 0 and buffer_size_after_limit_ > 0, we know we've + // hit a limit. However, if both are zero, it doesn't necessarily mean + // we aren't at a limit -- the buffer may have ended exactly at the limit. + int buffer_size_after_limit_; + + // Maximum number of bytes to read, period. This is unrelated to + // current_limit_. Set using SetTotalBytesLimit(). + int total_bytes_limit_; + int total_bytes_warning_threshold_; + + // Current recursion depth, controlled by IncrementRecursionDepth() and + // DecrementRecursionDepth(). + int recursion_depth_; + // Recursion depth limit, set by SetRecursionLimit(). + int recursion_limit_; + + // See SetExtensionRegistry(). + const DescriptorPool* extension_pool_; + MessageFactory* extension_factory_; + + // Private member functions. + + // Advance the buffer by a given number of bytes. + void Advance(int amount); + + // Back up input_ to the current buffer position. + void BackUpInputToCurrentPosition(); + + // Recomputes the value of buffer_size_after_limit_. Must be called after + // current_limit_ or total_bytes_limit_ changes. + void RecomputeBufferLimits(); + + // Writes an error message saying that we hit total_bytes_limit_. + void PrintTotalBytesLimitError(); + + // Called when the buffer runs out to request more data. Implies an + // Advance(BufferSize()). + bool Refresh(); + + // When parsing varints, we optimize for the common case of small values, and + // then optimize for the case when the varint fits within the current buffer + // piece. The Fallback method is used when we can't use the one-byte + // optimization. The Slow method is yet another fallback when the buffer is + // not large enough. Making the slow path out-of-line speeds up the common + // case by 10-15%. The slow path is fairly uncommon: it only triggers when a + // message crosses multiple buffers. + bool ReadVarint32Fallback(uint32* value); + bool ReadVarint64Fallback(uint64* value); + bool ReadVarint32Slow(uint32* value); + bool ReadVarint64Slow(uint64* value); + bool ReadLittleEndian32Fallback(uint32* value); + bool ReadLittleEndian64Fallback(uint64* value); + // Fallback/slow methods for reading tags. These do not update last_tag_, + // but will set legitimate_message_end_ if we are at the end of the input + // stream. + uint32 ReadTagFallback(); + uint32 ReadTagSlow(); + bool ReadStringFallback(string* buffer, int size); + + // Return the size of the buffer. + int BufferSize() const; + + static const int kDefaultTotalBytesLimit = 64 << 20; // 64MB + + static const int kDefaultTotalBytesWarningThreshold = 32 << 20; // 32MB + static const int kDefaultRecursionLimit = 64; +}; + +// Class which encodes and writes binary data which is composed of varint- +// encoded integers and fixed-width pieces. Wraps a ZeroCopyOutputStream. +// Most users will not need to deal with CodedOutputStream. +// +// Most methods of CodedOutputStream which return a bool return false if an +// underlying I/O error occurs. Once such a failure occurs, the +// CodedOutputStream is broken and is no longer useful. The Write* methods do +// not return the stream status, but will invalidate the stream if an error +// occurs. The client can probe HadError() to determine the status. +// +// Note that every method of CodedOutputStream which writes some data has +// a corresponding static "ToArray" version. These versions write directly +// to the provided buffer, returning a pointer past the last written byte. +// They require that the buffer has sufficient capacity for the encoded data. +// This allows an optimization where we check if an output stream has enough +// space for an entire message before we start writing and, if there is, we +// call only the ToArray methods to avoid doing bound checks for each +// individual value. +// i.e., in the example above: +// +// CodedOutputStream coded_output = new CodedOutputStream(raw_output); +// int magic_number = 1234; +// char text[] = "Hello world!"; +// +// int coded_size = sizeof(magic_number) + +// CodedOutputStream::VarintSize32(strlen(text)) + +// strlen(text); +// +// uint8* buffer = +// coded_output->GetDirectBufferForNBytesAndAdvance(coded_size); +// if (buffer != NULL) { +// // The output stream has enough space in the buffer: write directly to +// // the array. +// buffer = CodedOutputStream::WriteLittleEndian32ToArray(magic_number, +// buffer); +// buffer = CodedOutputStream::WriteVarint32ToArray(strlen(text), buffer); +// buffer = CodedOutputStream::WriteRawToArray(text, strlen(text), buffer); +// } else { +// // Make bound-checked writes, which will ask the underlying stream for +// // more space as needed. +// coded_output->WriteLittleEndian32(magic_number); +// coded_output->WriteVarint32(strlen(text)); +// coded_output->WriteRaw(text, strlen(text)); +// } +// +// delete coded_output; +class LIBPROTOBUF_EXPORT CodedOutputStream { + public: + // Create an CodedOutputStream that writes to the given ZeroCopyOutputStream. + explicit CodedOutputStream(ZeroCopyOutputStream* output); + + // Destroy the CodedOutputStream and position the underlying + // ZeroCopyOutputStream immediately after the last byte written. + ~CodedOutputStream(); + + // Skips a number of bytes, leaving the bytes unmodified in the underlying + // buffer. Returns false if an underlying write error occurs. This is + // mainly useful with GetDirectBufferPointer(). + bool Skip(int count); + + // Sets *data to point directly at the unwritten part of the + // CodedOutputStream's underlying buffer, and *size to the size of that + // buffer, but does not advance the stream's current position. This will + // always either produce a non-empty buffer or return false. If the caller + // writes any data to this buffer, it should then call Skip() to skip over + // the consumed bytes. This may be useful for implementing external fast + // serialization routines for types of data not covered by the + // CodedOutputStream interface. + bool GetDirectBufferPointer(void** data, int* size); + + // If there are at least "size" bytes available in the current buffer, + // returns a pointer directly into the buffer and advances over these bytes. + // The caller may then write directly into this buffer (e.g. using the + // *ToArray static methods) rather than go through CodedOutputStream. If + // there are not enough bytes available, returns NULL. The return pointer is + // invalidated as soon as any other non-const method of CodedOutputStream + // is called. + inline uint8* GetDirectBufferForNBytesAndAdvance(int size); + + // Write raw bytes, copying them from the given buffer. + void WriteRaw(const void* buffer, int size); + // Like WriteRaw() but writing directly to the target array. + // This is _not_ inlined, as the compiler often optimizes memcpy into inline + // copy loops. Since this gets called by every field with string or bytes + // type, inlining may lead to a significant amount of code bloat, with only a + // minor performance gain. + static uint8* WriteRawToArray(const void* buffer, int size, uint8* target); + + // Equivalent to WriteRaw(str.data(), str.size()). + void WriteString(const string& str); + // Like WriteString() but writing directly to the target array. + static uint8* WriteStringToArray(const string& str, uint8* target); + + + // Write a 32-bit little-endian integer. + void WriteLittleEndian32(uint32 value); + // Like WriteLittleEndian32() but writing directly to the target array. + static uint8* WriteLittleEndian32ToArray(uint32 value, uint8* target); + // Write a 64-bit little-endian integer. + void WriteLittleEndian64(uint64 value); + // Like WriteLittleEndian64() but writing directly to the target array. + static uint8* WriteLittleEndian64ToArray(uint64 value, uint8* target); + + // Write an unsigned integer with Varint encoding. Writing a 32-bit value + // is equivalent to casting it to uint64 and writing it as a 64-bit value, + // but may be more efficient. + void WriteVarint32(uint32 value); + // Like WriteVarint32() but writing directly to the target array. + static uint8* WriteVarint32ToArray(uint32 value, uint8* target); + // Write an unsigned integer with Varint encoding. + void WriteVarint64(uint64 value); + // Like WriteVarint64() but writing directly to the target array. + static uint8* WriteVarint64ToArray(uint64 value, uint8* target); + + // Equivalent to WriteVarint32() except when the value is negative, + // in which case it must be sign-extended to a full 10 bytes. + void WriteVarint32SignExtended(int32 value); + // Like WriteVarint32SignExtended() but writing directly to the target array. + static uint8* WriteVarint32SignExtendedToArray(int32 value, uint8* target); + + // This is identical to WriteVarint32(), but optimized for writing tags. + // In particular, if the input is a compile-time constant, this method + // compiles down to a couple instructions. + // Always inline because otherwise the aformentioned optimization can't work, + // but GCC by default doesn't want to inline this. + void WriteTag(uint32 value); + // Like WriteTag() but writing directly to the target array. + static uint8* WriteTagToArray( + uint32 value, uint8* target) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + // Returns the number of bytes needed to encode the given value as a varint. + static int VarintSize32(uint32 value); + // Returns the number of bytes needed to encode the given value as a varint. + static int VarintSize64(uint64 value); + + // If negative, 10 bytes. Otheriwse, same as VarintSize32(). + static int VarintSize32SignExtended(int32 value); + + // Returns the total number of bytes written since this object was created. + inline int ByteCount() const; + + // Returns true if there was an underlying I/O error since this object was + // created. + bool HadError() const { return had_error_; } + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedOutputStream); + + ZeroCopyOutputStream* output_; + uint8* buffer_; + int buffer_size_; + int total_bytes_; // Sum of sizes of all buffers seen so far. + bool had_error_; // Whether an error occurred during output. + + // Advance the buffer by a given number of bytes. + void Advance(int amount); + + // Called when the buffer runs out to request more data. Implies an + // Advance(buffer_size_). + bool Refresh(); + + static uint8* WriteVarint32FallbackToArray(uint32 value, uint8* target); + + // Always-inlined versions of WriteVarint* functions so that code can be + // reused, while still controlling size. For instance, WriteVarint32ToArray() + // should not directly call this: since it is inlined itself, doing so + // would greatly increase the size of generated code. Instead, it should call + // WriteVarint32FallbackToArray. Meanwhile, WriteVarint32() is already + // out-of-line, so it should just invoke this directly to avoid any extra + // function call overhead. + static uint8* WriteVarint32FallbackToArrayInline( + uint32 value, uint8* target) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + static uint8* WriteVarint64ToArrayInline( + uint64 value, uint8* target) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + static int VarintSize32Fallback(uint32 value); +}; + +// inline methods ==================================================== +// The vast majority of varints are only one byte. These inline +// methods optimize for that case. + +inline bool CodedInputStream::ReadVarint32(uint32* value) { + if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { + *value = *buffer_; + Advance(1); + return true; + } else { + return ReadVarint32Fallback(value); + } +} + +inline bool CodedInputStream::ReadVarint64(uint64* value) { + if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { + *value = *buffer_; + Advance(1); + return true; + } else { + return ReadVarint64Fallback(value); + } +} + +// static +inline const uint8* CodedInputStream::ReadLittleEndian32FromArray( + const uint8* buffer, + uint32* value) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + memcpy(value, buffer, sizeof(*value)); + return buffer + sizeof(*value); +#else + *value = (static_cast(buffer[0]) ) | + (static_cast(buffer[1]) << 8) | + (static_cast(buffer[2]) << 16) | + (static_cast(buffer[3]) << 24); + return buffer + sizeof(*value); +#endif +} +// static +inline const uint8* CodedInputStream::ReadLittleEndian64FromArray( + const uint8* buffer, + uint64* value) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + memcpy(value, buffer, sizeof(*value)); + return buffer + sizeof(*value); +#else + uint32 part0 = (static_cast(buffer[0]) ) | + (static_cast(buffer[1]) << 8) | + (static_cast(buffer[2]) << 16) | + (static_cast(buffer[3]) << 24); + uint32 part1 = (static_cast(buffer[4]) ) | + (static_cast(buffer[5]) << 8) | + (static_cast(buffer[6]) << 16) | + (static_cast(buffer[7]) << 24); + *value = static_cast(part0) | + (static_cast(part1) << 32); + return buffer + sizeof(*value); +#endif +} + +inline bool CodedInputStream::ReadLittleEndian32(uint32* value) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + if (GOOGLE_PREDICT_TRUE(BufferSize() >= static_cast(sizeof(*value)))) { + memcpy(value, buffer_, sizeof(*value)); + Advance(sizeof(*value)); + return true; + } else { + return ReadLittleEndian32Fallback(value); + } +#else + return ReadLittleEndian32Fallback(value); +#endif +} + +inline bool CodedInputStream::ReadLittleEndian64(uint64* value) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + if (GOOGLE_PREDICT_TRUE(BufferSize() >= static_cast(sizeof(*value)))) { + memcpy(value, buffer_, sizeof(*value)); + Advance(sizeof(*value)); + return true; + } else { + return ReadLittleEndian64Fallback(value); + } +#else + return ReadLittleEndian64Fallback(value); +#endif +} + +inline uint32 CodedInputStream::ReadTag() { + if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_) && buffer_[0] < 0x80) { + last_tag_ = buffer_[0]; + Advance(1); + return last_tag_; + } else { + last_tag_ = ReadTagFallback(); + return last_tag_; + } +} + +inline bool CodedInputStream::LastTagWas(uint32 expected) { + return last_tag_ == expected; +} + +inline bool CodedInputStream::ConsumedEntireMessage() { + return legitimate_message_end_; +} + +inline bool CodedInputStream::ExpectTag(uint32 expected) { + if (expected < (1 << 7)) { + if (GOOGLE_PREDICT_TRUE(buffer_ < buffer_end_) && buffer_[0] == expected) { + Advance(1); + return true; + } else { + return false; + } + } else if (expected < (1 << 14)) { + if (GOOGLE_PREDICT_TRUE(BufferSize() >= 2) && + buffer_[0] == static_cast(expected | 0x80) && + buffer_[1] == static_cast(expected >> 7)) { + Advance(2); + return true; + } else { + return false; + } + } else { + // Don't bother optimizing for larger values. + return false; + } +} + +inline const uint8* CodedInputStream::ExpectTagFromArray( + const uint8* buffer, uint32 expected) { + if (expected < (1 << 7)) { + if (buffer[0] == expected) { + return buffer + 1; + } + } else if (expected < (1 << 14)) { + if (buffer[0] == static_cast(expected | 0x80) && + buffer[1] == static_cast(expected >> 7)) { + return buffer + 2; + } + } + return NULL; +} + +inline void CodedInputStream::GetDirectBufferPointerInline(const void** data, + int* size) { + *data = buffer_; + *size = buffer_end_ - buffer_; +} + +inline bool CodedInputStream::ExpectAtEnd() { + // If we are at a limit we know no more bytes can be read. Otherwise, it's + // hard to say without calling Refresh(), and we'd rather not do that. + + if (buffer_ == buffer_end_ && buffer_size_after_limit_ != 0) { + last_tag_ = 0; // Pretend we called ReadTag()... + legitimate_message_end_ = true; // ... and it hit EOF. + return true; + } else { + return false; + } +} + +inline uint8* CodedOutputStream::GetDirectBufferForNBytesAndAdvance(int size) { + if (buffer_size_ < size) { + return NULL; + } else { + uint8* result = buffer_; + Advance(size); + return result; + } +} + +inline uint8* CodedOutputStream::WriteVarint32ToArray(uint32 value, + uint8* target) { + if (value < 0x80) { + *target = value; + return target + 1; + } else { + return WriteVarint32FallbackToArray(value, target); + } +} + +inline void CodedOutputStream::WriteVarint32SignExtended(int32 value) { + if (value < 0) { + WriteVarint64(static_cast(value)); + } else { + WriteVarint32(static_cast(value)); + } +} + +inline uint8* CodedOutputStream::WriteVarint32SignExtendedToArray( + int32 value, uint8* target) { + if (value < 0) { + return WriteVarint64ToArray(static_cast(value), target); + } else { + return WriteVarint32ToArray(static_cast(value), target); + } +} + +inline uint8* CodedOutputStream::WriteLittleEndian32ToArray(uint32 value, + uint8* target) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + memcpy(target, &value, sizeof(value)); +#else + target[0] = static_cast(value); + target[1] = static_cast(value >> 8); + target[2] = static_cast(value >> 16); + target[3] = static_cast(value >> 24); +#endif + return target + sizeof(value); +} + +inline uint8* CodedOutputStream::WriteLittleEndian64ToArray(uint64 value, + uint8* target) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + memcpy(target, &value, sizeof(value)); +#else + uint32 part0 = static_cast(value); + uint32 part1 = static_cast(value >> 32); + + target[0] = static_cast(part0); + target[1] = static_cast(part0 >> 8); + target[2] = static_cast(part0 >> 16); + target[3] = static_cast(part0 >> 24); + target[4] = static_cast(part1); + target[5] = static_cast(part1 >> 8); + target[6] = static_cast(part1 >> 16); + target[7] = static_cast(part1 >> 24); +#endif + return target + sizeof(value); +} + +inline void CodedOutputStream::WriteTag(uint32 value) { + WriteVarint32(value); +} + +inline uint8* CodedOutputStream::WriteTagToArray( + uint32 value, uint8* target) { + if (value < (1 << 7)) { + target[0] = value; + return target + 1; + } else if (value < (1 << 14)) { + target[0] = static_cast(value | 0x80); + target[1] = static_cast(value >> 7); + return target + 2; + } else { + return WriteVarint32FallbackToArray(value, target); + } +} + +inline int CodedOutputStream::VarintSize32(uint32 value) { + if (value < (1 << 7)) { + return 1; + } else { + return VarintSize32Fallback(value); + } +} + +inline int CodedOutputStream::VarintSize32SignExtended(int32 value) { + if (value < 0) { + return 10; // TODO(kenton): Make this a symbolic constant. + } else { + return VarintSize32(static_cast(value)); + } +} + +inline void CodedOutputStream::WriteString(const string& str) { + WriteRaw(str.data(), static_cast(str.size())); +} + +inline uint8* CodedOutputStream::WriteStringToArray( + const string& str, uint8* target) { + return WriteRawToArray(str.data(), static_cast(str.size()), target); +} + +inline int CodedOutputStream::ByteCount() const { + return total_bytes_ - buffer_size_; +} + +inline void CodedInputStream::Advance(int amount) { + buffer_ += amount; +} + +inline void CodedOutputStream::Advance(int amount) { + buffer_ += amount; + buffer_size_ -= amount; +} + +inline void CodedInputStream::SetRecursionLimit(int limit) { + recursion_limit_ = limit; +} + +inline bool CodedInputStream::IncrementRecursionDepth() { + ++recursion_depth_; + return recursion_depth_ <= recursion_limit_; +} + +inline void CodedInputStream::DecrementRecursionDepth() { + if (recursion_depth_ > 0) --recursion_depth_; +} + +inline void CodedInputStream::SetExtensionRegistry(DescriptorPool* pool, + MessageFactory* factory) { + extension_pool_ = pool; + extension_factory_ = factory; +} + +inline const DescriptorPool* CodedInputStream::GetExtensionPool() { + return extension_pool_; +} + +inline MessageFactory* CodedInputStream::GetExtensionFactory() { + return extension_factory_; +} + +inline int CodedInputStream::BufferSize() const { + return buffer_end_ - buffer_; +} + +inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input) + : input_(input), + buffer_(NULL), + buffer_end_(NULL), + total_bytes_read_(0), + overflow_bytes_(0), + last_tag_(0), + legitimate_message_end_(false), + aliasing_enabled_(false), + current_limit_(kint32max), + buffer_size_after_limit_(0), + total_bytes_limit_(kDefaultTotalBytesLimit), + total_bytes_warning_threshold_(kDefaultTotalBytesWarningThreshold), + recursion_depth_(0), + recursion_limit_(kDefaultRecursionLimit), + extension_pool_(NULL), + extension_factory_(NULL) { + // Eagerly Refresh() so buffer space is immediately available. + Refresh(); +} + +inline CodedInputStream::CodedInputStream(const uint8* buffer, int size) + : input_(NULL), + buffer_(buffer), + buffer_end_(buffer + size), + total_bytes_read_(size), + overflow_bytes_(0), + last_tag_(0), + legitimate_message_end_(false), + aliasing_enabled_(false), + current_limit_(size), + buffer_size_after_limit_(0), + total_bytes_limit_(kDefaultTotalBytesLimit), + total_bytes_warning_threshold_(kDefaultTotalBytesWarningThreshold), + recursion_depth_(0), + recursion_limit_(kDefaultRecursionLimit), + extension_pool_(NULL), + extension_factory_(NULL) { + // Note that setting current_limit_ == size is important to prevent some + // code paths from trying to access input_ and segfaulting. +} + +inline CodedInputStream::~CodedInputStream() { + if (input_ != NULL) { + BackUpInputToCurrentPosition(); + } +} + +} // namespace io +} // namespace protobuf + + +#if defined(_MSC_VER) && _MSC_VER >= 1300 + #pragma runtime_checks("c", restore) +#endif // _MSC_VER + +} // namespace google +#endif // GOOGLE_PROTOBUF_IO_CODED_STREAM_H__ diff --git a/depends/protobuf/src/google/protobuf/io/strtod.h b/depends/protobuf/google/protobuf/io/coded_stream_inl.h similarity index 65% rename from depends/protobuf/src/google/protobuf/io/strtod.h rename to depends/protobuf/google/protobuf/io/coded_stream_inl.h index 38f544af3..e9799d477 100644 --- a/depends/protobuf/src/google/protobuf/io/strtod.h +++ b/depends/protobuf/google/protobuf/io/coded_stream_inl.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -28,28 +28,37 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// A locale-independent version of strtod(), used to parse floating -// point default values in .proto files, where the decimal separator -// is always a dot. +// Author: jasonh@google.com (Jason Hsueh) +// +// Implements methods of coded_stream.h that need to be inlined for performance +// reasons, but should not be defined in a public header. + +#ifndef GOOGLE_PROTOBUF_IO_CODED_STREAM_INL_H__ +#define GOOGLE_PROTOBUF_IO_CODED_STREAM_INL_H__ -#ifndef GOOGLE_PROTOBUF_IO_STRTOD_H__ -#define GOOGLE_PROTOBUF_IO_STRTOD_H__ +#include +#include +#include namespace google { namespace protobuf { namespace io { -// A locale-independent version of the standard strtod(), which always -// uses a dot as the decimal separator. -double NoLocaleStrtod(const char* str, char** endptr); +inline bool CodedInputStream::InternalReadStringInline(string* buffer, + int size) { + if (size < 0) return false; // security: size is often user-supplied -// Casts a double value to a float value. If the value is outside of the -// representable range of float, it will be converted to positive or negative -// infinity. -float SafeDoubleToFloat(double value); + if (BufferSize() >= size) { + STLStringResizeUninitialized(buffer, size); + memcpy(string_as_array(buffer), buffer_, size); + Advance(size); + return true; + } + + return ReadStringFallback(buffer, size); +} } // namespace io } // namespace protobuf } // namespace google - -#endif // GOOGLE_PROTOBUF_IO_STRTOD_H__ +#endif // GOOGLE_PROTOBUF_IO_CODED_STREAM_INL_H__ diff --git a/depends/protobuf/src/google/protobuf/io/gzip_stream.cc b/depends/protobuf/google/protobuf/io/gzip_stream.cc similarity index 80% rename from depends/protobuf/src/google/protobuf/io/gzip_stream.cc rename to depends/protobuf/google/protobuf/io/gzip_stream.cc index a5284b3e1..0f1ff872a 100644 --- a/depends/protobuf/src/google/protobuf/io/gzip_stream.cc +++ b/depends/protobuf/google/protobuf/io/gzip_stream.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,13 +33,12 @@ // This file contains the implementation of classes GzipInputStream and // GzipOutputStream. +#include "config.h" #if HAVE_ZLIB #include -#include #include -#include namespace google { namespace protobuf { @@ -47,10 +46,9 @@ namespace io { static const int kDefaultBufferSize = 65536; -GzipInputStream::GzipInputStream(ZeroCopyInputStream* sub_stream, Format format, - int buffer_size) - : format_(format), sub_stream_(sub_stream), zerror_(Z_OK), byte_count_(0) { - zcontext_.state = Z_NULL; +GzipInputStream::GzipInputStream( + ZeroCopyInputStream* sub_stream, Format format, int buffer_size) + : format_(format), sub_stream_(sub_stream), zerror_(Z_OK) { zcontext_.zalloc = Z_NULL; zcontext_.zfree = Z_NULL; zcontext_.opaque = Z_NULL; @@ -71,25 +69,19 @@ GzipInputStream::GzipInputStream(ZeroCopyInputStream* sub_stream, Format format, output_position_ = output_buffer_; } GzipInputStream::~GzipInputStream() { - internal::SizedDelete(output_buffer_, output_buffer_length_); + operator delete(output_buffer_); zerror_ = inflateEnd(&zcontext_); } -static inline int internalInflateInit2(z_stream* zcontext, - GzipInputStream::Format format) { +static inline int internalInflateInit2( + z_stream* zcontext, GzipInputStream::Format format) { int windowBitsFormat = 0; switch (format) { - case GzipInputStream::GZIP: - windowBitsFormat = 16; - break; - case GzipInputStream::AUTO: - windowBitsFormat = 32; - break; - case GzipInputStream::ZLIB: - windowBitsFormat = 0; - break; + case GzipInputStream::GZIP: windowBitsFormat = 16; break; + case GzipInputStream::AUTO: windowBitsFormat = 32; break; + case GzipInputStream::ZLIB: windowBitsFormat = 0; break; } - return inflateInit2(zcontext, /* windowBits */ 15 | windowBitsFormat); + return inflateInit2(zcontext, /* windowBits */15 | windowBitsFormat); } int GzipInputStream::Inflate(int flush) { @@ -129,8 +121,8 @@ void GzipInputStream::DoNextOutput(const void** data, int* size) { // implements ZeroCopyInputStream ---------------------------------- bool GzipInputStream::Next(const void** data, int* size) { - bool ok = (zerror_ == Z_OK) || (zerror_ == Z_STREAM_END) || - (zerror_ == Z_BUF_ERROR); + bool ok = (zerror_ == Z_OK) || (zerror_ == Z_STREAM_END) + || (zerror_ == Z_BUF_ERROR); if ((!ok) || (zcontext_.next_out == NULL)) { return false; } @@ -142,7 +134,6 @@ bool GzipInputStream::Next(const void** data, int* size) { if (zcontext_.next_out != NULL) { // sub_stream_ may have concatenated streams to follow zerror_ = inflateEnd(&zcontext_); - byte_count_ += zcontext_.total_out; if (zerror_ != Z_OK) { return false; } @@ -161,8 +152,8 @@ bool GzipInputStream::Next(const void** data, int* size) { // The underlying stream's Next returned false inside Inflate. return false; } - ok = (zerror_ == Z_OK) || (zerror_ == Z_STREAM_END) || - (zerror_ == Z_BUF_ERROR); + ok = (zerror_ == Z_OK) || (zerror_ == Z_STREAM_END) + || (zerror_ == Z_BUF_ERROR); if (!ok) { return false; } @@ -175,7 +166,7 @@ void GzipInputStream::BackUp(int count) { } bool GzipInputStream::Skip(int count) { const void* data; - int size = 0; + int size; bool ok = Next(&data, &size); while (ok && (size < count)) { count -= size; @@ -186,13 +177,9 @@ bool GzipInputStream::Skip(int count) { } return ok; } -int64_t GzipInputStream::ByteCount() const { - int64_t ret = byte_count_ + zcontext_.total_out; - if (zcontext_.next_out != NULL && output_position_ != NULL) { - ret += reinterpret_cast(zcontext_.next_out) - - reinterpret_cast(output_position_); - } - return ret; +int64 GzipInputStream::ByteCount() const { + return zcontext_.total_out + + (((uintptr_t)zcontext_.next_out) - ((uintptr_t)output_position_)); } // ========================================================================= @@ -212,6 +199,16 @@ GzipOutputStream::GzipOutputStream(ZeroCopyOutputStream* sub_stream, Init(sub_stream, options); } +GzipOutputStream::GzipOutputStream( + ZeroCopyOutputStream* sub_stream, Format format, int buffer_size) { + Options options; + options.format = format; + if (buffer_size != -1) { + options.buffer_size = buffer_size; + } + Init(sub_stream, options); +} + void GzipOutputStream::Init(ZeroCopyOutputStream* sub_stream, const Options& options) { sub_stream_ = sub_stream; @@ -237,15 +234,20 @@ void GzipOutputStream::Init(ZeroCopyOutputStream* sub_stream, if (options.format == ZLIB) { windowBitsFormat = 0; } - zerror_ = - deflateInit2(&zcontext_, options.compression_level, Z_DEFLATED, - /* windowBits */ 15 | windowBitsFormat, - /* memLevel (default) */ 8, options.compression_strategy); + zerror_ = deflateInit2( + &zcontext_, + options.compression_level, + Z_DEFLATED, + /* windowBits */15 | windowBitsFormat, + /* memLevel (default) */8, + options.compression_strategy); } GzipOutputStream::~GzipOutputStream() { Close(); - internal::SizedDelete(input_buffer_, input_buffer_length_); + if (input_buffer_ != NULL) { + operator delete(input_buffer_); + } } // private @@ -299,19 +301,18 @@ bool GzipOutputStream::Next(void** data, int* size) { return true; } void GzipOutputStream::BackUp(int count) { - GOOGLE_CHECK_GE(zcontext_.avail_in, static_cast(count)); + GOOGLE_CHECK_GE(zcontext_.avail_in, count); zcontext_.avail_in -= count; } -int64_t GzipOutputStream::ByteCount() const { +int64 GzipOutputStream::ByteCount() const { return zcontext_.total_in + zcontext_.avail_in; } bool GzipOutputStream::Flush() { - zerror_ = Deflate(Z_FULL_FLUSH); - // Return true if the flush succeeded or if it was a no-op. - return (zerror_ == Z_OK) || - (zerror_ == Z_BUF_ERROR && zcontext_.avail_in == 0 && - zcontext_.avail_out != 0); + do { + zerror_ = Deflate(Z_FULL_FLUSH); + } while (zerror_ == Z_OK); + return zerror_ == Z_OK; } bool GzipOutputStream::Close() { diff --git a/depends/protobuf/src/google/protobuf/io/gzip_stream.h b/depends/protobuf/google/protobuf/io/gzip_stream.h similarity index 77% rename from depends/protobuf/src/google/protobuf/io/gzip_stream.h rename to depends/protobuf/google/protobuf/io/gzip_stream.h index 4cf71b6c3..65dbc5b55 100644 --- a/depends/protobuf/src/google/protobuf/io/gzip_stream.h +++ b/depends/protobuf/google/protobuf/io/gzip_stream.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -43,22 +43,16 @@ #ifndef GOOGLE_PROTOBUF_IO_GZIP_STREAM_H__ #define GOOGLE_PROTOBUF_IO_GZIP_STREAM_H__ +#include -#include #include -#include -#include "zlib.h" - -// Must be included last. -#include namespace google { namespace protobuf { namespace io { // A ZeroCopyInputStream that reads compressed data through zlib -class PROTOBUF_EXPORT GzipInputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream { public: // Format key for constructor enum Format { @@ -73,19 +67,25 @@ class PROTOBUF_EXPORT GzipInputStream PROTOBUF_FUTURE_FINAL }; // buffer_size and format may be -1 for default of 64kB and GZIP format - explicit GzipInputStream(ZeroCopyInputStream* sub_stream, - Format format = AUTO, int buffer_size = -1); + explicit GzipInputStream( + ZeroCopyInputStream* sub_stream, + Format format = AUTO, + int buffer_size = -1); virtual ~GzipInputStream(); // Return last error message or NULL if no error. - inline const char* ZlibErrorMessage() const { return zcontext_.msg; } - inline int ZlibErrorCode() const { return zerror_; } + inline const char* ZlibErrorMessage() const { + return zcontext_.msg; + } + inline int ZlibErrorCode() const { + return zerror_; + } // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; private: Format format_; @@ -98,7 +98,6 @@ class PROTOBUF_EXPORT GzipInputStream PROTOBUF_FUTURE_FINAL void* output_buffer_; void* output_position_; size_t output_buffer_length_; - int64_t byte_count_; int Inflate(int flush); void DoNextOutput(const void** data, int* size); @@ -106,8 +105,8 @@ class PROTOBUF_EXPORT GzipInputStream PROTOBUF_FUTURE_FINAL GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GzipInputStream); }; -class PROTOBUF_EXPORT GzipOutputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyOutputStream { + +class LIBPROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream { public: // Format key for constructor enum Format { @@ -118,7 +117,7 @@ class PROTOBUF_EXPORT GzipOutputStream PROTOBUF_FUTURE_FINAL ZLIB = 2, }; - struct PROTOBUF_EXPORT Options { + struct Options { // Defaults to GZIP. Format format; @@ -141,26 +140,31 @@ class PROTOBUF_EXPORT GzipOutputStream PROTOBUF_FUTURE_FINAL explicit GzipOutputStream(ZeroCopyOutputStream* sub_stream); // Create a GzipOutputStream with the given options. - GzipOutputStream(ZeroCopyOutputStream* sub_stream, const Options& options); + GzipOutputStream( + ZeroCopyOutputStream* sub_stream, + const Options& options); + + // DEPRECATED: Use one of the above constructors instead. + GzipOutputStream( + ZeroCopyOutputStream* sub_stream, + Format format, + int buffer_size = -1) GOOGLE_ATTRIBUTE_DEPRECATED; virtual ~GzipOutputStream(); // Return last error message or NULL if no error. - inline const char* ZlibErrorMessage() const { return zcontext_.msg; } - inline int ZlibErrorCode() const { return zerror_; } + inline const char* ZlibErrorMessage() const { + return zcontext_.msg; + } + inline int ZlibErrorCode() const { + return zerror_; + } // Flushes data written so far to zipped data in the underlying stream. // It is the caller's responsibility to flush the underlying stream if // necessary. // Compression may be less efficient stopping and starting around flushes. // Returns true if no error. - // - // Please ensure that block size is > 6. Here is an excerpt from the zlib - // doc that explains why: - // - // In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out - // is greater than six to avoid repeated flush markers due to - // avail_out == 0 on return. bool Flush(); // Writes out all data and closes the gzip stream. @@ -170,9 +174,9 @@ class PROTOBUF_EXPORT GzipOutputStream PROTOBUF_FUTURE_FINAL bool Close(); // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size) override; - void BackUp(int count) override; - int64_t ByteCount() const override; + bool Next(void** data, int* size); + void BackUp(int count); + int64 ByteCount() const; private: ZeroCopyOutputStream* sub_stream_; @@ -198,8 +202,6 @@ class PROTOBUF_EXPORT GzipOutputStream PROTOBUF_FUTURE_FINAL } // namespace io } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_IO_GZIP_STREAM_H__ diff --git a/depends/protobuf/src/google/protobuf/io/package_info.h b/depends/protobuf/google/protobuf/io/package_info.h similarity index 97% rename from depends/protobuf/src/google/protobuf/io/package_info.h rename to depends/protobuf/google/protobuf/io/package_info.h index 46c3dac91..7a7a4e773 100644 --- a/depends/protobuf/src/google/protobuf/io/package_info.h +++ b/depends/protobuf/google/protobuf/io/package_info.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,6 +37,7 @@ // documentation generator. namespace google { + namespace protobuf { // Auxiliary classes used for I/O. diff --git a/depends/protobuf/google/protobuf/io/printer.cc b/depends/protobuf/google/protobuf/io/printer.cc new file mode 100644 index 000000000..9ab90deec --- /dev/null +++ b/depends/protobuf/google/protobuf/io/printer.cc @@ -0,0 +1,199 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace io { + +Printer::Printer(ZeroCopyOutputStream* output, char variable_delimiter) + : variable_delimiter_(variable_delimiter), + output_(output), + buffer_(NULL), + buffer_size_(0), + at_start_of_line_(true), + failed_(false) { +} + +Printer::~Printer() { + // Only BackUp() if we're sure we've successfully called Next() at least once. + if (buffer_size_ > 0) { + output_->BackUp(buffer_size_); + } +} + +void Printer::Print(const map& variables, const char* text) { + int size = strlen(text); + int pos = 0; // The number of bytes we've written so far. + + for (int i = 0; i < size; i++) { + if (text[i] == '\n') { + // Saw newline. If there is more text, we may need to insert an indent + // here. So, write what we have so far, including the '\n'. + WriteRaw(text + pos, i - pos + 1); + pos = i + 1; + + // Setting this true will cause the next WriteRaw() to insert an indent + // first. + at_start_of_line_ = true; + + } else if (text[i] == variable_delimiter_) { + // Saw the start of a variable name. + + // Write what we have so far. + WriteRaw(text + pos, i - pos); + pos = i + 1; + + // Find closing delimiter. + const char* end = strchr(text + pos, variable_delimiter_); + if (end == NULL) { + GOOGLE_LOG(DFATAL) << " Unclosed variable name."; + end = text + pos; + } + int endpos = end - text; + + string varname(text + pos, endpos - pos); + if (varname.empty()) { + // Two delimiters in a row reduce to a literal delimiter character. + WriteRaw(&variable_delimiter_, 1); + } else { + // Replace with the variable's value. + map::const_iterator iter = variables.find(varname); + if (iter == variables.end()) { + GOOGLE_LOG(DFATAL) << " Undefined variable: " << varname; + } else { + WriteRaw(iter->second.data(), iter->second.size()); + } + } + + // Advance past this variable. + i = endpos; + pos = endpos + 1; + } + } + + // Write the rest. + WriteRaw(text + pos, size - pos); +} + +void Printer::Print(const char* text) { + static map empty; + Print(empty, text); +} + +void Printer::Print(const char* text, + const char* variable, const string& value) { + map vars; + vars[variable] = value; + Print(vars, text); +} + +void Printer::Print(const char* text, + const char* variable1, const string& value1, + const char* variable2, const string& value2) { + map vars; + vars[variable1] = value1; + vars[variable2] = value2; + Print(vars, text); +} + +void Printer::Print(const char* text, + const char* variable1, const string& value1, + const char* variable2, const string& value2, + const char* variable3, const string& value3) { + map vars; + vars[variable1] = value1; + vars[variable2] = value2; + vars[variable3] = value3; + Print(vars, text); +} + +void Printer::Indent() { + indent_ += " "; +} + +void Printer::Outdent() { + if (indent_.empty()) { + GOOGLE_LOG(DFATAL) << " Outdent() without matching Indent()."; + return; + } + + indent_.resize(indent_.size() - 2); +} + +void Printer::PrintRaw(const string& data) { + WriteRaw(data.data(), data.size()); +} + +void Printer::PrintRaw(const char* data) { + if (failed_) return; + WriteRaw(data, strlen(data)); +} + +void Printer::WriteRaw(const char* data, int size) { + if (failed_) return; + if (size == 0) return; + + if (at_start_of_line_) { + // Insert an indent. + at_start_of_line_ = false; + WriteRaw(indent_.data(), indent_.size()); + if (failed_) return; + } + + while (size > buffer_size_) { + // Data exceeds space in the buffer. Copy what we can and request a + // new buffer. + memcpy(buffer_, data, buffer_size_); + data += buffer_size_; + size -= buffer_size_; + void* void_buffer; + failed_ = !output_->Next(&void_buffer, &buffer_size_); + if (failed_) return; + buffer_ = reinterpret_cast(void_buffer); + } + + // Buffer is big enough to receive the data; copy it. + memcpy(buffer_, data, size); + buffer_ += size; + buffer_size_ -= size; +} + +} // namespace io +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/io/printer.h b/depends/protobuf/google/protobuf/io/printer.h new file mode 100644 index 000000000..5be48543a --- /dev/null +++ b/depends/protobuf/google/protobuf/io/printer.h @@ -0,0 +1,136 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Utility class for writing text to a ZeroCopyOutputStream. + +#ifndef GOOGLE_PROTOBUF_IO_PRINTER_H__ +#define GOOGLE_PROTOBUF_IO_PRINTER_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace io { + +class ZeroCopyOutputStream; // zero_copy_stream.h + +// This simple utility class assists in code generation. It basically +// allows the caller to define a set of variables and then output some +// text with variable substitutions. Example usage: +// +// Printer printer(output, '$'); +// map vars; +// vars["name"] = "Bob"; +// printer.Print(vars, "My name is $name$."); +// +// The above writes "My name is Bob." to the output stream. +// +// Printer aggressively enforces correct usage, crashing (with assert failures) +// in the case of undefined variables in debug builds. This helps greatly in +// debugging code which uses it. +class LIBPROTOBUF_EXPORT Printer { + public: + // Create a printer that writes text to the given output stream. Use the + // given character as the delimiter for variables. + Printer(ZeroCopyOutputStream* output, char variable_delimiter); + ~Printer(); + + // Print some text after applying variable substitutions. If a particular + // variable in the text is not defined, this will crash. Variables to be + // substituted are identified by their names surrounded by delimiter + // characters (as given to the constructor). The variable bindings are + // defined by the given map. + void Print(const map& variables, const char* text); + + // Like the first Print(), except the substitutions are given as parameters. + void Print(const char* text); + // Like the first Print(), except the substitutions are given as parameters. + void Print(const char* text, const char* variable, const string& value); + // Like the first Print(), except the substitutions are given as parameters. + void Print(const char* text, const char* variable1, const string& value1, + const char* variable2, const string& value2); + // Like the first Print(), except the substitutions are given as parameters. + void Print(const char* text, const char* variable1, const string& value1, + const char* variable2, const string& value2, + const char* variable3, const string& value3); + // TODO(kenton): Overloaded versions with more variables? Three seems + // to be enough. + + // Indent text by two spaces. After calling Indent(), two spaces will be + // inserted at the beginning of each line of text. Indent() may be called + // multiple times to produce deeper indents. + void Indent(); + + // Reduces the current indent level by two spaces, or crashes if the indent + // level is zero. + void Outdent(); + + // Write a string to the output buffer. + // This method does not look for newlines to add indentation. + void PrintRaw(const string& data); + + // Write a zero-delimited string to output buffer. + // This method does not look for newlines to add indentation. + void PrintRaw(const char* data); + + // Write some bytes to the output buffer. + // This method does not look for newlines to add indentation. + void WriteRaw(const char* data, int size); + + // True if any write to the underlying stream failed. (We don't just + // crash in this case because this is an I/O failure, not a programming + // error.) + bool failed() const { return failed_; } + + private: + const char variable_delimiter_; + + ZeroCopyOutputStream* const output_; + char* buffer_; + int buffer_size_; + + string indent_; + bool at_start_of_line_; + bool failed_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Printer); +}; + +} // namespace io +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_IO_PRINTER_H__ diff --git a/depends/protobuf/google/protobuf/io/tokenizer.cc b/depends/protobuf/google/protobuf/io/tokenizer.cc new file mode 100644 index 000000000..513831d55 --- /dev/null +++ b/depends/protobuf/google/protobuf/io/tokenizer.cc @@ -0,0 +1,694 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Here we have a hand-written lexer. At first you might ask yourself, +// "Hand-written text processing? Is Kenton crazy?!" Well, first of all, +// yes I am crazy, but that's beside the point. There are actually reasons +// why I ended up writing this this way. +// +// The traditional approach to lexing is to use lex to generate a lexer for +// you. Unfortunately, lex's output is ridiculously ugly and difficult to +// integrate cleanly with C++ code, especially abstract code or code meant +// as a library. Better parser-generators exist but would add dependencies +// which most users won't already have, which we'd like to avoid. (GNU flex +// has a C++ output option, but it's still ridiculously ugly, non-abstract, +// and not library-friendly.) +// +// The next approach that any good software engineer should look at is to +// use regular expressions. And, indeed, I did. I have code which +// implements this same class using regular expressions. It's about 200 +// lines shorter. However: +// - Rather than error messages telling you "This string has an invalid +// escape sequence at line 5, column 45", you get error messages like +// "Parse error on line 5". Giving more precise errors requires adding +// a lot of code that ends up basically as complex as the hand-coded +// version anyway. +// - The regular expression to match a string literal looks like this: +// kString = new RE("(\"([^\"\\\\]|" // non-escaped +// "\\\\[abfnrtv?\"'\\\\0-7]|" // normal escape +// "\\\\x[0-9a-fA-F])*\"|" // hex escape +// "\'([^\'\\\\]|" // Also support single-quotes. +// "\\\\[abfnrtv?\"'\\\\0-7]|" +// "\\\\x[0-9a-fA-F])*\')"); +// Verifying the correctness of this line noise is actually harder than +// verifying the correctness of ConsumeString(), defined below. I'm not +// even confident that the above is correct, after staring at it for some +// time. +// - PCRE is fast, but there's still more overhead involved than the code +// below. +// - Sadly, regular expressions are not part of the C standard library, so +// using them would require depending on some other library. For the +// open source release, this could be really annoying. Nobody likes +// downloading one piece of software just to find that they need to +// download something else to make it work, and in all likelihood +// people downloading Protocol Buffers will already be doing so just +// to make something else work. We could include a copy of PCRE with +// our code, but that obligates us to keep it up-to-date and just seems +// like a big waste just to save 200 lines of code. +// +// On a similar but unrelated note, I'm even scared to use ctype.h. +// Apparently functions like isalpha() are locale-dependent. So, if we used +// that, then if this code is being called from some program that doesn't +// have its locale set to "C", it would behave strangely. We can't just set +// the locale to "C" ourselves since we might break the calling program that +// way, particularly if it is multi-threaded. WTF? Someone please let me +// (Kenton) know if I'm missing something here... +// +// I'd love to hear about other alternatives, though, as this code isn't +// exactly pretty. + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace io { +namespace { + +// As mentioned above, I don't trust ctype.h due to the presence of "locales". +// So, I have written replacement functions here. Someone please smack me if +// this is a bad idea or if there is some way around this. +// +// These "character classes" are designed to be used in template methods. +// For instance, Tokenizer::ConsumeZeroOrMore() will eat +// whitespace. + +// Note: No class is allowed to contain '\0', since this is used to mark end- +// of-input and is handled specially. + +#define CHARACTER_CLASS(NAME, EXPRESSION) \ + class NAME { \ + public: \ + static inline bool InClass(char c) { \ + return EXPRESSION; \ + } \ + } + +CHARACTER_CLASS(Whitespace, c == ' ' || c == '\n' || c == '\t' || + c == '\r' || c == '\v' || c == '\f'); + +CHARACTER_CLASS(Unprintable, c < ' ' && c > '\0'); + +CHARACTER_CLASS(Digit, '0' <= c && c <= '9'); +CHARACTER_CLASS(OctalDigit, '0' <= c && c <= '7'); +CHARACTER_CLASS(HexDigit, ('0' <= c && c <= '9') || + ('a' <= c && c <= 'f') || + ('A' <= c && c <= 'F')); + +CHARACTER_CLASS(Letter, ('a' <= c && c <= 'z') || + ('A' <= c && c <= 'Z') || + (c == '_')); + +CHARACTER_CLASS(Alphanumeric, ('a' <= c && c <= 'z') || + ('A' <= c && c <= 'Z') || + ('0' <= c && c <= '9') || + (c == '_')); + +CHARACTER_CLASS(Escape, c == 'a' || c == 'b' || c == 'f' || c == 'n' || + c == 'r' || c == 't' || c == 'v' || c == '\\' || + c == '?' || c == '\'' || c == '\"'); + +#undef CHARACTER_CLASS + +// Given a char, interpret it as a numeric digit and return its value. +// This supports any number base up to 36. +inline int DigitValue(char digit) { + if ('0' <= digit && digit <= '9') return digit - '0'; + if ('a' <= digit && digit <= 'z') return digit - 'a' + 10; + if ('A' <= digit && digit <= 'Z') return digit - 'A' + 10; + return -1; +} + +// Inline because it's only used in one place. +inline char TranslateEscape(char c) { + switch (c) { + case 'a': return '\a'; + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + case '\\': return '\\'; + case '?': return '\?'; // Trigraphs = :( + case '\'': return '\''; + case '"': return '\"'; + + // We expect escape sequences to have been validated separately. + default: return '?'; + } +} + +} // anonymous namespace + +ErrorCollector::~ErrorCollector() {} + +// =================================================================== + +Tokenizer::Tokenizer(ZeroCopyInputStream* input, + ErrorCollector* error_collector) + : input_(input), + error_collector_(error_collector), + buffer_(NULL), + buffer_size_(0), + buffer_pos_(0), + read_error_(false), + line_(0), + column_(0), + token_start_(-1), + allow_f_after_float_(false), + comment_style_(CPP_COMMENT_STYLE) { + + current_.line = 0; + current_.column = 0; + current_.end_column = 0; + current_.type = TYPE_START; + + Refresh(); +} + +Tokenizer::~Tokenizer() { + // If we had any buffer left unread, return it to the underlying stream + // so that someone else can read it. + if (buffer_size_ > buffer_pos_) { + input_->BackUp(buffer_size_ - buffer_pos_); + } +} + +// ------------------------------------------------------------------- +// Internal helpers. + +void Tokenizer::NextChar() { + // Update our line and column counters based on the character being + // consumed. + if (current_char_ == '\n') { + ++line_; + column_ = 0; + } else if (current_char_ == '\t') { + column_ += kTabWidth - column_ % kTabWidth; + } else { + ++column_; + } + + // Advance to the next character. + ++buffer_pos_; + if (buffer_pos_ < buffer_size_) { + current_char_ = buffer_[buffer_pos_]; + } else { + Refresh(); + } +} + +void Tokenizer::Refresh() { + if (read_error_) { + current_char_ = '\0'; + return; + } + + // If we're in a token, append the rest of the buffer to it. + if (token_start_ >= 0 && token_start_ < buffer_size_) { + current_.text.append(buffer_ + token_start_, buffer_size_ - token_start_); + token_start_ = 0; + } + + const void* data = NULL; + buffer_ = NULL; + buffer_pos_ = 0; + do { + if (!input_->Next(&data, &buffer_size_)) { + // end of stream (or read error) + buffer_size_ = 0; + read_error_ = true; + current_char_ = '\0'; + return; + } + } while (buffer_size_ == 0); + + buffer_ = static_cast(data); + + current_char_ = buffer_[0]; +} + +inline void Tokenizer::StartToken() { + token_start_ = buffer_pos_; + current_.type = TYPE_START; // Just for the sake of initializing it. + current_.text.clear(); + current_.line = line_; + current_.column = column_; +} + +inline void Tokenizer::EndToken() { + // Note: The if() is necessary because some STL implementations crash when + // you call string::append(NULL, 0), presumably because they are trying to + // be helpful by detecting the NULL pointer, even though there's nothing + // wrong with reading zero bytes from NULL. + if (buffer_pos_ != token_start_) { + current_.text.append(buffer_ + token_start_, buffer_pos_ - token_start_); + } + token_start_ = -1; + current_.end_column = column_; +} + +// ------------------------------------------------------------------- +// Helper methods that consume characters. + +template +inline bool Tokenizer::LookingAt() { + return CharacterClass::InClass(current_char_); +} + +template +inline bool Tokenizer::TryConsumeOne() { + if (CharacterClass::InClass(current_char_)) { + NextChar(); + return true; + } else { + return false; + } +} + +inline bool Tokenizer::TryConsume(char c) { + if (current_char_ == c) { + NextChar(); + return true; + } else { + return false; + } +} + +template +inline void Tokenizer::ConsumeZeroOrMore() { + while (CharacterClass::InClass(current_char_)) { + NextChar(); + } +} + +template +inline void Tokenizer::ConsumeOneOrMore(const char* error) { + if (!CharacterClass::InClass(current_char_)) { + AddError(error); + } else { + do { + NextChar(); + } while (CharacterClass::InClass(current_char_)); + } +} + +// ------------------------------------------------------------------- +// Methods that read whole patterns matching certain kinds of tokens +// or comments. + +void Tokenizer::ConsumeString(char delimiter) { + while (true) { + switch (current_char_) { + case '\0': + case '\n': { + AddError("String literals cannot cross line boundaries."); + return; + } + + case '\\': { + // An escape sequence. + NextChar(); + if (TryConsumeOne()) { + // Valid escape sequence. + } else if (TryConsumeOne()) { + // Possibly followed by two more octal digits, but these will + // just be consumed by the main loop anyway so we don't need + // to do so explicitly here. + } else if (TryConsume('x') || TryConsume('X')) { + if (!TryConsumeOne()) { + AddError("Expected hex digits for escape sequence."); + } + // Possibly followed by another hex digit, but again we don't care. + } else { + AddError("Invalid escape sequence in string literal."); + } + break; + } + + default: { + if (current_char_ == delimiter) { + NextChar(); + return; + } + NextChar(); + break; + } + } + } +} + +Tokenizer::TokenType Tokenizer::ConsumeNumber(bool started_with_zero, + bool started_with_dot) { + bool is_float = false; + + if (started_with_zero && (TryConsume('x') || TryConsume('X'))) { + // A hex number (started with "0x"). + ConsumeOneOrMore("\"0x\" must be followed by hex digits."); + + } else if (started_with_zero && LookingAt()) { + // An octal number (had a leading zero). + ConsumeZeroOrMore(); + if (LookingAt()) { + AddError("Numbers starting with leading zero must be in octal."); + ConsumeZeroOrMore(); + } + + } else { + // A decimal number. + if (started_with_dot) { + is_float = true; + ConsumeZeroOrMore(); + } else { + ConsumeZeroOrMore(); + + if (TryConsume('.')) { + is_float = true; + ConsumeZeroOrMore(); + } + } + + if (TryConsume('e') || TryConsume('E')) { + is_float = true; + TryConsume('-') || TryConsume('+'); + ConsumeOneOrMore("\"e\" must be followed by exponent."); + } + + if (allow_f_after_float_ && (TryConsume('f') || TryConsume('F'))) { + is_float = true; + } + } + + if (LookingAt()) { + AddError("Need space between number and identifier."); + } else if (current_char_ == '.') { + if (is_float) { + AddError( + "Already saw decimal point or exponent; can't have another one."); + } else { + AddError("Hex and octal numbers must be integers."); + } + } + + return is_float ? TYPE_FLOAT : TYPE_INTEGER; +} + +void Tokenizer::ConsumeLineComment() { + while (current_char_ != '\0' && current_char_ != '\n') { + NextChar(); + } + TryConsume('\n'); +} + +void Tokenizer::ConsumeBlockComment() { + int start_line = line_; + int start_column = column_ - 2; + + while (true) { + while (current_char_ != '\0' && + current_char_ != '*' && + current_char_ != '/') { + NextChar(); + } + + if (TryConsume('*') && TryConsume('/')) { + // End of comment. + break; + } else if (TryConsume('/') && current_char_ == '*') { + // Note: We didn't consume the '*' because if there is a '/' after it + // we want to interpret that as the end of the comment. + AddError( + "\"/*\" inside block comment. Block comments cannot be nested."); + } else if (current_char_ == '\0') { + AddError("End-of-file inside block comment."); + error_collector_->AddError( + start_line, start_column, " Comment started here."); + break; + } + } +} + +// ------------------------------------------------------------------- + +bool Tokenizer::Next() { + previous_ = current_; + + // Did we skip any characters after the last token? + bool skipped_stuff = false; + + while (!read_error_) { + if (TryConsumeOne()) { + ConsumeZeroOrMore(); + + } else if (comment_style_ == CPP_COMMENT_STYLE && TryConsume('/')) { + // Starting a comment? + if (TryConsume('/')) { + ConsumeLineComment(); + } else if (TryConsume('*')) { + ConsumeBlockComment(); + } else { + // Oops, it was just a slash. Return it. + current_.type = TYPE_SYMBOL; + current_.text = "/"; + current_.line = line_; + current_.column = column_ - 1; + return true; + } + + } else if (comment_style_ == SH_COMMENT_STYLE && TryConsume('#')) { + ConsumeLineComment(); + + } else if (LookingAt() || current_char_ == '\0') { + AddError("Invalid control characters encountered in text."); + NextChar(); + // Skip more unprintable characters, too. But, remember that '\0' is + // also what current_char_ is set to after EOF / read error. We have + // to be careful not to go into an infinite loop of trying to consume + // it, so make sure to check read_error_ explicitly before consuming + // '\0'. + while (TryConsumeOne() || + (!read_error_ && TryConsume('\0'))) { + // Ignore. + } + + } else { + // Reading some sort of token. + StartToken(); + + if (TryConsumeOne()) { + ConsumeZeroOrMore(); + current_.type = TYPE_IDENTIFIER; + } else if (TryConsume('0')) { + current_.type = ConsumeNumber(true, false); + } else if (TryConsume('.')) { + // This could be the beginning of a floating-point number, or it could + // just be a '.' symbol. + + if (TryConsumeOne()) { + // It's a floating-point number. + if (previous_.type == TYPE_IDENTIFIER && !skipped_stuff) { + // We don't accept syntax like "blah.123". + error_collector_->AddError(line_, column_ - 2, + "Need space between identifier and decimal point."); + } + current_.type = ConsumeNumber(false, true); + } else { + current_.type = TYPE_SYMBOL; + } + } else if (TryConsumeOne()) { + current_.type = ConsumeNumber(false, false); + } else if (TryConsume('\"')) { + ConsumeString('\"'); + current_.type = TYPE_STRING; + } else if (TryConsume('\'')) { + ConsumeString('\''); + current_.type = TYPE_STRING; + } else { + NextChar(); + current_.type = TYPE_SYMBOL; + } + + EndToken(); + return true; + } + + skipped_stuff = true; + } + + // EOF + current_.type = TYPE_END; + current_.text.clear(); + current_.line = line_; + current_.column = column_; + current_.end_column = column_; + return false; +} + +// ------------------------------------------------------------------- +// Token-parsing helpers. Remember that these don't need to report +// errors since any errors should already have been reported while +// tokenizing. Also, these can assume that whatever text they +// are given is text that the tokenizer actually parsed as a token +// of the given type. + +bool Tokenizer::ParseInteger(const string& text, uint64 max_value, + uint64* output) { + // Sadly, we can't just use strtoul() since it is only 32-bit and strtoull() + // is non-standard. I hate the C standard library. :( + +// return strtoull(text.c_str(), NULL, 0); + + const char* ptr = text.c_str(); + int base = 10; + if (ptr[0] == '0') { + if (ptr[1] == 'x' || ptr[1] == 'X') { + // This is hex. + base = 16; + ptr += 2; + } else { + // This is octal. + base = 8; + } + } + + uint64 result = 0; + for (; *ptr != '\0'; ptr++) { + int digit = DigitValue(*ptr); + GOOGLE_LOG_IF(DFATAL, digit < 0 || digit >= base) + << " Tokenizer::ParseInteger() passed text that could not have been" + " tokenized as an integer: " << CEscape(text); + if (digit > max_value || result > (max_value - digit) / base) { + // Overflow. + return false; + } + result = result * base + digit; + } + + *output = result; + return true; +} + +double Tokenizer::ParseFloat(const string& text) { + const char* start = text.c_str(); + char* end; + double result = NoLocaleStrtod(start, &end); + + // "1e" is not a valid float, but if the tokenizer reads it, it will + // report an error but still return it as a valid token. We need to + // accept anything the tokenizer could possibly return, error or not. + if (*end == 'e' || *end == 'E') { + ++end; + if (*end == '-' || *end == '+') ++end; + } + + // If the Tokenizer had allow_f_after_float_ enabled, the float may be + // suffixed with the letter 'f'. + if (*end == 'f' || *end == 'F') { + ++end; + } + + GOOGLE_LOG_IF(DFATAL, end - start != text.size() || *start == '-') + << " Tokenizer::ParseFloat() passed text that could not have been" + " tokenized as a float: " << CEscape(text); + return result; +} + +void Tokenizer::ParseStringAppend(const string& text, string* output) { + // Reminder: text[0] is always the quote character. (If text is + // empty, it's invalid, so we'll just return.) + if (text.empty()) { + GOOGLE_LOG(DFATAL) + << " Tokenizer::ParseStringAppend() passed text that could not" + " have been tokenized as a string: " << CEscape(text); + return; + } + + output->reserve(output->size() + text.size()); + + // Loop through the string copying characters to "output" and + // interpreting escape sequences. Note that any invalid escape + // sequences or other errors were already reported while tokenizing. + // In this case we do not need to produce valid results. + for (const char* ptr = text.c_str() + 1; *ptr != '\0'; ptr++) { + if (*ptr == '\\' && ptr[1] != '\0') { + // An escape sequence. + ++ptr; + + if (OctalDigit::InClass(*ptr)) { + // An octal escape. May one, two, or three digits. + int code = DigitValue(*ptr); + if (OctalDigit::InClass(ptr[1])) { + ++ptr; + code = code * 8 + DigitValue(*ptr); + } + if (OctalDigit::InClass(ptr[1])) { + ++ptr; + code = code * 8 + DigitValue(*ptr); + } + output->push_back(static_cast(code)); + + } else if (*ptr == 'x') { + // A hex escape. May zero, one, or two digits. (The zero case + // will have been caught as an error earlier.) + int code = 0; + if (HexDigit::InClass(ptr[1])) { + ++ptr; + code = DigitValue(*ptr); + } + if (HexDigit::InClass(ptr[1])) { + ++ptr; + code = code * 16 + DigitValue(*ptr); + } + output->push_back(static_cast(code)); + + } else { + // Some other escape code. + output->push_back(TranslateEscape(*ptr)); + } + + } else if (*ptr == text[0]) { + // Ignore quote matching the starting quote. + } else { + output->push_back(*ptr); + } + } + + return; +} + +} // namespace io +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/io/tokenizer.h b/depends/protobuf/google/protobuf/io/tokenizer.h similarity index 59% rename from depends/protobuf/src/google/protobuf/io/tokenizer.h rename to depends/protobuf/google/protobuf/io/tokenizer.h index 4abab7e30..8f759abbd 100644 --- a/depends/protobuf/src/google/protobuf/io/tokenizer.h +++ b/depends/protobuf/google/protobuf/io/tokenizer.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,36 +37,23 @@ #ifndef GOOGLE_PROTOBUF_IO_TOKENIZER_H__ #define GOOGLE_PROTOBUF_IO_TOKENIZER_H__ - #include -#include - #include -#include - -// Must be included last. -#include namespace google { namespace protobuf { namespace io { -class ZeroCopyInputStream; // zero_copy_stream.h +class ZeroCopyInputStream; // zero_copy_stream.h // Defined in this file. class ErrorCollector; class Tokenizer; -// By "column number", the proto compiler refers to a count of the number -// of bytes before a given byte, except that a tab character advances to -// the next multiple of 8 bytes. Note in particular that column numbers -// are zero-based, while many user interfaces use one-based column numbers. -typedef int ColumnNumber; - // Abstract interface for an object which collects the errors that occur // during parsing. A typical implementation might simply print the errors // to stdout. -class PROTOBUF_EXPORT ErrorCollector { +class LIBPROTOBUF_EXPORT ErrorCollector { public: inline ErrorCollector() {} virtual ~ErrorCollector(); @@ -74,14 +61,12 @@ class PROTOBUF_EXPORT ErrorCollector { // Indicates that there was an error in the input at the given line and // column numbers. The numbers are zero-based, so you may want to add // 1 to each before printing them. - virtual void AddError(int line, ColumnNumber column, - const std::string& message) = 0; + virtual void AddError(int line, int column, const string& message) = 0; // Indicates that there was a warning in the input at the given line and // column numbers. The numbers are zero-based, so you may want to add // 1 to each before printing them. - virtual void AddWarning(int /* line */, ColumnNumber /* column */, - const std::string& /* message */) {} + virtual void AddWarning(int line, int column, const string& message) { } private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector); @@ -93,7 +78,7 @@ class PROTOBUF_EXPORT ErrorCollector { // precise descriptions. Whitespace and comments are skipped. By default, // C- and C++-style comments are recognized, but other styles can be used by // calling set_comment_style(). -class PROTOBUF_EXPORT Tokenizer { +class LIBPROTOBUF_EXPORT Tokenizer { public: // Construct a Tokenizer that reads and tokenizes text from the given // input stream and writes errors to the given error_collector. @@ -102,8 +87,8 @@ class PROTOBUF_EXPORT Tokenizer { ~Tokenizer(); enum TokenType { - TYPE_START, // Next() has not yet been called. - TYPE_END, // End of input reached. "text" is empty. + TYPE_START, // Next() has not yet been called. + TYPE_END, // End of input reached. "text" is empty. TYPE_IDENTIFIER, // A sequence of letters, digits, and underscores, not // starting with a digit. It is an error for a number @@ -124,27 +109,20 @@ class PROTOBUF_EXPORT Tokenizer { TYPE_SYMBOL, // Any other printable character, like '!' or '+'. // Symbols are always a single character, so "!+$%" is // four tokens. - TYPE_WHITESPACE, // A sequence of whitespace. This token type is only - // produced if report_whitespace() is true. It is not - // reported for whitespace within comments or strings. - TYPE_NEWLINE, // A newline (\n). This token type is only - // produced if report_whitespace() is true and - // report_newlines() is true. It is not reported for - // newlines in comments or strings. }; // Structure representing a token read from the token stream. struct Token { TokenType type; - std::string text; // The exact text of the token as it appeared in + string text; // The exact text of the token as it appeared in // the input. e.g. tokens of TYPE_STRING will still // be escaped and in quotes. // "line" and "column" specify the position of the first character of // the token within the input stream. They are zero-based. int line; - ColumnNumber column; - ColumnNumber end_column; + int column; + int end_column; }; // Get the current token. This is updated when Next() is called. Before @@ -159,75 +137,28 @@ class PROTOBUF_EXPORT Tokenizer { // reached. bool Next(); - // Like Next(), but also collects comments which appear between the previous - // and next tokens. - // - // Comments which appear to be attached to the previous token are stored - // in *prev_tailing_comments. Comments which appear to be attached to the - // next token are stored in *next_leading_comments. Comments appearing in - // between which do not appear to be attached to either will be added to - // detached_comments. Any of these parameters can be NULL to simply discard - // the comments. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // Only the comment content is returned; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk will - // be stripped from the beginning of each line other than the first. Newlines - // are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment. This is not attached to qux or corge - // // because there are blank lines separating it from both. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - bool NextWithComments(std::string* prev_trailing_comments, - std::vector* detached_comments, - std::string* next_leading_comments); - // Parse helpers --------------------------------------------------- // Parses a TYPE_FLOAT token. This never fails, so long as the text actually // comes from a TYPE_FLOAT token parsed by Tokenizer. If it doesn't, the // result is undefined (possibly an assert failure). - static double ParseFloat(const std::string& text); + static double ParseFloat(const string& text); // Parses a TYPE_STRING token. This never fails, so long as the text actually // comes from a TYPE_STRING token parsed by Tokenizer. If it doesn't, the // result is undefined (possibly an assert failure). - static void ParseString(const std::string& text, std::string* output); + static void ParseString(const string& text, string* output); // Identical to ParseString, but appends to output. - static void ParseStringAppend(const std::string& text, std::string* output); + static void ParseStringAppend(const string& text, string* output); // Parses a TYPE_INTEGER token. Returns false if the result would be // greater than max_value. Otherwise, returns true and sets *output to the // result. If the text is not from a Token of type TYPE_INTEGER originally // parsed by a Tokenizer, the result is undefined (possibly an assert // failure). - static bool ParseInteger(const std::string& text, uint64_t max_value, - uint64_t* output); + static bool ParseInteger(const string& text, uint64 max_value, + uint64* output); // Options --------------------------------------------------------- @@ -249,69 +180,38 @@ class PROTOBUF_EXPORT Tokenizer { // Sets the comment style. void set_comment_style(CommentStyle style) { comment_style_ = style; } - // Whether to require whitespace between a number and a field name. - // Default is true. Do not use this; for Google-internal cleanup only. - void set_require_space_after_number(bool require) { - require_space_after_number_ = require; - } - - // Whether to allow string literals to span multiple lines. Default is false. - // Do not use this; for Google-internal cleanup only. - void set_allow_multiline_strings(bool allow) { - allow_multiline_strings_ = allow; - } - - // If true, whitespace tokens are reported by Next(). - // Note: `set_report_whitespace(false)` implies `set_report_newlines(false)`. - bool report_whitespace() const; - void set_report_whitespace(bool report); - - // If true, newline tokens are reported by Next(). - // Note: `set_report_newlines(true)` implies `set_report_whitespace(true)`. - bool report_newlines() const; - void set_report_newlines(bool report); - - // External helper: validate an identifier. - static bool IsIdentifier(const std::string& text); - // ----------------------------------------------------------------- private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Tokenizer); - Token current_; // Returned by current(). - Token previous_; // Returned by previous(). + Token current_; // Returned by current(). + Token previous_; // Returned by previous(). ZeroCopyInputStream* input_; ErrorCollector* error_collector_; - char current_char_; // == buffer_[buffer_pos_], updated by NextChar(). - const char* buffer_; // Current buffer returned from input_. - int buffer_size_; // Size of buffer_. - int buffer_pos_; // Current position within the buffer. - bool read_error_; // Did we previously encounter a read error? + char current_char_; // == buffer_[buffer_pos_], updated by NextChar(). + const char* buffer_; // Current buffer returned from input_. + int buffer_size_; // Size of buffer_. + int buffer_pos_; // Current position within the buffer. + bool read_error_; // Did we previously encounter a read error? // Line and column number of current_char_ within the whole input stream. int line_; - ColumnNumber column_; + int column_; - // String to which text should be appended as we advance through it. - // Call RecordTo(&str) to start recording and StopRecording() to stop. - // E.g. StartToken() calls RecordTo(¤t_.text). record_start_ is the - // position within the current buffer where recording started. - std::string* record_target_; - int record_start_; + // Position in buffer_ where StartToken() was called. If the token + // started in the previous buffer, this is zero, and current_.text already + // contains the part of the token from the previous buffer. If not + // currently parsing a token, this is -1. + int token_start_; // Options. bool allow_f_after_float_; CommentStyle comment_style_; - bool require_space_after_number_; - bool allow_multiline_strings_; - bool report_whitespace_ = false; - bool report_newlines_ = false; // Since we count columns we need to interpret tabs somehow. We'll take // the standard 8-character definition for lack of any way to do better. - // This must match the documentation of ColumnNumber. static const int kTabWidth = 8; // ----------------------------------------------------------------- @@ -323,9 +223,6 @@ class PROTOBUF_EXPORT Tokenizer { // Read a new buffer from the input. void Refresh(); - inline void RecordTo(std::string* target); - inline void StopRecording(); - // Called when the current character is the first character of a new // token (not including whitespace or comments). inline void StartToken(); @@ -335,7 +232,7 @@ class PROTOBUF_EXPORT Tokenizer { inline void EndToken(); // Convenience method to add an error at the current line and column. - void AddError(const std::string& message) { + void AddError(const string& message) { error_collector_->AddError(line_, column_, message); } @@ -353,45 +250,18 @@ class PROTOBUF_EXPORT Tokenizer { // depending on what was read. This needs to know if the first // character was a zero in order to correctly recognize hex and octal // numbers. - // It also needs to know if the first character was a . to parse floating + // It also needs to know if the first characted was a . to parse floating // point correctly. TokenType ConsumeNumber(bool started_with_zero, bool started_with_dot); // Consume the rest of a line. - void ConsumeLineComment(std::string* content); + void ConsumeLineComment(); // Consume until "*/". - void ConsumeBlockComment(std::string* content); - - enum NextCommentStatus { - // Started a line comment. - LINE_COMMENT, - - // Started a block comment. - BLOCK_COMMENT, - - // Consumed a slash, then realized it wasn't a comment. current_ has - // been filled in with a slash token. The caller should return it. - SLASH_NOT_COMMENT, - - // We do not appear to be starting a comment here. - NO_COMMENT - }; - - // If we're at the start of a new comment, consume it and return what kind - // of comment it is. - NextCommentStatus TryConsumeCommentStart(); - - // If we're looking at a TYPE_WHITESPACE token and `report_whitespace_` is - // true, consume it and return true. - bool TryConsumeWhitespace(); - - // If we're looking at a TYPE_NEWLINE token and `report_newlines_` is true, - // consume it and return true. - bool TryConsumeNewline(); + void ConsumeBlockComment(); // ----------------------------------------------------------------- // These helper methods make the parsing code more readable. The - // "character classes" referred to are defined at the top of the .cc file. + // "character classes" refered to are defined at the top of the .cc file. // Basically it is a C++ class with one method: // static bool InClass(char c); // The method returns true if c is a member of this "class", like "Letter" @@ -399,44 +269,45 @@ class PROTOBUF_EXPORT Tokenizer { // Returns true if the current character is of the given character // class, but does not consume anything. - template + template inline bool LookingAt(); // If the current character is in the given class, consume it and return // true. Otherwise return false. // e.g. TryConsumeOne() - template + template inline bool TryConsumeOne(); // Like above, but try to consume the specific character indicated. inline bool TryConsume(char c); // Consume zero or more of the given character class. - template + template inline void ConsumeZeroOrMore(); // Consume one or more of the given character class or log the given // error message. // e.g. ConsumeOneOrMore("Expected digits."); - template + template inline void ConsumeOneOrMore(const char* error); }; // inline methods ==================================================== -inline const Tokenizer::Token& Tokenizer::current() { return current_; } +inline const Tokenizer::Token& Tokenizer::current() { + return current_; +} -inline const Tokenizer::Token& Tokenizer::previous() { return previous_; } +inline const Tokenizer::Token& Tokenizer::previous() { + return previous_; +} -inline void Tokenizer::ParseString(const std::string& text, - std::string* output) { +inline void Tokenizer::ParseString(const string& text, string* output) { output->clear(); ParseStringAppend(text, output); } } // namespace io } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_IO_TOKENIZER_H__ diff --git a/depends/protobuf/src/google/protobuf/io/zero_copy_stream.cc b/depends/protobuf/google/protobuf/io/zero_copy_stream.cc similarity index 80% rename from depends/protobuf/src/google/protobuf/io/zero_copy_stream.cc rename to depends/protobuf/google/protobuf/io/zero_copy_stream.cc index f81555e55..dad6ff144 100644 --- a/depends/protobuf/src/google/protobuf/io/zero_copy_stream.cc +++ b/depends/protobuf/google/protobuf/io/zero_copy_stream.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -34,21 +34,14 @@ #include -#include -#include namespace google { namespace protobuf { namespace io { +ZeroCopyInputStream::~ZeroCopyInputStream() {} +ZeroCopyOutputStream::~ZeroCopyOutputStream() {} -bool ZeroCopyOutputStream::WriteAliasedRaw(const void* /* data */, - int /* size */) { - GOOGLE_LOG(FATAL) << "This ZeroCopyOutputStream doesn't support aliasing. " - "Reaching here usually means a ZeroCopyOutputStream " - "implementation bug."; - return false; -} } // namespace io } // namespace protobuf diff --git a/depends/protobuf/src/google/protobuf/io/zero_copy_stream.h b/depends/protobuf/google/protobuf/io/zero_copy_stream.h similarity index 86% rename from depends/protobuf/src/google/protobuf/io/zero_copy_stream.h rename to depends/protobuf/google/protobuf/io/zero_copy_stream.h index 2041cbf64..db5326f70 100644 --- a/depends/protobuf/src/google/protobuf/io/zero_copy_stream.h +++ b/depends/protobuf/google/protobuf/io/zero_copy_stream.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -107,14 +107,11 @@ #ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_H__ #define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_H__ - +#include #include - -// Must be included last. -#include - namespace google { + namespace protobuf { namespace io { @@ -124,10 +121,10 @@ class ZeroCopyOutputStream; // Abstract interface similar to an input stream but designed to minimize // copying. -class PROTOBUF_EXPORT ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT ZeroCopyInputStream { public: - ZeroCopyInputStream() {} - virtual ~ZeroCopyInputStream() {} + inline ZeroCopyInputStream() {} + virtual ~ZeroCopyInputStream(); // Obtains a chunk of data from the stream. // @@ -154,13 +151,6 @@ class PROTOBUF_EXPORT ZeroCopyInputStream { // buffer that goes beyond what you wanted to read, you can use BackUp() // to return to the point where you intended to finish. // - // This method can be called with `count = 0` to finalize (flush) any - // previously returned buffer. For example, a file output stream can - // flush buffers returned from a previous call to Next() upon such - // BackUp(0) invocations. ZeroCopyOutputStream callers should always - // invoke BackUp() after a final Next() call, even if there is no - // excess buffer data to be backed up to indicate a flush point. - // // Preconditions: // * The last method called must have been Next(). // * count must be less than or equal to the size of the last buffer @@ -179,7 +169,7 @@ class PROTOBUF_EXPORT ZeroCopyInputStream { virtual bool Skip(int count) = 0; // Returns the total number of bytes read since this object was created. - virtual int64_t ByteCount() const = 0; + virtual int64 ByteCount() const = 0; private: @@ -188,10 +178,10 @@ class PROTOBUF_EXPORT ZeroCopyInputStream { // Abstract interface similar to an output stream but designed to minimize // copying. -class PROTOBUF_EXPORT ZeroCopyOutputStream { +class LIBPROTOBUF_EXPORT ZeroCopyOutputStream { public: - ZeroCopyOutputStream() {} - virtual ~ZeroCopyOutputStream() {} + inline ZeroCopyOutputStream() {} + virtual ~ZeroCopyOutputStream(); // Obtains a buffer into which data can be written. Any data written // into this buffer will eventually (maybe instantly, maybe later on) @@ -234,17 +224,7 @@ class PROTOBUF_EXPORT ZeroCopyOutputStream { virtual void BackUp(int count) = 0; // Returns the total number of bytes written since this object was created. - virtual int64_t ByteCount() const = 0; - - // Write a given chunk of data to the output. Some output streams may - // implement this in a way that avoids copying. Check AllowsAliasing() before - // calling WriteAliasedRaw(). It will GOOGLE_CHECK fail if WriteAliasedRaw() is - // called on a stream that does not allow aliasing. - // - // NOTE: It is caller's responsibility to ensure that the chunk of memory - // remains live until all of the data has been consumed from the stream. - virtual bool WriteAliasedRaw(const void* data, int size); - virtual bool AllowsAliasing() const { return false; } + virtual int64 ByteCount() const = 0; private: @@ -253,8 +233,6 @@ class PROTOBUF_EXPORT ZeroCopyOutputStream { } // namespace io } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_H__ diff --git a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl.cc similarity index 66% rename from depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc rename to depends/protobuf/google/protobuf/io/zero_copy_stream_impl.cc index c66bc862a..1384c746a 100644 --- a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -32,23 +32,21 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#ifndef _MSC_VER -#include -#include -#include +#ifdef _MSC_VER +#include +#else #include +#include +#include +#include #endif #include - -#include #include +#include -#include -#include -#include #include -#include - +#include +#include namespace google { namespace protobuf { @@ -58,13 +56,6 @@ namespace io { // Win32 lseek is broken: If invoked on a non-seekable file descriptor, its // return value is undefined. We re-define it to always produce an error. #define lseek(fd, offset, origin) ((off_t)-1) -// DO NOT include , instead create functions in io_win32.{h,cc} and import -// them like we do below. -using google::protobuf::io::win32::access; -using google::protobuf::io::win32::close; -using google::protobuf::io::win32::open; -using google::protobuf::io::win32::read; -using google::protobuf::io::win32::write; #endif namespace { @@ -80,35 +71,43 @@ int close_no_eintr(int fd) { } // namespace + // =================================================================== FileInputStream::FileInputStream(int file_descriptor, int block_size) - : copying_input_(file_descriptor), impl_(©ing_input_, block_size) {} + : copying_input_(file_descriptor), + impl_(©ing_input_, block_size) { +} -bool FileInputStream::Close() { return copying_input_.Close(); } +FileInputStream::~FileInputStream() {} + +bool FileInputStream::Close() { + return copying_input_.Close(); +} bool FileInputStream::Next(const void** data, int* size) { return impl_.Next(data, size); } -void FileInputStream::BackUp(int count) { impl_.BackUp(count); } +void FileInputStream::BackUp(int count) { + impl_.BackUp(count); +} -bool FileInputStream::Skip(int count) { return impl_.Skip(count); } +bool FileInputStream::Skip(int count) { + return impl_.Skip(count); +} -int64_t FileInputStream::ByteCount() const { return impl_.ByteCount(); } +int64 FileInputStream::ByteCount() const { + return impl_.ByteCount(); +} FileInputStream::CopyingFileInputStream::CopyingFileInputStream( int file_descriptor) - : file_(file_descriptor), - close_on_delete_(false), - is_closed_(false), - errno_(0), - previous_seek_failed_(false) { -#ifndef _WIN32 - int flags = fcntl(file_, F_GETFL); - flags &= ~O_NONBLOCK; - fcntl(file_, F_SETFL, flags); -#endif + : file_(file_descriptor), + close_on_delete_(false), + is_closed_(false), + errno_(0), + previous_seek_failed_(false) { } FileInputStream::CopyingFileInputStream::~CopyingFileInputStream() { @@ -153,7 +152,8 @@ int FileInputStream::CopyingFileInputStream::Read(void* buffer, int size) { int FileInputStream::CopyingFileInputStream::Skip(int count) { GOOGLE_CHECK(!is_closed_); - if (!previous_seek_failed_ && lseek(file_, count, SEEK_CUR) != (off_t)-1) { + if (!previous_seek_failed_ && + lseek(file_, count, SEEK_CUR) != (off_t)-1) { // Seek succeeded. return count; } else { @@ -170,23 +170,43 @@ int FileInputStream::CopyingFileInputStream::Skip(int count) { // =================================================================== -FileOutputStream::FileOutputStream(int file_descriptor, int /*block_size*/) - : CopyingOutputStreamAdaptor(©ing_output_), - copying_output_(file_descriptor) {} +FileOutputStream::FileOutputStream(int file_descriptor, int block_size) + : copying_output_(file_descriptor), + impl_(©ing_output_, block_size) { +} + +FileOutputStream::~FileOutputStream() { + impl_.Flush(); +} bool FileOutputStream::Close() { - bool flush_succeeded = Flush(); + bool flush_succeeded = impl_.Flush(); return copying_output_.Close() && flush_succeeded; } +bool FileOutputStream::Flush() { + return impl_.Flush(); +} + +bool FileOutputStream::Next(void** data, int* size) { + return impl_.Next(data, size); +} + +void FileOutputStream::BackUp(int count) { + impl_.BackUp(count); +} + +int64 FileOutputStream::ByteCount() const { + return impl_.ByteCount(); +} + FileOutputStream::CopyingFileOutputStream::CopyingFileOutputStream( int file_descriptor) - : file_(file_descriptor), - close_on_delete_(false), - is_closed_(false), - errno_(0) {} - -FileOutputStream::~FileOutputStream() { Flush(); } + : file_(file_descriptor), + close_on_delete_(false), + is_closed_(false), + errno_(0) { +} FileOutputStream::CopyingFileOutputStream::~CopyingFileOutputStream() { if (close_on_delete_) { @@ -211,12 +231,12 @@ bool FileOutputStream::CopyingFileOutputStream::Close() { return true; } -bool FileOutputStream::CopyingFileOutputStream::Write(const void* buffer, - int size) { +bool FileOutputStream::CopyingFileOutputStream::Write( + const void* buffer, int size) { GOOGLE_CHECK(!is_closed_); int total_written = 0; - const uint8_t* buffer_base = reinterpret_cast(buffer); + const uint8* buffer_base = reinterpret_cast(buffer); while (total_written < size) { int bytes; @@ -248,27 +268,38 @@ bool FileOutputStream::CopyingFileOutputStream::Write(const void* buffer, // =================================================================== -IstreamInputStream::IstreamInputStream(std::istream* input, int block_size) - : copying_input_(input), impl_(©ing_input_, block_size) {} +IstreamInputStream::IstreamInputStream(istream* input, int block_size) + : copying_input_(input), + impl_(©ing_input_, block_size) { +} + +IstreamInputStream::~IstreamInputStream() {} bool IstreamInputStream::Next(const void** data, int* size) { return impl_.Next(data, size); } -void IstreamInputStream::BackUp(int count) { impl_.BackUp(count); } +void IstreamInputStream::BackUp(int count) { + impl_.BackUp(count); +} -bool IstreamInputStream::Skip(int count) { return impl_.Skip(count); } +bool IstreamInputStream::Skip(int count) { + return impl_.Skip(count); +} -int64_t IstreamInputStream::ByteCount() const { return impl_.ByteCount(); } +int64 IstreamInputStream::ByteCount() const { + return impl_.ByteCount(); +} IstreamInputStream::CopyingIstreamInputStream::CopyingIstreamInputStream( - std::istream* input) - : input_(input) {} + istream* input) + : input_(input) { +} IstreamInputStream::CopyingIstreamInputStream::~CopyingIstreamInputStream() {} -int IstreamInputStream::CopyingIstreamInputStream::Read(void* buffer, - int size) { +int IstreamInputStream::CopyingIstreamInputStream::Read( + void* buffer, int size) { input_->read(reinterpret_cast(buffer), size); int result = input_->gcount(); if (result == 0 && input_->fail() && !input_->eof()) { @@ -279,28 +310,37 @@ int IstreamInputStream::CopyingIstreamInputStream::Read(void* buffer, // =================================================================== -OstreamOutputStream::OstreamOutputStream(std::ostream* output, int block_size) - : copying_output_(output), impl_(©ing_output_, block_size) {} +OstreamOutputStream::OstreamOutputStream(ostream* output, int block_size) + : copying_output_(output), + impl_(©ing_output_, block_size) { +} -OstreamOutputStream::~OstreamOutputStream() { impl_.Flush(); } +OstreamOutputStream::~OstreamOutputStream() { + impl_.Flush(); +} bool OstreamOutputStream::Next(void** data, int* size) { return impl_.Next(data, size); } -void OstreamOutputStream::BackUp(int count) { impl_.BackUp(count); } +void OstreamOutputStream::BackUp(int count) { + impl_.BackUp(count); +} -int64_t OstreamOutputStream::ByteCount() const { return impl_.ByteCount(); } +int64 OstreamOutputStream::ByteCount() const { + return impl_.ByteCount(); +} OstreamOutputStream::CopyingOstreamOutputStream::CopyingOstreamOutputStream( - std::ostream* output) - : output_(output) {} + ostream* output) + : output_(output) { +} OstreamOutputStream::CopyingOstreamOutputStream::~CopyingOstreamOutputStream() { } -bool OstreamOutputStream::CopyingOstreamOutputStream::Write(const void* buffer, - int size) { +bool OstreamOutputStream::CopyingOstreamOutputStream::Write( + const void* buffer, int size) { output_->write(reinterpret_cast(buffer), size); return output_->good(); } @@ -309,7 +349,10 @@ bool OstreamOutputStream::CopyingOstreamOutputStream::Write(const void* buffer, ConcatenatingInputStream::ConcatenatingInputStream( ZeroCopyInputStream* const streams[], int count) - : streams_(streams), stream_count_(count), bytes_retired_(0) { + : streams_(streams), stream_count_(count), bytes_retired_(0) { +} + +ConcatenatingInputStream::~ConcatenatingInputStream() { } bool ConcatenatingInputStream::Next(const void** data, int* size) { @@ -338,12 +381,12 @@ bool ConcatenatingInputStream::Skip(int count) { while (stream_count_ > 0) { // Assume that ByteCount() can be used to find out how much we actually // skipped when Skip() fails. - int64_t target_byte_count = streams_[0]->ByteCount() + count; + int64 target_byte_count = streams_[0]->ByteCount() + count; if (streams_[0]->Skip(count)) return true; // Hit the end of the stream. Figure out how many more bytes we still have // to skip. - int64_t final_byte_count = streams_[0]->ByteCount(); + int64 final_byte_count = streams_[0]->ByteCount(); GOOGLE_DCHECK_LT(final_byte_count, target_byte_count); count = target_byte_count - final_byte_count; @@ -356,7 +399,7 @@ bool ConcatenatingInputStream::Skip(int count) { return false; } -int64_t ConcatenatingInputStream::ByteCount() const { +int64 ConcatenatingInputStream::ByteCount() const { if (stream_count_ == 0) { return bytes_retired_; } else { @@ -365,6 +408,61 @@ int64_t ConcatenatingInputStream::ByteCount() const { } +// =================================================================== + +LimitingInputStream::LimitingInputStream(ZeroCopyInputStream* input, + int64 limit) + : input_(input), limit_(limit) {} + +LimitingInputStream::~LimitingInputStream() { + // If we overshot the limit, back up. + if (limit_ < 0) input_->BackUp(-limit_); +} + +bool LimitingInputStream::Next(const void** data, int* size) { + if (limit_ <= 0) return false; + if (!input_->Next(data, size)) return false; + + limit_ -= *size; + if (limit_ < 0) { + // We overshot the limit. Reduce *size to hide the rest of the buffer. + *size += limit_; + } + return true; +} + +void LimitingInputStream::BackUp(int count) { + if (limit_ < 0) { + input_->BackUp(count - limit_); + limit_ = count; + } else { + input_->BackUp(count); + limit_ += count; + } +} + +bool LimitingInputStream::Skip(int count) { + if (count > limit_) { + if (limit_ < 0) return false; + input_->Skip(limit_); + limit_ = 0; + return false; + } else { + if (!input_->Skip(count)) return false; + limit_ -= count; + return true; + } +} + +int64 LimitingInputStream::ByteCount() const { + if (limit_ < 0) { + return input_->ByteCount() + limit_; + } else { + return input_->ByteCount(); + } +} + + // =================================================================== } // namespace io diff --git a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl.h similarity index 75% rename from depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h rename to depends/protobuf/google/protobuf/io/zero_copy_stream_impl.h index a385992f2..9fedb0057 100644 --- a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +++ b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -40,21 +40,18 @@ #ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_H__ #define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_H__ - -#include #include - -#include +#include #include #include +#include -// Must be included last. -#include namespace google { namespace protobuf { namespace io { + // =================================================================== // A ZeroCopyInputStream which reads from a file descriptor. @@ -63,14 +60,14 @@ namespace io { // The latter will introduce an extra layer of buffering, harming performance. // Also, it's conceivable that FileInputStream could someday be enhanced // to use zero-copy file descriptors on OSs which support them. -class PROTOBUF_EXPORT FileInputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT FileInputStream : public ZeroCopyInputStream { public: // Creates a stream that reads from the given Unix file descriptor. // If a block_size is given, it specifies the number of bytes that // should be read and returned with each call to Next(). Otherwise, // a reasonable default is used. explicit FileInputStream(int file_descriptor, int block_size = -1); + ~FileInputStream(); // Flushes any buffers and closes the underlying file. Returns false if // an error occurs during the process; use GetErrno() to examine the error. @@ -88,28 +85,27 @@ class PROTOBUF_EXPORT FileInputStream PROTOBUF_FUTURE_FINAL // errno from that error. Otherwise, this is zero. Once an error // occurs, the stream is broken and all subsequent operations will // fail. - int GetErrno() const { return copying_input_.GetErrno(); } + int GetErrno() { return copying_input_.GetErrno(); } // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; private: - class PROTOBUF_EXPORT CopyingFileInputStream PROTOBUF_FUTURE_FINAL - : public CopyingInputStream { + class LIBPROTOBUF_EXPORT CopyingFileInputStream : public CopyingInputStream { public: CopyingFileInputStream(int file_descriptor); - ~CopyingFileInputStream() override; + ~CopyingFileInputStream(); bool Close(); void SetCloseOnDelete(bool value) { close_on_delete_ = value; } - int GetErrno() const { return errno_; } + int GetErrno() { return errno_; } // implements CopyingInputStream --------------------------------- - int Read(void* buffer, int size) override; - int Skip(int count) override; + int Read(void* buffer, int size); + int Skip(int count); private: // The file descriptor. @@ -142,22 +138,25 @@ class PROTOBUF_EXPORT FileInputStream PROTOBUF_FUTURE_FINAL // harming performance. Also, it's conceivable that FileOutputStream could // someday be enhanced to use zero-copy file descriptors on OSs which // support them. -class PROTOBUF_EXPORT FileOutputStream PROTOBUF_FUTURE_FINAL - : public CopyingOutputStreamAdaptor { +class LIBPROTOBUF_EXPORT FileOutputStream : public ZeroCopyOutputStream { public: // Creates a stream that writes to the given Unix file descriptor. // If a block_size is given, it specifies the size of the buffers // that should be returned by Next(). Otherwise, a reasonable default // is used. explicit FileOutputStream(int file_descriptor, int block_size = -1); - - ~FileOutputStream() override; + ~FileOutputStream(); // Flushes any buffers and closes the underlying file. Returns false if // an error occurs during the process; use GetErrno() to examine the error. // Even if an error occurs, the file descriptor is closed when this returns. bool Close(); + // Flushes FileOutputStream's buffers but does not close the + // underlying file. No special measures are taken to ensure that + // underlying operating system file object is synchronized to disk. + bool Flush(); + // By default, the file descriptor is not closed when the stream is // destroyed. Call SetCloseOnDelete(true) to change that. WARNING: // This leaves no way for the caller to detect if close() fails. If @@ -169,21 +168,25 @@ class PROTOBUF_EXPORT FileOutputStream PROTOBUF_FUTURE_FINAL // errno from that error. Otherwise, this is zero. Once an error // occurs, the stream is broken and all subsequent operations will // fail. - int GetErrno() const { return copying_output_.GetErrno(); } + int GetErrno() { return copying_output_.GetErrno(); } + + // implements ZeroCopyOutputStream --------------------------------- + bool Next(void** data, int* size); + void BackUp(int count); + int64 ByteCount() const; private: - class PROTOBUF_EXPORT CopyingFileOutputStream PROTOBUF_FUTURE_FINAL - : public CopyingOutputStream { + class LIBPROTOBUF_EXPORT CopyingFileOutputStream : public CopyingOutputStream { public: CopyingFileOutputStream(int file_descriptor); - ~CopyingFileOutputStream() override; + ~CopyingFileOutputStream(); bool Close(); void SetCloseOnDelete(bool value) { close_on_delete_ = value; } - int GetErrno() const { return errno_; } + int GetErrno() { return errno_; } // implements CopyingOutputStream -------------------------------- - bool Write(const void* buffer, int size) override; + bool Write(const void* buffer, int size); private: // The file descriptor. @@ -198,6 +201,7 @@ class PROTOBUF_EXPORT FileOutputStream PROTOBUF_FUTURE_FINAL }; CopyingFileOutputStream copying_output_; + CopyingOutputStreamAdaptor impl_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileOutputStream); }; @@ -208,35 +212,34 @@ class PROTOBUF_EXPORT FileOutputStream PROTOBUF_FUTURE_FINAL // // Note that for reading files (or anything represented by a file descriptor), // FileInputStream is more efficient. -class PROTOBUF_EXPORT IstreamInputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT IstreamInputStream : public ZeroCopyInputStream { public: // Creates a stream that reads from the given C++ istream. // If a block_size is given, it specifies the number of bytes that // should be read and returned with each call to Next(). Otherwise, // a reasonable default is used. - explicit IstreamInputStream(std::istream* stream, int block_size = -1); + explicit IstreamInputStream(istream* stream, int block_size = -1); + ~IstreamInputStream(); // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; private: - class PROTOBUF_EXPORT CopyingIstreamInputStream PROTOBUF_FUTURE_FINAL - : public CopyingInputStream { + class LIBPROTOBUF_EXPORT CopyingIstreamInputStream : public CopyingInputStream { public: - CopyingIstreamInputStream(std::istream* input); - ~CopyingIstreamInputStream() override; + CopyingIstreamInputStream(istream* input); + ~CopyingIstreamInputStream(); // implements CopyingInputStream --------------------------------- - int Read(void* buffer, int size) override; + int Read(void* buffer, int size); // (We use the default implementation of Skip().) private: // The stream. - std::istream* input_; + istream* input_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingIstreamInputStream); }; @@ -253,34 +256,32 @@ class PROTOBUF_EXPORT IstreamInputStream PROTOBUF_FUTURE_FINAL // // Note that for writing files (or anything represented by a file descriptor), // FileOutputStream is more efficient. -class PROTOBUF_EXPORT OstreamOutputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyOutputStream { +class LIBPROTOBUF_EXPORT OstreamOutputStream : public ZeroCopyOutputStream { public: // Creates a stream that writes to the given C++ ostream. // If a block_size is given, it specifies the size of the buffers // that should be returned by Next(). Otherwise, a reasonable default // is used. - explicit OstreamOutputStream(std::ostream* stream, int block_size = -1); - ~OstreamOutputStream() override; + explicit OstreamOutputStream(ostream* stream, int block_size = -1); + ~OstreamOutputStream(); // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size) override; - void BackUp(int count) override; - int64_t ByteCount() const override; + bool Next(void** data, int* size); + void BackUp(int count); + int64 ByteCount() const; private: - class PROTOBUF_EXPORT CopyingOstreamOutputStream PROTOBUF_FUTURE_FINAL - : public CopyingOutputStream { + class LIBPROTOBUF_EXPORT CopyingOstreamOutputStream : public CopyingOutputStream { public: - CopyingOstreamOutputStream(std::ostream* output); - ~CopyingOstreamOutputStream() override; + CopyingOstreamOutputStream(ostream* output); + ~CopyingOstreamOutputStream(); // implements CopyingOutputStream -------------------------------- - bool Write(const void* buffer, int size) override; + bool Write(const void* buffer, int size); private: // The stream. - std::ostream* output_; + ostream* output_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingOstreamOutputStream); }; @@ -300,19 +301,18 @@ class PROTOBUF_EXPORT OstreamOutputStream PROTOBUF_FUTURE_FINAL // ConcatenatingInputStream may do odd things. It is suggested that you do // not use ConcatenatingInputStream on streams that might produce read errors // other than end-of-stream. -class PROTOBUF_EXPORT ConcatenatingInputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT ConcatenatingInputStream : public ZeroCopyInputStream { public: // All streams passed in as well as the array itself must remain valid // until the ConcatenatingInputStream is destroyed. ConcatenatingInputStream(ZeroCopyInputStream* const streams[], int count); - ~ConcatenatingInputStream() override = default; + ~ConcatenatingInputStream(); // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; private: @@ -320,17 +320,38 @@ class PROTOBUF_EXPORT ConcatenatingInputStream PROTOBUF_FUTURE_FINAL // decremented. ZeroCopyInputStream* const* streams_; int stream_count_; - int64_t bytes_retired_; // Bytes read from previous streams. + int64 bytes_retired_; // Bytes read from previous streams. GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ConcatenatingInputStream); }; // =================================================================== +// A ZeroCopyInputStream which wraps some other stream and limits it to +// a particular byte count. +class LIBPROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { + public: + LimitingInputStream(ZeroCopyInputStream* input, int64 limit); + ~LimitingInputStream(); + + // implements ZeroCopyInputStream ---------------------------------- + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; + + + private: + ZeroCopyInputStream* input_; + int64 limit_; // Decreases as we go, becomes negative if we overshoot. + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream); +}; + +// =================================================================== + } // namespace io } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_H__ diff --git a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl_lite.cc similarity index 59% rename from depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc rename to depends/protobuf/google/protobuf/io/zero_copy_stream_impl_lite.cc index b3dfd84c7..e80125109 100644 --- a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -32,15 +32,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#include - -#include -#include - +#include #include -#include -#include -#include +#include namespace google { namespace protobuf { @@ -55,23 +49,28 @@ static const int kDefaultBlockSize = 8192; // =================================================================== -ArrayInputStream::ArrayInputStream(const void* data, int size, int block_size) - : data_(reinterpret_cast(data)), - size_(size), - block_size_(block_size > 0 ? block_size : size), - position_(0), - last_returned_size_(0) {} +ArrayInputStream::ArrayInputStream(const void* data, int size, + int block_size) + : data_(reinterpret_cast(data)), + size_(size), + block_size_(block_size > 0 ? block_size : size), + position_(0), + last_returned_size_(0) { +} + +ArrayInputStream::~ArrayInputStream() { +} bool ArrayInputStream::Next(const void** data, int* size) { if (position_ < size_) { - last_returned_size_ = std::min(block_size_, size_ - position_); + last_returned_size_ = min(block_size_, size_ - position_); *data = data_ + position_; *size = last_returned_size_; position_ += last_returned_size_; return true; } else { // We're at the end of the array. - last_returned_size_ = 0; // Don't let caller back up. + last_returned_size_ = 0; // Don't let caller back up. return false; } } @@ -87,7 +86,7 @@ void ArrayInputStream::BackUp(int count) { bool ArrayInputStream::Skip(int count) { GOOGLE_CHECK_GE(count, 0); - last_returned_size_ = 0; // Don't let caller back up. + last_returned_size_ = 0; // Don't let caller back up. if (count > size_ - position_) { position_ = size_; return false; @@ -97,93 +96,102 @@ bool ArrayInputStream::Skip(int count) { } } -int64_t ArrayInputStream::ByteCount() const { return position_; } +int64 ArrayInputStream::ByteCount() const { + return position_; +} // =================================================================== ArrayOutputStream::ArrayOutputStream(void* data, int size, int block_size) - : data_(reinterpret_cast(data)), - size_(size), - block_size_(block_size > 0 ? block_size : size), - position_(0), - last_returned_size_(0) {} + : data_(reinterpret_cast(data)), + size_(size), + block_size_(block_size > 0 ? block_size : size), + position_(0), + last_returned_size_(0) { +} + +ArrayOutputStream::~ArrayOutputStream() { +} bool ArrayOutputStream::Next(void** data, int* size) { if (position_ < size_) { - last_returned_size_ = std::min(block_size_, size_ - position_); + last_returned_size_ = min(block_size_, size_ - position_); *data = data_ + position_; *size = last_returned_size_; position_ += last_returned_size_; return true; } else { // We're at the end of the array. - last_returned_size_ = 0; // Don't let caller back up. + last_returned_size_ = 0; // Don't let caller back up. return false; } } void ArrayOutputStream::BackUp(int count) { - GOOGLE_CHECK_LE(count, last_returned_size_) - << "BackUp() can not exceed the size of the last Next() call."; + GOOGLE_CHECK_GT(last_returned_size_, 0) + << "BackUp() can only be called after a successful Next()."; + GOOGLE_CHECK_LE(count, last_returned_size_); GOOGLE_CHECK_GE(count, 0); position_ -= count; - last_returned_size_ -= count; + last_returned_size_ = 0; // Don't let caller back up further. } -int64_t ArrayOutputStream::ByteCount() const { return position_; } +int64 ArrayOutputStream::ByteCount() const { + return position_; +} // =================================================================== -StringOutputStream::StringOutputStream(std::string* target) : target_(target) {} +StringOutputStream::StringOutputStream(string* target) + : target_(target) { +} + +StringOutputStream::~StringOutputStream() { +} bool StringOutputStream::Next(void** data, int* size) { - GOOGLE_CHECK(target_ != NULL); - size_t old_size = target_->size(); + int old_size = target_->size(); // Grow the string. - size_t new_size; if (old_size < target_->capacity()) { // Resize the string to match its capacity, since we can get away // without a memory allocation this way. - new_size = target_->capacity(); + STLStringResizeUninitialized(target_, target_->capacity()); } else { - // Size has reached capacity, try to double it. - new_size = old_size * 2; - } - // Avoid integer overflow in returned '*size'. - new_size = std::min(new_size, old_size + std::numeric_limits::max()); - // Increase the size, also make sure that it is at least kMinimumSize. - STLStringResizeUninitialized( + // Size has reached capacity, so double the size. Also make sure + // that the new size is at least kMinimumSize. + STLStringResizeUninitialized( target_, - std::max(new_size, - kMinimumSize + 0)); // "+ 0" works around GCC4 weirdness. + max(old_size * 2, + kMinimumSize + 0)); // "+ 0" works around GCC4 weirdness. + } - *data = mutable_string_data(target_) + old_size; + *data = string_as_array(target_) + old_size; *size = target_->size() - old_size; return true; } void StringOutputStream::BackUp(int count) { GOOGLE_CHECK_GE(count, 0); - GOOGLE_CHECK(target_ != NULL); - GOOGLE_CHECK_LE(static_cast(count), target_->size()); + GOOGLE_CHECK_LE(count, target_->size()); target_->resize(target_->size() - count); } -int64_t StringOutputStream::ByteCount() const { - GOOGLE_CHECK(target_ != NULL); +int64 StringOutputStream::ByteCount() const { return target_->size(); } // =================================================================== +CopyingInputStream::~CopyingInputStream() {} + int CopyingInputStream::Skip(int count) { char junk[4096]; int skipped = 0; while (skipped < count) { - int bytes = Read(junk, std::min(count - skipped, - implicit_cast(sizeof(junk)))); + int bytes = Read(junk, min(count - skipped, + implicit_cast(sizeof(junk)))); if (bytes <= 0) { // EOF or read error. return skipped; @@ -195,13 +203,14 @@ int CopyingInputStream::Skip(int count) { CopyingInputStreamAdaptor::CopyingInputStreamAdaptor( CopyingInputStream* copying_stream, int block_size) - : copying_stream_(copying_stream), - owns_copying_stream_(false), - failed_(false), - position_(0), - buffer_size_(block_size > 0 ? block_size : kDefaultBlockSize), - buffer_used_(0), - backup_bytes_(0) {} + : copying_stream_(copying_stream), + owns_copying_stream_(false), + failed_(false), + position_(0), + buffer_size_(block_size > 0 ? block_size : kDefaultBlockSize), + buffer_used_(0), + backup_bytes_(0) { +} CopyingInputStreamAdaptor::~CopyingInputStreamAdaptor() { if (owns_copying_stream_) { @@ -245,11 +254,12 @@ bool CopyingInputStreamAdaptor::Next(const void** data, int* size) { void CopyingInputStreamAdaptor::BackUp(int count) { GOOGLE_CHECK(backup_bytes_ == 0 && buffer_.get() != NULL) - << " BackUp() can only be called after Next()."; + << " BackUp() can only be called after Next()."; GOOGLE_CHECK_LE(count, buffer_used_) - << " Can't back up over more bytes than were returned by the last call" - " to Next()."; - GOOGLE_CHECK_GE(count, 0) << " Parameter to BackUp() can't be negative."; + << " Can't back up over more bytes than were returned by the last call" + " to Next()."; + GOOGLE_CHECK_GE(count, 0) + << " Parameter to BackUp() can't be negative."; backup_bytes_ = count; } @@ -277,13 +287,13 @@ bool CopyingInputStreamAdaptor::Skip(int count) { return skipped == count; } -int64_t CopyingInputStreamAdaptor::ByteCount() const { +int64 CopyingInputStreamAdaptor::ByteCount() const { return position_ - backup_bytes_; } void CopyingInputStreamAdaptor::AllocateBufferIfNeeded() { if (buffer_.get() == NULL) { - buffer_.reset(new uint8_t[buffer_size_]); + buffer_.reset(new uint8[buffer_size_]); } } @@ -295,14 +305,17 @@ void CopyingInputStreamAdaptor::FreeBuffer() { // =================================================================== +CopyingOutputStream::~CopyingOutputStream() {} + CopyingOutputStreamAdaptor::CopyingOutputStreamAdaptor( CopyingOutputStream* copying_stream, int block_size) - : copying_stream_(copying_stream), - owns_copying_stream_(false), - failed_(false), - position_(0), - buffer_size_(block_size > 0 ? block_size : kDefaultBlockSize), - buffer_used_(0) {} + : copying_stream_(copying_stream), + owns_copying_stream_(false), + failed_(false), + position_(0), + buffer_size_(block_size > 0 ? block_size : kDefaultBlockSize), + buffer_used_(0) { +} CopyingOutputStreamAdaptor::~CopyingOutputStreamAdaptor() { WriteBuffer(); @@ -311,7 +324,9 @@ CopyingOutputStreamAdaptor::~CopyingOutputStreamAdaptor() { } } -bool CopyingOutputStreamAdaptor::Flush() { return WriteBuffer(); } +bool CopyingOutputStreamAdaptor::Flush() { + return WriteBuffer(); +} bool CopyingOutputStreamAdaptor::Next(void** data, int* size) { if (buffer_used_ == buffer_size_) { @@ -327,55 +342,20 @@ bool CopyingOutputStreamAdaptor::Next(void** data, int* size) { } void CopyingOutputStreamAdaptor::BackUp(int count) { - if (count == 0) { - Flush(); - return; - } GOOGLE_CHECK_GE(count, 0); GOOGLE_CHECK_EQ(buffer_used_, buffer_size_) - << " BackUp() can only be called after Next()."; + << " BackUp() can only be called after Next()."; GOOGLE_CHECK_LE(count, buffer_used_) - << " Can't back up over more bytes than were returned by the last call" - " to Next()."; + << " Can't back up over more bytes than were returned by the last call" + " to Next()."; buffer_used_ -= count; } -int64_t CopyingOutputStreamAdaptor::ByteCount() const { +int64 CopyingOutputStreamAdaptor::ByteCount() const { return position_ + buffer_used_; } -bool CopyingOutputStreamAdaptor::WriteAliasedRaw(const void* data, int size) { - if (size >= buffer_size_) { - if (!Flush() || !copying_stream_->Write(data, size)) { - return false; - } - GOOGLE_DCHECK_EQ(buffer_used_, 0); - position_ += size; - return true; - } - - void* out; - int out_size; - while (true) { - if (!Next(&out, &out_size)) { - return false; - } - - if (size <= out_size) { - std::memcpy(out, data, size); - BackUp(out_size - size); - return true; - } - - std::memcpy(out, data, out_size); - data = static_cast(data) + out_size; - size -= out_size; - } - return true; -} - - bool CopyingOutputStreamAdaptor::WriteBuffer() { if (failed_) { // Already failed on a previous write. @@ -397,7 +377,7 @@ bool CopyingOutputStreamAdaptor::WriteBuffer() { void CopyingOutputStreamAdaptor::AllocateBufferIfNeeded() { if (buffer_ == NULL) { - buffer_.reset(new uint8_t[buffer_size_]); + buffer_.reset(new uint8[buffer_size_]); } } @@ -406,63 +386,6 @@ void CopyingOutputStreamAdaptor::FreeBuffer() { buffer_.reset(); } -// =================================================================== - -LimitingInputStream::LimitingInputStream(ZeroCopyInputStream* input, - int64_t limit) - : input_(input), limit_(limit) { - prior_bytes_read_ = input_->ByteCount(); -} - -LimitingInputStream::~LimitingInputStream() { - // If we overshot the limit, back up. - if (limit_ < 0) input_->BackUp(-limit_); -} - -bool LimitingInputStream::Next(const void** data, int* size) { - if (limit_ <= 0) return false; - if (!input_->Next(data, size)) return false; - - limit_ -= *size; - if (limit_ < 0) { - // We overshot the limit. Reduce *size to hide the rest of the buffer. - *size += limit_; - } - return true; -} - -void LimitingInputStream::BackUp(int count) { - if (limit_ < 0) { - input_->BackUp(count - limit_); - limit_ = count; - } else { - input_->BackUp(count); - limit_ += count; - } -} - -bool LimitingInputStream::Skip(int count) { - if (count > limit_) { - if (limit_ < 0) return false; - input_->Skip(limit_); - limit_ = 0; - return false; - } else { - if (!input_->Skip(count)) return false; - limit_ -= count; - return true; - } -} - -int64_t LimitingInputStream::ByteCount() const { - if (limit_ < 0) { - return input_->ByteCount() + limit_ - prior_bytes_read_; - } else { - return input_->ByteCount() - prior_bytes_read_; - } -} - - // =================================================================== } // namespace io diff --git a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl_lite.h similarity index 67% rename from depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h rename to depends/protobuf/google/protobuf/io/zero_copy_stream_impl_lite.h index cbda32871..153f543ee 100644 --- a/depends/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/depends/protobuf/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -44,19 +44,11 @@ #ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ #define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ - -#include -#include #include - -#include -#include +#include #include -#include - +#include -// Must be included last. -#include namespace google { namespace protobuf { @@ -65,8 +57,7 @@ namespace io { // =================================================================== // A ZeroCopyInputStream backed by an in-memory array of bytes. -class PROTOBUF_EXPORT ArrayInputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT ArrayInputStream : public ZeroCopyInputStream { public: // Create an InputStream that returns the bytes pointed to by "data". // "data" remains the property of the caller but must remain valid until @@ -76,23 +67,23 @@ class PROTOBUF_EXPORT ArrayInputStream PROTOBUF_FUTURE_FINAL // useful for testing; in production you would probably never want to set // it. ArrayInputStream(const void* data, int size, int block_size = -1); - ~ArrayInputStream() override = default; + ~ArrayInputStream(); // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; private: - const uint8_t* const data_; // The byte array. + const uint8* const data_; // The byte array. const int size_; // Total size of the array. const int block_size_; // How many bytes to return at a time. int position_; - int last_returned_size_; // How many bytes we returned last time Next() - // was called (used for error checking only). + int last_returned_size_; // How many bytes we returned last time Next() + // was called (used for error checking only). GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArrayInputStream); }; @@ -100,8 +91,7 @@ class PROTOBUF_EXPORT ArrayInputStream PROTOBUF_FUTURE_FINAL // =================================================================== // A ZeroCopyOutputStream backed by an in-memory array of bytes. -class PROTOBUF_EXPORT ArrayOutputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyOutputStream { +class LIBPROTOBUF_EXPORT ArrayOutputStream : public ZeroCopyOutputStream { public: // Create an OutputStream that writes to the bytes pointed to by "data". // "data" remains the property of the caller but must remain valid until @@ -111,21 +101,21 @@ class PROTOBUF_EXPORT ArrayOutputStream PROTOBUF_FUTURE_FINAL // useful for testing; in production you would probably never want to set // it. ArrayOutputStream(void* data, int size, int block_size = -1); - ~ArrayOutputStream() override = default; + ~ArrayOutputStream(); // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size) override; - void BackUp(int count) override; - int64_t ByteCount() const override; + bool Next(void** data, int* size); + void BackUp(int count); + int64 ByteCount() const; private: - uint8_t* const data_; // The byte array. - const int size_; // Total size of the array. - const int block_size_; // How many bytes to return at a time. + uint8* const data_; // The byte array. + const int size_; // Total size of the array. + const int block_size_; // How many bytes to return at a time. int position_; - int last_returned_size_; // How many bytes we returned last time Next() - // was called (used for error checking only). + int last_returned_size_; // How many bytes we returned last time Next() + // was called (used for error checking only). GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArrayOutputStream); }; @@ -133,30 +123,27 @@ class PROTOBUF_EXPORT ArrayOutputStream PROTOBUF_FUTURE_FINAL // =================================================================== // A ZeroCopyOutputStream which appends bytes to a string. -class PROTOBUF_EXPORT StringOutputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyOutputStream { +class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream { public: // Create a StringOutputStream which appends bytes to the given string. - // The string remains property of the caller, but it is mutated in arbitrary - // ways and MUST NOT be accessed in any way until you're done with the - // stream. Either be sure there's no further usage, or (safest) destroy the - // stream before using the contents. + // The string remains property of the caller, but it MUST NOT be accessed + // in any way until the stream is destroyed. // // Hint: If you call target->reserve(n) before creating the stream, // the first call to Next() will return at least n bytes of buffer // space. - explicit StringOutputStream(std::string* target); - ~StringOutputStream() override = default; + explicit StringOutputStream(string* target); + ~StringOutputStream(); // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size) override; - void BackUp(int count) override; - int64_t ByteCount() const override; + bool Next(void** data, int* size); + void BackUp(int count); + int64 ByteCount() const; private: - static constexpr size_t kMinimumSize = 16; + static const int kMinimumSize = 16; - std::string* target_; + string* target_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOutputStream); }; @@ -178,9 +165,9 @@ class PROTOBUF_EXPORT StringOutputStream PROTOBUF_FUTURE_FINAL // CopyingInputStream implementations should avoid buffering if possible. // CopyingInputStreamAdaptor does its own buffering and will read data // in large blocks. -class PROTOBUF_EXPORT CopyingInputStream { +class LIBPROTOBUF_EXPORT CopyingInputStream { public: - virtual ~CopyingInputStream() {} + virtual ~CopyingInputStream(); // Reads up to "size" bytes into the given buffer. Returns the number of // bytes read. Read() waits until at least one byte is available, or @@ -204,7 +191,7 @@ class PROTOBUF_EXPORT CopyingInputStream { // If you want to read from file descriptors or C++ istreams, this is // already implemented for you: use FileInputStream or IstreamInputStream // respectively. -class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { +class LIBPROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { public: // Creates a stream that reads from the given CopyingInputStream. // If a block_size is given, it specifies the number of bytes that @@ -213,17 +200,17 @@ class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { // copying_stream unless SetOwnsCopyingStream(true) is called. explicit CopyingInputStreamAdaptor(CopyingInputStream* copying_stream, int block_size = -1); - ~CopyingInputStreamAdaptor() override; + ~CopyingInputStreamAdaptor(); // Call SetOwnsCopyingStream(true) to tell the CopyingInputStreamAdaptor to // delete the underlying CopyingInputStream when it is destroyed. void SetOwnsCopyingStream(bool value) { owns_copying_stream_ = value; } // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; + bool Next(const void** data, int* size); + void BackUp(int count); + bool Skip(int count); + int64 ByteCount() const; private: // Insures that buffer_ is not NULL. @@ -235,16 +222,16 @@ class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { CopyingInputStream* copying_stream_; bool owns_copying_stream_; - // True if we have seen a permanent error from the underlying stream. + // True if we have seen a permenant error from the underlying stream. bool failed_; // The current position of copying_stream_, relative to the point where // we started reading. - int64_t position_; + int64 position_; // Data is read into this buffer. It may be NULL if no buffer is currently // in use. Otherwise, it points to an array of size buffer_size_. - std::unique_ptr buffer_; + scoped_array buffer_; const int buffer_size_; // Number of valid bytes currently in the buffer (i.e. the size last @@ -272,9 +259,9 @@ class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { // CopyingOutputStream implementations should avoid buffering if possible. // CopyingOutputStreamAdaptor does its own buffering and will write data // in large blocks. -class PROTOBUF_EXPORT CopyingOutputStream { +class LIBPROTOBUF_EXPORT CopyingOutputStream { public: - virtual ~CopyingOutputStream() {} + virtual ~CopyingOutputStream(); // Writes "size" bytes from the given buffer to the output. Returns true // if successful, false on a write error. @@ -288,7 +275,7 @@ class PROTOBUF_EXPORT CopyingOutputStream { // If you want to write to file descriptors or C++ ostreams, this is // already implemented for you: use FileOutputStream or OstreamOutputStream // respectively. -class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { +class LIBPROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { public: // Creates a stream that writes to the given Unix file descriptor. // If a block_size is given, it specifies the size of the buffers @@ -296,7 +283,7 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { // is used. explicit CopyingOutputStreamAdaptor(CopyingOutputStream* copying_stream, int block_size = -1); - ~CopyingOutputStreamAdaptor() override; + ~CopyingOutputStreamAdaptor(); // Writes all pending data to the underlying stream. Returns false if a // write error occurred on the underlying stream. (The underlying @@ -308,11 +295,9 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { void SetOwnsCopyingStream(bool value) { owns_copying_stream_ = value; } // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size) override; - void BackUp(int count) override; - int64_t ByteCount() const override; - bool WriteAliasedRaw(const void* data, int size) override; - bool AllowsAliasing() const override { return true; } + bool Next(void** data, int* size); + void BackUp(int count); + int64 ByteCount() const; private: // Write the current buffer, if it is present. @@ -326,16 +311,16 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { CopyingOutputStream* copying_stream_; bool owns_copying_stream_; - // True if we have seen a permanent error from the underlying stream. + // True if we have seen a permenant error from the underlying stream. bool failed_; // The current position of copying_stream_, relative to the point where // we started writing. - int64_t position_; + int64 position_; // Data is written from this buffer. It may be NULL if no buffer is // currently in use. Otherwise, it points to an array of size buffer_size_. - std::unique_ptr buffer_; + scoped_array buffer_; const int buffer_size_; // Number of valid bytes currently in the buffer (i.e. the size last @@ -348,66 +333,8 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { // =================================================================== -// A ZeroCopyInputStream which wraps some other stream and limits it to -// a particular byte count. -class PROTOBUF_EXPORT LimitingInputStream PROTOBUF_FUTURE_FINAL - : public ZeroCopyInputStream { - public: - LimitingInputStream(ZeroCopyInputStream* input, int64_t limit); - ~LimitingInputStream() override; - - // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size) override; - void BackUp(int count) override; - bool Skip(int count) override; - int64_t ByteCount() const override; - - - private: - ZeroCopyInputStream* input_; - int64_t limit_; // Decreases as we go, becomes negative if we overshoot. - int64_t prior_bytes_read_; // Bytes read on underlying stream at construction - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream); -}; - - -// =================================================================== - -// mutable_string_data() and as_string_data() are workarounds to improve -// the performance of writing new data to an existing string. Unfortunately -// the methods provided by the string class are suboptimal, and using memcpy() -// is mildly annoying because it requires its pointer args to be non-NULL even -// if we ask it to copy 0 bytes. Furthermore, string_as_array() has the -// property that it always returns NULL if its arg is the empty string, exactly -// what we want to avoid if we're using it in conjunction with memcpy()! -// With C++11, the desired memcpy() boils down to memcpy(..., &(*s)[0], size), -// where s is a string*. Without C++11, &(*s)[0] is not guaranteed to be safe, -// so we use string_as_array(), and live with the extra logic that tests whether -// *s is empty. - -// Return a pointer to mutable characters underlying the given string. The -// return value is valid until the next time the string is resized. We -// trust the caller to treat the return value as an array of length s->size(). -inline char* mutable_string_data(std::string* s) { - // This should be simpler & faster than string_as_array() because the latter - // is guaranteed to return NULL when *s is empty, so it has to check for that. - return &(*s)[0]; -} - -// as_string_data(s) is equivalent to -// ({ char* p = mutable_string_data(s); make_pair(p, p != NULL); }) -// Sometimes it's faster: in some scenarios p cannot be NULL, and then the -// code can avoid that check. -inline std::pair as_string_data(std::string* s) { - char* p = mutable_string_data(s); - return std::make_pair(p, true); -} - } // namespace io } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ diff --git a/depends/protobuf/google/protobuf/message.cc b/depends/protobuf/google/protobuf/message.cc new file mode 100644 index 000000000..37db6a485 --- /dev/null +++ b/depends/protobuf/google/protobuf/message.cc @@ -0,0 +1,319 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { + +using internal::WireFormat; +using internal::ReflectionOps; + +Message::~Message() {} + +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); +} + +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(vector* errors) const { + return ReflectionOps::FindInitializationErrors(*this, "", errors); +} + +string Message::InitializationErrorString() const { + vector errors; + FindInitializationErrors(&errors); + return JoinStrings(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); +} + +bool Message::MergePartialFromCodedStream(io::CodedInputStream* input) { + return WireFormat::ParseAndMergePartial(input, this); +} + +bool Message::ParseFromFileDescriptor(int file_descriptor) { + io::FileInputStream input(file_descriptor); + return ParseFromZeroCopyStream(&input) && input.GetErrno() == 0; +} + +bool Message::ParsePartialFromFileDescriptor(int file_descriptor) { + io::FileInputStream input(file_descriptor); + return ParsePartialFromZeroCopyStream(&input) && input.GetErrno() == 0; +} + +bool Message::ParseFromIstream(istream* input) { + io::IstreamInputStream zero_copy_input(input); + return ParseFromZeroCopyStream(&zero_copy_input) && input->eof(); +} + +bool Message::ParsePartialFromIstream(istream* input) { + io::IstreamInputStream zero_copy_input(input); + return ParsePartialFromZeroCopyStream(&zero_copy_input) && input->eof(); +} + + +void Message::SerializeWithCachedSizes( + io::CodedOutputStream* output) const { + WireFormat::SerializeWithCachedSizes(*this, GetCachedSize(), output); +} + +int Message::ByteSize() const { + int size = WireFormat::ByteSize(*this); + SetCachedSize(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."; +} + +int Message::SpaceUsed() const { + return GetReflection()->SpaceUsed(*this); +} + +bool Message::SerializeToFileDescriptor(int file_descriptor) const { + io::FileOutputStream output(file_descriptor); + return SerializeToZeroCopyStream(&output); +} + +bool Message::SerializePartialToFileDescriptor(int file_descriptor) const { + io::FileOutputStream output(file_descriptor); + return SerializePartialToZeroCopyStream(&output); +} + +bool Message::SerializeToOstream(ostream* output) const { + { + io::OstreamOutputStream zero_copy_output(output); + if (!SerializeToZeroCopyStream(&zero_copy_output)) return false; + } + return output->good(); +} + +bool Message::SerializePartialToOstream(ostream* output) const { + io::OstreamOutputStream zero_copy_output(output); + return SerializePartialToZeroCopyStream(&zero_copy_output); +} + + +Reflection::~Reflection() {} + +// =================================================================== +// MessageFactory + +MessageFactory::~MessageFactory() {} + +namespace { + +class GeneratedMessageFactory : public MessageFactory { + public: + GeneratedMessageFactory(); + ~GeneratedMessageFactory(); + + static GeneratedMessageFactory* singleton(); + + typedef void RegistrationFunc(const string&); + void RegisterFile(const char* file, RegistrationFunc* registration_func); + void RegisterType(const Descriptor* descriptor, const Message* prototype); + + // implements MessageFactory --------------------------------------- + const Message* GetPrototype(const Descriptor* type); + + private: + // Only written at static init time, so does not require locking. + hash_map, streq> file_map_; + + // Initialized lazily, so requires locking. + Mutex mutex_; + hash_map type_map_; +}; + +GeneratedMessageFactory* generated_message_factory_ = NULL; +GOOGLE_PROTOBUF_DECLARE_ONCE(generated_message_factory_once_init_); + +void ShutdownGeneratedMessageFactory() { + delete generated_message_factory_; +} + +void InitGeneratedMessageFactory() { + generated_message_factory_ = new GeneratedMessageFactory; + internal::OnShutdown(&ShutdownGeneratedMessageFactory); +} + +GeneratedMessageFactory::GeneratedMessageFactory() {} +GeneratedMessageFactory::~GeneratedMessageFactory() {} + +GeneratedMessageFactory* GeneratedMessageFactory::singleton() { + ::google::protobuf::GoogleOnceInit(&generated_message_factory_once_init_, + &InitGeneratedMessageFactory); + return generated_message_factory_; +} + +void GeneratedMessageFactory::RegisterFile( + const char* file, RegistrationFunc* registration_func) { + if (!InsertIfNotPresent(&file_map_, file, registration_func)) { + GOOGLE_LOG(FATAL) << "File is already registered: " << file; + } +} + +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. + RegistrationFunc* registration_func = + FindPtrOrNull(file_map_, type->file()->name().c_str()); + if (registration_func == 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. + registration_func(type->file()->name()); + // 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 char* filename, void (*register_messages)(const string&)) { + GeneratedMessageFactory::singleton()->RegisterFile(filename, + register_messages); +} + +void MessageFactory::InternalRegisterGeneratedMessage( + const Descriptor* descriptor, const Message* prototype) { + GeneratedMessageFactory::singleton()->RegisterType(descriptor, prototype); +} + + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/message.h b/depends/protobuf/google/protobuf/message.h new file mode 100644 index 000000000..4bbc64183 --- /dev/null +++ b/depends/protobuf/google/protobuf/message.h @@ -0,0 +1,692 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Defines Message, the abstract interface implemented by non-lite +// protocol message objects. Although it's possible to implement this +// interface manually, most users will use the protocol compiler to +// generate implementations. +// +// Example usage: +// +// Say you have a message defined as: +// +// message Foo { +// optional string text = 1; +// repeated int32 numbers = 2; +// } +// +// Then, if you used the protocol compiler to generate a class from the above +// definition, you could use it like so: +// +// string data; // Will store a serialized version of the message. +// +// { +// // Create a message and serialize it. +// Foo foo; +// foo.set_text("Hello World!"); +// foo.add_numbers(1); +// foo.add_numbers(5); +// foo.add_numbers(42); +// +// foo.SerializeToString(&data); +// } +// +// { +// // Parse the serialized message and check that it contains the +// // correct data. +// Foo foo; +// foo.ParseFromString(data); +// +// assert(foo.text() == "Hello World!"); +// assert(foo.numbers_size() == 3); +// assert(foo.numbers(0) == 1); +// assert(foo.numbers(1) == 5); +// assert(foo.numbers(2) == 42); +// } +// +// { +// // Same as the last block, but do it dynamically via the Message +// // reflection interface. +// Message* foo = new Foo; +// Descriptor* descriptor = foo->GetDescriptor(); +// +// // Get the descriptors for the fields we're interested in and verify +// // their types. +// FieldDescriptor* text_field = descriptor->FindFieldByName("text"); +// assert(text_field != NULL); +// assert(text_field->type() == FieldDescriptor::TYPE_STRING); +// assert(text_field->label() == FieldDescriptor::TYPE_OPTIONAL); +// FieldDescriptor* numbers_field = descriptor->FindFieldByName("numbers"); +// assert(numbers_field != NULL); +// assert(numbers_field->type() == FieldDescriptor::TYPE_INT32); +// assert(numbers_field->label() == FieldDescriptor::TYPE_REPEATED); +// +// // Parse the message. +// foo->ParseFromString(data); +// +// // Use the reflection interface to examine the contents. +// const Reflection* reflection = foo->GetReflection(); +// assert(reflection->GetString(foo, text_field) == "Hello World!"); +// assert(reflection->FieldSize(foo, numbers_field) == 3); +// assert(reflection->GetRepeatedInt32(foo, numbers_field, 0) == 1); +// assert(reflection->GetRepeatedInt32(foo, numbers_field, 1) == 5); +// assert(reflection->GetRepeatedInt32(foo, numbers_field, 2) == 42); +// +// delete foo; +// } + +#ifndef GOOGLE_PROTOBUF_MESSAGE_H__ +#define GOOGLE_PROTOBUF_MESSAGE_H__ + +#include +#include + +#ifdef __DECCXX +// HP C++'s iosfwd doesn't work. +#include +#else +#include +#endif + +#include + +#include + + +namespace google { +namespace protobuf { + +// Defined in this file. +class Message; +class Reflection; +class MessageFactory; + +// Defined in other files. +class Descriptor; // descriptor.h +class FieldDescriptor; // descriptor.h +class EnumDescriptor; // descriptor.h +class EnumValueDescriptor; // descriptor.h +namespace io { + class ZeroCopyInputStream; // zero_copy_stream.h + class ZeroCopyOutputStream; // zero_copy_stream.h + class CodedInputStream; // coded_stream.h + class CodedOutputStream; // coded_stream.h +} +class UnknownFieldSet; // unknown_field_set.h + +// A container to hold message metadata. +struct Metadata { + const Descriptor* descriptor; + const Reflection* reflection; +}; + +// Returns the EnumDescriptor for enum type E, which must be a +// proto-declared enum type. Code generated by the protocol compiler +// will include specializations of this template for each enum type declared. +template +const EnumDescriptor* GetEnumDescriptor(); + +// Abstract interface for protocol messages. +// +// See also MessageLite, which contains most every-day operations. Message +// adds descriptors and reflection on top of that. +// +// The methods of this class that are virtual but not pure-virtual have +// default implementations based on reflection. Message classes which are +// optimized for speed will want to override these with faster implementations, +// but classes optimized for code size may be happy with keeping them. See +// the optimize_for option in descriptor.proto. +class LIBPROTOBUF_EXPORT Message : public MessageLite { + public: + inline Message() {} + virtual ~Message(); + + // Basic Operations ------------------------------------------------ + + // Construct a new instance of the same type. Ownership is passed to the + // caller. (This is also defined in MessageLite, but is defined again here + // for return-type covariance.) + virtual Message* New() const = 0; + + // Make this message into a copy of the given message. The given message + // must have the same descriptor, but need not necessarily be the same class. + // By default this is just implemented as "Clear(); MergeFrom(from);". + virtual void CopyFrom(const Message& from); + + // Merge the fields from the given message into this message. Singular + // fields will be overwritten, except for embedded messages which will + // be merged. Repeated fields will be concatenated. The given message + // must be of the same type as this message (i.e. the exact same class). + virtual void MergeFrom(const Message& from); + + // Verifies that IsInitialized() returns true. GOOGLE_CHECK-fails otherwise, with + // a nice error message. + void CheckInitialized() const; + + // Slowly build a list of all required fields that are not set. + // This is much, much slower than IsInitialized() as it is implemented + // purely via reflection. Generally, you should not call this unless you + // have already determined that an error exists by calling IsInitialized(). + void FindInitializationErrors(vector* errors) const; + + // Like FindInitializationErrors, but joins all the strings, delimited by + // commas, and returns them. + string InitializationErrorString() const; + + // Clears all unknown fields from this message and all embedded messages. + // Normally, if unknown tag numbers are encountered when parsing a message, + // the tag and value are stored in the message's UnknownFieldSet and + // then written back out when the message is serialized. This allows servers + // which simply route messages to other servers to pass through messages + // that have new field definitions which they don't yet know about. However, + // this behavior can have security implications. To avoid it, call this + // method after parsing. + // + // See Reflection::GetUnknownFields() for more on unknown fields. + virtual void DiscardUnknownFields(); + + // Computes (an estimate of) the total number of bytes currently used for + // storing the message in memory. The default implementation calls the + // Reflection object's SpaceUsed() method. + virtual int SpaceUsed() const; + + // Debugging & Testing---------------------------------------------- + + // Generates a human readable form of this message, useful for debugging + // and other purposes. + string DebugString() const; + // Like DebugString(), but with less whitespace. + string ShortDebugString() const; + // Like DebugString(), but do not escape UTF-8 byte sequences. + string Utf8DebugString() const; + // Convenience function useful in GDB. Prints DebugString() to stdout. + void PrintDebugString() const; + + // Heavy I/O ------------------------------------------------------- + // Additional parsing and serialization methods not implemented by + // MessageLite because they are not supported by the lite library. + + // Parse a protocol buffer from a file descriptor. If successful, the entire + // input will be consumed. + bool ParseFromFileDescriptor(int file_descriptor); + // Like ParseFromFileDescriptor(), but accepts messages that are missing + // required fields. + bool ParsePartialFromFileDescriptor(int file_descriptor); + // Parse a protocol buffer from a C++ istream. If successful, the entire + // input will be consumed. + bool ParseFromIstream(istream* input); + // Like ParseFromIstream(), but accepts messages that are missing + // required fields. + bool ParsePartialFromIstream(istream* input); + + // Serialize the message and write it to the given file descriptor. All + // required fields must be set. + bool SerializeToFileDescriptor(int file_descriptor) const; + // Like SerializeToFileDescriptor(), but allows missing required fields. + bool SerializePartialToFileDescriptor(int file_descriptor) const; + // Serialize the message and write it to the given C++ ostream. All + // required fields must be set. + bool SerializeToOstream(ostream* output) const; + // Like SerializeToOstream(), but allows missing required fields. + bool SerializePartialToOstream(ostream* output) const; + + + // Reflection-based methods ---------------------------------------- + // These methods are pure-virtual in MessageLite, but Message provides + // reflection-based default implementations. + + virtual string GetTypeName() const; + virtual void Clear(); + virtual bool IsInitialized() const; + virtual void CheckTypeAndMergeFrom(const MessageLite& other); + virtual bool MergePartialFromCodedStream(io::CodedInputStream* input); + virtual int ByteSize() const; + virtual void SerializeWithCachedSizes(io::CodedOutputStream* output) const; + + private: + // This is called only by the default implementation of ByteSize(), to + // update the cached size. If you override ByteSize(), you do not need + // to override this. If you do not override ByteSize(), you MUST override + // this; the default implementation will crash. + // + // The method is private because subclasses should never call it; only + // override it. Yes, C++ lets you do that. Crazy, huh? + virtual void SetCachedSize(int size) const; + + public: + + // Introspection --------------------------------------------------- + + // Typedef for backwards-compatibility. + typedef google::protobuf::Reflection Reflection; + + // Get a Descriptor for this message's type. This describes what + // fields the message contains, the types of those fields, etc. + const Descriptor* GetDescriptor() const { return GetMetadata().descriptor; } + + // Get the Reflection interface for this Message, which can be used to + // read and modify the fields of the Message dynamically (in other words, + // without knowing the message type at compile time). This object remains + // property of the Message. + // + // This method remains virtual in case a subclass does not implement + // reflection and wants to override the default behavior. + virtual const Reflection* GetReflection() const { + return GetMetadata().reflection; + } + + protected: + // Get a struct containing the metadata for the Message. Most subclasses only + // need to implement this method, rather than the GetDescriptor() and + // GetReflection() wrappers. + virtual Metadata GetMetadata() const = 0; + + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Message); +}; + +// This interface contains methods that can be used to dynamically access +// and modify the fields of a protocol message. Their semantics are +// similar to the accessors the protocol compiler generates. +// +// To get the Reflection for a given Message, call Message::GetReflection(). +// +// This interface is separate from Message only for efficiency reasons; +// the vast majority of implementations of Message will share the same +// implementation of Reflection (GeneratedMessageReflection, +// defined in generated_message.h), and all Messages of a particular class +// should share the same Reflection object (though you should not rely on +// the latter fact). +// +// There are several ways that these methods can be used incorrectly. For +// example, any of the following conditions will lead to undefined +// results (probably assertion failures): +// - The FieldDescriptor is not a field of this message type. +// - The method called is not appropriate for the field's type. For +// each field type in FieldDescriptor::TYPE_*, there is only one +// Get*() method, one Set*() method, and one Add*() method that is +// valid for that type. It should be obvious which (except maybe +// for TYPE_BYTES, which are represented using strings in C++). +// - A Get*() or Set*() method for singular fields is called on a repeated +// field. +// - GetRepeated*(), SetRepeated*(), or Add*() is called on a non-repeated +// field. +// - The Message object passed to any method is not of the right type for +// this Reflection object (i.e. message.GetReflection() != reflection). +// +// You might wonder why there is not any abstract representation for a field +// of arbitrary type. E.g., why isn't there just a "GetField()" method that +// returns "const Field&", where "Field" is some class with accessors like +// "GetInt32Value()". The problem is that someone would have to deal with +// allocating these Field objects. For generated message classes, having to +// allocate space for an additional object to wrap every field would at least +// double the message's memory footprint, probably worse. Allocating the +// objects on-demand, on the other hand, would be expensive and prone to +// memory leaks. So, instead we ended up with this flat interface. +// +// TODO(kenton): Create a utility class which callers can use to read and +// write fields from a Reflection without paying attention to the type. +class LIBPROTOBUF_EXPORT Reflection { + public: + // TODO(kenton): Remove parameter. + inline Reflection() {} + virtual ~Reflection(); + + // Get the UnknownFieldSet for the message. This contains fields which + // were seen when the Message was parsed but were not recognized according + // to the Message's definition. + virtual const UnknownFieldSet& GetUnknownFields( + const Message& message) const = 0; + // Get a mutable pointer to the UnknownFieldSet for the message. This + // contains fields which were seen when the Message was parsed but were not + // recognized according to the Message's definition. + virtual UnknownFieldSet* MutableUnknownFields(Message* message) const = 0; + + // Estimate the amount of memory used by the message object. + virtual int SpaceUsed(const Message& message) const = 0; + + // Check if the given non-repeated field is set. + virtual bool HasField(const Message& message, + const FieldDescriptor* field) const = 0; + + // Get the number of elements of a repeated field. + virtual int FieldSize(const Message& message, + const FieldDescriptor* field) const = 0; + + // Clear the value of a field, so that HasField() returns false or + // FieldSize() returns zero. + virtual void ClearField(Message* message, + const FieldDescriptor* field) const = 0; + + // Remove the last element of a repeated field. + // We don't provide a way to remove any element other than the last + // because it invites inefficient use, such as O(n^2) filtering loops + // that should have been O(n). If you want to remove an element other + // than the last, the best way to do it is to re-arrange the elements + // (using Swap()) so that the one you want removed is at the end, then + // call RemoveLast(). + virtual void RemoveLast(Message* message, + const FieldDescriptor* field) const = 0; + + // Swap the complete contents of two messages. + virtual void Swap(Message* message1, Message* message2) const = 0; + + // Swap two elements of a repeated field. + virtual void SwapElements(Message* message, + const FieldDescriptor* field, + int index1, + int index2) const = 0; + + // List all fields of the message which are currently set. This includes + // extensions. Singular fields will only be listed if HasField(field) would + // return true and repeated fields will only be listed if FieldSize(field) + // would return non-zero. Fields (both normal fields and extension fields) + // will be listed ordered by field number. + virtual void ListFields(const Message& message, + vector* output) const = 0; + + // Singular field getters ------------------------------------------ + // These get the value of a non-repeated field. They return the default + // value for fields that aren't set. + + virtual int32 GetInt32 (const Message& message, + const FieldDescriptor* field) const = 0; + virtual int64 GetInt64 (const Message& message, + const FieldDescriptor* field) const = 0; + virtual uint32 GetUInt32(const Message& message, + const FieldDescriptor* field) const = 0; + virtual uint64 GetUInt64(const Message& message, + const FieldDescriptor* field) const = 0; + virtual float GetFloat (const Message& message, + const FieldDescriptor* field) const = 0; + virtual double GetDouble(const Message& message, + const FieldDescriptor* field) const = 0; + virtual bool GetBool (const Message& message, + const FieldDescriptor* field) const = 0; + virtual string GetString(const Message& message, + const FieldDescriptor* field) const = 0; + virtual const EnumValueDescriptor* GetEnum( + const Message& message, const FieldDescriptor* field) const = 0; + // See MutableMessage() for the meaning of the "factory" parameter. + virtual const Message& GetMessage(const Message& message, + const FieldDescriptor* field, + MessageFactory* factory = NULL) const = 0; + + // Get a string value without copying, if possible. + // + // GetString() necessarily returns a copy of the string. This can be + // inefficient when the string is already stored in a string object in the + // underlying message. GetStringReference() will return a reference to the + // underlying string in this case. Otherwise, it will copy the string into + // *scratch and return that. + // + // Note: It is perfectly reasonable and useful to write code like: + // str = reflection->GetStringReference(field, &str); + // This line would ensure that only one copy of the string is made + // regardless of the field's underlying representation. When initializing + // a newly-constructed string, though, it's just as fast and more readable + // to use code like: + // string str = reflection->GetString(field); + virtual const string& GetStringReference(const Message& message, + const FieldDescriptor* field, + string* scratch) const = 0; + + + // Singular field mutators ----------------------------------------- + // These mutate the value of a non-repeated field. + + virtual void SetInt32 (Message* message, + const FieldDescriptor* field, int32 value) const = 0; + virtual void SetInt64 (Message* message, + const FieldDescriptor* field, int64 value) const = 0; + virtual void SetUInt32(Message* message, + const FieldDescriptor* field, uint32 value) const = 0; + virtual void SetUInt64(Message* message, + const FieldDescriptor* field, uint64 value) const = 0; + virtual void SetFloat (Message* message, + const FieldDescriptor* field, float value) const = 0; + virtual void SetDouble(Message* message, + const FieldDescriptor* field, double value) const = 0; + virtual void SetBool (Message* message, + const FieldDescriptor* field, bool value) const = 0; + virtual void SetString(Message* message, + const FieldDescriptor* field, + const string& value) const = 0; + virtual void SetEnum (Message* message, + const FieldDescriptor* field, + const EnumValueDescriptor* value) const = 0; + // Get a mutable pointer to a field with a message type. If a MessageFactory + // is provided, it will be used to construct instances of the sub-message; + // otherwise, the default factory is used. If the field is an extension that + // does not live in the same pool as the containing message's descriptor (e.g. + // it lives in an overlay pool), then a MessageFactory must be provided. + // If you have no idea what that meant, then you probably don't need to worry + // about it (don't provide a MessageFactory). WARNING: If the + // FieldDescriptor is for a compiled-in extension, then + // factory->GetPrototype(field->message_type() MUST return an instance of the + // compiled-in class for this type, NOT DynamicMessage. + virtual Message* MutableMessage(Message* message, + const FieldDescriptor* field, + MessageFactory* factory = NULL) const = 0; + + + // Repeated field getters ------------------------------------------ + // These get the value of one element of a repeated field. + + virtual int32 GetRepeatedInt32 (const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual int64 GetRepeatedInt64 (const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual uint32 GetRepeatedUInt32(const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual uint64 GetRepeatedUInt64(const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual float GetRepeatedFloat (const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual double GetRepeatedDouble(const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual bool GetRepeatedBool (const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual string GetRepeatedString(const Message& message, + const FieldDescriptor* field, + int index) const = 0; + virtual const EnumValueDescriptor* GetRepeatedEnum( + const Message& message, + const FieldDescriptor* field, int index) const = 0; + virtual const Message& GetRepeatedMessage( + const Message& message, + const FieldDescriptor* field, int index) const = 0; + + // See GetStringReference(), above. + virtual const string& GetRepeatedStringReference( + const Message& message, const FieldDescriptor* field, + int index, string* scratch) const = 0; + + + // Repeated field mutators ----------------------------------------- + // These mutate the value of one element of a repeated field. + + virtual void SetRepeatedInt32 (Message* message, + const FieldDescriptor* field, + int index, int32 value) const = 0; + virtual void SetRepeatedInt64 (Message* message, + const FieldDescriptor* field, + int index, int64 value) const = 0; + virtual void SetRepeatedUInt32(Message* message, + const FieldDescriptor* field, + int index, uint32 value) const = 0; + virtual void SetRepeatedUInt64(Message* message, + const FieldDescriptor* field, + int index, uint64 value) const = 0; + virtual void SetRepeatedFloat (Message* message, + const FieldDescriptor* field, + int index, float value) const = 0; + virtual void SetRepeatedDouble(Message* message, + const FieldDescriptor* field, + int index, double value) const = 0; + virtual void SetRepeatedBool (Message* message, + const FieldDescriptor* field, + int index, bool value) const = 0; + virtual void SetRepeatedString(Message* message, + const FieldDescriptor* field, + int index, const string& value) const = 0; + virtual void SetRepeatedEnum(Message* message, + const FieldDescriptor* field, int index, + const EnumValueDescriptor* value) const = 0; + // Get a mutable pointer to an element of a repeated field with a message + // type. + virtual Message* MutableRepeatedMessage( + Message* message, const FieldDescriptor* field, int index) const = 0; + + + // Repeated field adders ------------------------------------------- + // These add an element to a repeated field. + + virtual void AddInt32 (Message* message, + const FieldDescriptor* field, int32 value) const = 0; + virtual void AddInt64 (Message* message, + const FieldDescriptor* field, int64 value) const = 0; + virtual void AddUInt32(Message* message, + const FieldDescriptor* field, uint32 value) const = 0; + virtual void AddUInt64(Message* message, + const FieldDescriptor* field, uint64 value) const = 0; + virtual void AddFloat (Message* message, + const FieldDescriptor* field, float value) const = 0; + virtual void AddDouble(Message* message, + const FieldDescriptor* field, double value) const = 0; + virtual void AddBool (Message* message, + const FieldDescriptor* field, bool value) const = 0; + virtual void AddString(Message* message, + const FieldDescriptor* field, + const string& value) const = 0; + virtual void AddEnum (Message* message, + const FieldDescriptor* field, + const EnumValueDescriptor* value) const = 0; + // See MutableMessage() for comments on the "factory" parameter. + virtual Message* AddMessage(Message* message, + const FieldDescriptor* field, + MessageFactory* factory = NULL) const = 0; + + + // Extensions ------------------------------------------------------ + + // Try to find an extension of this message type by fully-qualified field + // name. Returns NULL if no extension is known for this name or number. + virtual const FieldDescriptor* FindKnownExtensionByName( + const string& name) const = 0; + + // Try to find an extension of this message type by field number. + // Returns NULL if no extension is known for this name or number. + virtual const FieldDescriptor* FindKnownExtensionByNumber( + int number) const = 0; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Reflection); +}; + +// Abstract interface for a factory for message objects. +class LIBPROTOBUF_EXPORT MessageFactory { + public: + inline MessageFactory() {} + virtual ~MessageFactory(); + + // Given a Descriptor, gets or constructs the default (prototype) Message + // of that type. You can then call that message's New() method to construct + // a mutable message of that type. + // + // Calling this method twice with the same Descriptor returns the same + // object. The returned object remains property of the factory. Also, any + // objects created by calling the prototype's New() method share some data + // with the prototype, so these must be destoyed before the MessageFactory + // is destroyed. + // + // The given descriptor must outlive the returned message, and hence must + // outlive the MessageFactory. + // + // Some implementations do not support all types. GetPrototype() will + // return NULL if the descriptor passed in is not supported. + // + // This method may or may not be thread-safe depending on the implementation. + // Each implementation should document its own degree thread-safety. + virtual const Message* GetPrototype(const Descriptor* type) = 0; + + // Gets a MessageFactory which supports all generated, compiled-in messages. + // In other words, for any compiled-in type FooMessage, the following is true: + // MessageFactory::generated_factory()->GetPrototype( + // FooMessage::descriptor()) == FooMessage::default_instance() + // This factory supports all types which are found in + // DescriptorPool::generated_pool(). If given a descriptor from any other + // pool, GetPrototype() will return NULL. (You can also check if a + // descriptor is for a generated message by checking if + // descriptor->file()->pool() == DescriptorPool::generated_pool().) + // + // This factory is 100% thread-safe; calling GetPrototype() does not modify + // any shared data. + // + // This factory is a singleton. The caller must not delete the object. + static MessageFactory* generated_factory(); + + // For internal use only: Registers a .proto file at static initialization + // time, to be placed in generated_factory. The first time GetPrototype() + // is called with a descriptor from this file, |register_messages| will be + // called, with the file name as the parameter. It must call + // InternalRegisterGeneratedMessage() (below) to register each message type + // in the file. This strange mechanism is necessary because descriptors are + // built lazily, so we can't register types by their descriptor until we + // know that the descriptor exists. |filename| must be a permanent string. + static void InternalRegisterGeneratedFile( + const char* filename, void (*register_messages)(const string&)); + + // For internal use only: Registers a message type. Called only by the + // functions which are registered with InternalRegisterGeneratedFile(), + // above. + static void InternalRegisterGeneratedMessage(const Descriptor* descriptor, + const Message* prototype); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFactory); +}; + +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_MESSAGE_H__ diff --git a/depends/protobuf/google/protobuf/message_lite.cc b/depends/protobuf/google/protobuf/message_lite.cc new file mode 100644 index 000000000..7c8f37dc7 --- /dev/null +++ b/depends/protobuf/google/protobuf/message_lite.cc @@ -0,0 +1,334 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Authors: wink@google.com (Wink Saville), +// kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { + +MessageLite::~MessageLite() {} + +string MessageLite::InitializationErrorString() const { + return "(cannot determine missing fields for lite message)"; +} + +namespace { + +// When serializing, we first compute the byte size, then serialize the message. +// If serialization produces a different number of bytes than expected, we +// call this function, which crashes. The problem could be due to a bug in the +// protobuf implementation but is more likely caused by concurrent modification +// of the message. This function attempts to distinguish between the two and +// provide a useful error message. +void ByteSizeConsistencyError(int byte_size_before_serialization, + int byte_size_after_serialization, + int bytes_produced_by_serialization) { + GOOGLE_CHECK_EQ(byte_size_before_serialization, byte_size_after_serialization) + << "Protocol message was modified concurrently during serialization."; + GOOGLE_CHECK_EQ(bytes_produced_by_serialization, byte_size_before_serialization) + << "Byte size calculation and serialization were inconsistent. This " + "may indicate a bug in protocol buffers or it may be caused by " + "concurrent modification of the message."; + GOOGLE_LOG(FATAL) << "This shouldn't be called if all the sizes are equal."; +} + +string InitializationErrorMessage(const char* action, + const MessageLite& message) { + // Note: We want to avoid depending on strutil in the lite library, otherwise + // we'd use: + // + // return strings::Substitute( + // "Can't $0 message of type \"$1\" because it is missing required " + // "fields: $2", + // action, message.GetTypeName(), + // message.InitializationErrorString()); + + string result; + result += "Can't "; + result += action; + result += " message of type \""; + result += message.GetTypeName(); + result += "\" because it is missing required fields: "; + result += message.InitializationErrorString(); + return result; +} + +// Several of the Parse methods below just do one thing and then call another +// method. In a naive implementation, we might have ParseFromString() call +// ParseFromArray() which would call ParseFromZeroCopyStream() which would call +// ParseFromCodedStream() which would call MergeFromCodedStream() which would +// call MergePartialFromCodedStream(). However, when parsing very small +// messages, every function call introduces significant overhead. To avoid +// this without reproducing code, we use these forced-inline helpers. +// +// Note: GCC only allows GOOGLE_ATTRIBUTE_ALWAYS_INLINE on declarations, not +// definitions. +inline bool InlineMergeFromCodedStream(io::CodedInputStream* input, + MessageLite* message) + GOOGLE_ATTRIBUTE_ALWAYS_INLINE; +inline bool InlineParseFromCodedStream(io::CodedInputStream* input, + MessageLite* message) + GOOGLE_ATTRIBUTE_ALWAYS_INLINE; +inline bool InlineParsePartialFromCodedStream(io::CodedInputStream* input, + MessageLite* message) + GOOGLE_ATTRIBUTE_ALWAYS_INLINE; +inline bool InlineParseFromArray(const void* data, int size, + MessageLite* message) + GOOGLE_ATTRIBUTE_ALWAYS_INLINE; +inline bool InlineParsePartialFromArray(const void* data, int size, + MessageLite* message) + GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + +bool InlineMergeFromCodedStream(io::CodedInputStream* input, + MessageLite* message) { + if (!message->MergePartialFromCodedStream(input)) return false; + if (!message->IsInitialized()) { + GOOGLE_LOG(ERROR) << InitializationErrorMessage("parse", *message); + return false; + } + return true; +} + +bool InlineParseFromCodedStream(io::CodedInputStream* input, + MessageLite* message) { + message->Clear(); + return InlineMergeFromCodedStream(input, message); +} + +bool InlineParsePartialFromCodedStream(io::CodedInputStream* input, + MessageLite* message) { + message->Clear(); + return message->MergePartialFromCodedStream(input); +} + +bool InlineParseFromArray(const void* data, int size, MessageLite* message) { + io::CodedInputStream input(reinterpret_cast(data), size); + return InlineParseFromCodedStream(&input, message) && + input.ConsumedEntireMessage(); +} + +bool InlineParsePartialFromArray(const void* data, int size, + MessageLite* message) { + io::CodedInputStream input(reinterpret_cast(data), size); + return InlineParsePartialFromCodedStream(&input, message) && + input.ConsumedEntireMessage(); +} + +} // namespace + +bool MessageLite::MergeFromCodedStream(io::CodedInputStream* input) { + return InlineMergeFromCodedStream(input, this); +} + +bool MessageLite::ParseFromCodedStream(io::CodedInputStream* input) { + return InlineParseFromCodedStream(input, this); +} + +bool MessageLite::ParsePartialFromCodedStream(io::CodedInputStream* input) { + return InlineParsePartialFromCodedStream(input, this); +} + +bool MessageLite::ParseFromZeroCopyStream(io::ZeroCopyInputStream* input) { + io::CodedInputStream decoder(input); + return ParseFromCodedStream(&decoder) && decoder.ConsumedEntireMessage(); +} + +bool MessageLite::ParsePartialFromZeroCopyStream( + io::ZeroCopyInputStream* input) { + io::CodedInputStream decoder(input); + return ParsePartialFromCodedStream(&decoder) && + decoder.ConsumedEntireMessage(); +} + +bool MessageLite::ParseFromBoundedZeroCopyStream( + io::ZeroCopyInputStream* input, int size) { + io::CodedInputStream decoder(input); + decoder.PushLimit(size); + return ParseFromCodedStream(&decoder) && + decoder.ConsumedEntireMessage() && + decoder.BytesUntilLimit() == 0; +} + +bool MessageLite::ParsePartialFromBoundedZeroCopyStream( + io::ZeroCopyInputStream* input, int size) { + io::CodedInputStream decoder(input); + decoder.PushLimit(size); + return ParsePartialFromCodedStream(&decoder) && + decoder.ConsumedEntireMessage() && + decoder.BytesUntilLimit() == 0; +} + +bool MessageLite::ParseFromString(const string& data) { + return InlineParseFromArray(data.data(), data.size(), this); +} + +bool MessageLite::ParsePartialFromString(const string& data) { + return InlineParsePartialFromArray(data.data(), data.size(), this); +} + +bool MessageLite::ParseFromArray(const void* data, int size) { + return InlineParseFromArray(data, size, this); +} + +bool MessageLite::ParsePartialFromArray(const void* data, int size) { + return InlineParsePartialFromArray(data, size, this); +} + + +// =================================================================== + +uint8* MessageLite::SerializeWithCachedSizesToArray(uint8* target) const { + // We only optimize this when using optimize_for = SPEED. In other cases + // we just use the CodedOutputStream path. + int size = GetCachedSize(); + io::ArrayOutputStream out(target, size); + io::CodedOutputStream coded_out(&out); + SerializeWithCachedSizes(&coded_out); + GOOGLE_CHECK(!coded_out.HadError()); + return target + size; +} + +bool MessageLite::SerializeToCodedStream(io::CodedOutputStream* output) const { + GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + return SerializePartialToCodedStream(output); +} + +bool MessageLite::SerializePartialToCodedStream( + io::CodedOutputStream* output) const { + const int size = ByteSize(); // Force size to be cached. + uint8* buffer = output->GetDirectBufferForNBytesAndAdvance(size); + if (buffer != NULL) { + uint8* end = SerializeWithCachedSizesToArray(buffer); + if (end - buffer != size) { + ByteSizeConsistencyError(size, ByteSize(), end - buffer); + } + return true; + } else { + int original_byte_count = output->ByteCount(); + SerializeWithCachedSizes(output); + if (output->HadError()) { + return false; + } + int final_byte_count = output->ByteCount(); + + if (final_byte_count - original_byte_count != size) { + ByteSizeConsistencyError(size, ByteSize(), + final_byte_count - original_byte_count); + } + + return true; + } +} + +bool MessageLite::SerializeToZeroCopyStream( + io::ZeroCopyOutputStream* output) const { + io::CodedOutputStream encoder(output); + return SerializeToCodedStream(&encoder); +} + +bool MessageLite::SerializePartialToZeroCopyStream( + io::ZeroCopyOutputStream* output) const { + io::CodedOutputStream encoder(output); + return SerializePartialToCodedStream(&encoder); +} + +bool MessageLite::AppendToString(string* output) const { + GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + return AppendPartialToString(output); +} + +bool MessageLite::AppendPartialToString(string* output) const { + int old_size = output->size(); + int byte_size = ByteSize(); + STLStringResizeUninitialized(output, old_size + byte_size); + uint8* start = reinterpret_cast(string_as_array(output) + old_size); + uint8* end = SerializeWithCachedSizesToArray(start); + if (end - start != byte_size) { + ByteSizeConsistencyError(byte_size, ByteSize(), end - start); + } + return true; +} + +bool MessageLite::SerializeToString(string* output) const { + output->clear(); + return AppendToString(output); +} + +bool MessageLite::SerializePartialToString(string* output) const { + output->clear(); + return AppendPartialToString(output); +} + +bool MessageLite::SerializeToArray(void* data, int size) const { + GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + return SerializePartialToArray(data, size); +} + +bool MessageLite::SerializePartialToArray(void* data, int size) const { + int byte_size = ByteSize(); + if (size < byte_size) return false; + uint8* start = reinterpret_cast(data); + uint8* end = SerializeWithCachedSizesToArray(start); + if (end - start != byte_size) { + ByteSizeConsistencyError(byte_size, ByteSize(), end - start); + } + return true; +} + +string MessageLite::SerializeAsString() const { + // If the compiler implements the (Named) Return Value Optimization, + // the local variable 'result' will not actually reside on the stack + // of this function, but will be overlaid with the object that the + // caller supplied for the return value to be constructed in. + string output; + if (!AppendToString(&output)) + output.clear(); + return output; +} + +string MessageLite::SerializePartialAsString() const { + string output; + if (!AppendPartialToString(&output)) + output.clear(); + return output; +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/message_lite.h b/depends/protobuf/google/protobuf/message_lite.h new file mode 100644 index 000000000..ebf4ba3c8 --- /dev/null +++ b/depends/protobuf/google/protobuf/message_lite.h @@ -0,0 +1,239 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Authors: wink@google.com (Wink Saville), +// kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// Defines MessageLite, the abstract interface implemented by all (lite +// and non-lite) protocol message objects. + +#ifndef GOOGLE_PROTOBUF_MESSAGE_LITE_H__ +#define GOOGLE_PROTOBUF_MESSAGE_LITE_H__ + +#include +#include + +namespace google { +namespace protobuf { + +// Interface to light weight protocol messages. +// +// This interface is implemented by all protocol message objects. Non-lite +// messages additionally implement the Message interface, which is a +// subclass of MessageLite. Use MessageLite instead when you only need +// the subset of features which it supports -- namely, nothing that uses +// descriptors or reflection. You can instruct the protocol compiler +// to generate classes which implement only MessageLite, not the full +// Message interface, by adding the following line to the .proto file: +// +// option optimize_for = LITE_RUNTIME; +// +// This is particularly useful on resource-constrained systems where +// the full protocol buffers runtime library is too big. +// +// Note that on non-constrained systems (e.g. servers) when you need +// to link in lots of protocol definitions, a better way to reduce +// total code footprint is to use optimize_for = CODE_SIZE. This +// will make the generated code smaller while still supporting all the +// same features (at the expense of speed). optimize_for = LITE_RUNTIME +// is best when you only have a small number of message types linked +// into your binary, in which case the size of the protocol buffers +// runtime itself is the biggest problem. +class LIBPROTOBUF_EXPORT MessageLite { + public: + inline MessageLite() {} + virtual ~MessageLite(); + + // Basic Operations ------------------------------------------------ + + // Get the name of this message type, e.g. "foo.bar.BazProto". + virtual string GetTypeName() const = 0; + + // Construct a new instance of the same type. Ownership is passed to the + // caller. + virtual MessageLite* New() const = 0; + + // Clear all fields of the message and set them to their default values. + // Clear() avoids freeing memory, assuming that any memory allocated + // to hold parts of the message will be needed again to hold the next + // message. If you actually want to free the memory used by a Message, + // you must delete it. + virtual void Clear() = 0; + + // Quickly check if all required fields have values set. + virtual bool IsInitialized() const = 0; + + // This is not implemented for Lite messages -- it just returns "(cannot + // determine missing fields for lite message)". However, it is implemented + // for full messages. See message.h. + virtual string InitializationErrorString() const; + + // If |other| is the exact same class as this, calls MergeFrom(). Otherwise, + // results are undefined (probably crash). + virtual void CheckTypeAndMergeFrom(const MessageLite& other) = 0; + + // Parsing --------------------------------------------------------- + // Methods for parsing in protocol buffer format. Most of these are + // just simple wrappers around MergeFromCodedStream(). + + // Fill the message with a protocol buffer parsed from the given input + // stream. Returns false on a read error or if the input is in the + // wrong format. + bool ParseFromCodedStream(io::CodedInputStream* input); + // Like ParseFromCodedStream(), but accepts messages that are missing + // required fields. + bool ParsePartialFromCodedStream(io::CodedInputStream* input); + // Read a protocol buffer from the given zero-copy input stream. If + // successful, the entire input will be consumed. + bool ParseFromZeroCopyStream(io::ZeroCopyInputStream* input); + // Like ParseFromZeroCopyStream(), but accepts messages that are missing + // required fields. + bool ParsePartialFromZeroCopyStream(io::ZeroCopyInputStream* input); + // Read a protocol buffer from the given zero-copy input stream, expecting + // the message to be exactly "size" bytes long. If successful, exactly + // this many bytes will have been consumed from the input. + bool ParseFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, int size); + // Like ParseFromBoundedZeroCopyStream(), but accepts messages that are + // missing required fields. + bool ParsePartialFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, + int size); + // Parse a protocol buffer contained in a string. + bool ParseFromString(const string& data); + // Like ParseFromString(), but accepts messages that are missing + // required fields. + bool ParsePartialFromString(const string& data); + // Parse a protocol buffer contained in an array of bytes. + bool ParseFromArray(const void* data, int size); + // Like ParseFromArray(), but accepts messages that are missing + // required fields. + bool ParsePartialFromArray(const void* data, int size); + + + // Reads a protocol buffer from the stream and merges it into this + // Message. Singular fields read from the input overwrite what is + // already in the Message and repeated fields are appended to those + // already present. + // + // It is the responsibility of the caller to call input->LastTagWas() + // (for groups) or input->ConsumedEntireMessage() (for non-groups) after + // this returns to verify that the message's end was delimited correctly. + // + // ParsefromCodedStream() is implemented as Clear() followed by + // MergeFromCodedStream(). + bool MergeFromCodedStream(io::CodedInputStream* input); + + // Like MergeFromCodedStream(), but succeeds even if required fields are + // missing in the input. + // + // MergeFromCodedStream() is just implemented as MergePartialFromCodedStream() + // followed by IsInitialized(). + virtual bool MergePartialFromCodedStream(io::CodedInputStream* input) = 0; + + // Serialization --------------------------------------------------- + // Methods for serializing in protocol buffer format. Most of these + // are just simple wrappers around ByteSize() and SerializeWithCachedSizes(). + + // Write a protocol buffer of this message to the given output. Returns + // false on a write error. If the message is missing required fields, + // this may GOOGLE_CHECK-fail. + bool SerializeToCodedStream(io::CodedOutputStream* output) const; + // Like SerializeToCodedStream(), but allows missing required fields. + bool SerializePartialToCodedStream(io::CodedOutputStream* output) const; + // Write the message to the given zero-copy output stream. All required + // fields must be set. + bool SerializeToZeroCopyStream(io::ZeroCopyOutputStream* output) const; + // Like SerializeToZeroCopyStream(), but allows missing required fields. + bool SerializePartialToZeroCopyStream(io::ZeroCopyOutputStream* output) const; + // Serialize the message and store it in the given string. All required + // fields must be set. + bool SerializeToString(string* output) const; + // Like SerializeToString(), but allows missing required fields. + bool SerializePartialToString(string* output) const; + // Serialize the message and store it in the given byte array. All required + // fields must be set. + bool SerializeToArray(void* data, int size) const; + // Like SerializeToArray(), but allows missing required fields. + bool SerializePartialToArray(void* data, int size) const; + + // Make a string encoding the message. Is equivalent to calling + // SerializeToString() on a string and using that. Returns the empty + // string if SerializeToString() would have returned an error. + // Note: If you intend to generate many such strings, you may + // reduce heap fragmentation by instead re-using the same string + // object with calls to SerializeToString(). + string SerializeAsString() const; + // Like SerializeAsString(), but allows missing required fields. + string SerializePartialAsString() const; + + // Like SerializeToString(), but appends to the data to the string's existing + // contents. All required fields must be set. + bool AppendToString(string* output) const; + // Like AppendToString(), but allows missing required fields. + bool AppendPartialToString(string* output) const; + + // Computes the serialized size of the message. This recursively calls + // ByteSize() on all embedded messages. If a subclass does not override + // this, it MUST override SetCachedSize(). + virtual int ByteSize() const = 0; + + // Serializes the message without recomputing the size. The message must + // not have changed since the last call to ByteSize(); if it has, the results + // are undefined. + virtual void SerializeWithCachedSizes( + io::CodedOutputStream* output) const = 0; + + // Like SerializeWithCachedSizes, but writes directly to *target, returning + // a pointer to the byte immediately after the last byte written. "target" + // must point at a byte array of at least ByteSize() bytes. + virtual uint8* SerializeWithCachedSizesToArray(uint8* target) const; + + // Returns the result of the last call to ByteSize(). An embedded message's + // size is needed both to serialize it (because embedded messages are + // length-delimited) and to compute the outer message's size. Caching + // the size avoids computing it multiple times. + // + // ByteSize() does not automatically use the cached size when available + // because this would require invalidating it every time the message was + // modified, which would be too hard and expensive. (E.g. if a deeply-nested + // sub-message is changed, all of its parents' cached sizes would need to be + // invalidated, which is too much work for an otherwise inlined setter + // method.) + virtual int GetCachedSize() const = 0; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageLite); +}; + +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_MESSAGE_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/package_info.h b/depends/protobuf/google/protobuf/package_info.h similarity index 92% rename from depends/protobuf/src/google/protobuf/package_info.h rename to depends/protobuf/google/protobuf/package_info.h index 2b61679af..60cd3994c 100644 --- a/depends/protobuf/src/google/protobuf/package_info.h +++ b/depends/protobuf/google/protobuf/package_info.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -36,6 +36,8 @@ // It is not compiled into anything, but it may be read by an automated // documentation generator. +namespace google { + // Core components of the Protocol Buffers runtime library. // // The files in this package represent the core of the Protocol Buffer @@ -58,9 +60,5 @@ // The implementation does contain some "const" methods which actually modify // the object behind the scenes -- e.g., to cache results -- but in these cases // mutex locking is used to make the access thread-safe. -namespace google { -namespace protobuf { -// TODO(gerbens) remove this comment, we need it to prevent clang-format -// from combining the brackets. Which would mess with extract script -} // namespace protobuf +namespace protobuf {} } // namespace google diff --git a/depends/protobuf/google/protobuf/reflection_ops.cc b/depends/protobuf/google/protobuf/reflection_ops.cc new file mode 100644 index 000000000..897c0d7c8 --- /dev/null +++ b/depends/protobuf/google/protobuf/reflection_ops.cc @@ -0,0 +1,262 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace internal { + +void ReflectionOps::Copy(const Message& from, Message* to) { + if (&from == to) return; + Clear(to); + Merge(from, to); +} + +void ReflectionOps::Merge(const Message& from, Message* to) { + GOOGLE_CHECK_NE(&from, to); + + const Descriptor* descriptor = from.GetDescriptor(); + GOOGLE_CHECK_EQ(to->GetDescriptor(), descriptor) + << "Tried to merge messages of different types."; + + const Reflection* from_reflection = from.GetReflection(); + const Reflection* to_reflection = to->GetReflection(); + + vector fields; + from_reflection->ListFields(from, &fields); + for (int i = 0; i < fields.size(); i++) { + const FieldDescriptor* field = fields[i]; + + if (field->is_repeated()) { + int count = from_reflection->FieldSize(from, field); + for (int j = 0; j < count; j++) { + switch (field->cpp_type()) { +#define HANDLE_TYPE(CPPTYPE, METHOD) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + to_reflection->Add##METHOD(to, field, \ + from_reflection->GetRepeated##METHOD(from, field, j)); \ + break; + + HANDLE_TYPE(INT32 , Int32 ); + HANDLE_TYPE(INT64 , Int64 ); + HANDLE_TYPE(UINT32, UInt32); + HANDLE_TYPE(UINT64, UInt64); + HANDLE_TYPE(FLOAT , Float ); + HANDLE_TYPE(DOUBLE, Double); + HANDLE_TYPE(BOOL , Bool ); + HANDLE_TYPE(STRING, String); + HANDLE_TYPE(ENUM , Enum ); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_MESSAGE: + to_reflection->AddMessage(to, field)->MergeFrom( + from_reflection->GetRepeatedMessage(from, field, j)); + break; + } + } + } else { + switch (field->cpp_type()) { +#define HANDLE_TYPE(CPPTYPE, METHOD) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + to_reflection->Set##METHOD(to, field, \ + from_reflection->Get##METHOD(from, field)); \ + break; + + HANDLE_TYPE(INT32 , Int32 ); + HANDLE_TYPE(INT64 , Int64 ); + HANDLE_TYPE(UINT32, UInt32); + HANDLE_TYPE(UINT64, UInt64); + HANDLE_TYPE(FLOAT , Float ); + HANDLE_TYPE(DOUBLE, Double); + HANDLE_TYPE(BOOL , Bool ); + HANDLE_TYPE(STRING, String); + HANDLE_TYPE(ENUM , Enum ); +#undef HANDLE_TYPE + + case FieldDescriptor::CPPTYPE_MESSAGE: + to_reflection->MutableMessage(to, field)->MergeFrom( + from_reflection->GetMessage(from, field)); + break; + } + } + } + + to_reflection->MutableUnknownFields(to)->MergeFrom( + from_reflection->GetUnknownFields(from)); +} + +void ReflectionOps::Clear(Message* message) { + const Reflection* reflection = message->GetReflection(); + + vector fields; + reflection->ListFields(*message, &fields); + for (int i = 0; i < fields.size(); i++) { + reflection->ClearField(message, fields[i]); + } + + reflection->MutableUnknownFields(message)->Clear(); +} + +bool ReflectionOps::IsInitialized(const Message& message) { + const Descriptor* descriptor = message.GetDescriptor(); + const Reflection* reflection = message.GetReflection(); + + // Check required fields of this message. + for (int i = 0; i < descriptor->field_count(); i++) { + if (descriptor->field(i)->is_required()) { + if (!reflection->HasField(message, descriptor->field(i))) { + return false; + } + } + } + + // Check that sub-messages are initialized. + vector fields; + reflection->ListFields(message, &fields); + for (int i = 0; i < fields.size(); i++) { + const FieldDescriptor* field = fields[i]; + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (field->is_repeated()) { + int size = reflection->FieldSize(message, field); + + for (int i = 0; i < size; i++) { + if (!reflection->GetRepeatedMessage(message, field, i) + .IsInitialized()) { + return false; + } + } + } else { + if (!reflection->GetMessage(message, field).IsInitialized()) { + return false; + } + } + } + } + + return true; +} + +void ReflectionOps::DiscardUnknownFields(Message* message) { + const Reflection* reflection = message->GetReflection(); + + reflection->MutableUnknownFields(message)->Clear(); + + vector fields; + reflection->ListFields(*message, &fields); + for (int i = 0; i < fields.size(); i++) { + const FieldDescriptor* field = fields[i]; + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (field->is_repeated()) { + int size = reflection->FieldSize(*message, field); + for (int i = 0; i < size; i++) { + reflection->MutableRepeatedMessage(message, field, i) + ->DiscardUnknownFields(); + } + } else { + reflection->MutableMessage(message, field)->DiscardUnknownFields(); + } + } + } +} + +static string SubMessagePrefix(const string& prefix, + const FieldDescriptor* field, + int index) { + string result(prefix); + if (field->is_extension()) { + result.append("("); + result.append(field->full_name()); + result.append(")"); + } else { + result.append(field->name()); + } + if (index != -1) { + result.append("["); + result.append(SimpleItoa(index)); + result.append("]"); + } + result.append("."); + return result; +} + +void ReflectionOps::FindInitializationErrors( + const Message& message, + const string& prefix, + vector* errors) { + const Descriptor* descriptor = message.GetDescriptor(); + const Reflection* reflection = message.GetReflection(); + + // Check required fields of this message. + for (int i = 0; i < descriptor->field_count(); i++) { + if (descriptor->field(i)->is_required()) { + if (!reflection->HasField(message, descriptor->field(i))) { + errors->push_back(prefix + descriptor->field(i)->name()); + } + } + } + + // Check sub-messages. + vector fields; + reflection->ListFields(message, &fields); + for (int i = 0; i < fields.size(); i++) { + const FieldDescriptor* field = fields[i]; + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + + if (field->is_repeated()) { + int size = reflection->FieldSize(message, field); + + for (int i = 0; i < size; i++) { + const Message& sub_message = + reflection->GetRepeatedMessage(message, field, i); + FindInitializationErrors(sub_message, + SubMessagePrefix(prefix, field, i), + errors); + } + } else { + const Message& sub_message = reflection->GetMessage(message, field); + FindInitializationErrors(sub_message, + SubMessagePrefix(prefix, field, -1), + errors); + } + } + } +} + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/src/google/protobuf/reflection_ops.h b/depends/protobuf/google/protobuf/reflection_ops.h similarity index 85% rename from depends/protobuf/src/google/protobuf/reflection_ops.h rename to depends/protobuf/google/protobuf/reflection_ops.h index 0a45702f9..355a0a5d2 100644 --- a/depends/protobuf/src/google/protobuf/reflection_ops.h +++ b/depends/protobuf/google/protobuf/reflection_ops.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -38,16 +38,8 @@ #ifndef GOOGLE_PROTOBUF_REFLECTION_OPS_H__ #define GOOGLE_PROTOBUF_REFLECTION_OPS_H__ -#include #include -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -// Must be included last. -#include - namespace google { namespace protobuf { namespace internal { @@ -61,22 +53,20 @@ namespace internal { // the Message interface. // // This class is really a namespace that contains only static methods. -class PROTOBUF_EXPORT ReflectionOps { +class LIBPROTOBUF_EXPORT ReflectionOps { public: static void Copy(const Message& from, Message* to); static void Merge(const Message& from, Message* to); static void Clear(Message* message); static bool IsInitialized(const Message& message); - static bool IsInitialized(const Message& message, bool check_fields, - bool check_descendants); static void DiscardUnknownFields(Message* message); // Finds all unset required fields in the message and adds their full // paths (e.g. "foo.bar[5].baz") to *names. "prefix" will be attached to // the front of each name. static void FindInitializationErrors(const Message& message, - const std::string& prefix, - std::vector* errors); + const string& prefix, + vector* errors); private: // All methods are static. No need to construct. @@ -85,8 +75,6 @@ class PROTOBUF_EXPORT ReflectionOps { } // namespace internal } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_REFLECTION_OPS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum_lite.h b/depends/protobuf/google/protobuf/repeated_field.cc similarity index 50% rename from depends/protobuf/src/google/protobuf/compiler/java/enum_lite.h rename to depends/protobuf/google/protobuf/repeated_field.cc index 50f3fe7b1..09377742a 100644 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum_lite.h +++ b/depends/protobuf/google/protobuf/repeated_field.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -32,67 +32,67 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_LITE_H__ +#include -#include -#include -#include +#include +#include namespace google { namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google -namespace google { -namespace protobuf { -namespace compiler { -namespace java { +namespace internal { -class EnumLiteGenerator { - public: - EnumLiteGenerator(const EnumDescriptor* descriptor, bool immutable_api, - Context* context); - ~EnumLiteGenerator(); +void RepeatedPtrFieldBase::Reserve(int new_size) { + if (total_size_ >= new_size) return; - void Generate(io::Printer* printer); + void** old_elements = elements_; + total_size_ = max(total_size_ * 2, new_size); + elements_ = new void*[total_size_]; + memcpy(elements_, old_elements, allocated_size_ * sizeof(elements_[0])); + if (old_elements != initial_space_) { + delete [] old_elements; + } +} - private: - const EnumDescriptor* descriptor_; +void RepeatedPtrFieldBase::Swap(RepeatedPtrFieldBase* other) { + void** swap_elements = elements_; + int swap_current_size = current_size_; + int swap_allocated_size = allocated_size_; + int swap_total_size = total_size_; + // We may not be using initial_space_ but it's not worth checking. Just + // copy it anyway. + void* swap_initial_space[kInitialSize]; + memcpy(swap_initial_space, initial_space_, sizeof(initial_space_)); - // The proto language allows multiple enum constants to have the same - // numeric value. Java, however, does not allow multiple enum constants to - // be considered equivalent. We treat the first defined constant for any - // given numeric value as "canonical" and the rest as aliases of that - // canonical value. - std::vector canonical_values_; + elements_ = other->elements_; + current_size_ = other->current_size_; + allocated_size_ = other->allocated_size_; + total_size_ = other->total_size_; + memcpy(initial_space_, other->initial_space_, sizeof(initial_space_)); - struct Alias { - const EnumValueDescriptor* value; - const EnumValueDescriptor* canonical_value; - }; - std::vector aliases_; + other->elements_ = swap_elements; + other->current_size_ = swap_current_size; + other->allocated_size_ = swap_allocated_size; + other->total_size_ = swap_total_size; + memcpy(other->initial_space_, swap_initial_space, sizeof(swap_initial_space)); - bool immutable_api_; + if (elements_ == other->initial_space_) { + elements_ = initial_space_; + } + if (other->elements_ == initial_space_) { + other->elements_ = other->initial_space_; + } +} - Context* context_; - ClassNameResolver* name_resolver_; +string* StringTypeHandlerBase::New() { + return new string; +} +void StringTypeHandlerBase::Delete(string* value) { + delete value; +} + +} // namespace internal - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumLiteGenerator); -}; -} // namespace java -} // namespace compiler } // namespace protobuf } // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_LITE_H__ diff --git a/depends/protobuf/google/protobuf/repeated_field.h b/depends/protobuf/google/protobuf/repeated_field.h new file mode 100644 index 000000000..aed4ce9f2 --- /dev/null +++ b/depends/protobuf/google/protobuf/repeated_field.h @@ -0,0 +1,1295 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// RepeatedField and RepeatedPtrField are used by generated protocol message +// classes to manipulate repeated fields. These classes are very similar to +// STL's vector, but include a number of optimizations found to be useful +// specifically in the case of Protocol Buffers. RepeatedPtrField is +// particularly different from STL vector as it manages ownership of the +// pointers that it contains. +// +// Typically, clients should not need to access RepeatedField objects directly, +// but should instead use the accessor functions generated automatically by the +// protocol compiler. + +#ifndef GOOGLE_PROTOBUF_REPEATED_FIELD_H__ +#define GOOGLE_PROTOBUF_REPEATED_FIELD_H__ + +#include +#include +#include +#include + +namespace google { + +namespace protobuf { + +class Message; + +namespace internal { + +// We need this (from generated_message_reflection.cc). +LIBPROTOBUF_EXPORT int StringSpaceUsedExcludingSelf(const string& str); + +} // namespace internal + +// RepeatedField is used to represent repeated fields of a primitive type (in +// other words, everything except strings and nested Messages). Most users will +// not ever use a RepeatedField directly; they will use the get-by-index, +// set-by-index, and add accessors that are generated for all repeated fields. +template +class RepeatedField { + public: + RepeatedField(); + RepeatedField(const RepeatedField& other); + ~RepeatedField(); + + RepeatedField& operator=(const RepeatedField& other); + + int size() const; + + const Element& Get(int index) const; + Element* Mutable(int index); + void Set(int index, const Element& value); + void Add(const Element& value); + Element* Add(); + // Remove the last element in the array. + // We don't provide a way to remove any element other than the last + // because it invites inefficient use, such as O(n^2) filtering loops + // that should have been O(n). If you want to remove an element other + // than the last, the best way to do it is to re-arrange the elements + // so that the one you want removed is at the end, then call RemoveLast(). + void RemoveLast(); + void Clear(); + void MergeFrom(const RepeatedField& other); + void CopyFrom(const RepeatedField& other); + + // Reserve space to expand the field to at least the given size. If the + // array is grown, it will always be at least doubled in size. + void Reserve(int new_size); + + // Resize the RepeatedField to a new, smaller size. This is O(1). + void Truncate(int new_size); + + void AddAlreadyReserved(const Element& value); + Element* AddAlreadyReserved(); + int Capacity() const; + + // Gets the underlying array. This pointer is possibly invalidated by + // any add or remove operation. + Element* mutable_data(); + const Element* data() const; + + // Swap entire contents with "other". + void Swap(RepeatedField* other); + + // Swap two elements. + void SwapElements(int index1, int index2); + + // STL-like iterator support + typedef Element* iterator; + typedef const Element* const_iterator; + typedef Element value_type; + + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + + // Returns the number of bytes used by the repeated field, excluding + // sizeof(*this) + int SpaceUsedExcludingSelf() const; + + private: + static const int kInitialSize = 4; + + Element* elements_; + int current_size_; + int total_size_; + + Element initial_space_[kInitialSize]; + + // Move the contents of |from| into |to|, possibly clobbering |from| in the + // process. For primitive types this is just a memcpy(), but it could be + // specialized for non-primitive types to, say, swap each element instead. + void MoveArray(Element to[], Element from[], int size); + + // Copy the elements of |from| into |to|. + void CopyArray(Element to[], const Element from[], int size); +}; + +namespace internal { +template class RepeatedPtrIterator; +template class RepeatedPtrOverPtrsIterator; +} // namespace internal + +namespace internal { + +// This is the common base class for RepeatedPtrFields. It deals only in void* +// pointers. Users should not use this interface directly. +// +// The methods of this interface correspond to the methods of RepeatedPtrField, +// but may have a template argument called TypeHandler. Its signature is: +// class TypeHandler { +// public: +// typedef MyType Type; +// static Type* New(); +// static void Delete(Type*); +// static void Clear(Type*); +// static void Merge(const Type& from, Type* to); +// +// // Only needs to be implemented if SpaceUsedExcludingSelf() is called. +// static int SpaceUsed(const Type&); +// }; +class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { + protected: + // The reflection implementation needs to call protected methods directly, + // reinterpreting pointers as being to Message instead of a specific Message + // subclass. + friend class GeneratedMessageReflection; + + // ExtensionSet stores repeated message extensions as + // RepeatedPtrField, but non-lite ExtensionSets need to + // implement SpaceUsed(), and thus need to call SpaceUsedExcludingSelf() + // reinterpreting MessageLite as Message. ExtensionSet also needs to make + // use of AddFromCleared(), which is not part of the public interface. + friend class ExtensionSet; + + RepeatedPtrFieldBase(); + + // Must be called from destructor. + template + void Destroy(); + + int size() const; + + template + const typename TypeHandler::Type& Get(int index) const; + template + typename TypeHandler::Type* Mutable(int index); + template + typename TypeHandler::Type* Add(); + template + void RemoveLast(); + template + void Clear(); + template + void MergeFrom(const RepeatedPtrFieldBase& other); + template + void CopyFrom(const RepeatedPtrFieldBase& other); + + void Reserve(int new_size); + + int Capacity() const; + + // Used for constructing iterators. + void* const* raw_data() const; + void** raw_mutable_data() const; + + template + typename TypeHandler::Type** mutable_data(); + template + const typename TypeHandler::Type* const* data() const; + + void Swap(RepeatedPtrFieldBase* other); + + void SwapElements(int index1, int index2); + + template + int SpaceUsedExcludingSelf() const; + + + // Advanced memory management -------------------------------------- + + // Like Add(), but if there are no cleared objects to use, returns NULL. + template + typename TypeHandler::Type* AddFromCleared(); + + template + void AddAllocated(typename TypeHandler::Type* value); + template + typename TypeHandler::Type* ReleaseLast(); + + int ClearedCount() const; + template + void AddCleared(typename TypeHandler::Type* value); + template + typename TypeHandler::Type* ReleaseCleared(); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase); + + static const int kInitialSize = 4; + + void** elements_; + int current_size_; + int allocated_size_; + int total_size_; + + void* initial_space_[kInitialSize]; + + template + static inline typename TypeHandler::Type* cast(void* element) { + return reinterpret_cast(element); + } + template + static inline const typename TypeHandler::Type* cast(const void* element) { + return reinterpret_cast(element); + } +}; + +template +class GenericTypeHandler { + public: + typedef GenericType Type; + static GenericType* New() { return new GenericType; } + static void Delete(GenericType* value) { delete value; } + static void Clear(GenericType* value) { value->Clear(); } + static void Merge(const GenericType& from, GenericType* to) { + to->MergeFrom(from); + } + static int SpaceUsed(const GenericType& value) { return value.SpaceUsed(); } +}; + +template <> +inline void GenericTypeHandler::Merge( + const MessageLite& from, MessageLite* to) { + to->CheckTypeAndMergeFrom(from); +} + +// HACK: If a class is declared as DLL-exported in MSVC, it insists on +// generating copies of all its methods -- even inline ones -- to include +// in the DLL. But SpaceUsed() calls StringSpaceUsedExcludingSelf() which +// isn't in the lite library, therefore the lite library cannot link if +// StringTypeHandler is exported. So, we factor out StringTypeHandlerBase, +// export that, then make StringTypeHandler be a subclass which is NOT +// exported. +// TODO(kenton): There has to be a better way. +class LIBPROTOBUF_EXPORT StringTypeHandlerBase { + public: + typedef string Type; + static string* New(); + static void Delete(string* value); + static void Clear(string* value) { value->clear(); } + static void Merge(const string& from, string* to) { *to = from; } +}; + +class StringTypeHandler : public StringTypeHandlerBase { + public: + static int SpaceUsed(const string& value) { + return sizeof(value) + StringSpaceUsedExcludingSelf(value); + } +}; + + +} // namespace internal + +// RepeatedPtrField is like RepeatedField, but used for repeated strings or +// Messages. +template +class RepeatedPtrField : public internal::RepeatedPtrFieldBase { + public: + RepeatedPtrField(); + RepeatedPtrField(const RepeatedPtrField& other); + ~RepeatedPtrField(); + + RepeatedPtrField& operator=(const RepeatedPtrField& other); + + int size() const; + + const Element& Get(int index) const; + Element* Mutable(int index); + Element* Add(); + void RemoveLast(); // Remove the last element in the array. + void Clear(); + void MergeFrom(const RepeatedPtrField& other); + void CopyFrom(const RepeatedPtrField& other); + + // Reserve space to expand the field to at least the given size. This only + // resizes the pointer array; it doesn't allocate any objects. If the + // array is grown, it will always be at least doubled in size. + void Reserve(int new_size); + + int Capacity() const; + + // Gets the underlying array. This pointer is possibly invalidated by + // any add or remove operation. + Element** mutable_data(); + const Element* const* data() const; + + // Swap entire contents with "other". + void Swap(RepeatedPtrField* other); + + // Swap two elements. + void SwapElements(int index1, int index2); + + // STL-like iterator support + typedef internal::RepeatedPtrIterator iterator; + typedef internal::RepeatedPtrIterator const_iterator; + typedef Element value_type; + + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + + // Custom STL-like iterator that iterates over and returns the underlying + // pointers to Element rather than Element itself. + typedef internal::RepeatedPtrOverPtrsIterator pointer_iterator; + pointer_iterator pointer_begin(); + pointer_iterator pointer_end(); + + // Returns (an estimate of) the number of bytes used by the repeated field, + // excluding sizeof(*this). + int SpaceUsedExcludingSelf() const; + + // Advanced memory management -------------------------------------- + // When hardcore memory management becomes necessary -- as it often + // does here at Google -- the following methods may be useful. + + // Add an already-allocated object, passing ownership to the + // RepeatedPtrField. + void AddAllocated(Element* value); + // Remove the last element and return it, passing ownership to the + // caller. + // Requires: size() > 0 + Element* ReleaseLast(); + + // When elements are removed by calls to RemoveLast() or Clear(), they + // are not actually freed. Instead, they are cleared and kept so that + // they can be reused later. This can save lots of CPU time when + // repeatedly reusing a protocol message for similar purposes. + // + // Really, extremely hardcore programs may actually want to manipulate + // these objects to better-optimize memory management. These methods + // allow that. + + // Get the number of cleared objects that are currently being kept + // around for reuse. + int ClearedCount() const; + // Add an element to the pool of cleared objects, passing ownership to + // the RepeatedPtrField. The element must be cleared prior to calling + // this method. + void AddCleared(Element* value); + // Remove a single element from the cleared pool and return it, passing + // ownership to the caller. The element is guaranteed to be cleared. + // Requires: ClearedCount() > 0 + Element* ReleaseCleared(); + + protected: + // Note: RepeatedPtrField SHOULD NOT be subclassed by users. We only + // subclass it in one place as a hack for compatibility with proto1. The + // subclass needs to know about TypeHandler in order to call protected + // methods on RepeatedPtrFieldBase. + class TypeHandler; + +}; + +// implementation ==================================================== + +template +inline RepeatedField::RepeatedField() + : elements_(initial_space_), + current_size_(0), + total_size_(kInitialSize) { +} + +template +inline RepeatedField::RepeatedField(const RepeatedField& other) + : elements_(initial_space_), + current_size_(0), + total_size_(kInitialSize) { + CopyFrom(other); +} + +template +RepeatedField::~RepeatedField() { + if (elements_ != initial_space_) { + delete [] elements_; + } +} + +template +inline RepeatedField& +RepeatedField::operator=(const RepeatedField& other) { + CopyFrom(other); + return *this; +} + +template +inline int RepeatedField::size() const { + return current_size_; +} + +template +inline int RepeatedField::Capacity() const { + return total_size_; +} + +template +inline void RepeatedField::AddAlreadyReserved(const Element& value) { + GOOGLE_DCHECK_LT(size(), Capacity()); + elements_[current_size_++] = value; +} + +template +inline Element* RepeatedField::AddAlreadyReserved() { + GOOGLE_DCHECK_LT(size(), Capacity()); + return &elements_[current_size_++]; +} + +template +inline const Element& RepeatedField::Get(int index) const { + GOOGLE_DCHECK_LT(index, size()); + return elements_[index]; +} + +template +inline Element* RepeatedField::Mutable(int index) { + GOOGLE_DCHECK_LT(index, size()); + return elements_ + index; +} + +template +inline void RepeatedField::Set(int index, const Element& value) { + GOOGLE_DCHECK_LT(index, size()); + elements_[index] = value; +} + +template +inline void RepeatedField::Add(const Element& value) { + if (current_size_ == total_size_) Reserve(total_size_ + 1); + elements_[current_size_++] = value; +} + +template +inline Element* RepeatedField::Add() { + if (current_size_ == total_size_) Reserve(total_size_ + 1); + return &elements_[current_size_++]; +} + +template +inline void RepeatedField::RemoveLast() { + GOOGLE_DCHECK_GT(current_size_, 0); + --current_size_; +} + +template +inline void RepeatedField::Clear() { + current_size_ = 0; +} + +template +inline void RepeatedField::MergeFrom(const RepeatedField& other) { + Reserve(current_size_ + other.current_size_); + CopyArray(elements_ + current_size_, other.elements_, other.current_size_); + current_size_ += other.current_size_; +} + +template +inline void RepeatedField::CopyFrom(const RepeatedField& other) { + Clear(); + MergeFrom(other); +} + +template +inline Element* RepeatedField::mutable_data() { + return elements_; +} + +template +inline const Element* RepeatedField::data() const { + return elements_; +} + + +template +void RepeatedField::Swap(RepeatedField* other) { + Element* swap_elements = elements_; + int swap_current_size = current_size_; + int swap_total_size = total_size_; + // We may not be using initial_space_ but it's not worth checking. Just + // copy it anyway. + Element swap_initial_space[kInitialSize]; + MoveArray(swap_initial_space, initial_space_, kInitialSize); + + elements_ = other->elements_; + current_size_ = other->current_size_; + total_size_ = other->total_size_; + MoveArray(initial_space_, other->initial_space_, kInitialSize); + + other->elements_ = swap_elements; + other->current_size_ = swap_current_size; + other->total_size_ = swap_total_size; + MoveArray(other->initial_space_, swap_initial_space, kInitialSize); + + if (elements_ == other->initial_space_) { + elements_ = initial_space_; + } + if (other->elements_ == initial_space_) { + other->elements_ = other->initial_space_; + } +} + +template +void RepeatedField::SwapElements(int index1, int index2) { + std::swap(elements_[index1], elements_[index2]); +} + +template +inline typename RepeatedField::iterator +RepeatedField::begin() { + return elements_; +} +template +inline typename RepeatedField::const_iterator +RepeatedField::begin() const { + return elements_; +} +template +inline typename RepeatedField::iterator +RepeatedField::end() { + return elements_ + current_size_; +} +template +inline typename RepeatedField::const_iterator +RepeatedField::end() const { + return elements_ + current_size_; +} + +template +inline int RepeatedField::SpaceUsedExcludingSelf() const { + return (elements_ != initial_space_) ? total_size_ * sizeof(elements_[0]) : 0; +} + +// Avoid inlining of Reserve(): new, memcpy, and delete[] lead to a significant +// amount of code bloat. +template +void RepeatedField::Reserve(int new_size) { + if (total_size_ >= new_size) return; + + Element* old_elements = elements_; + total_size_ = max(total_size_ * 2, new_size); + elements_ = new Element[total_size_]; + MoveArray(elements_, old_elements, current_size_); + if (old_elements != initial_space_) { + delete [] old_elements; + } +} + +template +inline void RepeatedField::Truncate(int new_size) { + GOOGLE_DCHECK_LE(new_size, current_size_); + current_size_ = new_size; +} + +template +inline void RepeatedField::MoveArray( + Element to[], Element from[], int array_size) { + memcpy(to, from, array_size * sizeof(Element)); +} + +template +inline void RepeatedField::CopyArray( + Element to[], const Element from[], int array_size) { + memcpy(to, from, array_size * sizeof(Element)); +} + + +// ------------------------------------------------------------------- + +namespace internal { + +inline RepeatedPtrFieldBase::RepeatedPtrFieldBase() + : elements_(initial_space_), + current_size_(0), + allocated_size_(0), + total_size_(kInitialSize) { +} + +template +void RepeatedPtrFieldBase::Destroy() { + for (int i = 0; i < allocated_size_; i++) { + TypeHandler::Delete(cast(elements_[i])); + } + if (elements_ != initial_space_) { + delete [] elements_; + } +} + +inline int RepeatedPtrFieldBase::size() const { + return current_size_; +} + + +template +inline const typename TypeHandler::Type& +RepeatedPtrFieldBase::Get(int index) const { + GOOGLE_DCHECK_LT(index, size()); + return *cast(elements_[index]); +} + +template +inline typename TypeHandler::Type* +RepeatedPtrFieldBase::Mutable(int index) { + GOOGLE_DCHECK_LT(index, size()); + return cast(elements_[index]); +} + +template +inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add() { + if (current_size_ < allocated_size_) { + return cast(elements_[current_size_++]); + } + if (allocated_size_ == total_size_) Reserve(total_size_ + 1); + ++allocated_size_; + typename TypeHandler::Type* result = TypeHandler::New(); + elements_[current_size_++] = result; + return result; +} + +template +inline void RepeatedPtrFieldBase::RemoveLast() { + GOOGLE_DCHECK_GT(current_size_, 0); + TypeHandler::Clear(cast(elements_[--current_size_])); +} + +template +void RepeatedPtrFieldBase::Clear() { + for (int i = 0; i < current_size_; i++) { + TypeHandler::Clear(cast(elements_[i])); + } + current_size_ = 0; +} + +template +inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) { + Reserve(current_size_ + other.current_size_); + for (int i = 0; i < other.current_size_; i++) { + TypeHandler::Merge(other.template Get(i), Add()); + } +} + +template +inline void RepeatedPtrFieldBase::CopyFrom(const RepeatedPtrFieldBase& other) { + RepeatedPtrFieldBase::Clear(); + RepeatedPtrFieldBase::MergeFrom(other); +} + +inline int RepeatedPtrFieldBase::Capacity() const { + return total_size_; +} + +inline void* const* RepeatedPtrFieldBase::raw_data() const { + return elements_; +} + +inline void** RepeatedPtrFieldBase::raw_mutable_data() const { + return elements_; +} + +template +inline typename TypeHandler::Type** RepeatedPtrFieldBase::mutable_data() { + // TODO(kenton): Breaks C++ aliasing rules. We should probably remove this + // method entirely. + return reinterpret_cast(elements_); +} + +template +inline const typename TypeHandler::Type* const* +RepeatedPtrFieldBase::data() const { + // TODO(kenton): Breaks C++ aliasing rules. We should probably remove this + // method entirely. + return reinterpret_cast(elements_); +} + +inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { + std::swap(elements_[index1], elements_[index2]); +} + +template +inline int RepeatedPtrFieldBase::SpaceUsedExcludingSelf() const { + int allocated_bytes = + (elements_ != initial_space_) ? total_size_ * sizeof(elements_[0]) : 0; + for (int i = 0; i < allocated_size_; ++i) { + allocated_bytes += TypeHandler::SpaceUsed(*cast(elements_[i])); + } + return allocated_bytes; +} + +template +inline typename TypeHandler::Type* RepeatedPtrFieldBase::AddFromCleared() { + if (current_size_ < allocated_size_) { + return cast(elements_[current_size_++]); + } else { + return NULL; + } +} + +template +void RepeatedPtrFieldBase::AddAllocated( + typename TypeHandler::Type* value) { + // Make room for the new pointer. + if (current_size_ == total_size_) { + // The array is completely full with no cleared objects, so grow it. + Reserve(total_size_ + 1); + ++allocated_size_; + } else if (allocated_size_ == total_size_) { + // There is no more space in the pointer array because it contains some + // cleared objects awaiting reuse. We don't want to grow the array in this + // case because otherwise a loop calling AddAllocated() followed by Clear() + // would leak memory. + TypeHandler::Delete(cast(elements_[current_size_])); + } else if (current_size_ < allocated_size_) { + // We have some cleared objects. We don't care about their order, so we + // can just move the first one to the end to make space. + elements_[allocated_size_] = elements_[current_size_]; + ++allocated_size_; + } else { + // There are no cleared objects. + ++allocated_size_; + } + + elements_[current_size_++] = value; +} + +template +inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLast() { + GOOGLE_DCHECK_GT(current_size_, 0); + typename TypeHandler::Type* result = + cast(elements_[--current_size_]); + --allocated_size_; + if (current_size_ < allocated_size_) { + // There are cleared elements on the end; replace the removed element + // with the last allocated element. + elements_[current_size_] = elements_[allocated_size_]; + } + return result; +} + + +inline int RepeatedPtrFieldBase::ClearedCount() const { + return allocated_size_ - current_size_; +} + +template +inline void RepeatedPtrFieldBase::AddCleared( + typename TypeHandler::Type* value) { + if (allocated_size_ == total_size_) Reserve(total_size_ + 1); + elements_[allocated_size_++] = value; +} + +template +inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseCleared() { + GOOGLE_DCHECK_GT(allocated_size_, current_size_); + return cast(elements_[--allocated_size_]); +} + +} // namespace internal + +// ------------------------------------------------------------------- + +template +class RepeatedPtrField::TypeHandler + : public internal::GenericTypeHandler {}; + +template <> +class RepeatedPtrField::TypeHandler + : public internal::StringTypeHandler {}; + + +template +inline RepeatedPtrField::RepeatedPtrField() {} + +template +inline RepeatedPtrField::RepeatedPtrField( + const RepeatedPtrField& other) { + CopyFrom(other); +} + +template +RepeatedPtrField::~RepeatedPtrField() { + Destroy(); +} + +template +inline RepeatedPtrField& RepeatedPtrField::operator=( + const RepeatedPtrField& other) { + CopyFrom(other); + return *this; +} + +template +inline int RepeatedPtrField::size() const { + return RepeatedPtrFieldBase::size(); +} + +template +inline const Element& RepeatedPtrField::Get(int index) const { + return RepeatedPtrFieldBase::Get(index); +} + +template +inline Element* RepeatedPtrField::Mutable(int index) { + return RepeatedPtrFieldBase::Mutable(index); +} + +template +inline Element* RepeatedPtrField::Add() { + return RepeatedPtrFieldBase::Add(); +} + +template +inline void RepeatedPtrField::RemoveLast() { + RepeatedPtrFieldBase::RemoveLast(); +} + +template +inline void RepeatedPtrField::Clear() { + RepeatedPtrFieldBase::Clear(); +} + +template +inline void RepeatedPtrField::MergeFrom( + const RepeatedPtrField& other) { + RepeatedPtrFieldBase::MergeFrom(other); +} + +template +inline void RepeatedPtrField::CopyFrom( + const RepeatedPtrField& other) { + RepeatedPtrFieldBase::CopyFrom(other); +} + +template +inline Element** RepeatedPtrField::mutable_data() { + return RepeatedPtrFieldBase::mutable_data(); +} + +template +inline const Element* const* RepeatedPtrField::data() const { + return RepeatedPtrFieldBase::data(); +} + +template +void RepeatedPtrField::Swap(RepeatedPtrField* other) { + RepeatedPtrFieldBase::Swap(other); +} + +template +void RepeatedPtrField::SwapElements(int index1, int index2) { + RepeatedPtrFieldBase::SwapElements(index1, index2); +} + +template +inline int RepeatedPtrField::SpaceUsedExcludingSelf() const { + return RepeatedPtrFieldBase::SpaceUsedExcludingSelf(); +} + +template +inline void RepeatedPtrField::AddAllocated(Element* value) { + RepeatedPtrFieldBase::AddAllocated(value); +} + +template +inline Element* RepeatedPtrField::ReleaseLast() { + return RepeatedPtrFieldBase::ReleaseLast(); +} + + +template +inline int RepeatedPtrField::ClearedCount() const { + return RepeatedPtrFieldBase::ClearedCount(); +} + +template +inline void RepeatedPtrField::AddCleared(Element* value) { + return RepeatedPtrFieldBase::AddCleared(value); +} + +template +inline Element* RepeatedPtrField::ReleaseCleared() { + return RepeatedPtrFieldBase::ReleaseCleared(); +} + +template +inline void RepeatedPtrField::Reserve(int new_size) { + return RepeatedPtrFieldBase::Reserve(new_size); +} + +template +inline int RepeatedPtrField::Capacity() const { + return RepeatedPtrFieldBase::Capacity(); +} + +// ------------------------------------------------------------------- + +namespace internal { + +// STL-like iterator implementation for RepeatedPtrField. You should not +// refer to this class directly; use RepeatedPtrField::iterator instead. +// +// The iterator for RepeatedPtrField, RepeatedPtrIterator, is +// very similar to iterator_ptr in util/gtl/iterator_adaptors-inl.h, +// but adds random-access operators and is modified to wrap a void** base +// iterator (since RepeatedPtrField stores its array as a void* array and +// casting void** to T** would violate C++ aliasing rules). +// +// This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin +// (jyasskin@google.com). +template +class RepeatedPtrIterator + : public std::iterator< + std::random_access_iterator_tag, Element> { + public: + typedef RepeatedPtrIterator iterator; + typedef std::iterator< + std::random_access_iterator_tag, Element> superclass; + + // Let the compiler know that these are type names, so we don't have to + // write "typename" in front of them everywhere. + typedef typename superclass::reference reference; + typedef typename superclass::pointer pointer; + typedef typename superclass::difference_type difference_type; + + RepeatedPtrIterator() : it_(NULL) {} + explicit RepeatedPtrIterator(void* const* it) : it_(it) {} + + // Allow "upcasting" from RepeatedPtrIterator to + // RepeatedPtrIterator. + template + RepeatedPtrIterator(const RepeatedPtrIterator& other) + : it_(other.it_) { + // Force a compiler error if the other type is not convertible to ours. + if (false) { + implicit_cast(0); + } + } + + // dereferenceable + reference operator*() const { return *reinterpret_cast(*it_); } + pointer operator->() const { return &(operator*()); } + + // {inc,dec}rementable + iterator& operator++() { ++it_; return *this; } + iterator operator++(int) { return iterator(it_++); } + iterator& operator--() { --it_; return *this; } + iterator operator--(int) { return iterator(it_--); } + + // equality_comparable + bool operator==(const iterator& x) const { return it_ == x.it_; } + bool operator!=(const iterator& x) const { return it_ != x.it_; } + + // less_than_comparable + bool operator<(const iterator& x) const { return it_ < x.it_; } + bool operator<=(const iterator& x) const { return it_ <= x.it_; } + bool operator>(const iterator& x) const { return it_ > x.it_; } + bool operator>=(const iterator& x) const { return it_ >= x.it_; } + + // addable, subtractable + iterator& operator+=(difference_type d) { + it_ += d; + return *this; + } + friend iterator operator+(iterator it, difference_type d) { + it += d; + return it; + } + friend iterator operator+(difference_type d, iterator it) { + it += d; + return it; + } + iterator& operator-=(difference_type d) { + it_ -= d; + return *this; + } + friend iterator operator-(iterator it, difference_type d) { + it -= d; + return it; + } + + // indexable + reference operator[](difference_type d) const { return *(*this + d); } + + // random access iterator + difference_type operator-(const iterator& x) const { return it_ - x.it_; } + + private: + template + friend class RepeatedPtrIterator; + + // The internal iterator. + void* const* it_; +}; + +// Provide an iterator that operates on pointers to the underlying objects +// rather than the objects themselves as RepeatedPtrIterator does. +// Consider using this when working with stl algorithms that change +// the array. +template +class RepeatedPtrOverPtrsIterator + : public std::iterator { + public: + typedef RepeatedPtrOverPtrsIterator iterator; + typedef std::iterator< + std::random_access_iterator_tag, Element*> superclass; + + // Let the compiler know that these are type names, so we don't have to + // write "typename" in front of them everywhere. + typedef typename superclass::reference reference; + typedef typename superclass::pointer pointer; + typedef typename superclass::difference_type difference_type; + + RepeatedPtrOverPtrsIterator() : it_(NULL) {} + explicit RepeatedPtrOverPtrsIterator(void** it) : it_(it) {} + + // dereferenceable + reference operator*() const { return *reinterpret_cast(it_); } + pointer operator->() const { return &(operator*()); } + + // {inc,dec}rementable + iterator& operator++() { ++it_; return *this; } + iterator operator++(int) { return iterator(it_++); } + iterator& operator--() { --it_; return *this; } + iterator operator--(int) { return iterator(it_--); } + + // equality_comparable + bool operator==(const iterator& x) const { return it_ == x.it_; } + bool operator!=(const iterator& x) const { return it_ != x.it_; } + + // less_than_comparable + bool operator<(const iterator& x) const { return it_ < x.it_; } + bool operator<=(const iterator& x) const { return it_ <= x.it_; } + bool operator>(const iterator& x) const { return it_ > x.it_; } + bool operator>=(const iterator& x) const { return it_ >= x.it_; } + + // addable, subtractable + iterator& operator+=(difference_type d) { + it_ += d; + return *this; + } + friend iterator operator+(iterator it, difference_type d) { + it += d; + return it; + } + friend iterator operator+(difference_type d, iterator it) { + it += d; + return it; + } + iterator& operator-=(difference_type d) { + it_ -= d; + return *this; + } + friend iterator operator-(iterator it, difference_type d) { + it -= d; + return it; + } + + // indexable + reference operator[](difference_type d) const { return *(*this + d); } + + // random access iterator + difference_type operator-(const iterator& x) const { return it_ - x.it_; } + + private: + template + friend class RepeatedPtrIterator; + + // The internal iterator. + void** it_; +}; + + +} // namespace internal + +template +inline typename RepeatedPtrField::iterator +RepeatedPtrField::begin() { + return iterator(raw_data()); +} +template +inline typename RepeatedPtrField::const_iterator +RepeatedPtrField::begin() const { + return iterator(raw_data()); +} +template +inline typename RepeatedPtrField::iterator +RepeatedPtrField::end() { + return iterator(raw_data() + size()); +} +template +inline typename RepeatedPtrField::const_iterator +RepeatedPtrField::end() const { + return iterator(raw_data() + size()); +} + +template +inline typename RepeatedPtrField::pointer_iterator +RepeatedPtrField::pointer_begin() { + return pointer_iterator(raw_mutable_data()); +} +template +inline typename RepeatedPtrField::pointer_iterator +RepeatedPtrField::pointer_end() { + return pointer_iterator(raw_mutable_data() + size()); +} + + +// Iterators and helper functions that follow the spirit of the STL +// std::back_insert_iterator and std::back_inserter but are tailor-made +// for RepeatedField and RepatedPtrField. Typical usage would be: +// +// std::copy(some_sequence.begin(), some_sequence.end(), +// google::protobuf::RepeatedFieldBackInserter(proto.mutable_sequence())); +// +// Ported by johannes from util/gtl/proto-array-iterators-inl.h + +namespace internal { +// A back inserter for RepeatedField objects. +template class RepeatedFieldBackInsertIterator + : public std::iterator { + public: + explicit RepeatedFieldBackInsertIterator( + RepeatedField* const mutable_field) + : field_(mutable_field) { + } + RepeatedFieldBackInsertIterator& operator=(const T& value) { + field_->Add(value); + return *this; + } + RepeatedFieldBackInsertIterator& operator*() { + return *this; + } + RepeatedFieldBackInsertIterator& operator++() { + return *this; + } + RepeatedFieldBackInsertIterator& operator++(int ignores_parameter) { + return *this; + } + + private: + RepeatedField* field_; +}; + +// A back inserter for RepeatedPtrField objects. +template class RepeatedPtrFieldBackInsertIterator + : public std::iterator { + public: + RepeatedPtrFieldBackInsertIterator( + RepeatedPtrField* const mutable_field) + : field_(mutable_field) { + } + RepeatedPtrFieldBackInsertIterator& operator=(const T& value) { + *field_->Add() = value; + return *this; + } + RepeatedPtrFieldBackInsertIterator& operator=( + const T* const ptr_to_value) { + *field_->Add() = *ptr_to_value; + return *this; + } + RepeatedPtrFieldBackInsertIterator& operator*() { + return *this; + } + RepeatedPtrFieldBackInsertIterator& operator++() { + return *this; + } + RepeatedPtrFieldBackInsertIterator& operator++(int ignores_parameter) { + return *this; + } + + private: + RepeatedPtrField* field_; +}; + +// A back inserter for RepeatedPtrFields that inserts by transfering ownership +// of a pointer. +template class AllocatedRepeatedPtrFieldBackInsertIterator + : public std::iterator { + public: + explicit AllocatedRepeatedPtrFieldBackInsertIterator( + RepeatedPtrField* const mutable_field) + : field_(mutable_field) { + } + AllocatedRepeatedPtrFieldBackInsertIterator& operator=( + T* const ptr_to_value) { + field_->AddAllocated(ptr_to_value); + return *this; + } + AllocatedRepeatedPtrFieldBackInsertIterator& operator*() { + return *this; + } + AllocatedRepeatedPtrFieldBackInsertIterator& operator++() { + return *this; + } + AllocatedRepeatedPtrFieldBackInsertIterator& operator++( + int ignores_parameter) { + return *this; + } + + private: + RepeatedPtrField* field_; +}; +} // namespace internal + +// Provides a back insert iterator for RepeatedField instances, +// similar to std::back_inserter(). Note the identically named +// function for RepeatedPtrField instances. +template internal::RepeatedFieldBackInsertIterator +RepeatedFieldBackInserter(RepeatedField* const mutable_field) { + return internal::RepeatedFieldBackInsertIterator(mutable_field); +} + +// Provides a back insert iterator for RepeatedPtrField instances, +// similar to std::back_inserter(). Note the identically named +// function for RepeatedField instances. +template internal::RepeatedPtrFieldBackInsertIterator +RepeatedFieldBackInserter(RepeatedPtrField* const mutable_field) { + return internal::RepeatedPtrFieldBackInsertIterator(mutable_field); +} + +// Provides a back insert iterator for RepeatedPtrField instances +// similar to std::back_inserter() which transfers the ownership while +// copying elements. +template internal::AllocatedRepeatedPtrFieldBackInsertIterator +AllocatedRepeatedPtrFieldBackInserter( + RepeatedPtrField* const mutable_field) { + return internal::AllocatedRepeatedPtrFieldBackInsertIterator( + mutable_field); +} + +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_REPEATED_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/service.cc b/depends/protobuf/google/protobuf/service.cc similarity index 97% rename from depends/protobuf/src/google/protobuf/service.cc rename to depends/protobuf/google/protobuf/service.cc index 53945684c..caf968ca5 100644 --- a/depends/protobuf/src/google/protobuf/service.cc +++ b/depends/protobuf/google/protobuf/service.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -42,4 +42,5 @@ RpcChannel::~RpcChannel() {} RpcController::~RpcController() {} } // namespace protobuf + } // namespace google diff --git a/depends/protobuf/src/google/protobuf/service.h b/depends/protobuf/google/protobuf/service.h similarity index 90% rename from depends/protobuf/src/google/protobuf/service.h rename to depends/protobuf/google/protobuf/service.h index d288eb554..a6a7d16de 100644 --- a/depends/protobuf/src/google/protobuf/service.h +++ b/depends/protobuf/google/protobuf/service.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,7 +33,7 @@ // Sanjay Ghemawat, Jeff Dean, and others. // // DEPRECATED: This module declares the abstract interfaces underlying proto2 -// RPC services. These are intended to be independent of any particular RPC +// RPC services. These are intented to be independent of any particular RPC // implementation, so that proto2 services can be used on top of a variety // of implementations. Starting with version 2.3.0, RPC implementations should // not try to build on these, but should instead provide code generator plugins @@ -74,12 +74,12 @@ // // To call a remote MyServiceImpl, first you need an RpcChannel connected to it. // How to construct a channel depends, again, on your RPC implementation. -// Here we use a hypothetical "MyRpcChannel" as an example: +// Here we use a hypothentical "MyRpcChannel" as an example: // MyRpcChannel channel("rpc:hostname:1234/myservice"); // MyRpcController controller; // MyServiceImpl::Stub stub(&channel); // FooRequest request; -// FooResponse response; +// FooRespnose response; // // // ... fill in request ... // @@ -100,18 +100,9 @@ #ifndef GOOGLE_PROTOBUF_SERVICE_H__ #define GOOGLE_PROTOBUF_SERVICE_H__ - #include -#include #include -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -// Must be included last. -#include - namespace google { namespace protobuf { @@ -121,17 +112,17 @@ class RpcController; class RpcChannel; // Defined in other files. -class Descriptor; // descriptor.h -class ServiceDescriptor; // descriptor.h -class MethodDescriptor; // descriptor.h -class Message; // message.h +class Descriptor; // descriptor.h +class ServiceDescriptor; // descriptor.h +class MethodDescriptor; // descriptor.h +class Message; // message.h // Abstract base interface for protocol-buffer-based RPC services. Services // themselves are abstract interfaces (implemented either by servers or as // stubs), but they subclass this base interface. The methods of this // interface can be used to call the methods of the Service without knowing // its exact type at compile time (analogous to Reflection). -class PROTOBUF_EXPORT Service { +class LIBPROTOBUF_EXPORT Service { public: inline Service() {} virtual ~Service(); @@ -139,7 +130,10 @@ class PROTOBUF_EXPORT Service { // When constructing a stub, you may pass STUB_OWNS_CHANNEL as the second // parameter to the constructor to tell it to delete its RpcChannel when // destroyed. - enum ChannelOwnership { STUB_OWNS_CHANNEL, STUB_DOESNT_OWN_CHANNEL }; + enum ChannelOwnership { + STUB_OWNS_CHANNEL, + STUB_DOESNT_OWN_CHANNEL + }; // Get the ServiceDescriptor describing this service and its methods. virtual const ServiceDescriptor* GetDescriptor() = 0; @@ -170,8 +164,10 @@ class PROTOBUF_EXPORT Service { // RpcController can be queried to determine if an error occurred and // possibly to get more information about the error. virtual void CallMethod(const MethodDescriptor* method, - RpcController* controller, const Message* request, - Message* response, Closure* done) = 0; + RpcController* controller, + const Message* request, + Message* response, + Closure* done) = 0; // CallMethod() requires that the request and response passed in are of a // particular subclass of Message. GetRequestPrototype() and @@ -187,9 +183,9 @@ class PROTOBUF_EXPORT Service { // request->ParseFromString(input); // service->CallMethod(method, *request, response, callback); virtual const Message& GetRequestPrototype( - const MethodDescriptor* method) const = 0; + const MethodDescriptor* method) const = 0; virtual const Message& GetResponsePrototype( - const MethodDescriptor* method) const = 0; + const MethodDescriptor* method) const = 0; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Service); @@ -203,7 +199,7 @@ class PROTOBUF_EXPORT Service { // "least common denominator" set of features which we expect all // implementations to support. Specific implementations may provide more // advanced features (e.g. deadline propagation). -class PROTOBUF_EXPORT RpcController { +class LIBPROTOBUF_EXPORT RpcController { public: inline RpcController() {} virtual ~RpcController(); @@ -223,7 +219,7 @@ class PROTOBUF_EXPORT RpcController { virtual bool Failed() const = 0; // If Failed() is true, returns a human-readable description of the error. - virtual std::string ErrorText() const = 0; + virtual string ErrorText() const = 0; // Advises the RPC system that the caller desires that the RPC call be // canceled. The RPC system may cancel it immediately, may wait awhile and @@ -241,7 +237,7 @@ class PROTOBUF_EXPORT RpcController { // you need to return machine-readable information about failures, you // should incorporate it into your response protocol buffer and should // NOT call SetFailed(). - virtual void SetFailed(const std::string& reason) = 0; + virtual void SetFailed(const string& reason) = 0; // If true, indicates that the client canceled the RPC, so the server may // as well give up on replying to it. The server should still call the @@ -269,7 +265,7 @@ class PROTOBUF_EXPORT RpcController { // RpcChannel* channel = new MyRpcChannel("remotehost.example.com:1234"); // MyService* service = new MyService::Stub(channel); // service->MyMethod(request, &response, callback); -class PROTOBUF_EXPORT RpcChannel { +class LIBPROTOBUF_EXPORT RpcChannel { public: inline RpcChannel() {} virtual ~RpcChannel(); @@ -280,16 +276,16 @@ class PROTOBUF_EXPORT RpcChannel { // need not be of any specific class as long as their descriptors are // method->input_type() and method->output_type(). virtual void CallMethod(const MethodDescriptor* method, - RpcController* controller, const Message* request, - Message* response, Closure* done) = 0; + RpcController* controller, + const Message* request, + Message* response, + Closure* done) = 0; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RpcChannel); }; } // namespace protobuf -} // namespace google - -#include +} // namespace google #endif // GOOGLE_PROTOBUF_SERVICE_H__ diff --git a/depends/protobuf/src/google/protobuf/stubs/common.cc b/depends/protobuf/google/protobuf/stubs/common.cc similarity index 52% rename from depends/protobuf/src/google/protobuf/stubs/common.cc rename to depends/protobuf/google/protobuf/stubs/common.cc index e0a807ffb..7b15be44d 100644 --- a/depends/protobuf/src/google/protobuf/stubs/common.cc +++ b/depends/protobuf/google/protobuf/stubs/common.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -31,33 +31,22 @@ // Author: kenton@google.com (Kenton Varda) #include - -#include -#include -#include +#include #include +#include #include +#include "config.h" + #ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // We only need minimal includes -#endif #include #define snprintf _snprintf // see comment in strutil.cc +#elif defined(HAVE_PTHREAD) +#include +#else +#error "No suitable threading library available." #endif -#if defined(__ANDROID__) -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include namespace google { namespace protobuf { @@ -92,7 +81,7 @@ void VerifyVersion(int headerVersion, } } -std::string VersionString(int version) { +string VersionString(int version) { int major = version / 1000000; int minor = (version / 1000) % 1000; int micro = version % 1000; @@ -113,123 +102,75 @@ std::string VersionString(int version) { // =================================================================== // emulates google3/base/logging.cc -// If the minimum logging level is not set, we default to logging messages for -// all levels. -#ifndef GOOGLE_PROTOBUF_MIN_LOG_LEVEL -#define GOOGLE_PROTOBUF_MIN_LOG_LEVEL LOGLEVEL_INFO -#endif - namespace internal { -#if defined(__ANDROID__) -inline void DefaultLogHandler(LogLevel level, const char* filename, int line, - const std::string& message) { - if (level < GOOGLE_PROTOBUF_MIN_LOG_LEVEL) { - return; - } - static const char* level_names[] = {"INFO", "WARNING", "ERROR", "FATAL"}; - - static const int android_log_levels[] = { - ANDROID_LOG_INFO, // LOG(INFO), - ANDROID_LOG_WARN, // LOG(WARNING) - ANDROID_LOG_ERROR, // LOG(ERROR) - ANDROID_LOG_FATAL, // LOG(FATAL) - }; - - // Bound the logging level. - const int android_log_level = android_log_levels[level]; - ::std::ostringstream ostr; - ostr << "[libprotobuf " << level_names[level] << " " << filename << ":" - << line << "] " << message.c_str(); - - // Output the log string the Android log at the appropriate level. - __android_log_write(android_log_level, "libprotobuf-native", - ostr.str().c_str()); - // Also output to std::cerr. - fprintf(stderr, "%s", ostr.str().c_str()); - fflush(stderr); - - // Indicate termination if needed. - if (android_log_level == ANDROID_LOG_FATAL) { - __android_log_write(ANDROID_LOG_FATAL, "libprotobuf-native", - "terminating.\n"); - } -} - -#else void DefaultLogHandler(LogLevel level, const char* filename, int line, - const std::string& message) { - if (level < GOOGLE_PROTOBUF_MIN_LOG_LEVEL) { - return; - } + const string& message) { static const char* level_names[] = { "INFO", "WARNING", "ERROR", "FATAL" }; // We use fprintf() instead of cerr because we want this to work at static // initialization time. - fprintf(stderr, "[libprotobuf %s %s:%d] %s\n", + fprintf(stderr, "libprotobuf %s %s:%d] %s\n", level_names[level], filename, line, message.c_str()); fflush(stderr); // Needed on MSVC. } -#endif -void NullLogHandler(LogLevel /* level */, const char* /* filename */, - int /* line */, const std::string& /* message */) { +void NullLogHandler(LogLevel level, const char* filename, int line, + const string& message) { // Nothing. } static LogHandler* log_handler_ = &DefaultLogHandler; -static std::atomic log_silencer_count_ = ATOMIC_VAR_INIT(0); +static int log_silencer_count_ = 0; -LogMessage& LogMessage::operator<<(const std::string& value) { - message_ += value; - return *this; -} +static Mutex* log_silencer_count_mutex_ = NULL; +GOOGLE_PROTOBUF_DECLARE_ONCE(log_silencer_count_init_); -LogMessage& LogMessage::operator<<(const char* value) { - message_ += value; - return *this; +void DeleteLogSilencerCount() { + delete log_silencer_count_mutex_; + log_silencer_count_mutex_ = NULL; } - -LogMessage& LogMessage::operator<<(const StringPiece& value) { - message_ += value.ToString(); - return *this; +void InitLogSilencerCount() { + log_silencer_count_mutex_ = new Mutex; + OnShutdown(&DeleteLogSilencerCount); } - -LogMessage& LogMessage::operator<<(const util::Status& status) { - message_ += status.ToString(); - return *this; +void InitLogSilencerCountOnce() { + GoogleOnceInit(&log_silencer_count_init_, &InitLogSilencerCount); } -LogMessage& LogMessage::operator<<(const uint128& value) { - std::ostringstream str; - str << value; - message_ += str.str(); +LogMessage& LogMessage::operator<<(const string& value) { + message_ += value; return *this; } -LogMessage& LogMessage::operator<<(char value) { - return *this << StringPiece(&value, 1); -} - -LogMessage& LogMessage::operator<<(void* value) { - StrAppend(&message_, strings::Hex(reinterpret_cast(value))); +LogMessage& LogMessage::operator<<(const char* value) { + message_ += value; return *this; } +// Since this is just for logging, we don't care if the current locale changes +// the results -- in fact, we probably prefer that. So we use snprintf() +// instead of Simple*toa(). #undef DECLARE_STREAM_OPERATOR -#define DECLARE_STREAM_OPERATOR(TYPE) \ - LogMessage& LogMessage::operator<<(TYPE value) { \ - StrAppend(&message_, value); \ - return *this; \ +#define DECLARE_STREAM_OPERATOR(TYPE, FORMAT) \ + LogMessage& LogMessage::operator<<(TYPE value) { \ + /* 128 bytes should be big enough for any of the primitive */ \ + /* values which we print with this, but well use snprintf() */ \ + /* anyway to be extra safe. */ \ + char buffer[128]; \ + snprintf(buffer, sizeof(buffer), FORMAT, value); \ + /* Guard against broken MSVC snprintf(). */ \ + buffer[sizeof(buffer)-1] = '\0'; \ + message_ += buffer; \ + return *this; \ } -DECLARE_STREAM_OPERATOR(int) -DECLARE_STREAM_OPERATOR(unsigned int) -DECLARE_STREAM_OPERATOR(long) // NOLINT(runtime/int) -DECLARE_STREAM_OPERATOR(unsigned long) // NOLINT(runtime/int) -DECLARE_STREAM_OPERATOR(double) -DECLARE_STREAM_OPERATOR(long long) // NOLINT(runtime/int) -DECLARE_STREAM_OPERATOR(unsigned long long) // NOLINT(runtime/int) +DECLARE_STREAM_OPERATOR(char , "%c" ) +DECLARE_STREAM_OPERATOR(int , "%d" ) +DECLARE_STREAM_OPERATOR(uint , "%u" ) +DECLARE_STREAM_OPERATOR(long , "%ld") +DECLARE_STREAM_OPERATOR(unsigned long, "%lu") +DECLARE_STREAM_OPERATOR(double , "%g" ) #undef DECLARE_STREAM_OPERATOR LogMessage::LogMessage(LogLevel level, const char* filename, int line) @@ -240,15 +181,17 @@ void LogMessage::Finish() { bool suppress = false; if (level_ != LOGLEVEL_FATAL) { - suppress = log_silencer_count_ > 0; + InitLogSilencerCountOnce(); + MutexLock lock(log_silencer_count_mutex_); + suppress = internal::log_silencer_count_ > 0; } if (!suppress) { - log_handler_(level_, filename_, line_, message_); + internal::log_handler_(level_, filename_, line_, message_); } if (level_ == LOGLEVEL_FATAL) { -#if PROTOBUF_USE_EXCEPTIONS +#ifdef PROTOBUF_USE_EXCEPTIONS throw FatalException(filename_, line_, message_); #else abort(); @@ -265,9 +208,9 @@ void LogFinisher::operator=(LogMessage& other) { LogHandler* SetLogHandler(LogHandler* new_func) { LogHandler* old = internal::log_handler_; if (old == &internal::NullLogHandler) { - old = nullptr; + old = NULL; } - if (new_func == nullptr) { + if (new_func == NULL) { internal::log_handler_ = &internal::NullLogHandler; } else { internal::log_handler_ = new_func; @@ -276,10 +219,14 @@ LogHandler* SetLogHandler(LogHandler* new_func) { } LogSilencer::LogSilencer() { + internal::InitLogSilencerCountOnce(); + MutexLock lock(internal::log_silencer_count_mutex_); ++internal::log_silencer_count_; }; LogSilencer::~LogSilencer() { + internal::InitLogSilencerCountOnce(); + MutexLock lock(internal::log_silencer_count_mutex_); --internal::log_silencer_count_; }; @@ -293,24 +240,132 @@ namespace internal { FunctionClosure0::~FunctionClosure0() {} } void DoNothing() {} // =================================================================== -// emulates google3/util/endian/endian.h -// -// TODO(xiaofeng): PROTOBUF_LITTLE_ENDIAN is unfortunately defined in -// google/protobuf/io/coded_stream.h and therefore can not be used here. -// Maybe move that macro definition here in the future. -uint32_t ghtonl(uint32_t x) { - union { - uint32_t result; - uint8_t result_array[4]; - }; - result_array[0] = static_cast(x >> 24); - result_array[1] = static_cast((x >> 16) & 0xFF); - result_array[2] = static_cast((x >> 8) & 0xFF); - result_array[3] = static_cast(x & 0xFF); - return result; +// emulates google3/base/mutex.cc + +#ifdef _WIN32 + +struct Mutex::Internal { + CRITICAL_SECTION mutex; +#ifndef NDEBUG + // Used only to implement AssertHeld(). + DWORD thread_id; +#endif +}; + +Mutex::Mutex() + : mInternal(new Internal) { + InitializeCriticalSection(&mInternal->mutex); +} + +Mutex::~Mutex() { + DeleteCriticalSection(&mInternal->mutex); + delete mInternal; +} + +void Mutex::Lock() { + EnterCriticalSection(&mInternal->mutex); +#ifndef NDEBUG + mInternal->thread_id = GetCurrentThreadId(); +#endif +} + +void Mutex::Unlock() { +#ifndef NDEBUG + mInternal->thread_id = 0; +#endif + LeaveCriticalSection(&mInternal->mutex); +} + +void Mutex::AssertHeld() { +#ifndef NDEBUG + GOOGLE_DCHECK_EQ(mInternal->thread_id, GetCurrentThreadId()); +#endif +} + +#elif defined(HAVE_PTHREAD) + +struct Mutex::Internal { + pthread_mutex_t mutex; +}; + +Mutex::Mutex() + : mInternal(new Internal) { + pthread_mutex_init(&mInternal->mutex, NULL); +} + +Mutex::~Mutex() { + pthread_mutex_destroy(&mInternal->mutex); + delete mInternal; +} + +void Mutex::Lock() { + int result = pthread_mutex_lock(&mInternal->mutex); + if (result != 0) { + GOOGLE_LOG(FATAL) << "pthread_mutex_lock: " << strerror(result); + } +} + +void Mutex::Unlock() { + int result = pthread_mutex_unlock(&mInternal->mutex); + if (result != 0) { + GOOGLE_LOG(FATAL) << "pthread_mutex_unlock: " << strerror(result); + } +} + +void Mutex::AssertHeld() { + // pthreads dosn't provide a way to check which thread holds the mutex. + // TODO(kenton): Maybe keep track of locking thread ID like with WIN32? } -#if PROTOBUF_USE_EXCEPTIONS +#endif + +// =================================================================== +// Shutdown support. + +namespace internal { + +typedef void OnShutdownFunc(); +vector* shutdown_functions = NULL; +Mutex* shutdown_functions_mutex = NULL; +GOOGLE_PROTOBUF_DECLARE_ONCE(shutdown_functions_init); + +void InitShutdownFunctions() { + shutdown_functions = new vector; + shutdown_functions_mutex = new Mutex; +} + +inline void InitShutdownFunctionsOnce() { + GoogleOnceInit(&shutdown_functions_init, &InitShutdownFunctions); +} + +void OnShutdown(void (*func)()) { + InitShutdownFunctionsOnce(); + MutexLock lock(shutdown_functions_mutex); + shutdown_functions->push_back(func); +} + +} // namespace internal + +void ShutdownProtobufLibrary() { + internal::InitShutdownFunctionsOnce(); + + // We don't need to lock shutdown_functions_mutex because it's up to the + // caller to make sure that no one is using the library before this is + // called. + + // Make it safe to call this multiple times. + if (internal::shutdown_functions == NULL) return; + + for (int i = 0; i < internal::shutdown_functions->size(); i++) { + internal::shutdown_functions->at(i)(); + } + delete internal::shutdown_functions; + internal::shutdown_functions = NULL; + delete internal::shutdown_functions_mutex; + internal::shutdown_functions_mutex = NULL; +} + +#ifdef PROTOBUF_USE_EXCEPTIONS FatalException::~FatalException() throw() {} const char* FatalException::what() const throw() { @@ -320,5 +375,3 @@ const char* FatalException::what() const throw() { } // namespace protobuf } // namespace google - -#include diff --git a/depends/protobuf/google/protobuf/stubs/common.h b/depends/protobuf/google/protobuf/stubs/common.h new file mode 100644 index 000000000..9cd2b9e9a --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/common.h @@ -0,0 +1,1234 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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) and others +// +// Contains basic types and utilities used by the rest of the library. + +#ifndef GOOGLE_PROTOBUF_COMMON_H__ +#define GOOGLE_PROTOBUF_COMMON_H__ + +#include +#include +#include +#include +#include +#if defined(__osf__) +// Tru64 lacks stdint.h, but has inttypes.h which defines a superset of +// what stdint.h would define. +#include +#elif !defined(_MSC_VER) +#include +#endif +#include + +using std::min; +using std::max; + +// make MSVC shut up about some things +#ifdef _MSC_VER + // don't spew nonsense! + #pragma warning( disable: 4251 ) + // POSIX is OK, stop complaining. + #pragma warning( disable: 4996 ) + // using 'this' in initializer lists... + #pragma warning( disable: 4355 ) + // signed/unsigned mismatch + #pragma warning( disable: 4018 ) + // possible loss of data from assignments between different numeric types + #pragma warning( disable: 4244 ) + // forcing value to 'bool' + #pragma warning( disable: 4800 ) +#endif + +#if defined(_MSC_VER) && defined(_CPPUNWIND) + #define PROTOBUF_USE_EXCEPTIONS +#elif defined(__EXCEPTIONS) + #define PROTOBUF_USE_EXCEPTIONS +#endif +#ifdef PROTOBUF_USE_EXCEPTIONS +#include +#endif + +#if defined(_WIN32) && defined(GetMessage) +// Allow GetMessage to be used as a valid method name in protobuf classes. +// windows.h defines GetMessage() as a macro. Let's re-define it as an inline +// function. The inline function should be equivalent for C++ users. +inline BOOL GetMessage_Win32( + LPMSG lpMsg, HWND hWnd, + UINT wMsgFilterMin, UINT wMsgFilterMax) { + return GetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); +} +#undef GetMessage +inline BOOL GetMessage( + LPMSG lpMsg, HWND hWnd, + UINT wMsgFilterMin, UINT wMsgFilterMax) { + return GetMessage_Win32(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); +} +#endif + + +namespace std {} + +namespace google { +namespace protobuf { + +#undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS +#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) + +#if defined(_MSC_VER) && defined(PROTOBUF_USE_DLLS) + #ifdef LIBPROTOBUF_EXPORTS + #define LIBPROTOBUF_EXPORT __declspec(dllexport) + #else + #define LIBPROTOBUF_EXPORT __declspec(dllimport) + #endif + #ifdef LIBPROTOC_EXPORTS + #define LIBPROTOC_EXPORT __declspec(dllexport) + #else + #define LIBPROTOC_EXPORT __declspec(dllimport) + #endif +#elif defined(PROTOBUF_USE_DLLS) + #define LIBPROTOBUF_EXPORT __attribute__ ((visibility("default"))) + #define LIBPROTOC_EXPORT __attribute__ ((visibility("default"))) +#else + #define LIBPROTOBUF_EXPORT + #define LIBPROTOC_EXPORT +#endif + +namespace internal { + +// Some of these constants are macros rather than const ints so that they can +// be used in #if directives. + +// The current version, represented as a single integer to make comparison +// easier: major * 10^6 + minor * 10^3 + micro +#define GOOGLE_PROTOBUF_VERSION 2004001 + +// The minimum library version which works with the current version of the +// headers. +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 2004000 + +// The minimum header version which works with the current version of +// the library. This constant should only be used by protoc's C++ code +// generator. +static const int kMinHeaderVersionForLibrary = 2004000; + +// The minimum protoc version which works with the current version of the +// headers. +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 2004000 + +// The minimum header version which works with the current version of +// protoc. This constant should only be used in VerifyVersion(). +static const int kMinHeaderVersionForProtoc = 2004000; + +// Verifies that the headers and libraries are compatible. Use the macro +// below to call this. +void LIBPROTOBUF_EXPORT VerifyVersion(int headerVersion, int minLibraryVersion, + const char* filename); + +// Converts a numeric version number to a string. +std::string LIBPROTOBUF_EXPORT VersionString(int version); + +} // namespace internal + +// Place this macro in your main() function (or somewhere before you attempt +// to use the protobuf library) to verify that the version you link against +// matches the headers you compiled against. If a version mismatch is +// detected, the process will abort. +#define GOOGLE_PROTOBUF_VERIFY_VERSION \ + ::google::protobuf::internal::VerifyVersion( \ + GOOGLE_PROTOBUF_VERSION, GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION, \ + __FILE__) + +// =================================================================== +// from google3/base/port.h + +typedef unsigned int uint; + +#ifdef _MSC_VER +typedef __int8 int8; +typedef __int16 int16; +typedef __int32 int32; +typedef __int64 int64; + +typedef unsigned __int8 uint8; +typedef unsigned __int16 uint16; +typedef unsigned __int32 uint32; +typedef unsigned __int64 uint64; +#else +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +#endif + +// long long macros to be used because gcc and vc++ use different suffixes, +// and different size specifiers in format strings +#undef GOOGLE_LONGLONG +#undef GOOGLE_ULONGLONG +#undef GOOGLE_LL_FORMAT + +#ifdef _MSC_VER +#define GOOGLE_LONGLONG(x) x##I64 +#define GOOGLE_ULONGLONG(x) x##UI64 +#define GOOGLE_LL_FORMAT "I64" // As in printf("%I64d", ...) +#else +#define GOOGLE_LONGLONG(x) x##LL +#define GOOGLE_ULONGLONG(x) x##ULL +#define GOOGLE_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also. +#endif + +static const int32 kint32max = 0x7FFFFFFF; +static const int32 kint32min = -kint32max - 1; +static const int64 kint64max = GOOGLE_LONGLONG(0x7FFFFFFFFFFFFFFF); +static const int64 kint64min = -kint64max - 1; +static const uint32 kuint32max = 0xFFFFFFFFu; +static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); + +// ------------------------------------------------------------------- +// 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. + +#ifndef GOOGLE_ATTRIBUTE_ALWAYS_INLINE +#if defined(__GNUC__) && (__GNUC__ > 3 ||(__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +// For functions we want to force inline. +// Introduced in gcc 3.1. +#define GOOGLE_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) +#else +// Other compilers will have to figure it out for themselves. +#define GOOGLE_ATTRIBUTE_ALWAYS_INLINE +#endif +#endif + +#ifndef GOOGLE_ATTRIBUTE_DEPRECATED +#ifdef __GNUC__ +// If the method/variable/type is used anywhere, produce a warning. +#define GOOGLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated)) +#else +#define GOOGLE_ATTRIBUTE_DEPRECATED +#endif +#endif + +#ifndef GOOGLE_PREDICT_TRUE +#ifdef __GNUC__ +// Provided at least since GCC 3.0. +#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) +#else +#define GOOGLE_PREDICT_TRUE +#endif +#endif + +// Delimits a block of code which may write to memory which is simultaneously +// written by other threads, but which has been determined to be thread-safe +// (e.g. because it is an idempotent write). +#ifndef GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN +#define GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN() +#endif +#ifndef GOOGLE_SAFE_CONCURRENT_WRITES_END +#define GOOGLE_SAFE_CONCURRENT_WRITES_END() +#endif + +// =================================================================== +// from google3/base/basictypes.h + +// The GOOGLE_ARRAYSIZE(arr) macro returns the # of elements in an array arr. +// The expression is a compile-time constant, and therefore can be +// used in defining new arrays, for example. +// +// GOOGLE_ARRAYSIZE catches a few type errors. If you see a compiler error +// +// "warning: division by zero in ..." +// +// when using GOOGLE_ARRAYSIZE, you are (wrongfully) giving it a pointer. +// You should only use GOOGLE_ARRAYSIZE on statically allocated arrays. +// +// The following comments are on the implementation details, and can +// be ignored by the users. +// +// ARRAYSIZE(arr) works by inspecting sizeof(arr) (the # of bytes in +// the array) and sizeof(*(arr)) (the # of bytes in one array +// element). If the former is divisible by the latter, perhaps arr is +// indeed an array, in which case the division result is the # of +// elements in the array. Otherwise, arr cannot possibly be an array, +// and we generate a compiler error to prevent the code from +// compiling. +// +// Since the size of bool is implementation-defined, we need to cast +// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final +// result has type size_t. +// +// This macro is not perfect as it wrongfully accepts certain +// pointers, namely where the pointer size is divisible by the pointee +// size. Since all our code has to go through a 32-bit compiler, +// where a pointer is 4 bytes, this means all pointers to a type whose +// size is 3 or greater than 4 will be (righteously) rejected. +// +// Kudos to Jorg Brown for this simple and elegant implementation. + +#undef GOOGLE_ARRAYSIZE +#define GOOGLE_ARRAYSIZE(a) \ + ((sizeof(a) / sizeof(*(a))) / \ + static_cast(!(sizeof(a) % sizeof(*(a))))) + +namespace internal { + +// Use implicit_cast as a safe version of static_cast or const_cast +// for upcasting in the type hierarchy (i.e. casting a pointer to Foo +// to a pointer to SuperclassOfFoo or casting a pointer to Foo to +// a const pointer to Foo). +// When you use implicit_cast, the compiler checks that the cast is safe. +// Such explicit implicit_casts are necessary in surprisingly many +// situations where C++ demands an exact type match instead of an +// argument type convertable to a target type. +// +// The From type can be inferred, so the preferred syntax for using +// implicit_cast is the same as for static_cast etc.: +// +// implicit_cast(expr) +// +// implicit_cast would have been part of the C++ standard library, +// but the proposal was submitted too late. It will probably make +// its way into the language in the future. +template +inline To implicit_cast(From const &f) { + return f; +} + +// When you upcast (that is, cast a pointer from type Foo to type +// SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts +// always succeed. When you downcast (that is, cast a pointer from +// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because +// how do you know the pointer is really of type SubclassOfFoo? It +// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus, +// when you downcast, you should use this macro. In debug mode, we +// use dynamic_cast<> to double-check the downcast is legal (we die +// if it's not). In normal mode, we do the efficient static_cast<> +// instead. Thus, it's important to test in debug mode to make sure +// the cast is legal! +// This is the only place in the code we should use dynamic_cast<>. +// In particular, you SHOULDN'T be using dynamic_cast<> in order to +// do RTTI (eg code like this: +// if (dynamic_cast(foo)) HandleASubclass1Object(foo); +// if (dynamic_cast(foo)) HandleASubclass2Object(foo); +// You should design the code some other way not to need this. + +template // use like this: down_cast(foo); +inline To down_cast(From* f) { // so we only accept pointers + // Ensures that To is a sub-type of From *. This test is here only + // for compile-time type checking, and has no overhead in an + // optimized build at run-time, as it will be optimized away + // completely. + if (false) { + implicit_cast(0); + } + +#if !defined(NDEBUG) && !defined(GOOGLE_PROTOBUF_NO_RTTI) + assert(f == NULL || dynamic_cast(f) != NULL); // RTTI: debug mode only! +#endif + return static_cast(f); +} + +} // namespace internal + +// We made these internal so that they would show up as such in the docs, +// but we don't want to stick "internal::" in front of them everywhere. +using internal::implicit_cast; +using internal::down_cast; + +// The COMPILE_ASSERT macro can be used to verify that a compile time +// expression is true. For example, you could use it to verify the +// size of a static array: +// +// COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES, +// content_type_names_incorrect_size); +// +// or to make sure a struct is smaller than a certain size: +// +// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); +// +// The second argument to the macro is the name of the variable. If +// the expression is false, most compilers will issue a warning/error +// containing the name of the variable. + +namespace internal { + +template +struct CompileAssert { +}; + +} // namespace internal + +#undef GOOGLE_COMPILE_ASSERT +#define GOOGLE_COMPILE_ASSERT(expr, msg) \ + typedef ::google::protobuf::internal::CompileAssert<(bool(expr))> \ + msg[bool(expr) ? 1 : -1] + + +// Implementation details of COMPILE_ASSERT: +// +// - COMPILE_ASSERT works by defining an array type that has -1 +// elements (and thus is invalid) when the expression is false. +// +// - The simpler definition +// +// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1] +// +// does not work, as gcc supports variable-length arrays whose sizes +// are determined at run-time (this is gcc's extension and not part +// of the C++ standard). As a result, gcc fails to reject the +// following code with the simple definition: +// +// int foo; +// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is +// // not a compile-time constant. +// +// - By using the type CompileAssert<(bool(expr))>, we ensures that +// expr is a compile-time constant. (Template arguments must be +// determined at compile-time.) +// +// - The outter parentheses in CompileAssert<(bool(expr))> are necessary +// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written +// +// CompileAssert +// +// instead, these compilers will refuse to compile +// +// COMPILE_ASSERT(5 > 0, some_message); +// +// (They seem to think the ">" in "5 > 0" marks the end of the +// template argument list.) +// +// - The array size is (bool(expr) ? 1 : -1), instead of simply +// +// ((expr) ? 1 : -1). +// +// This is to avoid running into a bug in MS VC 7.1, which +// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1. + +// =================================================================== +// from google3/base/scoped_ptr.h + +namespace internal { + +// This is an implementation designed to match the anticipated future TR2 +// implementation of the scoped_ptr class, and its closely-related brethren, +// scoped_array, scoped_ptr_malloc, and make_scoped_ptr. + +template class scoped_ptr; +template class scoped_array; + +// A scoped_ptr is like a T*, except that the destructor of scoped_ptr +// automatically deletes the pointer it holds (if any). +// That is, scoped_ptr owns the T object that it points to. +// Like a T*, a scoped_ptr may hold either NULL or a pointer to a T object. +// +// The size of a scoped_ptr is small: +// sizeof(scoped_ptr) == sizeof(C*) +template +class scoped_ptr { + public: + + // The element type + typedef C element_type; + + // Constructor. Defaults to intializing with NULL. + // There is no way to create an uninitialized scoped_ptr. + // The input parameter must be allocated with new. + explicit scoped_ptr(C* p = NULL) : ptr_(p) { } + + // Destructor. If there is a C object, delete it. + // We don't need to test ptr_ == NULL because C++ does that for us. + ~scoped_ptr() { + enum { type_must_be_complete = sizeof(C) }; + delete ptr_; + } + + // Reset. Deletes the current owned object, if any. + // Then takes ownership of a new object, if given. + // this->reset(this->get()) works. + void reset(C* p = NULL) { + if (p != ptr_) { + enum { type_must_be_complete = sizeof(C) }; + delete ptr_; + ptr_ = p; + } + } + + // Accessors to get the owned object. + // operator* and operator-> will assert() if there is no current object. + C& operator*() const { + assert(ptr_ != NULL); + return *ptr_; + } + C* operator->() const { + assert(ptr_ != NULL); + return ptr_; + } + C* get() const { return ptr_; } + + // Comparison operators. + // These return whether two scoped_ptr refer to the same object, not just to + // two different but equal objects. + bool operator==(C* p) const { return ptr_ == p; } + bool operator!=(C* p) const { return ptr_ != p; } + + // Swap two scoped pointers. + void swap(scoped_ptr& p2) { + C* tmp = ptr_; + ptr_ = p2.ptr_; + p2.ptr_ = tmp; + } + + // Release a pointer. + // The return value is the current pointer held by this object. + // If this object holds a NULL pointer, the return value is NULL. + // After this operation, this object will hold a NULL pointer, + // and will not own the object any more. + C* release() { + C* retVal = ptr_; + ptr_ = NULL; + return retVal; + } + + private: + C* ptr_; + + // Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't + // make sense, and if C2 == C, it still doesn't make sense because you should + // never have the same object owned by two different scoped_ptrs. + template bool operator==(scoped_ptr const& p2) const; + template bool operator!=(scoped_ptr const& p2) const; + + // Disallow evil constructors + scoped_ptr(const scoped_ptr&); + void operator=(const scoped_ptr&); +}; + +// scoped_array is like scoped_ptr, except that the caller must allocate +// with new [] and the destructor deletes objects with delete []. +// +// As with scoped_ptr, a scoped_array either points to an object +// or is NULL. A scoped_array owns the object that it points to. +// +// Size: sizeof(scoped_array) == sizeof(C*) +template +class scoped_array { + public: + + // The element type + typedef C element_type; + + // Constructor. Defaults to intializing with NULL. + // There is no way to create an uninitialized scoped_array. + // The input parameter must be allocated with new []. + explicit scoped_array(C* p = NULL) : array_(p) { } + + // Destructor. If there is a C object, delete it. + // We don't need to test ptr_ == NULL because C++ does that for us. + ~scoped_array() { + enum { type_must_be_complete = sizeof(C) }; + delete[] array_; + } + + // Reset. Deletes the current owned object, if any. + // Then takes ownership of a new object, if given. + // this->reset(this->get()) works. + void reset(C* p = NULL) { + if (p != array_) { + enum { type_must_be_complete = sizeof(C) }; + delete[] array_; + array_ = p; + } + } + + // Get one element of the current object. + // Will assert() if there is no current object, or index i is negative. + C& operator[](std::ptrdiff_t i) const { + assert(i >= 0); + assert(array_ != NULL); + return array_[i]; + } + + // Get a pointer to the zeroth element of the current object. + // If there is no current object, return NULL. + C* get() const { + return array_; + } + + // Comparison operators. + // These return whether two scoped_array refer to the same object, not just to + // two different but equal objects. + bool operator==(C* p) const { return array_ == p; } + bool operator!=(C* p) const { return array_ != p; } + + // Swap two scoped arrays. + void swap(scoped_array& p2) { + C* tmp = array_; + array_ = p2.array_; + p2.array_ = tmp; + } + + // Release an array. + // The return value is the current pointer held by this object. + // If this object holds a NULL pointer, the return value is NULL. + // After this operation, this object will hold a NULL pointer, + // and will not own the object any more. + C* release() { + C* retVal = array_; + array_ = NULL; + return retVal; + } + + private: + C* array_; + + // Forbid comparison of different scoped_array types. + template bool operator==(scoped_array const& p2) const; + template bool operator!=(scoped_array const& p2) const; + + // Disallow evil constructors + scoped_array(const scoped_array&); + void operator=(const scoped_array&); +}; + +} // namespace internal + +// We made these internal so that they would show up as such in the docs, +// but we don't want to stick "internal::" in front of them everywhere. +using internal::scoped_ptr; +using internal::scoped_array; + +// =================================================================== +// emulates google3/base/logging.h + +enum LogLevel { + LOGLEVEL_INFO, // Informational. This is never actually used by + // libprotobuf. + LOGLEVEL_WARNING, // Warns about issues that, although not technically a + // problem now, could cause problems in the future. For + // example, a // warning will be printed when parsing a + // message that is near the message size limit. + LOGLEVEL_ERROR, // An error occurred which should never happen during + // normal use. + LOGLEVEL_FATAL, // An error occurred from which the library cannot + // recover. This usually indicates a programming error + // in the code which calls the library, especially when + // compiled in debug mode. + +#ifdef NDEBUG + LOGLEVEL_DFATAL = LOGLEVEL_ERROR +#else + LOGLEVEL_DFATAL = LOGLEVEL_FATAL +#endif +}; + +namespace internal { + +class LogFinisher; + +class LIBPROTOBUF_EXPORT LogMessage { + public: + LogMessage(LogLevel level, const char* filename, int line); + ~LogMessage(); + + LogMessage& operator<<(const std::string& value); + LogMessage& operator<<(const char* value); + LogMessage& operator<<(char value); + LogMessage& operator<<(int value); + LogMessage& operator<<(uint value); + LogMessage& operator<<(long value); + LogMessage& operator<<(unsigned long value); + LogMessage& operator<<(double value); + + private: + friend class LogFinisher; + void Finish(); + + LogLevel level_; + const char* filename_; + int line_; + std::string message_; +}; + +// Used to make the entire "LOG(BLAH) << etc." expression have a void return +// type and print a newline after each message. +class LIBPROTOBUF_EXPORT LogFinisher { + public: + void operator=(LogMessage& other); +}; + +} // namespace internal + +// Undef everything in case we're being mixed with some other Google library +// which already defined them itself. Presumably all Google libraries will +// support the same syntax for these so it should not be a big deal if they +// end up using our definitions instead. +#undef GOOGLE_LOG +#undef GOOGLE_LOG_IF + +#undef GOOGLE_CHECK +#undef GOOGLE_CHECK_EQ +#undef GOOGLE_CHECK_NE +#undef GOOGLE_CHECK_LT +#undef GOOGLE_CHECK_LE +#undef GOOGLE_CHECK_GT +#undef GOOGLE_CHECK_GE + +#undef GOOGLE_DLOG +#undef GOOGLE_DCHECK +#undef GOOGLE_DCHECK_EQ +#undef GOOGLE_DCHECK_NE +#undef GOOGLE_DCHECK_LT +#undef GOOGLE_DCHECK_LE +#undef GOOGLE_DCHECK_GT +#undef GOOGLE_DCHECK_GE + +#define GOOGLE_LOG(LEVEL) \ + ::google::protobuf::internal::LogFinisher() = \ + ::google::protobuf::internal::LogMessage( \ + ::google::protobuf::LOGLEVEL_##LEVEL, __FILE__, __LINE__) +#define GOOGLE_LOG_IF(LEVEL, CONDITION) \ + !(CONDITION) ? (void)0 : GOOGLE_LOG(LEVEL) + +#define GOOGLE_CHECK(EXPRESSION) \ + GOOGLE_LOG_IF(FATAL, !(EXPRESSION)) << "CHECK failed: " #EXPRESSION ": " +#define GOOGLE_CHECK_EQ(A, B) GOOGLE_CHECK((A) == (B)) +#define GOOGLE_CHECK_NE(A, B) GOOGLE_CHECK((A) != (B)) +#define GOOGLE_CHECK_LT(A, B) GOOGLE_CHECK((A) < (B)) +#define GOOGLE_CHECK_LE(A, B) GOOGLE_CHECK((A) <= (B)) +#define GOOGLE_CHECK_GT(A, B) GOOGLE_CHECK((A) > (B)) +#define GOOGLE_CHECK_GE(A, B) GOOGLE_CHECK((A) >= (B)) + +#ifdef NDEBUG + +#define GOOGLE_DLOG GOOGLE_LOG_IF(INFO, false) + +#define GOOGLE_DCHECK(EXPRESSION) while(false) GOOGLE_CHECK(EXPRESSION) +#define GOOGLE_DCHECK_EQ(A, B) GOOGLE_DCHECK((A) == (B)) +#define GOOGLE_DCHECK_NE(A, B) GOOGLE_DCHECK((A) != (B)) +#define GOOGLE_DCHECK_LT(A, B) GOOGLE_DCHECK((A) < (B)) +#define GOOGLE_DCHECK_LE(A, B) GOOGLE_DCHECK((A) <= (B)) +#define GOOGLE_DCHECK_GT(A, B) GOOGLE_DCHECK((A) > (B)) +#define GOOGLE_DCHECK_GE(A, B) GOOGLE_DCHECK((A) >= (B)) + +#else // NDEBUG + +#define GOOGLE_DLOG GOOGLE_LOG + +#define GOOGLE_DCHECK GOOGLE_CHECK +#define GOOGLE_DCHECK_EQ GOOGLE_CHECK_EQ +#define GOOGLE_DCHECK_NE GOOGLE_CHECK_NE +#define GOOGLE_DCHECK_LT GOOGLE_CHECK_LT +#define GOOGLE_DCHECK_LE GOOGLE_CHECK_LE +#define GOOGLE_DCHECK_GT GOOGLE_CHECK_GT +#define GOOGLE_DCHECK_GE GOOGLE_CHECK_GE + +#endif // !NDEBUG + +typedef void LogHandler(LogLevel level, const char* filename, int line, + const std::string& message); + +// The protobuf library sometimes writes warning and error messages to +// stderr. These messages are primarily useful for developers, but may +// also help end users figure out a problem. If you would prefer that +// these messages be sent somewhere other than stderr, call SetLogHandler() +// to set your own handler. This returns the old handler. Set the handler +// to NULL to ignore log messages (but see also LogSilencer, below). +// +// Obviously, SetLogHandler is not thread-safe. You should only call it +// at initialization time, and probably not from library code. If you +// simply want to suppress log messages temporarily (e.g. because you +// have some code that tends to trigger them frequently and you know +// the warnings are not important to you), use the LogSilencer class +// below. +LIBPROTOBUF_EXPORT LogHandler* SetLogHandler(LogHandler* new_func); + +// Create a LogSilencer if you want to temporarily suppress all log +// messages. As long as any LogSilencer objects exist, non-fatal +// log messages will be discarded (the current LogHandler will *not* +// be called). Constructing a LogSilencer is thread-safe. You may +// accidentally suppress log messages occurring in another thread, but +// since messages are generally for debugging purposes only, this isn't +// a big deal. If you want to intercept log messages, use SetLogHandler(). +class LIBPROTOBUF_EXPORT LogSilencer { + public: + LogSilencer(); + ~LogSilencer(); +}; + +// =================================================================== +// emulates google3/base/callback.h + +// Abstract interface for a callback. When calling an RPC, you must provide +// a Closure to call when the procedure completes. See the Service interface +// in service.h. +// +// To automatically construct a Closure which calls a particular function or +// method with a particular set of parameters, use the NewCallback() function. +// Example: +// void FooDone(const FooResponse* response) { +// ... +// } +// +// void CallFoo() { +// ... +// // When done, call FooDone() and pass it a pointer to the response. +// Closure* callback = NewCallback(&FooDone, response); +// // Make the call. +// service->Foo(controller, request, response, callback); +// } +// +// Example that calls a method: +// class Handler { +// public: +// ... +// +// void FooDone(const FooResponse* response) { +// ... +// } +// +// void CallFoo() { +// ... +// // When done, call FooDone() and pass it a pointer to the response. +// Closure* callback = NewCallback(this, &Handler::FooDone, response); +// // Make the call. +// service->Foo(controller, request, response, callback); +// } +// }; +// +// Currently NewCallback() supports binding zero, one, or two arguments. +// +// Callbacks created with NewCallback() automatically delete themselves when +// executed. They should be used when a callback is to be called exactly +// once (usually the case with RPC callbacks). If a callback may be called +// a different number of times (including zero), create it with +// NewPermanentCallback() instead. You are then responsible for deleting the +// callback (using the "delete" keyword as normal). +// +// Note that NewCallback() is a bit touchy regarding argument types. Generally, +// the values you provide for the parameter bindings must exactly match the +// types accepted by the callback function. For example: +// void Foo(string s); +// NewCallback(&Foo, "foo"); // WON'T WORK: const char* != string +// NewCallback(&Foo, string("foo")); // WORKS +// Also note that the arguments cannot be references: +// void Foo(const string& s); +// string my_str; +// NewCallback(&Foo, my_str); // WON'T WORK: Can't use referecnes. +// However, correctly-typed pointers will work just fine. +class LIBPROTOBUF_EXPORT Closure { + public: + Closure() {} + virtual ~Closure(); + + virtual void Run() = 0; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Closure); +}; + +namespace internal { + +class LIBPROTOBUF_EXPORT FunctionClosure0 : public Closure { + public: + typedef void (*FunctionType)(); + + FunctionClosure0(FunctionType function, bool self_deleting) + : function_(function), self_deleting_(self_deleting) {} + ~FunctionClosure0(); + + void Run() { + bool needs_delete = self_deleting_; // read in case callback deletes + function_(); + if (needs_delete) delete this; + } + + private: + FunctionType function_; + bool self_deleting_; +}; + +template +class MethodClosure0 : public Closure { + public: + typedef void (Class::*MethodType)(); + + MethodClosure0(Class* object, MethodType method, bool self_deleting) + : object_(object), method_(method), self_deleting_(self_deleting) {} + ~MethodClosure0() {} + + void Run() { + bool needs_delete = self_deleting_; // read in case callback deletes + (object_->*method_)(); + if (needs_delete) delete this; + } + + private: + Class* object_; + MethodType method_; + bool self_deleting_; +}; + +template +class FunctionClosure1 : public Closure { + public: + typedef void (*FunctionType)(Arg1 arg1); + + FunctionClosure1(FunctionType function, bool self_deleting, + Arg1 arg1) + : function_(function), self_deleting_(self_deleting), + arg1_(arg1) {} + ~FunctionClosure1() {} + + void Run() { + bool needs_delete = self_deleting_; // read in case callback deletes + function_(arg1_); + if (needs_delete) delete this; + } + + private: + FunctionType function_; + bool self_deleting_; + Arg1 arg1_; +}; + +template +class MethodClosure1 : public Closure { + public: + typedef void (Class::*MethodType)(Arg1 arg1); + + MethodClosure1(Class* object, MethodType method, bool self_deleting, + Arg1 arg1) + : object_(object), method_(method), self_deleting_(self_deleting), + arg1_(arg1) {} + ~MethodClosure1() {} + + void Run() { + bool needs_delete = self_deleting_; // read in case callback deletes + (object_->*method_)(arg1_); + if (needs_delete) delete this; + } + + private: + Class* object_; + MethodType method_; + bool self_deleting_; + Arg1 arg1_; +}; + +template +class FunctionClosure2 : public Closure { + public: + typedef void (*FunctionType)(Arg1 arg1, Arg2 arg2); + + FunctionClosure2(FunctionType function, bool self_deleting, + Arg1 arg1, Arg2 arg2) + : function_(function), self_deleting_(self_deleting), + arg1_(arg1), arg2_(arg2) {} + ~FunctionClosure2() {} + + void Run() { + bool needs_delete = self_deleting_; // read in case callback deletes + function_(arg1_, arg2_); + if (needs_delete) delete this; + } + + private: + FunctionType function_; + bool self_deleting_; + Arg1 arg1_; + Arg2 arg2_; +}; + +template +class MethodClosure2 : public Closure { + public: + typedef void (Class::*MethodType)(Arg1 arg1, Arg2 arg2); + + MethodClosure2(Class* object, MethodType method, bool self_deleting, + Arg1 arg1, Arg2 arg2) + : object_(object), method_(method), self_deleting_(self_deleting), + arg1_(arg1), arg2_(arg2) {} + ~MethodClosure2() {} + + void Run() { + bool needs_delete = self_deleting_; // read in case callback deletes + (object_->*method_)(arg1_, arg2_); + if (needs_delete) delete this; + } + + private: + Class* object_; + MethodType method_; + bool self_deleting_; + Arg1 arg1_; + Arg2 arg2_; +}; + +} // namespace internal + +// See Closure. +inline Closure* NewCallback(void (*function)()) { + return new internal::FunctionClosure0(function, true); +} + +// See Closure. +inline Closure* NewPermanentCallback(void (*function)()) { + return new internal::FunctionClosure0(function, false); +} + +// See Closure. +template +inline Closure* NewCallback(Class* object, void (Class::*method)()) { + return new internal::MethodClosure0(object, method, true); +} + +// See Closure. +template +inline Closure* NewPermanentCallback(Class* object, void (Class::*method)()) { + return new internal::MethodClosure0(object, method, false); +} + +// See Closure. +template +inline Closure* NewCallback(void (*function)(Arg1), + Arg1 arg1) { + return new internal::FunctionClosure1(function, true, arg1); +} + +// See Closure. +template +inline Closure* NewPermanentCallback(void (*function)(Arg1), + Arg1 arg1) { + return new internal::FunctionClosure1(function, false, arg1); +} + +// See Closure. +template +inline Closure* NewCallback(Class* object, void (Class::*method)(Arg1), + Arg1 arg1) { + return new internal::MethodClosure1(object, method, true, arg1); +} + +// See Closure. +template +inline Closure* NewPermanentCallback(Class* object, void (Class::*method)(Arg1), + Arg1 arg1) { + return new internal::MethodClosure1(object, method, false, arg1); +} + +// See Closure. +template +inline Closure* NewCallback(void (*function)(Arg1, Arg2), + Arg1 arg1, Arg2 arg2) { + return new internal::FunctionClosure2( + function, true, arg1, arg2); +} + +// See Closure. +template +inline Closure* NewPermanentCallback(void (*function)(Arg1, Arg2), + Arg1 arg1, Arg2 arg2) { + return new internal::FunctionClosure2( + function, false, arg1, arg2); +} + +// See Closure. +template +inline Closure* NewCallback(Class* object, void (Class::*method)(Arg1, Arg2), + Arg1 arg1, Arg2 arg2) { + return new internal::MethodClosure2( + object, method, true, arg1, arg2); +} + +// See Closure. +template +inline Closure* NewPermanentCallback( + Class* object, void (Class::*method)(Arg1, Arg2), + Arg1 arg1, Arg2 arg2) { + return new internal::MethodClosure2( + object, method, false, arg1, arg2); +} + +// A function which does nothing. Useful for creating no-op callbacks, e.g.: +// Closure* nothing = NewCallback(&DoNothing); +void LIBPROTOBUF_EXPORT DoNothing(); + +// =================================================================== +// emulates google3/base/mutex.h + +namespace internal { + +// A Mutex is a non-reentrant (aka non-recursive) mutex. At most one thread T +// may hold a mutex at a given time. If T attempts to Lock() the same Mutex +// while holding it, T will deadlock. +class LIBPROTOBUF_EXPORT Mutex { + public: + // Create a Mutex that is not held by anybody. + Mutex(); + + // Destructor + ~Mutex(); + + // Block if necessary until this Mutex is free, then acquire it exclusively. + void Lock(); + + // Release this Mutex. Caller must hold it exclusively. + void Unlock(); + + // Crash if this Mutex is not held exclusively by this thread. + // May fail to crash when it should; will never crash when it should not. + void AssertHeld(); + + private: + struct Internal; + Internal* mInternal; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Mutex); +}; + +// MutexLock(mu) acquires mu when constructed and releases it when destroyed. +class LIBPROTOBUF_EXPORT MutexLock { + public: + explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); } + ~MutexLock() { this->mu_->Unlock(); } + private: + Mutex *const mu_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock); +}; + +// TODO(kenton): Implement these? Hard to implement portably. +typedef MutexLock ReaderMutexLock; +typedef MutexLock WriterMutexLock; + +// MutexLockMaybe is like MutexLock, but is a no-op when mu is NULL. +class LIBPROTOBUF_EXPORT MutexLockMaybe { + public: + explicit MutexLockMaybe(Mutex *mu) : + mu_(mu) { if (this->mu_ != NULL) { this->mu_->Lock(); } } + ~MutexLockMaybe() { if (this->mu_ != NULL) { this->mu_->Unlock(); } } + private: + Mutex *const mu_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLockMaybe); +}; + +} // namespace internal + +// We made these internal so that they would show up as such in the docs, +// but we don't want to stick "internal::" in front of them everywhere. +using internal::Mutex; +using internal::MutexLock; +using internal::ReaderMutexLock; +using internal::WriterMutexLock; +using internal::MutexLockMaybe; + +// =================================================================== +// from google3/base/type_traits.h + +namespace internal { + +// Specified by TR1 [4.7.4] Pointer modifications. +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { + typedef T type; }; + +// =================================================================== + +// Checks if the buffer contains structurally-valid UTF-8. Implemented in +// structurally_valid.cc. +LIBPROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len); + +} // namespace internal + +// =================================================================== +// Shutdown support. + +// Shut down the entire protocol buffers library, deleting all static-duration +// objects allocated by the library or by generated .pb.cc files. +// +// There are two reasons you might want to call this: +// * You use a draconian definition of "memory leak" in which you expect +// every single malloc() to have a corresponding free(), even for objects +// which live until program exit. +// * You are writing a dynamically-loaded library which needs to clean up +// after itself when the library is unloaded. +// +// It is safe to call this multiple times. However, it is not safe to use +// any other part of the protocol buffers library after +// ShutdownProtobufLibrary() has been called. +LIBPROTOBUF_EXPORT void ShutdownProtobufLibrary(); + +namespace internal { + +// Register a function to be called when ShutdownProtocolBuffers() is called. +LIBPROTOBUF_EXPORT void OnShutdown(void (*func)()); + +} // namespace internal + +#ifdef PROTOBUF_USE_EXCEPTIONS +class FatalException : public std::exception { + public: + FatalException(const char* filename, int line, const std::string& message) + : filename_(filename), line_(line), message_(message) {} + virtual ~FatalException() throw(); + + virtual const char* what() const throw(); + + const char* filename() const { return filename_; } + int line() const { return line_; } + const std::string& message() const { return message_; } + + private: + const char* filename_; + const int line_; + const std::string message_; +}; +#endif + +// This is at the end of the file instead of the beginning to work around a bug +// in some versions of MSVC. +using namespace std; // Don't do this at home, kids. + +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMMON_H__ diff --git a/depends/protobuf/google/protobuf/stubs/hash.h b/depends/protobuf/google/protobuf/stubs/hash.h new file mode 100644 index 000000000..b4b2da574 --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/hash.h @@ -0,0 +1,438 @@ +// 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) +// +// Deals with the fact that hash_map is not defined everywhere. + +#ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__ +#define GOOGLE_PROTOBUF_STUBS_HASH_H__ + +#include +#include + +#define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 +#define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 + +// Android +#if defined(__ANDROID__) +# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP +# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP + +// Use C++11 unordered_{map|set} if available. +#elif ((_LIBCPP_STD_VER >= 11) || \ + (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ + (__GLIBCXX__ > 20090421))) +# define GOOGLE_PROTOBUF_HAS_CXX11_HASH + +// For XCode >= 4.6: the compiler is clang with libc++. +// For earlier XCode version: the compiler is gcc-4.2.1 with libstdc++. +// libc++ provides and friends even in non C++11 mode, +// and it does not provide the tr1 library. Therefore the following macro +// checks against this special case. +// Note that we should not test the __APPLE_CC__ version number or the +// __clang__ macro, since the new compiler can still use -stdlib=libstdc++, in +// which case is not compilable without -std=c++11 +#elif defined(__APPLE_CC__) +# if __GNUC__ >= 4 +# define GOOGLE_PROTOBUF_HAS_TR1 +# else +// Not tested for gcc < 4... These setting can compile under 4.2.1 though. +# define GOOGLE_PROTOBUF_HASH_NAMESPACE __gnu_cxx +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set +# endif + +// Version checks for gcc. +#elif defined(__GNUC__) +// For GCC 4.x+, use tr1::unordered_map/set; otherwise, follow the +// instructions from: +// https://gcc.gnu.org/onlinedocs/libstdc++/manual/backwards.html +# if __GNUC__ >= 4 +# define GOOGLE_PROTOBUF_HAS_TR1 +# elif __GNUC__ >= 3 +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set +# if __GNUC__ == 3 && __GNUC_MINOR__ == 0 +# define GOOGLE_PROTOBUF_HASH_NAMESPACE std // GCC 3.0 +# else +# define GOOGLE_PROTOBUF_HASH_NAMESPACE __gnu_cxx // GCC 3.1 and later +# endif +# else +# define GOOGLE_PROTOBUF_HASH_NAMESPACE +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set +# endif + +// Version checks for MSC. +// Apparently Microsoft decided to move hash_map *back* to the std namespace in +// MSVC 2010: +// http://blogs.msdn.com/vcblog/archive/2009/05/25/stl-breaking-changes-in-visual-studio-2010-beta-1.aspx +// And.. they are moved back to stdext in MSVC 2013 (haven't checked 2012). That +// said, use unordered_map for MSVC 2010 and beyond is our safest bet. +#elif defined(_MSC_VER) +# if _MSC_VER >= 1600 // Since Visual Studio 2010 +# define GOOGLE_PROTOBUF_HAS_CXX11_HASH +# define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare +# elif _MSC_VER >= 1500 // Since Visual Studio 2008 +# define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set +# define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare +# define GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE +# elif _MSC_VER >= 1310 +# define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set +# define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare +# else +# define GOOGLE_PROTOBUF_HASH_NAMESPACE std +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set +# define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare +# endif + +// **ADD NEW COMPILERS SUPPORT HERE.** +// For other compilers, undefine the macro and fallback to use std::map, in +// google/protobuf/stubs/hash.h +#else +# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP +# undef GOOGLE_PROTOBUF_HAVE_HASH_SET +#endif + +#if defined(GOOGLE_PROTOBUF_HAS_CXX11_HASH) +# define GOOGLE_PROTOBUF_HASH_NAMESPACE std +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS unordered_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set +#elif defined(GOOGLE_PROTOBUF_HAS_TR1) +# define GOOGLE_PROTOBUF_HASH_NAMESPACE std::tr1 +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS unordered_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set +#endif + +# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \ + namespace google { \ + namespace protobuf { +# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END }} + +#undef GOOGLE_PROTOBUF_HAS_CXX11_HASH +#undef GOOGLE_PROTOBUF_HAS_TR1 + +#if defined(GOOGLE_PROTOBUF_HAVE_HASH_MAP) && \ + defined(GOOGLE_PROTOBUF_HAVE_HASH_SET) +#else +#define GOOGLE_PROTOBUF_MISSING_HASH +#include +#include +#endif + +namespace google { + namespace protobuf { + +#ifdef GOOGLE_PROTOBUF_MISSING_HASH +#undef GOOGLE_PROTOBUF_MISSING_HASH + + // This system doesn't have hash_map or hash_set. Emulate them using map and + // set. + + // Make hash be the same as less. Note that everywhere where custom + // hash functions are defined in the protobuf code, they are also defined such + // that they can be used as "less" functions, which is required by MSVC anyway. + template + struct hash { + // Dummy, just to make derivative hash functions compile. + int operator()(const Key& key) { + GOOGLE_LOG(FATAL) << "Should never be called."; + return 0; + } + + inline bool operator()(const Key& a, const Key& b) const { + return a < b; + } + }; + + // Make sure char* is compared by value. + template <> + struct hash { + // Dummy, just to make derivative hash functions compile. + int operator()(const char* key) { + GOOGLE_LOG(FATAL) << "Should never be called."; + return 0; + } + + inline bool operator()(const char* a, const char* b) const { + return strcmp(a, b) < 0; + } + }; + + template , + typename EqualKey = std::equal_to, + typename Alloc = std::allocator< std::pair > > + class hash_map : public std::map { + typedef std::map BaseClass; + + public: + hash_map(int a = 0, const HashFcn& b = HashFcn(), + const EqualKey& c = EqualKey(), + const Alloc& d = Alloc()) : BaseClass(b, d) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + + template , + typename EqualKey = std::equal_to > + class hash_set : public std::set { + public: + hash_set(int = 0) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + +#elif defined(_MSC_VER) && !defined(_STLPORT_VERSION) + + template + struct hash : public GOOGLE_PROTOBUF_HASH_COMPARE { + }; + + // MSVC's hash_compare hashes based on the string contents but + // compares based on the string pointer. WTF? + class CstringLess { + public: + inline bool operator()(const char* a, const char* b) const { + return strcmp(a, b) < 0; + } + }; + + template <> + struct hash + : public GOOGLE_PROTOBUF_HASH_COMPARE {}; + +#ifdef GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE + + template + struct InternalHashCompare : public GOOGLE_PROTOBUF_HASH_COMPARE { + InternalHashCompare() {} + InternalHashCompare(HashFcn hashfcn, EqualKey equalkey) + : hashfcn_(hashfcn), equalkey_(equalkey) {} + size_t operator()(const Key& key) const { return hashfcn_(key); } + bool operator()(const Key& key1, const Key& key2) const { + return !equalkey_(key1, key2); + } + HashFcn hashfcn_; + EqualKey equalkey_; + }; + + template , + typename EqualKey = std::equal_to, + typename Alloc = std::allocator< std::pair > > + class hash_map + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, InternalHashCompare, Alloc> { + typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, InternalHashCompare, Alloc> BaseClass; + + public: + hash_map(int a = 0, const HashFcn& b = HashFcn(), + const EqualKey& c = EqualKey(), const Alloc& d = Alloc()) + : BaseClass(InternalHashCompare(b, c), d) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + + template , + typename EqualKey = std::equal_to > + class hash_set + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS< + Key, InternalHashCompare > { + public: + hash_set(int = 0) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + +#else // GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE + + template , + typename EqualKey = std::equal_to, + typename Alloc = std::allocator< std::pair > > + class hash_map + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, HashFcn, EqualKey, Alloc> { + typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, HashFcn, EqualKey, Alloc> BaseClass; + + public: + hash_map(int a = 0, const HashFcn& b = HashFcn(), + const EqualKey& c = EqualKey(), + const Alloc& d = Alloc()) : BaseClass(a, b, c, d) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + + template , + typename EqualKey = std::equal_to > + class hash_set + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS< + Key, HashFcn, EqualKey> { + public: + hash_set(int = 0) {} + + HashFcn hash_function() const { return HashFcn(); } + }; +#endif // GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE + +#else // defined(_MSC_VER) && !defined(_STLPORT_VERSION) + + template + struct hash : public GOOGLE_PROTOBUF_HASH_NAMESPACE::hash { + }; + + template + struct hash { + inline size_t operator()(const Key* key) const { + return reinterpret_cast(key); + } + }; + + // Unlike the old SGI version, the TR1 "hash" does not special-case char*. So, + // we go ahead and provide our own implementation. + template <> + struct hash { + inline size_t operator()(const char* str) const { + size_t result = 0; + for (; *str != '\0'; str++) { + result = 5 * result + *str; + } + return result; + } + }; + + template<> + struct hash { + size_t operator()(bool x) const { + return static_cast(x); + } + }; + + template , + typename EqualKey = std::equal_to, + typename Alloc = std::allocator< std::pair > > + class hash_map + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, HashFcn, EqualKey, Alloc> { + typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS< + Key, Data, HashFcn, EqualKey, Alloc> BaseClass; + + public: + hash_map(int a = 0, const HashFcn& b = HashFcn(), + const EqualKey& c = EqualKey(), + const Alloc& d = Alloc()) : BaseClass(a, b, c, d) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + + template , + typename EqualKey = std::equal_to > + class hash_set + : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS< + Key, HashFcn, EqualKey> { + public: + hash_set(int = 0) {} + + HashFcn hash_function() const { return HashFcn(); } + }; + +#endif // !GOOGLE_PROTOBUF_MISSING_HASH + + template <> + struct hash { + inline size_t operator()(const string& key) const { + return hash()(key.c_str()); + } + + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; + inline bool operator()(const string& a, const string& b) const { + return a < b; + } + }; + + template + struct hash > { + inline size_t operator()(const pair& key) const { + size_t first_hash = hash()(key.first); + size_t second_hash = hash()(key.second); + + // FIXME(kenton): What is the best way to compute this hash? I have + // no idea! This seems a bit better than an XOR. + return first_hash * ((1 << 16) - 1) + second_hash; + } + + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; + inline bool operator()(const pair& a, + const pair& b) const { + return a < b; + } + }; + + // Used by GCC/SGI STL only. (Why isn't this provided by the standard + // library? :( ) + struct streq { + inline bool operator()(const char* a, const char* b) const { + return strcmp(a, b) == 0; + } + }; + + } // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ \ No newline at end of file diff --git a/depends/protobuf/google/protobuf/stubs/map-util.h b/depends/protobuf/google/protobuf/stubs/map-util.h new file mode 100644 index 000000000..f5c9d6b6d --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/map-util.h @@ -0,0 +1,119 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// from google3/util/gtl/map-util.h +// Author: Anton Carver + +#ifndef GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__ +#define GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__ + +#include + +namespace google { +namespace protobuf { + +// Perform a lookup in a map or hash_map. +// If the key is present in the map then the value associated with that +// key is returned, otherwise the value passed as a default is returned. +template +const typename Collection::value_type::second_type& +FindWithDefault(const Collection& collection, + const typename Collection::value_type::first_type& key, + const typename Collection::value_type::second_type& value) { + typename Collection::const_iterator it = collection.find(key); + if (it == collection.end()) { + return value; + } + return it->second; +} + +// Perform a lookup in a map or hash_map. +// If the key is present a const pointer to the associated value is returned, +// otherwise a NULL pointer is returned. +template +const typename Collection::value_type::second_type* +FindOrNull(const Collection& collection, + const typename Collection::value_type::first_type& key) { + typename Collection::const_iterator it = collection.find(key); + if (it == collection.end()) { + return 0; + } + return &it->second; +} + +// Perform a lookup in a map or hash_map whose values are pointers. +// If the key is present a const pointer to the associated value is returned, +// otherwise a NULL pointer is returned. +// This function does not distinguish between a missing key and a key mapped +// to a NULL value. +template +const typename Collection::value_type::second_type +FindPtrOrNull(const Collection& collection, + const typename Collection::value_type::first_type& key) { + typename Collection::const_iterator it = collection.find(key); + if (it == collection.end()) { + return 0; + } + return it->second; +} + +// Change the value associated with a particular key in a map or hash_map. +// If the key is not present in the map the key and value are inserted, +// otherwise the value is updated to be a copy of the value provided. +// True indicates that an insert took place, false indicates an update. +template +bool InsertOrUpdate(Collection * const collection, + const Key& key, const Value& value) { + pair ret = + collection->insert(typename Collection::value_type(key, value)); + if (!ret.second) { + // update + ret.first->second = value; + return false; + } + return true; +} + +// Insert a new key and value into a map or hash_map. +// If the key is not present in the map the key and value are +// inserted, otherwise nothing happens. True indicates that an insert +// took place, false indicates the key was already present. +template +bool InsertIfNotPresent(Collection * const collection, + const Key& key, const Value& value) { + pair ret = + collection->insert(typename Collection::value_type(key, value)); + return ret.second; +} + +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__ diff --git a/depends/protobuf/google/protobuf/stubs/once.cc b/depends/protobuf/google/protobuf/stubs/once.cc new file mode 100644 index 000000000..5b7af9ce9 --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/once.cc @@ -0,0 +1,88 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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) +// +// emulates google3/base/once.h +// +// This header is intended to be included only by internal .cc files and +// generated .pb.cc files. Users should not use this directly. + +#ifdef _WIN32 +#include +#endif + +#include + +namespace google { +namespace protobuf { + +#ifdef _WIN32 + +struct ProtobufOnceInternal { + ProtobufOnceInternal() { + InitializeCriticalSection(&critical_section); + } + ~ProtobufOnceInternal() { + DeleteCriticalSection(&critical_section); + } + CRITICAL_SECTION critical_section; +}; + +ProtobufOnceType::~ProtobufOnceType() +{ + delete internal_; + internal_ = NULL; +} + +ProtobufOnceType::ProtobufOnceType() { + // internal_ may be non-NULL if Init() was already called. + if (internal_ == NULL) internal_ = new ProtobufOnceInternal; +} + +void ProtobufOnceType::Init(void (*init_func)()) { + // internal_ may be NULL if we're still in dynamic initialization and the + // constructor has not been called yet. As mentioned in once.h, we assume + // that the program is still single-threaded at this time, and therefore it + // should be safe to initialize internal_ like so. + if (internal_ == NULL) internal_ = new ProtobufOnceInternal; + + EnterCriticalSection(&internal_->critical_section); + if (!initialized_) { + init_func(); + initialized_ = true; + } + LeaveCriticalSection(&internal_->critical_section); +} + +#endif + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/stubs/once.h b/depends/protobuf/google/protobuf/stubs/once.h new file mode 100644 index 000000000..0dee40766 --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/once.h @@ -0,0 +1,123 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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) +// +// emulates google3/base/once.h +// +// This header is intended to be included only by internal .cc files and +// generated .pb.cc files. Users should not use this directly. +// +// This is basically a portable version of pthread_once(). +// +// This header declares three things: +// * A type called ProtobufOnceType. +// * A macro GOOGLE_PROTOBUF_DECLARE_ONCE() which declares a variable of type +// ProtobufOnceType. This is the only legal way to declare such a variable. +// The macro may only be used at the global scope (you cannot create local +// or class member variables of this type). +// * A function GogoleOnceInit(ProtobufOnceType* once, void (*init_func)()). +// This function, when invoked multiple times given the same ProtobufOnceType +// object, will invoke init_func on the first call only, and will make sure +// none of the calls return before that first call to init_func has finished. +// +// This implements a way to perform lazy initialization. It's more efficient +// than using mutexes as no lock is needed if initialization has already +// happened. +// +// Example usage: +// void Init(); +// GOOGLE_PROTOBUF_DECLARE_ONCE(once_init); +// +// // Calls Init() exactly once. +// void InitOnce() { +// GoogleOnceInit(&once_init, &Init); +// } +// +// Note that if GoogleOnceInit() is called before main() has begun, it must +// only be called by the thread that will eventually call main() -- that is, +// the thread that performs dynamic initialization. In general this is a safe +// assumption since people don't usually construct threads before main() starts, +// but it is technically not guaranteed. Unfortunately, Win32 provides no way +// whatsoever to statically-initialize its synchronization primitives, so our +// only choice is to assume that dynamic initialization is single-threaded. + +#ifndef GOOGLE_PROTOBUF_STUBS_ONCE_H__ +#define GOOGLE_PROTOBUF_STUBS_ONCE_H__ + +#include + +#ifndef _WIN32 +#include +#endif + +namespace google { +namespace protobuf { + +#ifdef _WIN32 + +struct ProtobufOnceInternal; + +struct LIBPROTOBUF_EXPORT ProtobufOnceType { + ProtobufOnceType(); + ~ProtobufOnceType(); + void Init(void (*init_func)()); + + volatile bool initialized_; + ProtobufOnceInternal* internal_; +}; + +#define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \ + ::google::protobuf::ProtobufOnceType NAME + +inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) { + // Note: Double-checked locking is safe on x86. + if (!once->initialized_) { + once->Init(init_func); + } +} + +#else + +typedef pthread_once_t ProtobufOnceType; + +#define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \ + pthread_once_t NAME = PTHREAD_ONCE_INIT + +inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) { + pthread_once(once, init_func); +} + +#endif + +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_STUBS_ONCE_H__ diff --git a/depends/protobuf/src/google/protobuf/stubs/stl_util.h b/depends/protobuf/google/protobuf/stubs/stl_util-inl.h similarity index 56% rename from depends/protobuf/src/google/protobuf/stubs/stl_util.h rename to depends/protobuf/google/protobuf/stubs/stl_util-inl.h index e6260d076..a2e671bb7 100644 --- a/depends/protobuf/src/google/protobuf/stubs/stl_util.h +++ b/depends/protobuf/google/protobuf/stubs/stl_util-inl.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -28,43 +28,46 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// from google3/util/gtl/stl_util.h +// from google3/util/gtl/stl_util-inl.h -#ifndef GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__ -#define GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__ +#ifndef GOOGLE_PROTOBUF_STUBS_STL_UTIL_INL_H__ +#define GOOGLE_PROTOBUF_STUBS_STL_UTIL_INL_H__ #include -#include - -// Must be last. -#include // NOLINT - namespace google { namespace protobuf { +// STLDeleteContainerPointers() +// For a range within a container of pointers, calls delete +// (non-array version) on these pointers. +// NOTE: for these three functions, we could just implement a DeleteObject +// functor and then call for_each() on the range and functor, but this +// requires us to pull in all of algorithm.h, which seems expensive. +// For hash_[multi]set, it is important that this deletes behind the iterator +// because the hash_set may call the hash function on the iterator when it is +// advanced, which could result in the hash function trying to deference a +// stale pointer. +template +void STLDeleteContainerPointers(ForwardIterator begin, + ForwardIterator end) { + while (begin != end) { + ForwardIterator temp = begin; + ++begin; + delete *temp; + } +} + // Inside Google, this function implements a horrible, disgusting hack in which // we reach into the string's private implementation and resize it without // initializing the new bytes. In some cases doing this can significantly // improve performance. However, since it's totally non-portable it has no // place in open source code. Feel free to fill this function in with your // own disgusting hack if you want the perf boost. -inline void STLStringResizeUninitialized(std::string* s, size_t new_size) { +inline void STLStringResizeUninitialized(string* s, size_t new_size) { s->resize(new_size); } -// As above, but we make sure to follow amortized growth in which we always -// increase the capacity by at least a constant factor >1. -inline void STLStringResizeUninitializedAmortized(std::string* s, - size_t new_size) { - const size_t cap = s->capacity(); - if (new_size > cap) { - // Make sure to always grow by at least a factor of 2x. - s->reserve(std::max(new_size, 2 * cap)); - } - STLStringResizeUninitialized(s, new_size); -} - // Return a mutable char* pointing to a string's internal buffer, // which may not be null-terminated. Writing through this pointer will // modify the string. @@ -77,14 +80,42 @@ inline void STLStringResizeUninitializedAmortized(std::string* s, // (http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#530) // proposes this as the method. According to Matt Austern, this should // already work on all current implementations. -inline char* string_as_array(std::string* str) { +inline char* string_as_array(string* str) { // DO NOT USE const_cast(str->data())! See the unittest for why. - return str->empty() ? nullptr : &*str->begin(); + return str->empty() ? NULL : &*str->begin(); +} + +// STLDeleteElements() deletes all the elements in an STL container and clears +// the container. This function is suitable for use with a vector, set, +// hash_set, or any other STL container which defines sensible begin(), end(), +// and clear() methods. +// +// If container is NULL, this function is a no-op. +// +// As an alternative to calling STLDeleteElements() directly, consider +// ElementDeleter (defined below), which ensures that your container's elements +// are deleted when the ElementDeleter goes out of scope. +template +void STLDeleteElements(T *container) { + if (!container) return; + STLDeleteContainerPointers(container->begin(), container->end()); + container->clear(); +} + +// Given an STL container consisting of (key, value) pairs, STLDeleteValues +// deletes all the "value" components and clears the container. Does nothing +// in the case it's given a NULL pointer. + +template +void STLDeleteValues(T *v) { + if (!v) return; + for (typename T::iterator i = v->begin(); i != v->end(); ++i) { + delete i->second; + } + v->clear(); } } // namespace protobuf } // namespace google -#include // NOLINT - -#endif // GOOGLE_PROTOBUF_STUBS_STL_UTIL_H__ +#endif // GOOGLE_PROTOBUF_STUBS_STL_UTIL_INL_H__ diff --git a/depends/protobuf/src/google/protobuf/stubs/structurally_valid.cc b/depends/protobuf/google/protobuf/stubs/structurally_valid.cc similarity index 80% rename from depends/protobuf/src/google/protobuf/stubs/structurally_valid.cc rename to depends/protobuf/google/protobuf/stubs/structurally_valid.cc index a53573658..0f6afe6dc 100644 --- a/depends/protobuf/src/google/protobuf/stubs/structurally_valid.cc +++ b/depends/protobuf/google/protobuf/stubs/structurally_valid.cc @@ -1,39 +1,8 @@ -// 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. - +// Copyright 2005-2008 Google Inc. All Rights Reserved. // Author: jrm@google.com (Jim Meehan) #include -#include - namespace google { namespace protobuf { namespace internal { @@ -42,9 +11,9 @@ namespace internal { // in making a string replacement, how many bytes to add 0..255, and the offset // 0..64k-1 of the replacement string in remap_string. struct RemapEntry { - uint8_t delete_bytes; - uint8_t add_bytes; - uint16_t bytes_offset; + uint8 delete_bytes; + uint8 add_bytes; + uint16 bytes_offset; }; // Exit type codes for state tables. All but the first get stuffed into @@ -81,18 +50,18 @@ typedef enum { // byte value and 6 for space-optimized tables subscripted by only six // significant bits in UTF-8 continuation bytes. typedef struct { - const uint32_t state0; - const uint32_t state0_size; - const uint32_t total_size; + const uint32 state0; + const uint32 state0_size; + const uint32 total_size; const int max_expand; const int entry_shift; const int bytes_per_entry; - const uint32_t losub; - const uint32_t hiadd; - const uint8_t* state_table; + const uint32 losub; + const uint32 hiadd; + const uint8* state_table; const RemapEntry* remap_base; - const uint8_t* remap_string; - const uint8_t* fast_state; + const uint8* remap_string; + const uint8* fast_state; } UTF8StateMachineObj; typedef UTF8StateMachineObj UTF8ScanObj; @@ -122,7 +91,7 @@ static const unsigned int utf8acceptnonsurrogates_BYTES = 1; static const unsigned int utf8acceptnonsurrogates_LOSUB = 0x20202020; static const unsigned int utf8acceptnonsurrogates_HIADD = 0x00000000; -static const uint8_t utf8acceptnonsurrogates[] = { +static const uint8 utf8acceptnonsurrogates[] = { // state[0] 0x000000 Byte 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -376,13 +345,11 @@ static const UTF8ScanObj utf8acceptnonsurrogates_obj = { // Return true if current Tbl pointer is within state0 range // Note that unsigned compare checks both ends of range simultaneously -static inline bool InStateZero(const UTF8ScanObj* st, const uint8_t* Tbl) { - const uint8_t* Tbl0 = &st->state_table[st->state0]; - return (static_cast(Tbl - Tbl0) < st->state0_size); +static inline bool InStateZero(const UTF8ScanObj* st, const uint8* Tbl) { + const uint8* Tbl0 = &st->state_table[st->state0]; + return (static_cast(Tbl - Tbl0) < st->state0_size); } -namespace { - // Scan a UTF-8 string based on state table. // Always scan complete UTF-8 characters // Set number of bytes scanned. Return reason for exiting @@ -394,19 +361,19 @@ int UTF8GenericScan(const UTF8ScanObj* st, if (str_length == 0) return kExitOK; int eshift = st->entry_shift; - const uint8_t* isrc = reinterpret_cast(str); - const uint8_t* src = isrc; - const uint8_t* srclimit = isrc + str_length; - const uint8_t* srclimit8 = str_length < 7 ? isrc : srclimit - 7; - const uint8_t* Tbl_0 = &st->state_table[st->state0]; + const uint8* isrc = reinterpret_cast(str); + const uint8* src = isrc; + const uint8* srclimit = isrc + str_length; + const uint8* srclimit8 = srclimit - 7; + const uint8* Tbl_0 = &st->state_table[st->state0]; DoAgain: // Do state-table scan int e = 0; - uint8_t c; - const uint8_t* Tbl2 = &st->fast_state[0]; - const uint32_t losub = st->losub; - const uint32_t hiadd = st->hiadd; + uint8 c; + const uint8* Tbl2 = &st->fast_state[0]; + const uint32 losub = st->losub; + const uint32 hiadd = st->hiadd; // Check initial few bytes one at a time until 8-byte aligned //---------------------------- while ((((uintptr_t)src & 0x07) != 0) && @@ -420,12 +387,12 @@ int UTF8GenericScan(const UTF8ScanObj* st, // including slowing slightly on cr/lf/ht //---------------------------- while (src < srclimit8) { - uint32_t s0123 = (reinterpret_cast(src))[0]; - uint32_t s4567 = (reinterpret_cast(src))[1]; + uint32 s0123 = (reinterpret_cast(src))[0]; + uint32 s4567 = (reinterpret_cast(src))[1]; src += 8; // This is a fast range check for all bytes in [lowsub..0x80-hiadd) - uint32_t temp = (s0123 - losub) | (s0123 + hiadd) | - (s4567 - losub) | (s4567 + hiadd); + uint32 temp = (s0123 - losub) | (s0123 + hiadd) | + (s4567 - losub) | (s4567 + hiadd); if ((temp & 0x80808080) != 0) { // We typically end up here on cr/lf/ht; src was incremented int e0123 = (Tbl2[src[-8]] | Tbl2[src[-7]]) | @@ -448,7 +415,7 @@ int UTF8GenericScan(const UTF8ScanObj* st, // Byte-at-a-time scan //---------------------------- - const uint8_t* Tbl = Tbl_0; + const uint8* Tbl = Tbl_0; while (src < srclimit) { c = *src; e = Tbl[c]; @@ -458,7 +425,8 @@ int UTF8GenericScan(const UTF8ScanObj* st, } //---------------------------- - // Exit possibilities: + + // Exit posibilities: // Some exit code, !state0, back up over last char // Some exit code, state0, back up one byte exactly // source consumed, !state0, back up over partial char @@ -502,10 +470,10 @@ int UTF8GenericScanFastAscii(const UTF8ScanObj* st, *bytes_consumed = 0; if (str_length == 0) return kExitOK; - const uint8_t* isrc = reinterpret_cast(str); - const uint8_t* src = isrc; - const uint8_t* srclimit = isrc + str_length; - const uint8_t* srclimit8 = str_length < 7 ? isrc : srclimit - 7; + const uint8* isrc = reinterpret_cast(str); + const uint8* src = isrc; + const uint8* srclimit = isrc + str_length; + const uint8* srclimit8 = srclimit - 7; int n; int rest_consumed; int exit_reason; @@ -517,9 +485,8 @@ int UTF8GenericScanFastAscii(const UTF8ScanObj* st, } if (((uintptr_t)src & 0x07) == 0) { while ((src < srclimit8) && - (((reinterpret_cast(src)[0] | - reinterpret_cast(src)[1]) & - 0x80808080) == 0)) { + (((reinterpret_cast(src)[0] | + reinterpret_cast(src)[1]) & 0x80808080) == 0)) { src += 8; } } @@ -542,6 +509,7 @@ int UTF8GenericScanFastAscii(const UTF8ScanObj* st, // UTF-8 strings. Since UTF-8 validation is only used for debugging // anyway, we simply always return success if initialization hasn't // occurred yet. +namespace { bool module_initialized_ = false; @@ -556,62 +524,13 @@ InitDetector init_detector; bool IsStructurallyValidUTF8(const char* buf, int len) { if (!module_initialized_) return true; - + int bytes_consumed = 0; UTF8GenericScanFastAscii(&utf8acceptnonsurrogates_obj, buf, len, &bytes_consumed); return (bytes_consumed == len); } -int UTF8SpnStructurallyValid(StringPiece str) { - if (!module_initialized_) return str.size(); - - int bytes_consumed = 0; - UTF8GenericScanFastAscii(&utf8acceptnonsurrogates_obj, - str.data(), str.size(), &bytes_consumed); - return bytes_consumed; -} - -// Coerce UTF-8 byte string in src_str to be -// a structurally-valid equal-length string by selectively -// overwriting illegal bytes with replace_char (typically blank). -// replace_char must be legal printable 7-bit Ascii 0x20..0x7e. -// src_str is read-only. If any overwriting is needed, a modified byte string -// is created in idst, length isrclen. -// -// Returns pointer to output buffer, isrc if no changes were made, -// or idst if some bytes were changed. -// -// Fast case: all is structurally valid and no byte copying is done. -// -char* UTF8CoerceToStructurallyValid(StringPiece src_str, char* idst, - const char replace_char) { - const char* isrc = src_str.data(); - const int len = src_str.length(); - int n = UTF8SpnStructurallyValid(src_str); - if (n == len) { // Normal case -- all is cool, return - return const_cast(isrc); - } else { // Unusual case -- copy w/o bad bytes - const char* src = isrc; - const char* srclimit = isrc + len; - char* dst = idst; - memmove(dst, src, n); // Copy initial good chunk - src += n; - dst += n; - while (src < srclimit) { // src points to bogus byte or is off the end - dst[0] = replace_char; // replace one bad byte - src++; - dst++; - StringPiece str2(src, srclimit - src); - n = UTF8SpnStructurallyValid(str2); // scan the remainder - memmove(dst, src, n); // copy next good chunk - src += n; - dst += n; - } - } - return idst; -} - } // namespace internal } // namespace protobuf } // namespace google diff --git a/depends/protobuf/google/protobuf/stubs/strutil.cc b/depends/protobuf/google/protobuf/stubs/strutil.cc new file mode 100644 index 000000000..bb658ba8d --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/strutil.cc @@ -0,0 +1,1166 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// from google3/strings/strutil.cc + +#include +#include +#include // FLT_DIG and DBL_DIG +#include +#include +#include +#include + +#ifdef _WIN32 +// MSVC has only _snprintf, not snprintf. +// +// MinGW has both snprintf and _snprintf, but they appear to be different +// functions. The former is buggy. When invoked like so: +// char buffer[32]; +// snprintf(buffer, 32, "%.*g\n", FLT_DIG, 1.23e10f); +// it prints "1.23000e+10". This is plainly wrong: %g should never print +// trailing zeros after the decimal point. For some reason this bug only +// occurs with some input values, not all. In any case, _snprintf does the +// right thing, so we use it. +#define snprintf _snprintf +#endif + +namespace google { +namespace protobuf { + +inline bool IsNaN(double value) { + // NaN is never equal to anything, even itself. + return value != value; +} + +// These are defined as macros on some platforms. #undef them so that we can +// redefine them. +#undef isxdigit +#undef isprint + +// The definitions of these in ctype.h change based on locale. Since our +// string manipulation is all in relation to the protocol buffer and C++ +// languages, we always want to use the C locale. So, we re-define these +// exactly as we want them. +inline bool isxdigit(char c) { + return ('0' <= c && c <= '9') || + ('a' <= c && c <= 'f') || + ('A' <= c && c <= 'F'); +} + +inline bool isprint(char c) { + return c >= 0x20 && c <= 0x7E; +} + +// ---------------------------------------------------------------------- +// StripString +// Replaces any occurrence of the character 'remove' (or the characters +// in 'remove') with the character 'replacewith'. +// ---------------------------------------------------------------------- +void StripString(string* s, const char* remove, char replacewith) { + const char * str_start = s->c_str(); + const char * str = str_start; + for (str = strpbrk(str, remove); + str != NULL; + str = strpbrk(str + 1, remove)) { + (*s)[str - str_start] = replacewith; + } +} + +// ---------------------------------------------------------------------- +// StringReplace() +// Replace the "old" pattern with the "new" pattern in a string, +// and append the result to "res". If replace_all is false, +// it only replaces the first instance of "old." +// ---------------------------------------------------------------------- + +void StringReplace(const string& s, const string& oldsub, + const string& newsub, bool replace_all, + string* res) { + if (oldsub.empty()) { + res->append(s); // if empty, append the given string. + return; + } + + string::size_type start_pos = 0; + string::size_type pos; + do { + pos = s.find(oldsub, start_pos); + if (pos == string::npos) { + break; + } + res->append(s, start_pos, pos - start_pos); + res->append(newsub); + start_pos = pos + oldsub.size(); // start searching again after the "old" + } while (replace_all); + res->append(s, start_pos, s.length() - start_pos); +} + +// ---------------------------------------------------------------------- +// StringReplace() +// Give me a string and two patterns "old" and "new", and I replace +// the first instance of "old" in the string with "new", if it +// exists. If "global" is true; call this repeatedly until it +// fails. RETURN a new string, regardless of whether the replacement +// happened or not. +// ---------------------------------------------------------------------- + +string StringReplace(const string& s, const string& oldsub, + const string& newsub, bool replace_all) { + string ret; + StringReplace(s, oldsub, newsub, replace_all, &ret); + return ret; +} + +// ---------------------------------------------------------------------- +// SplitStringUsing() +// Split a string using a character delimiter. Append the components +// to 'result'. +// +// Note: For multi-character delimiters, this routine will split on *ANY* of +// the characters in the string, not the entire string as a single delimiter. +// ---------------------------------------------------------------------- +template +static inline +void SplitStringToIteratorUsing(const string& full, + const char* delim, + ITR& result) { + // Optimize the common case where delim is a single character. + if (delim[0] != '\0' && delim[1] == '\0') { + char c = delim[0]; + const char* p = full.data(); + const char* end = p + full.size(); + while (p != end) { + if (*p == c) { + ++p; + } else { + const char* start = p; + while (++p != end && *p != c); + *result++ = string(start, p - start); + } + } + return; + } + + string::size_type begin_index, end_index; + begin_index = full.find_first_not_of(delim); + while (begin_index != string::npos) { + end_index = full.find_first_of(delim, begin_index); + if (end_index == string::npos) { + *result++ = full.substr(begin_index); + return; + } + *result++ = full.substr(begin_index, (end_index - begin_index)); + begin_index = full.find_first_not_of(delim, end_index); + } +} + +void SplitStringUsing(const string& full, + const char* delim, + vector* result) { + back_insert_iterator< vector > it(*result); + SplitStringToIteratorUsing(full, delim, it); +} + +// ---------------------------------------------------------------------- +// JoinStrings() +// This merges a vector of string components with delim inserted +// as separaters between components. +// +// ---------------------------------------------------------------------- +template +static void JoinStringsIterator(const ITERATOR& start, + const ITERATOR& end, + const char* delim, + string* result) { + GOOGLE_CHECK(result != NULL); + result->clear(); + int delim_length = strlen(delim); + + // Precompute resulting length so we can reserve() memory in one shot. + int length = 0; + for (ITERATOR iter = start; iter != end; ++iter) { + if (iter != start) { + length += delim_length; + } + length += iter->size(); + } + result->reserve(length); + + // Now combine everything. + for (ITERATOR iter = start; iter != end; ++iter) { + if (iter != start) { + result->append(delim, delim_length); + } + result->append(iter->data(), iter->size()); + } +} + +void JoinStrings(const vector& components, + const char* delim, + string * result) { + JoinStringsIterator(components.begin(), components.end(), delim, result); +} + +// ---------------------------------------------------------------------- +// UnescapeCEscapeSequences() +// This does all the unescaping that C does: \ooo, \r, \n, etc +// Returns length of resulting string. +// The implementation of \x parses any positive number of hex digits, +// but it is an error if the value requires more than 8 bits, and the +// result is truncated to 8 bits. +// +// The second call stores its errors in a supplied string vector. +// If the string vector pointer is NULL, it reports the errors with LOG(). +// ---------------------------------------------------------------------- + +#define IS_OCTAL_DIGIT(c) (((c) >= '0') && ((c) <= '7')) + +inline int hex_digit_to_int(char c) { + /* Assume ASCII. */ + assert('0' == 0x30 && 'A' == 0x41 && 'a' == 0x61); + assert(isxdigit(c)); + int x = static_cast(c); + if (x > '9') { + x += 9; + } + return x & 0xf; +} + +// Protocol buffers doesn't ever care about errors, but I don't want to remove +// the code. +#define LOG_STRING(LEVEL, VECTOR) GOOGLE_LOG_IF(LEVEL, false) + +int UnescapeCEscapeSequences(const char* source, char* dest) { + return UnescapeCEscapeSequences(source, dest, NULL); +} + +int UnescapeCEscapeSequences(const char* source, char* dest, + vector *errors) { + GOOGLE_DCHECK(errors == NULL) << "Error reporting not implemented."; + + char* d = dest; + const char* p = source; + + // Small optimization for case where source = dest and there's no escaping + while ( p == d && *p != '\0' && *p != '\\' ) + p++, d++; + + while (*p != '\0') { + if (*p != '\\') { + *d++ = *p++; + } else { + switch ( *++p ) { // skip past the '\\' + case '\0': + LOG_STRING(ERROR, errors) << "String cannot end with \\"; + *d = '\0'; + return d - dest; // we're done with p + case 'a': *d++ = '\a'; break; + case 'b': *d++ = '\b'; break; + case 'f': *d++ = '\f'; break; + case 'n': *d++ = '\n'; break; + case 'r': *d++ = '\r'; break; + case 't': *d++ = '\t'; break; + case 'v': *d++ = '\v'; break; + case '\\': *d++ = '\\'; break; + case '?': *d++ = '\?'; break; // \? Who knew? + case '\'': *d++ = '\''; break; + case '"': *d++ = '\"'; break; + case '0': case '1': case '2': case '3': // octal digit: 1 to 3 digits + case '4': case '5': case '6': case '7': { + char ch = *p - '0'; + if ( IS_OCTAL_DIGIT(p[1]) ) + ch = ch * 8 + *++p - '0'; + if ( IS_OCTAL_DIGIT(p[1]) ) // safe (and easy) to do this twice + ch = ch * 8 + *++p - '0'; // now points at last digit + *d++ = ch; + break; + } + case 'x': case 'X': { + if (!isxdigit(p[1])) { + if (p[1] == '\0') { + LOG_STRING(ERROR, errors) << "String cannot end with \\x"; + } else { + LOG_STRING(ERROR, errors) << + "\\x cannot be followed by non-hex digit: \\" << *p << p[1]; + } + break; + } + unsigned int ch = 0; + const char *hex_start = p; + while (isxdigit(p[1])) // arbitrarily many hex digits + ch = (ch << 4) + hex_digit_to_int(*++p); + if (ch > 0xFF) + LOG_STRING(ERROR, errors) << "Value of " << + "\\" << string(hex_start, p+1-hex_start) << " exceeds 8 bits"; + *d++ = ch; + break; + } +#if 0 // TODO(kenton): Support \u and \U? Requires runetochar(). + case 'u': { + // \uhhhh => convert 4 hex digits to UTF-8 + char32 rune = 0; + const char *hex_start = p; + for (int i = 0; i < 4; ++i) { + if (isxdigit(p[1])) { // Look one char ahead. + rune = (rune << 4) + hex_digit_to_int(*++p); // Advance p. + } else { + LOG_STRING(ERROR, errors) + << "\\u must be followed by 4 hex digits: \\" + << string(hex_start, p+1-hex_start); + break; + } + } + d += runetochar(d, &rune); + break; + } + case 'U': { + // \Uhhhhhhhh => convert 8 hex digits to UTF-8 + char32 rune = 0; + const char *hex_start = p; + for (int i = 0; i < 8; ++i) { + if (isxdigit(p[1])) { // Look one char ahead. + // Don't change rune until we're sure this + // is within the Unicode limit, but do advance p. + char32 newrune = (rune << 4) + hex_digit_to_int(*++p); + if (newrune > 0x10FFFF) { + LOG_STRING(ERROR, errors) + << "Value of \\" + << string(hex_start, p + 1 - hex_start) + << " exceeds Unicode limit (0x10FFFF)"; + break; + } else { + rune = newrune; + } + } else { + LOG_STRING(ERROR, errors) + << "\\U must be followed by 8 hex digits: \\" + << string(hex_start, p+1-hex_start); + break; + } + } + d += runetochar(d, &rune); + break; + } +#endif + default: + LOG_STRING(ERROR, errors) << "Unknown escape sequence: \\" << *p; + } + p++; // read past letter we escaped + } + } + *d = '\0'; + return d - dest; +} + +// ---------------------------------------------------------------------- +// UnescapeCEscapeString() +// This does the same thing as UnescapeCEscapeSequences, but creates +// a new string. The caller does not need to worry about allocating +// a dest buffer. This should be used for non performance critical +// tasks such as printing debug messages. It is safe for src and dest +// to be the same. +// +// The second call stores its errors in a supplied string vector. +// If the string vector pointer is NULL, it reports the errors with LOG(). +// +// In the first and second calls, the length of dest is returned. In the +// the third call, the new string is returned. +// ---------------------------------------------------------------------- +int UnescapeCEscapeString(const string& src, string* dest) { + return UnescapeCEscapeString(src, dest, NULL); +} + +int UnescapeCEscapeString(const string& src, string* dest, + vector *errors) { + scoped_array unescaped(new char[src.size() + 1]); + int len = UnescapeCEscapeSequences(src.c_str(), unescaped.get(), errors); + GOOGLE_CHECK(dest); + dest->assign(unescaped.get(), len); + return len; +} + +string UnescapeCEscapeString(const string& src) { + scoped_array unescaped(new char[src.size() + 1]); + int len = UnescapeCEscapeSequences(src.c_str(), unescaped.get(), NULL); + return string(unescaped.get(), len); +} + +// ---------------------------------------------------------------------- +// CEscapeString() +// CHexEscapeString() +// Copies 'src' to 'dest', escaping dangerous characters using +// C-style escape sequences. This is very useful for preparing query +// flags. 'src' and 'dest' should not overlap. The 'Hex' version uses +// hexadecimal rather than octal sequences. +// Returns the number of bytes written to 'dest' (not including the \0) +// or -1 if there was insufficient space. +// +// Currently only \n, \r, \t, ", ', \ and !isprint() chars are escaped. +// ---------------------------------------------------------------------- +int CEscapeInternal(const char* src, int src_len, char* dest, + int dest_len, bool use_hex, bool utf8_safe) { + const char* src_end = src + src_len; + int used = 0; + bool last_hex_escape = false; // true if last output char was \xNN + + for (; src < src_end; src++) { + if (dest_len - used < 2) // Need space for two letter escape + return -1; + + bool is_hex_escape = false; + switch (*src) { + case '\n': dest[used++] = '\\'; dest[used++] = 'n'; break; + case '\r': dest[used++] = '\\'; dest[used++] = 'r'; break; + case '\t': dest[used++] = '\\'; dest[used++] = 't'; break; + case '\"': dest[used++] = '\\'; dest[used++] = '\"'; break; + case '\'': dest[used++] = '\\'; dest[used++] = '\''; break; + case '\\': dest[used++] = '\\'; dest[used++] = '\\'; break; + default: + // Note that if we emit \xNN and the src character after that is a hex + // digit then that digit must be escaped too to prevent it being + // interpreted as part of the character code by C. + if ((!utf8_safe || static_cast(*src) < 0x80) && + (!isprint(*src) || + (last_hex_escape && isxdigit(*src)))) { + if (dest_len - used < 4) // need space for 4 letter escape + return -1; + sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"), + static_cast(*src)); + is_hex_escape = use_hex; + used += 4; + } else { + dest[used++] = *src; break; + } + } + last_hex_escape = is_hex_escape; + } + + if (dest_len - used < 1) // make sure that there is room for \0 + return -1; + + dest[used] = '\0'; // doesn't count towards return value though + return used; +} + +int CEscapeString(const char* src, int src_len, char* dest, int dest_len) { + return CEscapeInternal(src, src_len, dest, dest_len, false, false); +} + +// ---------------------------------------------------------------------- +// CEscape() +// CHexEscape() +// Copies 'src' to result, escaping dangerous characters using +// C-style escape sequences. This is very useful for preparing query +// flags. 'src' and 'dest' should not overlap. The 'Hex' version +// hexadecimal rather than octal sequences. +// +// Currently only \n, \r, \t, ", ', \ and !isprint() chars are escaped. +// ---------------------------------------------------------------------- +string CEscape(const string& src) { + const int dest_length = src.size() * 4 + 1; // Maximum possible expansion + scoped_array dest(new char[dest_length]); + const int len = CEscapeInternal(src.data(), src.size(), + dest.get(), dest_length, false, false); + GOOGLE_DCHECK_GE(len, 0); + return string(dest.get(), len); +} + +namespace strings { + +string Utf8SafeCEscape(const string& src) { + const int dest_length = src.size() * 4 + 1; // Maximum possible expansion + scoped_array dest(new char[dest_length]); + const int len = CEscapeInternal(src.data(), src.size(), + dest.get(), dest_length, false, true); + GOOGLE_DCHECK_GE(len, 0); + return string(dest.get(), len); +} + +string CHexEscape(const string& src) { + const int dest_length = src.size() * 4 + 1; // Maximum possible expansion + scoped_array dest(new char[dest_length]); + const int len = CEscapeInternal(src.data(), src.size(), + dest.get(), dest_length, true, false); + GOOGLE_DCHECK_GE(len, 0); + return string(dest.get(), len); +} + +} // namespace strings + +// ---------------------------------------------------------------------- +// strto32_adaptor() +// strtou32_adaptor() +// Implementation of strto[u]l replacements that have identical +// overflow and underflow characteristics for both ILP-32 and LP-64 +// platforms, including errno preservation in error-free calls. +// ---------------------------------------------------------------------- + +int32 strto32_adaptor(const char *nptr, char **endptr, int base) { + const int saved_errno = errno; + errno = 0; + const long result = strtol(nptr, endptr, base); + if (errno == ERANGE && result == LONG_MIN) { + return kint32min; + } else if (errno == ERANGE && result == LONG_MAX) { + return kint32max; + } else if (errno == 0 && result < kint32min) { + errno = ERANGE; + return kint32min; + } else if (errno == 0 && result > kint32max) { + errno = ERANGE; + return kint32max; + } + if (errno == 0) + errno = saved_errno; + return static_cast(result); +} + +uint32 strtou32_adaptor(const char *nptr, char **endptr, int base) { + const int saved_errno = errno; + errno = 0; + const unsigned long result = strtoul(nptr, endptr, base); + if (errno == ERANGE && result == ULONG_MAX) { + return kuint32max; + } else if (errno == 0 && result > kuint32max) { + errno = ERANGE; + return kuint32max; + } + if (errno == 0) + errno = saved_errno; + return static_cast(result); +} + +// ---------------------------------------------------------------------- +// FastIntToBuffer() +// FastInt64ToBuffer() +// FastHexToBuffer() +// FastHex64ToBuffer() +// FastHex32ToBuffer() +// ---------------------------------------------------------------------- + +// Offset into buffer where FastInt64ToBuffer places the end of string +// null character. Also used by FastInt64ToBufferLeft. +static const int kFastInt64ToBufferOffset = 21; + +char *FastInt64ToBuffer(int64 i, char* buffer) { + // We could collapse the positive and negative sections, but that + // would be slightly slower for positive numbers... + // 22 bytes is enough to store -2**64, -18446744073709551616. + char* p = buffer + kFastInt64ToBufferOffset; + *p-- = '\0'; + if (i >= 0) { + do { + *p-- = '0' + i % 10; + i /= 10; + } while (i > 0); + return p + 1; + } else { + // On different platforms, % and / have different behaviors for + // negative numbers, so we need to jump through hoops to make sure + // we don't divide negative numbers. + if (i > -10) { + i = -i; + *p-- = '0' + i; + *p = '-'; + return p; + } else { + // Make sure we aren't at MIN_INT, in which case we can't say i = -i + i = i + 10; + i = -i; + *p-- = '0' + i % 10; + // Undo what we did a moment ago + i = i / 10 + 1; + do { + *p-- = '0' + i % 10; + i /= 10; + } while (i > 0); + *p = '-'; + return p; + } + } +} + +// Offset into buffer where FastInt32ToBuffer places the end of string +// null character. Also used by FastInt32ToBufferLeft +static const int kFastInt32ToBufferOffset = 11; + +// Yes, this is a duplicate of FastInt64ToBuffer. But, we need this for the +// compiler to generate 32 bit arithmetic instructions. It's much faster, at +// least with 32 bit binaries. +char *FastInt32ToBuffer(int32 i, char* buffer) { + // We could collapse the positive and negative sections, but that + // would be slightly slower for positive numbers... + // 12 bytes is enough to store -2**32, -4294967296. + char* p = buffer + kFastInt32ToBufferOffset; + *p-- = '\0'; + if (i >= 0) { + do { + *p-- = '0' + i % 10; + i /= 10; + } while (i > 0); + return p + 1; + } else { + // On different platforms, % and / have different behaviors for + // negative numbers, so we need to jump through hoops to make sure + // we don't divide negative numbers. + if (i > -10) { + i = -i; + *p-- = '0' + i; + *p = '-'; + return p; + } else { + // Make sure we aren't at MIN_INT, in which case we can't say i = -i + i = i + 10; + i = -i; + *p-- = '0' + i % 10; + // Undo what we did a moment ago + i = i / 10 + 1; + do { + *p-- = '0' + i % 10; + i /= 10; + } while (i > 0); + *p = '-'; + return p; + } + } +} + +char *FastHexToBuffer(int i, char* buffer) { + GOOGLE_CHECK(i >= 0) << "FastHexToBuffer() wants non-negative integers, not " << i; + + static const char *hexdigits = "0123456789abcdef"; + char *p = buffer + 21; + *p-- = '\0'; + do { + *p-- = hexdigits[i & 15]; // mod by 16 + i >>= 4; // divide by 16 + } while (i > 0); + return p + 1; +} + +char *InternalFastHexToBuffer(uint64 value, char* buffer, int num_byte) { + static const char *hexdigits = "0123456789abcdef"; + buffer[num_byte] = '\0'; + for (int i = num_byte - 1; i >= 0; i--) { + buffer[i] = hexdigits[uint32(value) & 0xf]; + value >>= 4; + } + return buffer; +} + +char *FastHex64ToBuffer(uint64 value, char* buffer) { + return InternalFastHexToBuffer(value, buffer, 16); +} + +char *FastHex32ToBuffer(uint32 value, char* buffer) { + return InternalFastHexToBuffer(value, buffer, 8); +} + +static inline char* PlaceNum(char* p, int num, char prev_sep) { + *p-- = '0' + num % 10; + *p-- = '0' + num / 10; + *p-- = prev_sep; + return p; +} + +// ---------------------------------------------------------------------- +// FastInt32ToBufferLeft() +// FastUInt32ToBufferLeft() +// FastInt64ToBufferLeft() +// FastUInt64ToBufferLeft() +// +// Like the Fast*ToBuffer() functions above, these are intended for speed. +// Unlike the Fast*ToBuffer() functions, however, these functions write +// their output to the beginning of the buffer (hence the name, as the +// output is left-aligned). The caller is responsible for ensuring that +// the buffer has enough space to hold the output. +// +// Returns a pointer to the end of the string (i.e. the null character +// terminating the string). +// ---------------------------------------------------------------------- + +static const char two_ASCII_digits[100][2] = { + {'0','0'}, {'0','1'}, {'0','2'}, {'0','3'}, {'0','4'}, + {'0','5'}, {'0','6'}, {'0','7'}, {'0','8'}, {'0','9'}, + {'1','0'}, {'1','1'}, {'1','2'}, {'1','3'}, {'1','4'}, + {'1','5'}, {'1','6'}, {'1','7'}, {'1','8'}, {'1','9'}, + {'2','0'}, {'2','1'}, {'2','2'}, {'2','3'}, {'2','4'}, + {'2','5'}, {'2','6'}, {'2','7'}, {'2','8'}, {'2','9'}, + {'3','0'}, {'3','1'}, {'3','2'}, {'3','3'}, {'3','4'}, + {'3','5'}, {'3','6'}, {'3','7'}, {'3','8'}, {'3','9'}, + {'4','0'}, {'4','1'}, {'4','2'}, {'4','3'}, {'4','4'}, + {'4','5'}, {'4','6'}, {'4','7'}, {'4','8'}, {'4','9'}, + {'5','0'}, {'5','1'}, {'5','2'}, {'5','3'}, {'5','4'}, + {'5','5'}, {'5','6'}, {'5','7'}, {'5','8'}, {'5','9'}, + {'6','0'}, {'6','1'}, {'6','2'}, {'6','3'}, {'6','4'}, + {'6','5'}, {'6','6'}, {'6','7'}, {'6','8'}, {'6','9'}, + {'7','0'}, {'7','1'}, {'7','2'}, {'7','3'}, {'7','4'}, + {'7','5'}, {'7','6'}, {'7','7'}, {'7','8'}, {'7','9'}, + {'8','0'}, {'8','1'}, {'8','2'}, {'8','3'}, {'8','4'}, + {'8','5'}, {'8','6'}, {'8','7'}, {'8','8'}, {'8','9'}, + {'9','0'}, {'9','1'}, {'9','2'}, {'9','3'}, {'9','4'}, + {'9','5'}, {'9','6'}, {'9','7'}, {'9','8'}, {'9','9'} +}; + +char* FastUInt32ToBufferLeft(uint32 u, char* buffer) { + int digits; + const char *ASCII_digits = NULL; + // The idea of this implementation is to trim the number of divides to as few + // as possible by using multiplication and subtraction rather than mod (%), + // and by outputting two digits at a time rather than one. + // The huge-number case is first, in the hopes that the compiler will output + // that case in one branch-free block of code, and only output conditional + // branches into it from below. + if (u >= 1000000000) { // >= 1,000,000,000 + digits = u / 100000000; // 100,000,000 + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; +sublt100_000_000: + u -= digits * 100000000; // 100,000,000 +lt100_000_000: + digits = u / 1000000; // 1,000,000 + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; +sublt1_000_000: + u -= digits * 1000000; // 1,000,000 +lt1_000_000: + digits = u / 10000; // 10,000 + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; +sublt10_000: + u -= digits * 10000; // 10,000 +lt10_000: + digits = u / 100; + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; +sublt100: + u -= digits * 100; +lt100: + digits = u; + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; +done: + *buffer = 0; + return buffer; + } + + if (u < 100) { + digits = u; + if (u >= 10) goto lt100; + *buffer++ = '0' + digits; + goto done; + } + if (u < 10000) { // 10,000 + if (u >= 1000) goto lt10_000; + digits = u / 100; + *buffer++ = '0' + digits; + goto sublt100; + } + if (u < 1000000) { // 1,000,000 + if (u >= 100000) goto lt1_000_000; + digits = u / 10000; // 10,000 + *buffer++ = '0' + digits; + goto sublt10_000; + } + if (u < 100000000) { // 100,000,000 + if (u >= 10000000) goto lt100_000_000; + digits = u / 1000000; // 1,000,000 + *buffer++ = '0' + digits; + goto sublt1_000_000; + } + // we already know that u < 1,000,000,000 + digits = u / 100000000; // 100,000,000 + *buffer++ = '0' + digits; + goto sublt100_000_000; +} + +char* FastInt32ToBufferLeft(int32 i, char* buffer) { + uint32 u = i; + if (i < 0) { + *buffer++ = '-'; + u = -i; + } + return FastUInt32ToBufferLeft(u, buffer); +} + +char* FastUInt64ToBufferLeft(uint64 u64, char* buffer) { + int digits; + const char *ASCII_digits = NULL; + + uint32 u = static_cast(u64); + if (u == u64) return FastUInt32ToBufferLeft(u, buffer); + + uint64 top_11_digits = u64 / 1000000000; + buffer = FastUInt64ToBufferLeft(top_11_digits, buffer); + u = u64 - (top_11_digits * 1000000000); + + digits = u / 10000000; // 10,000,000 + GOOGLE_DCHECK_LT(digits, 100); + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; + u -= digits * 10000000; // 10,000,000 + digits = u / 100000; // 100,000 + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; + u -= digits * 100000; // 100,000 + digits = u / 1000; // 1,000 + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; + u -= digits * 1000; // 1,000 + digits = u / 10; + ASCII_digits = two_ASCII_digits[digits]; + buffer[0] = ASCII_digits[0]; + buffer[1] = ASCII_digits[1]; + buffer += 2; + u -= digits * 10; + digits = u; + *buffer++ = '0' + digits; + *buffer = 0; + return buffer; +} + +char* FastInt64ToBufferLeft(int64 i, char* buffer) { + uint64 u = i; + if (i < 0) { + *buffer++ = '-'; + u = -i; + } + return FastUInt64ToBufferLeft(u, buffer); +} + +// ---------------------------------------------------------------------- +// SimpleItoa() +// Description: converts an integer to a string. +// +// Return value: string +// ---------------------------------------------------------------------- + +string SimpleItoa(int i) { + char buffer[kFastToBufferSize]; + return (sizeof(i) == 4) ? + FastInt32ToBuffer(i, buffer) : + FastInt64ToBuffer(i, buffer); +} + +string SimpleItoa(unsigned int i) { + char buffer[kFastToBufferSize]; + return string(buffer, (sizeof(i) == 4) ? + FastUInt32ToBufferLeft(i, buffer) : + FastUInt64ToBufferLeft(i, buffer)); +} + +string SimpleItoa(long i) { + char buffer[kFastToBufferSize]; + return (sizeof(i) == 4) ? + FastInt32ToBuffer(i, buffer) : + FastInt64ToBuffer(i, buffer); +} + +string SimpleItoa(unsigned long i) { + char buffer[kFastToBufferSize]; + return string(buffer, (sizeof(i) == 4) ? + FastUInt32ToBufferLeft(i, buffer) : + FastUInt64ToBufferLeft(i, buffer)); +} + +string SimpleItoa(long long i) { + char buffer[kFastToBufferSize]; + return (sizeof(i) == 4) ? + FastInt32ToBuffer(i, buffer) : + FastInt64ToBuffer(i, buffer); +} + +string SimpleItoa(unsigned long long i) { + char buffer[kFastToBufferSize]; + return string(buffer, (sizeof(i) == 4) ? + FastUInt32ToBufferLeft(i, buffer) : + FastUInt64ToBufferLeft(i, buffer)); +} + +// ---------------------------------------------------------------------- +// SimpleDtoa() +// SimpleFtoa() +// DoubleToBuffer() +// FloatToBuffer() +// We want to print the value without losing precision, but we also do +// not want to print more digits than necessary. This turns out to be +// trickier than it sounds. Numbers like 0.2 cannot be represented +// exactly in binary. If we print 0.2 with a very large precision, +// e.g. "%.50g", we get "0.2000000000000000111022302462515654042363167". +// On the other hand, if we set the precision too low, we lose +// significant digits when printing numbers that actually need them. +// It turns out there is no precision value that does the right thing +// for all numbers. +// +// Our strategy is to first try printing with a precision that is never +// over-precise, then parse the result with strtod() to see if it +// matches. If not, we print again with a precision that will always +// give a precise result, but may use more digits than necessary. +// +// An arguably better strategy would be to use the algorithm described +// in "How to Print Floating-Point Numbers Accurately" by Steele & +// White, e.g. as implemented by David M. Gay's dtoa(). It turns out, +// however, that the following implementation is about as fast as +// DMG's code. Furthermore, DMG's code locks mutexes, which means it +// will not scale well on multi-core machines. DMG's code is slightly +// more accurate (in that it will never use more digits than +// necessary), but this is probably irrelevant for most users. +// +// Rob Pike and Ken Thompson also have an implementation of dtoa() in +// third_party/fmt/fltfmt.cc. Their implementation is similar to this +// one in that it makes guesses and then uses strtod() to check them. +// Their implementation is faster because they use their own code to +// generate the digits in the first place rather than use snprintf(), +// thus avoiding format string parsing overhead. However, this makes +// it considerably more complicated than the following implementation, +// and it is embedded in a larger library. If speed turns out to be +// an issue, we could re-implement this in terms of their +// implementation. +// ---------------------------------------------------------------------- + +string SimpleDtoa(double value) { + char buffer[kDoubleToBufferSize]; + return DoubleToBuffer(value, buffer); +} + +string SimpleFtoa(float value) { + char buffer[kFloatToBufferSize]; + return FloatToBuffer(value, buffer); +} + +static inline bool IsValidFloatChar(char c) { + return ('0' <= c && c <= '9') || + c == 'e' || c == 'E' || + c == '+' || c == '-'; +} + +void DelocalizeRadix(char* buffer) { + // Fast check: if the buffer has a normal decimal point, assume no + // translation is needed. + if (strchr(buffer, '.') != NULL) return; + + // Find the first unknown character. + while (IsValidFloatChar(*buffer)) ++buffer; + + if (*buffer == '\0') { + // No radix character found. + return; + } + + // We are now pointing at the locale-specific radix character. Replace it + // with '.'. + *buffer = '.'; + ++buffer; + + if (!IsValidFloatChar(*buffer) && *buffer != '\0') { + // It appears the radix was a multi-byte character. We need to remove the + // extra bytes. + char* target = buffer; + do { ++buffer; } while (!IsValidFloatChar(*buffer) && *buffer != '\0'); + memmove(target, buffer, strlen(buffer) + 1); + } +} + +char* DoubleToBuffer(double value, char* buffer) { + // DBL_DIG is 15 for IEEE-754 doubles, which are used on almost all + // platforms these days. Just in case some system exists where DBL_DIG + // is significantly larger -- and risks overflowing our buffer -- we have + // this assert. + GOOGLE_COMPILE_ASSERT(DBL_DIG < 20, DBL_DIG_is_too_big); + + if (value == numeric_limits::infinity()) { + strcpy(buffer, "inf"); + return buffer; + } else if (value == -numeric_limits::infinity()) { + strcpy(buffer, "-inf"); + return buffer; + } else if (IsNaN(value)) { + strcpy(buffer, "nan"); + return buffer; + } + + int snprintf_result = + snprintf(buffer, kDoubleToBufferSize, "%.*g", DBL_DIG, value); + + // The snprintf should never overflow because the buffer is significantly + // larger than the precision we asked for. + GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kDoubleToBufferSize); + + // We need to make parsed_value volatile in order to force the compiler to + // write it out to the stack. Otherwise, it may keep the value in a + // register, and if it does that, it may keep it as a long double instead + // of a double. This long double may have extra bits that make it compare + // unequal to "value" even though it would be exactly equal if it were + // truncated to a double. + volatile double parsed_value = strtod(buffer, NULL); + if (parsed_value != value) { + int snprintf_result = + snprintf(buffer, kDoubleToBufferSize, "%.*g", DBL_DIG+2, value); + + // Should never overflow; see above. + GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kDoubleToBufferSize); + } + + DelocalizeRadix(buffer); + return buffer; +} + +bool safe_strtof(const char* str, float* value) { + char* endptr; + errno = 0; // errno only gets set on errors +#if defined(_WIN32) || defined (__hpux) // has no strtof() + *value = strtod(str, &endptr); +#else + *value = strtof(str, &endptr); +#endif + return *str != 0 && *endptr == 0 && errno == 0; +} + +char* FloatToBuffer(float value, char* buffer) { + // FLT_DIG is 6 for IEEE-754 floats, which are used on almost all + // platforms these days. Just in case some system exists where FLT_DIG + // is significantly larger -- and risks overflowing our buffer -- we have + // this assert. + GOOGLE_COMPILE_ASSERT(FLT_DIG < 10, FLT_DIG_is_too_big); + + if (value == numeric_limits::infinity()) { + strcpy(buffer, "inf"); + return buffer; + } else if (value == -numeric_limits::infinity()) { + strcpy(buffer, "-inf"); + return buffer; + } else if (IsNaN(value)) { + strcpy(buffer, "nan"); + return buffer; + } + + int snprintf_result = + snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG, value); + + // The snprintf should never overflow because the buffer is significantly + // larger than the precision we asked for. + GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize); + + float parsed_value; + if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) { + int snprintf_result = + snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+2, value); + + // Should never overflow; see above. + GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize); + } + + DelocalizeRadix(buffer); + return buffer; +} + +// ---------------------------------------------------------------------- +// NoLocaleStrtod() +// This code will make you cry. +// ---------------------------------------------------------------------- + +// Returns a string identical to *input except that the character pointed to +// by radix_pos (which should be '.') is replaced with the locale-specific +// radix character. +string LocalizeRadix(const char* input, const char* radix_pos) { + // Determine the locale-specific radix character by calling sprintf() to + // print the number 1.5, then stripping off the digits. As far as I can + // tell, this is the only portable, thread-safe way to get the C library + // to divuldge the locale's radix character. No, localeconv() is NOT + // thread-safe. + char temp[16]; + int size = sprintf(temp, "%.1f", 1.5); + GOOGLE_CHECK_EQ(temp[0], '1'); + GOOGLE_CHECK_EQ(temp[size-1], '5'); + GOOGLE_CHECK_LE(size, 6); + + // Now replace the '.' in the input with it. + string result; + result.reserve(strlen(input) + size - 3); + result.append(input, radix_pos); + result.append(temp + 1, size - 2); + result.append(radix_pos + 1); + return result; +} + +double NoLocaleStrtod(const char* text, char** original_endptr) { + // We cannot simply set the locale to "C" temporarily with setlocale() + // as this is not thread-safe. Instead, we try to parse in the current + // locale first. If parsing stops at a '.' character, then this is a + // pretty good hint that we're actually in some other locale in which + // '.' is not the radix character. + + char* temp_endptr; + double result = strtod(text, &temp_endptr); + if (original_endptr != NULL) *original_endptr = temp_endptr; + if (*temp_endptr != '.') return result; + + // Parsing halted on a '.'. Perhaps we're in a different locale? Let's + // try to replace the '.' with a locale-specific radix character and + // try again. + string localized = LocalizeRadix(text, temp_endptr); + const char* localized_cstr = localized.c_str(); + char* localized_endptr; + result = strtod(localized_cstr, &localized_endptr); + if ((localized_endptr - localized_cstr) > + (temp_endptr - text)) { + // This attempt got further, so replacing the decimal must have helped. + // Update original_endptr to point at the right location. + if (original_endptr != NULL) { + // size_diff is non-zero if the localized radix has multiple bytes. + int size_diff = localized.size() - strlen(text); + // const_cast is necessary to match the strtod() interface. + *original_endptr = const_cast( + text + (localized_endptr - localized_cstr - size_diff)); + } + } + + return result; +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/stubs/strutil.h b/depends/protobuf/google/protobuf/stubs/strutil.h new file mode 100644 index 000000000..4a79c2240 --- /dev/null +++ b/depends/protobuf/google/protobuf/stubs/strutil.h @@ -0,0 +1,457 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// from google3/strings/strutil.h + +#ifndef GOOGLE_PROTOBUF_STUBS_STRUTIL_H__ +#define GOOGLE_PROTOBUF_STUBS_STRUTIL_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { + +#ifdef _MSC_VER +#define strtoll _strtoi64 +#define strtoull _strtoui64 +#elif defined(__DECCXX) && defined(__osf__) +// HP C++ on Tru64 does not have strtoll, but strtol is already 64-bit. +#define strtoll strtol +#define strtoull strtoul +#endif + +// ---------------------------------------------------------------------- +// ascii_isalnum() +// Check if an ASCII character is alphanumeric. We can't use ctype's +// isalnum() because it is affected by locale. This function is applied +// to identifiers in the protocol buffer language, not to natural-language +// strings, so locale should not be taken into account. +// ascii_isdigit() +// Like above, but only accepts digits. +// ---------------------------------------------------------------------- + +inline bool ascii_isalnum(char c) { + return ('a' <= c && c <= 'z') || + ('A' <= c && c <= 'Z') || + ('0' <= c && c <= '9'); +} + +inline bool ascii_isdigit(char c) { + return ('0' <= c && c <= '9'); +} + +// ---------------------------------------------------------------------- +// HasPrefixString() +// Check if a string begins with a given prefix. +// StripPrefixString() +// Given a string and a putative prefix, returns the string minus the +// prefix string if the prefix matches, otherwise the original +// string. +// ---------------------------------------------------------------------- +inline bool HasPrefixString(const string& str, + const string& prefix) { + return str.size() >= prefix.size() && + str.compare(0, prefix.size(), prefix) == 0; +} + +inline string StripPrefixString(const string& str, const string& prefix) { + if (HasPrefixString(str, prefix)) { + return str.substr(prefix.size()); + } else { + return str; + } +} + +// ---------------------------------------------------------------------- +// HasSuffixString() +// Return true if str ends in suffix. +// StripSuffixString() +// Given a string and a putative suffix, returns the string minus the +// suffix string if the suffix matches, otherwise the original +// string. +// ---------------------------------------------------------------------- +inline bool HasSuffixString(const string& str, + const string& suffix) { + return str.size() >= suffix.size() && + str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; +} + +inline string StripSuffixString(const string& str, const string& suffix) { + if (HasSuffixString(str, suffix)) { + return str.substr(0, str.size() - suffix.size()); + } else { + return str; + } +} + +// ---------------------------------------------------------------------- +// StripString +// Replaces any occurrence of the character 'remove' (or the characters +// in 'remove') with the character 'replacewith'. +// Good for keeping html characters or protocol characters (\t) out +// of places where they might cause a problem. +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT void StripString(string* s, const char* remove, + char replacewith); + +// ---------------------------------------------------------------------- +// LowerString() +// UpperString() +// Convert the characters in "s" to lowercase or uppercase. ASCII-only: +// these functions intentionally ignore locale because they are applied to +// identifiers used in the Protocol Buffer language, not to natural-language +// strings. +// ---------------------------------------------------------------------- + +inline void LowerString(string * s) { + string::iterator end = s->end(); + for (string::iterator i = s->begin(); i != end; ++i) { + // tolower() changes based on locale. We don't want this! + if ('A' <= *i && *i <= 'Z') *i += 'a' - 'A'; + } +} + +inline void UpperString(string * s) { + string::iterator end = s->end(); + for (string::iterator i = s->begin(); i != end; ++i) { + // toupper() changes based on locale. We don't want this! + if ('a' <= *i && *i <= 'z') *i += 'A' - 'a'; + } +} + +// ---------------------------------------------------------------------- +// StringReplace() +// Give me a string and two patterns "old" and "new", and I replace +// the first instance of "old" in the string with "new", if it +// exists. RETURN a new string, regardless of whether the replacement +// happened or not. +// ---------------------------------------------------------------------- + +LIBPROTOBUF_EXPORT string StringReplace(const string& s, const string& oldsub, + const string& newsub, bool replace_all); + +// ---------------------------------------------------------------------- +// SplitStringUsing() +// Split a string using a character delimiter. Append the components +// to 'result'. If there are consecutive delimiters, this function skips +// over all of them. +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT void SplitStringUsing(const string& full, const char* delim, + vector* res); + +// ---------------------------------------------------------------------- +// JoinStrings() +// These methods concatenate a vector of strings into a C++ string, using +// the C-string "delim" as a separator between components. There are two +// flavors of the function, one flavor returns the concatenated string, +// another takes a pointer to the target string. In the latter case the +// target string is cleared and overwritten. +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT void JoinStrings(const vector& components, + const char* delim, string* result); + +inline string JoinStrings(const vector& components, + const char* delim) { + string result; + JoinStrings(components, delim, &result); + return result; +} + +// ---------------------------------------------------------------------- +// UnescapeCEscapeSequences() +// Copies "source" to "dest", rewriting C-style escape sequences +// -- '\n', '\r', '\\', '\ooo', etc -- to their ASCII +// equivalents. "dest" must be sufficiently large to hold all +// the characters in the rewritten string (i.e. at least as large +// as strlen(source) + 1 should be safe, since the replacements +// are always shorter than the original escaped sequences). It's +// safe for source and dest to be the same. RETURNS the length +// of dest. +// +// It allows hex sequences \xhh, or generally \xhhhhh with an +// arbitrary number of hex digits, but all of them together must +// specify a value of a single byte (e.g. \x0045 is equivalent +// to \x45, and \x1234 is erroneous). +// +// It also allows escape sequences of the form \uhhhh (exactly four +// hex digits, upper or lower case) or \Uhhhhhhhh (exactly eight +// hex digits, upper or lower case) to specify a Unicode code +// point. The dest array will contain the UTF8-encoded version of +// that code-point (e.g., if source contains \u2019, then dest will +// contain the three bytes 0xE2, 0x80, and 0x99). +// +// Errors: In the first form of the call, errors are reported with +// LOG(ERROR). The same is true for the second form of the call if +// the pointer to the string vector is NULL; otherwise, error +// messages are stored in the vector. In either case, the effect on +// the dest array is not defined, but rest of the source will be +// processed. +// ---------------------------------------------------------------------- + +LIBPROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest); +LIBPROTOBUF_EXPORT int UnescapeCEscapeSequences(const char* source, char* dest, + vector *errors); + +// ---------------------------------------------------------------------- +// UnescapeCEscapeString() +// This does the same thing as UnescapeCEscapeSequences, but creates +// a new string. The caller does not need to worry about allocating +// a dest buffer. This should be used for non performance critical +// tasks such as printing debug messages. It is safe for src and dest +// to be the same. +// +// The second call stores its errors in a supplied string vector. +// If the string vector pointer is NULL, it reports the errors with LOG(). +// +// In the first and second calls, the length of dest is returned. In the +// the third call, the new string is returned. +// ---------------------------------------------------------------------- + +LIBPROTOBUF_EXPORT int UnescapeCEscapeString(const string& src, string* dest); +LIBPROTOBUF_EXPORT int UnescapeCEscapeString(const string& src, string* dest, + vector *errors); +LIBPROTOBUF_EXPORT string UnescapeCEscapeString(const string& src); + +// ---------------------------------------------------------------------- +// CEscapeString() +// Copies 'src' to 'dest', escaping dangerous characters using +// C-style escape sequences. This is very useful for preparing query +// flags. 'src' and 'dest' should not overlap. +// Returns the number of bytes written to 'dest' (not including the \0) +// or -1 if there was insufficient space. +// +// Currently only \n, \r, \t, ", ', \ and !isprint() chars are escaped. +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT int CEscapeString(const char* src, int src_len, + char* dest, int dest_len); + +// ---------------------------------------------------------------------- +// CEscape() +// More convenient form of CEscapeString: returns result as a "string". +// This version is slower than CEscapeString() because it does more +// allocation. However, it is much more convenient to use in +// non-speed-critical code like logging messages etc. +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT string CEscape(const string& src); + +namespace strings { +// Like CEscape() but does not escape bytes with the upper bit set. +LIBPROTOBUF_EXPORT string Utf8SafeCEscape(const string& src); + +// Like CEscape() but uses hex (\x) escapes instead of octals. +LIBPROTOBUF_EXPORT string CHexEscape(const string& src); +} // namespace strings + +// ---------------------------------------------------------------------- +// strto32() +// strtou32() +// strto64() +// strtou64() +// Architecture-neutral plug compatible replacements for strtol() and +// strtoul(). Long's have different lengths on ILP-32 and LP-64 +// platforms, so using these is safer, from the point of view of +// overflow behavior, than using the standard libc functions. +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT int32 strto32_adaptor(const char *nptr, char **endptr, + int base); +LIBPROTOBUF_EXPORT uint32 strtou32_adaptor(const char *nptr, char **endptr, + int base); + +inline int32 strto32(const char *nptr, char **endptr, int base) { + if (sizeof(int32) == sizeof(long)) + return strtol(nptr, endptr, base); + else + return strto32_adaptor(nptr, endptr, base); +} + +inline uint32 strtou32(const char *nptr, char **endptr, int base) { + if (sizeof(uint32) == sizeof(unsigned long)) + return strtoul(nptr, endptr, base); + else + return strtou32_adaptor(nptr, endptr, base); +} + +// For now, long long is 64-bit on all the platforms we care about, so these +// functions can simply pass the call to strto[u]ll. +inline int64 strto64(const char *nptr, char **endptr, int base) { + GOOGLE_COMPILE_ASSERT(sizeof(int64) == sizeof(long long), + sizeof_int64_is_not_sizeof_long_long); + return strtoll(nptr, endptr, base); +} + +inline uint64 strtou64(const char *nptr, char **endptr, int base) { + GOOGLE_COMPILE_ASSERT(sizeof(uint64) == sizeof(unsigned long long), + sizeof_uint64_is_not_sizeof_long_long); + return strtoull(nptr, endptr, base); +} + +// ---------------------------------------------------------------------- +// FastIntToBuffer() +// FastHexToBuffer() +// FastHex64ToBuffer() +// FastHex32ToBuffer() +// FastTimeToBuffer() +// These are intended for speed. FastIntToBuffer() assumes the +// integer is non-negative. FastHexToBuffer() puts output in +// hex rather than decimal. FastTimeToBuffer() puts the output +// into RFC822 format. +// +// FastHex64ToBuffer() puts a 64-bit unsigned value in hex-format, +// padded to exactly 16 bytes (plus one byte for '\0') +// +// FastHex32ToBuffer() puts a 32-bit unsigned value in hex-format, +// padded to exactly 8 bytes (plus one byte for '\0') +// +// All functions take the output buffer as an arg. +// They all return a pointer to the beginning of the output, +// which may not be the beginning of the input buffer. +// ---------------------------------------------------------------------- + +// Suggested buffer size for FastToBuffer functions. Also works with +// DoubleToBuffer() and FloatToBuffer(). +static const int kFastToBufferSize = 32; + +LIBPROTOBUF_EXPORT char* FastInt32ToBuffer(int32 i, char* buffer); +LIBPROTOBUF_EXPORT char* FastInt64ToBuffer(int64 i, char* buffer); +char* FastUInt32ToBuffer(uint32 i, char* buffer); // inline below +char* FastUInt64ToBuffer(uint64 i, char* buffer); // inline below +LIBPROTOBUF_EXPORT char* FastHexToBuffer(int i, char* buffer); +LIBPROTOBUF_EXPORT char* FastHex64ToBuffer(uint64 i, char* buffer); +LIBPROTOBUF_EXPORT char* FastHex32ToBuffer(uint32 i, char* buffer); + +// at least 22 bytes long +inline char* FastIntToBuffer(int i, char* buffer) { + return (sizeof(i) == 4 ? + FastInt32ToBuffer(i, buffer) : FastInt64ToBuffer(i, buffer)); +} +inline char* FastUIntToBuffer(unsigned int i, char* buffer) { + return (sizeof(i) == 4 ? + FastUInt32ToBuffer(i, buffer) : FastUInt64ToBuffer(i, buffer)); +} +inline char* FastLongToBuffer(long i, char* buffer) { + return (sizeof(i) == 4 ? + FastInt32ToBuffer(i, buffer) : FastInt64ToBuffer(i, buffer)); +} +inline char* FastULongToBuffer(unsigned long i, char* buffer) { + return (sizeof(i) == 4 ? + FastUInt32ToBuffer(i, buffer) : FastUInt64ToBuffer(i, buffer)); +} + +// ---------------------------------------------------------------------- +// FastInt32ToBufferLeft() +// FastUInt32ToBufferLeft() +// FastInt64ToBufferLeft() +// FastUInt64ToBufferLeft() +// +// Like the Fast*ToBuffer() functions above, these are intended for speed. +// Unlike the Fast*ToBuffer() functions, however, these functions write +// their output to the beginning of the buffer (hence the name, as the +// output is left-aligned). The caller is responsible for ensuring that +// the buffer has enough space to hold the output. +// +// Returns a pointer to the end of the string (i.e. the null character +// terminating the string). +// ---------------------------------------------------------------------- + +LIBPROTOBUF_EXPORT char* FastInt32ToBufferLeft(int32 i, char* buffer); +LIBPROTOBUF_EXPORT char* FastUInt32ToBufferLeft(uint32 i, char* buffer); +LIBPROTOBUF_EXPORT char* FastInt64ToBufferLeft(int64 i, char* buffer); +LIBPROTOBUF_EXPORT char* FastUInt64ToBufferLeft(uint64 i, char* buffer); + +// Just define these in terms of the above. +inline char* FastUInt32ToBuffer(uint32 i, char* buffer) { + FastUInt32ToBufferLeft(i, buffer); + return buffer; +} +inline char* FastUInt64ToBuffer(uint64 i, char* buffer) { + FastUInt64ToBufferLeft(i, buffer); + return buffer; +} + +// ---------------------------------------------------------------------- +// SimpleItoa() +// Description: converts an integer to a string. +// +// Return value: string +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT string SimpleItoa(int i); +LIBPROTOBUF_EXPORT string SimpleItoa(unsigned int i); +LIBPROTOBUF_EXPORT string SimpleItoa(long i); +LIBPROTOBUF_EXPORT string SimpleItoa(unsigned long i); +LIBPROTOBUF_EXPORT string SimpleItoa(long long i); +LIBPROTOBUF_EXPORT string SimpleItoa(unsigned long long i); + +// ---------------------------------------------------------------------- +// SimpleDtoa() +// SimpleFtoa() +// DoubleToBuffer() +// FloatToBuffer() +// Description: converts a double or float to a string which, if +// passed to NoLocaleStrtod(), will produce the exact same original double +// (except in case of NaN; all NaNs are considered the same value). +// We try to keep the string short but it's not guaranteed to be as +// short as possible. +// +// DoubleToBuffer() and FloatToBuffer() write the text to the given +// buffer and return it. The buffer must be at least +// kDoubleToBufferSize bytes for doubles and kFloatToBufferSize +// bytes for floats. kFastToBufferSize is also guaranteed to be large +// enough to hold either. +// +// Return value: string +// ---------------------------------------------------------------------- +LIBPROTOBUF_EXPORT string SimpleDtoa(double value); +LIBPROTOBUF_EXPORT string SimpleFtoa(float value); + +LIBPROTOBUF_EXPORT char* DoubleToBuffer(double i, char* buffer); +LIBPROTOBUF_EXPORT char* FloatToBuffer(float i, char* buffer); + +// In practice, doubles should never need more than 24 bytes and floats +// should never need more than 14 (including null terminators), but we +// overestimate to be safe. +static const int kDoubleToBufferSize = 32; +static const int kFloatToBufferSize = 24; + +// ---------------------------------------------------------------------- +// NoLocaleStrtod() +// Exactly like strtod(), except it always behaves as if in the "C" +// locale (i.e. decimal points must be '.'s). +// ---------------------------------------------------------------------- + +LIBPROTOBUF_EXPORT double NoLocaleStrtod(const char* text, char** endptr); + +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_STUBS_STRUTIL_H__ + + diff --git a/depends/protobuf/src/google/protobuf/stubs/substitute.cc b/depends/protobuf/google/protobuf/stubs/substitute.cc similarity index 73% rename from depends/protobuf/src/google/protobuf/stubs/substitute.cc rename to depends/protobuf/google/protobuf/stubs/substitute.cc index d301682ee..b542aaa41 100644 --- a/depends/protobuf/src/google/protobuf/stubs/substitute.cc +++ b/depends/protobuf/google/protobuf/stubs/substitute.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -31,10 +31,8 @@ // Author: kenton@google.com (Kenton Varda) #include - -#include #include -#include +#include namespace google { namespace protobuf { @@ -46,32 +44,34 @@ using internal::SubstituteArg; // to Substitute(). static int CountSubstituteArgs(const SubstituteArg* const* args_array) { int count = 0; - while (args_array[count] != nullptr && args_array[count]->size() != -1) { + while (args_array[count] != NULL && args_array[count]->size() != -1) { ++count; } return count; } -std::string Substitute(const std::string& format, const SubstituteArg& arg0, - const SubstituteArg& arg1, const SubstituteArg& arg2, - const SubstituteArg& arg3, const SubstituteArg& arg4, - const SubstituteArg& arg5, const SubstituteArg& arg6, - const SubstituteArg& arg7, const SubstituteArg& arg8, - const SubstituteArg& arg9) { - std::string result; - SubstituteAndAppend(&result, format.c_str(), arg0, arg1, arg2, arg3, arg4, - arg5, arg6, arg7, arg8, arg9); +string Substitute( + const char* format, + const SubstituteArg& arg0, const SubstituteArg& arg1, + const SubstituteArg& arg2, const SubstituteArg& arg3, + const SubstituteArg& arg4, const SubstituteArg& arg5, + const SubstituteArg& arg6, const SubstituteArg& arg7, + const SubstituteArg& arg8, const SubstituteArg& arg9) { + string result; + SubstituteAndAppend(&result, format, arg0, arg1, arg2, arg3, arg4, + arg5, arg6, arg7, arg8, arg9); return result; } -void SubstituteAndAppend(std::string* output, const char* format, - const SubstituteArg& arg0, const SubstituteArg& arg1, - const SubstituteArg& arg2, const SubstituteArg& arg3, - const SubstituteArg& arg4, const SubstituteArg& arg5, - const SubstituteArg& arg6, const SubstituteArg& arg7, - const SubstituteArg& arg8, const SubstituteArg& arg9) { +void SubstituteAndAppend( + string* output, const char* format, + const SubstituteArg& arg0, const SubstituteArg& arg1, + const SubstituteArg& arg2, const SubstituteArg& arg3, + const SubstituteArg& arg4, const SubstituteArg& arg5, + const SubstituteArg& arg6, const SubstituteArg& arg7, + const SubstituteArg& arg8, const SubstituteArg& arg9) { const SubstituteArg* const args_array[] = { - &arg0, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, nullptr + &arg0, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, NULL }; // Determine total size needed. @@ -113,9 +113,7 @@ void SubstituteAndAppend(std::string* output, const char* format, for (int i = 0; format[i] != '\0'; i++) { if (format[i] == '$') { if (ascii_isdigit(format[i+1])) { - unsigned int index = format[i+1] - '0'; - assert(index < 10); - const SubstituteArg* src = args_array[index]; + const SubstituteArg* src = args_array[format[i+1] - '0']; memcpy(target, src->data(), src->size()); target += src->size(); ++i; // Skip next char. diff --git a/depends/protobuf/src/google/protobuf/stubs/substitute.h b/depends/protobuf/google/protobuf/stubs/substitute.h similarity index 75% rename from depends/protobuf/src/google/protobuf/stubs/substitute.h rename to depends/protobuf/google/protobuf/stubs/substitute.h index 0f851de09..2581793b5 100644 --- a/depends/protobuf/src/google/protobuf/stubs/substitute.h +++ b/depends/protobuf/google/protobuf/stubs/substitute.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -31,17 +31,13 @@ // Author: kenton@google.com (Kenton Varda) // from google3/strings/substitute.h +#include #include -#include #include -#include - #ifndef GOOGLE_PROTOBUF_STUBS_SUBSTITUTE_H_ #define GOOGLE_PROTOBUF_STUBS_SUBSTITUTE_H_ -#include - namespace google { namespace protobuf { namespace strings { @@ -92,14 +88,12 @@ class SubstituteArg { public: inline SubstituteArg(const char* value) : text_(value), size_(strlen(text_)) {} - inline SubstituteArg(const std::string& value) - : text_(value.data()), size_(value.size()) {} - inline SubstituteArg(const StringPiece value) - : text_(value.data()), size_(value.size()) {} + inline SubstituteArg(const string& value) + : text_(value.data()), size_(value.size()) {} // Indicates that no argument was given. inline explicit SubstituteArg() - : text_(nullptr), size_(-1) {} + : text_(NULL), size_(-1) {} // Primitives // We don't overload for signed and unsigned char because if people are @@ -143,36 +137,34 @@ class SubstituteArg { } // namespace internal -PROTOBUF_EXPORT std::string Substitute( - const std::string& format, - const internal::SubstituteArg& arg0 = internal::SubstituteArg(), - const internal::SubstituteArg& arg1 = internal::SubstituteArg(), - const internal::SubstituteArg& arg2 = internal::SubstituteArg(), - const internal::SubstituteArg& arg3 = internal::SubstituteArg(), - const internal::SubstituteArg& arg4 = internal::SubstituteArg(), - const internal::SubstituteArg& arg5 = internal::SubstituteArg(), - const internal::SubstituteArg& arg6 = internal::SubstituteArg(), - const internal::SubstituteArg& arg7 = internal::SubstituteArg(), - const internal::SubstituteArg& arg8 = internal::SubstituteArg(), - const internal::SubstituteArg& arg9 = internal::SubstituteArg()); - -PROTOBUF_EXPORT void SubstituteAndAppend( - std::string* output, const char* format, - const internal::SubstituteArg& arg0 = internal::SubstituteArg(), - const internal::SubstituteArg& arg1 = internal::SubstituteArg(), - const internal::SubstituteArg& arg2 = internal::SubstituteArg(), - const internal::SubstituteArg& arg3 = internal::SubstituteArg(), - const internal::SubstituteArg& arg4 = internal::SubstituteArg(), - const internal::SubstituteArg& arg5 = internal::SubstituteArg(), - const internal::SubstituteArg& arg6 = internal::SubstituteArg(), - const internal::SubstituteArg& arg7 = internal::SubstituteArg(), - const internal::SubstituteArg& arg8 = internal::SubstituteArg(), - const internal::SubstituteArg& arg9 = internal::SubstituteArg()); +LIBPROTOBUF_EXPORT string Substitute( + const char* format, + const internal::SubstituteArg& arg0 = internal::SubstituteArg(), + const internal::SubstituteArg& arg1 = internal::SubstituteArg(), + const internal::SubstituteArg& arg2 = internal::SubstituteArg(), + const internal::SubstituteArg& arg3 = internal::SubstituteArg(), + const internal::SubstituteArg& arg4 = internal::SubstituteArg(), + const internal::SubstituteArg& arg5 = internal::SubstituteArg(), + const internal::SubstituteArg& arg6 = internal::SubstituteArg(), + const internal::SubstituteArg& arg7 = internal::SubstituteArg(), + const internal::SubstituteArg& arg8 = internal::SubstituteArg(), + const internal::SubstituteArg& arg9 = internal::SubstituteArg()); + +LIBPROTOBUF_EXPORT void SubstituteAndAppend( + string* output, const char* format, + const internal::SubstituteArg& arg0 = internal::SubstituteArg(), + const internal::SubstituteArg& arg1 = internal::SubstituteArg(), + const internal::SubstituteArg& arg2 = internal::SubstituteArg(), + const internal::SubstituteArg& arg3 = internal::SubstituteArg(), + const internal::SubstituteArg& arg4 = internal::SubstituteArg(), + const internal::SubstituteArg& arg5 = internal::SubstituteArg(), + const internal::SubstituteArg& arg6 = internal::SubstituteArg(), + const internal::SubstituteArg& arg7 = internal::SubstituteArg(), + const internal::SubstituteArg& arg8 = internal::SubstituteArg(), + const internal::SubstituteArg& arg9 = internal::SubstituteArg()); } // namespace strings } // namespace protobuf } // namespace google -#include - #endif // GOOGLE_PROTOBUF_STUBS_SUBSTITUTE_H_ diff --git a/depends/protobuf/google/protobuf/text_format.cc b/depends/protobuf/google/protobuf/text_format.cc new file mode 100644 index 000000000..1494ebd78 --- /dev/null +++ b/depends/protobuf/google/protobuf/text_format.cc @@ -0,0 +1,1285 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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: jschorr@google.com (Joseph Schorr) +// 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 + +namespace google { +namespace protobuf { + +string Message::DebugString() const { + string debug_string; + + TextFormat::PrintToString(*this, &debug_string); + + return debug_string; +} + +string Message::ShortDebugString() const { + string debug_string; + + TextFormat::Printer printer; + printer.SetSingleLineMode(true); + + printer.PrintToString(*this, &debug_string); + // Single line mode currently might have an extra space at the end. + if (debug_string.size() > 0 && + debug_string[debug_string.size() - 1] == ' ') { + debug_string.resize(debug_string.size() - 1); + } + + return debug_string; +} + +string Message::Utf8DebugString() const { + string debug_string; + + TextFormat::Printer printer; + printer.SetUseUtf8StringEscaping(true); + + printer.PrintToString(*this, &debug_string); + + return debug_string; +} + +void Message::PrintDebugString() const { + printf("%s", DebugString().c_str()); +} + + +// =========================================================================== +// Internal class for parsing an ASCII representation of a Protocol Message. +// This class makes use of the Protocol Message compiler's tokenizer found +// in //google/protobuf/io/tokenizer.h. Note that class's Parse +// method is *not* thread-safe and should only be used in a single thread at +// a time. + +// Makes code slightly more readable. The meaning of "DO(foo)" is +// "Execute foo and fail if it fails.", where failure is indicated by +// returning false. Borrowed from parser.cc (Thanks Kenton!). +#define DO(STATEMENT) if (STATEMENT) {} else return false + +class TextFormat::Parser::ParserImpl { + public: + + // Determines if repeated values for a non-repeated field are + // permitted, e.g., the string "foo: 1 foo: 2" for a + // required/optional field named "foo". + enum SingularOverwritePolicy { + ALLOW_SINGULAR_OVERWRITES = 0, // the last value is retained + FORBID_SINGULAR_OVERWRITES = 1, // an error is issued + }; + + ParserImpl(const Descriptor* root_message_type, + io::ZeroCopyInputStream* input_stream, + io::ErrorCollector* error_collector, + TextFormat::Finder* finder, + SingularOverwritePolicy singular_overwrite_policy) + : error_collector_(error_collector), + finder_(finder), + tokenizer_error_collector_(this), + tokenizer_(input_stream, &tokenizer_error_collector_), + root_message_type_(root_message_type), + singular_overwrite_policy_(singular_overwrite_policy), + had_errors_(false) { + // For backwards-compatibility with proto1, we need to allow the 'f' suffix + // for floats. + tokenizer_.set_allow_f_after_float(true); + + // '#' starts a comment. + tokenizer_.set_comment_style(io::Tokenizer::SH_COMMENT_STYLE); + + // Consume the starting token. + tokenizer_.Next(); + } + ~ParserImpl() { } + + // Parses the ASCII representation specified in input and saves the + // information into the output pointer (a Message). Returns + // false if an error occurs (an error will also be logged to + // GOOGLE_LOG(ERROR)). + bool Parse(Message* output) { + // Consume fields until we cannot do so anymore. + while(true) { + if (LookingAtType(io::Tokenizer::TYPE_END)) { + return !had_errors_; + } + + DO(ConsumeField(output)); + } + } + + bool ParseField(const FieldDescriptor* field, Message* output) { + bool suc; + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + suc = ConsumeFieldMessage(output, output->GetReflection(), field); + } else { + suc = ConsumeFieldValue(output, output->GetReflection(), field); + } + return suc && LookingAtType(io::Tokenizer::TYPE_END); + } + + void ReportError(int line, int col, const string& message) { + had_errors_ = true; + if (error_collector_ == NULL) { + if (line >= 0) { + GOOGLE_LOG(ERROR) << "Error parsing text-format " + << root_message_type_->full_name() + << ": " << (line + 1) << ":" + << (col + 1) << ": " << message; + } else { + GOOGLE_LOG(ERROR) << "Error parsing text-format " + << root_message_type_->full_name() + << ": " << message; + } + } else { + error_collector_->AddError(line, col, message); + } + } + + void ReportWarning(int line, int col, const string& message) { + if (error_collector_ == NULL) { + if (line >= 0) { + GOOGLE_LOG(WARNING) << "Warning parsing text-format " + << root_message_type_->full_name() + << ": " << (line + 1) << ":" + << (col + 1) << ": " << message; + } else { + GOOGLE_LOG(WARNING) << "Warning parsing text-format " + << root_message_type_->full_name() + << ": " << message; + } + } else { + error_collector_->AddWarning(line, col, message); + } + } + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ParserImpl); + + // Reports an error with the given message with information indicating + // the position (as derived from the current token). + void ReportError(const string& message) { + ReportError(tokenizer_.current().line, tokenizer_.current().column, + message); + } + + // Reports a warning with the given message with information indicating + // the position (as derived from the current token). + void ReportWarning(const string& message) { + ReportWarning(tokenizer_.current().line, tokenizer_.current().column, + message); + } + + // Consumes the specified message with the given starting delimeter. + // This method checks to see that the end delimeter at the conclusion of + // the consumption matches the starting delimeter passed in here. + bool ConsumeMessage(Message* message, const string delimeter) { + while (!LookingAt(">") && !LookingAt("}")) { + DO(ConsumeField(message)); + } + + // Confirm that we have a valid ending delimeter. + DO(Consume(delimeter)); + + return true; + } + + // Consumes the current field (as returned by the tokenizer) on the + // passed in message. + bool ConsumeField(Message* message) { + const Reflection* reflection = message->GetReflection(); + const Descriptor* descriptor = message->GetDescriptor(); + + string field_name; + + const FieldDescriptor* field = NULL; + + if (TryConsume("[")) { + // Extension. + DO(ConsumeIdentifier(&field_name)); + while (TryConsume(".")) { + string part; + DO(ConsumeIdentifier(&part)); + field_name += "."; + field_name += part; + } + DO(Consume("]")); + + field = (finder_ != NULL + ? finder_->FindExtension(message, field_name) + : reflection->FindKnownExtensionByName(field_name)); + + if (field == NULL) { + ReportError("Extension \"" + field_name + "\" is not defined or " + "is not an extension of \"" + + descriptor->full_name() + "\"."); + return false; + } + } else { + DO(ConsumeIdentifier(&field_name)); + + field = descriptor->FindFieldByName(field_name); + // Group names are expected to be capitalized as they appear in the + // .proto file, which actually matches their type names, not their field + // names. + if (field == NULL) { + string lower_field_name = field_name; + LowerString(&lower_field_name); + field = descriptor->FindFieldByName(lower_field_name); + // If the case-insensitive match worked but the field is NOT a group, + if (field != NULL && field->type() != FieldDescriptor::TYPE_GROUP) { + field = NULL; + } + } + // Again, special-case group names as described above. + if (field != NULL && field->type() == FieldDescriptor::TYPE_GROUP + && field->message_type()->name() != field_name) { + field = NULL; + } + + if (field == NULL) { + ReportError("Message type \"" + descriptor->full_name() + + "\" has no field named \"" + field_name + "\"."); + return false; + } + } + + // Fail if the field is not repeated and it has already been specified. + if ((singular_overwrite_policy_ == FORBID_SINGULAR_OVERWRITES) && + !field->is_repeated() && reflection->HasField(*message, field)) { + ReportError("Non-repeated field \"" + field_name + + "\" is specified multiple times."); + return false; + } + + // Perform special handling for embedded message types. + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + // ':' is optional here. + TryConsume(":"); + DO(ConsumeFieldMessage(message, reflection, field)); + } else { + DO(Consume(":")); + if (field->is_repeated() && TryConsume("[")) { + // Short repeated format, e.g. "foo: [1, 2, 3]" + while (true) { + DO(ConsumeFieldValue(message, reflection, field)); + if (TryConsume("]")) { + break; + } + DO(Consume(",")); + } + } else { + DO(ConsumeFieldValue(message, reflection, field)); + } + } + + // For historical reasons, fields may optionally be separated by commas or + // semicolons. + TryConsume(";") || TryConsume(","); + + if (field->options().deprecated()) { + ReportWarning("text format contains deprecated field \"" + + field_name + "\""); + } + + return true; + } + + bool ConsumeFieldMessage(Message* message, + const Reflection* reflection, + const FieldDescriptor* field) { + string delimeter; + if (TryConsume("<")) { + delimeter = ">"; + } else { + DO(Consume("{")); + delimeter = "}"; + } + + if (field->is_repeated()) { + DO(ConsumeMessage(reflection->AddMessage(message, field), delimeter)); + } else { + DO(ConsumeMessage(reflection->MutableMessage(message, field), + delimeter)); + } + return true; + } + + bool ConsumeFieldValue(Message* message, + const Reflection* reflection, + const FieldDescriptor* field) { + +// Define an easy to use macro for setting fields. This macro checks +// to see if the field is repeated (in which case we need to use the Add +// methods or not (in which case we need to use the Set methods). +#define SET_FIELD(CPPTYPE, VALUE) \ + if (field->is_repeated()) { \ + reflection->Add##CPPTYPE(message, field, VALUE); \ + } else { \ + reflection->Set##CPPTYPE(message, field, VALUE); \ + } \ + + switch(field->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: { + int64 value; + DO(ConsumeSignedInteger(&value, kint32max)); + SET_FIELD(Int32, static_cast(value)); + break; + } + + case FieldDescriptor::CPPTYPE_UINT32: { + uint64 value; + DO(ConsumeUnsignedInteger(&value, kuint32max)); + SET_FIELD(UInt32, static_cast(value)); + break; + } + + case FieldDescriptor::CPPTYPE_INT64: { + int64 value; + DO(ConsumeSignedInteger(&value, kint64max)); + SET_FIELD(Int64, value); + break; + } + + case FieldDescriptor::CPPTYPE_UINT64: { + uint64 value; + DO(ConsumeUnsignedInteger(&value, kuint64max)); + SET_FIELD(UInt64, value); + break; + } + + case FieldDescriptor::CPPTYPE_FLOAT: { + double value; + DO(ConsumeDouble(&value)); + SET_FIELD(Float, static_cast(value)); + break; + } + + case FieldDescriptor::CPPTYPE_DOUBLE: { + double value; + DO(ConsumeDouble(&value)); + SET_FIELD(Double, value); + break; + } + + case FieldDescriptor::CPPTYPE_STRING: { + string value; + DO(ConsumeString(&value)); + SET_FIELD(String, value); + break; + } + + case FieldDescriptor::CPPTYPE_BOOL: { + if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { + uint64 value; + DO(ConsumeUnsignedInteger(&value, 1)); + SET_FIELD(Bool, value); + } else { + string value; + DO(ConsumeIdentifier(&value)); + if (value == "true" || value == "t") { + SET_FIELD(Bool, true); + } else if (value == "false" || value == "f") { + SET_FIELD(Bool, false); + } else { + ReportError("Invalid value for boolean field \"" + field->name() + + "\". Value: \"" + value + "\"."); + return false; + } + } + break; + } + + case FieldDescriptor::CPPTYPE_ENUM: { + string value; + const EnumDescriptor* enum_type = field->enum_type(); + const EnumValueDescriptor* enum_value = NULL; + + if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { + DO(ConsumeIdentifier(&value)); + // Find the enumeration value. + enum_value = enum_type->FindValueByName(value); + + } else if (LookingAt("-") || + LookingAtType(io::Tokenizer::TYPE_INTEGER)) { + int64 int_value; + DO(ConsumeSignedInteger(&int_value, kint32max)); + value = SimpleItoa(int_value); // for error reporting + enum_value = enum_type->FindValueByNumber(int_value); + } else { + ReportError("Expected integer or identifier."); + return false; + } + + if (enum_value == NULL) { + ReportError("Unknown enumeration value of \"" + value + "\" for " + "field \"" + field->name() + "\"."); + return false; + } + + SET_FIELD(Enum, enum_value); + break; + } + + case FieldDescriptor::CPPTYPE_MESSAGE: { + // We should never get here. Put here instead of a default + // so that if new types are added, we get a nice compiler warning. + GOOGLE_LOG(FATAL) << "Reached an unintended state: CPPTYPE_MESSAGE"; + break; + } + } +#undef SET_FIELD + return true; + } + + // Returns true if the current token's text is equal to that specified. + bool LookingAt(const string& text) { + return tokenizer_.current().text == text; + } + + // Returns true if the current token's type is equal to that specified. + bool LookingAtType(io::Tokenizer::TokenType token_type) { + return tokenizer_.current().type == token_type; + } + + // Consumes an identifier and saves its value in the identifier parameter. + // Returns false if the token is not of type IDENTFIER. + bool ConsumeIdentifier(string* identifier) { + if (!LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { + ReportError("Expected identifier."); + return false; + } + + *identifier = tokenizer_.current().text; + + tokenizer_.Next(); + return true; + } + + // Consumes a string and saves its value in the text parameter. + // Returns false if the token is not of type STRING. + bool ConsumeString(string* text) { + if (!LookingAtType(io::Tokenizer::TYPE_STRING)) { + ReportError("Expected string."); + return false; + } + + text->clear(); + while (LookingAtType(io::Tokenizer::TYPE_STRING)) { + io::Tokenizer::ParseStringAppend(tokenizer_.current().text, text); + + tokenizer_.Next(); + } + + return true; + } + + // Consumes a uint64 and saves its value in the value parameter. + // Returns false if the token is not of type INTEGER. + bool ConsumeUnsignedInteger(uint64* value, uint64 max_value) { + if (!LookingAtType(io::Tokenizer::TYPE_INTEGER)) { + ReportError("Expected integer."); + return false; + } + + if (!io::Tokenizer::ParseInteger(tokenizer_.current().text, + max_value, value)) { + ReportError("Integer out of range."); + return false; + } + + tokenizer_.Next(); + return true; + } + + // Consumes an int64 and saves its value in the value parameter. + // Note that since the tokenizer does not support negative numbers, + // we actually may consume an additional token (for the minus sign) in this + // method. Returns false if the token is not an integer + // (signed or otherwise). + bool ConsumeSignedInteger(int64* value, uint64 max_value) { + bool negative = false; + + if (TryConsume("-")) { + negative = true; + // Two's complement always allows one more negative integer than + // positive. + ++max_value; + } + + uint64 unsigned_value; + + DO(ConsumeUnsignedInteger(&unsigned_value, max_value)); + + *value = static_cast(unsigned_value); + + if (negative) { + *value = -*value; + } + + return true; + } + + // Consumes a double and saves its value in the value parameter. + // Note that since the tokenizer does not support negative numbers, + // we actually may consume an additional token (for the minus sign) in this + // method. Returns false if the token is not a double + // (signed or otherwise). + bool ConsumeDouble(double* value) { + bool negative = false; + + if (TryConsume("-")) { + negative = true; + } + + // A double can actually be an integer, according to the tokenizer. + // Therefore, we must check both cases here. + if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { + // We have found an integer value for the double. + uint64 integer_value; + DO(ConsumeUnsignedInteger(&integer_value, kuint64max)); + + *value = static_cast(integer_value); + } else if (LookingAtType(io::Tokenizer::TYPE_FLOAT)) { + // We have found a float value for the double. + *value = io::Tokenizer::ParseFloat(tokenizer_.current().text); + + // Mark the current token as consumed. + tokenizer_.Next(); + } else if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { + string text = tokenizer_.current().text; + LowerString(&text); + if (text == "inf" || text == "infinity") { + *value = std::numeric_limits::infinity(); + tokenizer_.Next(); + } else if (text == "nan") { + *value = std::numeric_limits::quiet_NaN(); + tokenizer_.Next(); + } else { + ReportError("Expected double."); + return false; + } + } else { + ReportError("Expected double."); + return false; + } + + if (negative) { + *value = -*value; + } + + return true; + } + + // Consumes a token and confirms that it matches that specified in the + // value parameter. Returns false if the token found does not match that + // which was specified. + bool Consume(const string& value) { + const string& current_value = tokenizer_.current().text; + + if (current_value != value) { + ReportError("Expected \"" + value + "\", found \"" + current_value + + "\"."); + return false; + } + + tokenizer_.Next(); + + return true; + } + + // Attempts to consume the supplied value. Returns false if a the + // token found does not match the value specified. + bool TryConsume(const string& value) { + if (tokenizer_.current().text == value) { + tokenizer_.Next(); + return true; + } else { + return false; + } + } + + // An internal instance of the Tokenizer's error collector, used to + // collect any base-level parse errors and feed them to the ParserImpl. + class ParserErrorCollector : public io::ErrorCollector { + public: + explicit ParserErrorCollector(TextFormat::Parser::ParserImpl* parser) : + parser_(parser) { } + + virtual ~ParserErrorCollector() { }; + + virtual void AddError(int line, int column, const string& message) { + parser_->ReportError(line, column, message); + } + + virtual void AddWarning(int line, int column, const string& message) { + parser_->ReportWarning(line, column, message); + } + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ParserErrorCollector); + TextFormat::Parser::ParserImpl* parser_; + }; + + io::ErrorCollector* error_collector_; + TextFormat::Finder* finder_; + ParserErrorCollector tokenizer_error_collector_; + io::Tokenizer tokenizer_; + const Descriptor* root_message_type_; + SingularOverwritePolicy singular_overwrite_policy_; + bool had_errors_; +}; + +#undef DO + +// =========================================================================== +// Internal class for writing text to the io::ZeroCopyOutputStream. Adapted +// from the Printer found in //google/protobuf/io/printer.h +class TextFormat::Printer::TextGenerator { + public: + explicit TextGenerator(io::ZeroCopyOutputStream* output, + int initial_indent_level) + : output_(output), + buffer_(NULL), + buffer_size_(0), + at_start_of_line_(true), + failed_(false), + indent_(""), + initial_indent_level_(initial_indent_level) { + indent_.resize(initial_indent_level_ * 2, ' '); + } + + ~TextGenerator() { + // Only BackUp() if we're sure we've successfully called Next() at least + // once. + if (buffer_size_ > 0) { + output_->BackUp(buffer_size_); + } + } + + // Indent text by two spaces. After calling Indent(), two spaces will be + // inserted at the beginning of each line of text. Indent() may be called + // multiple times to produce deeper indents. + void Indent() { + indent_ += " "; + } + + // Reduces the current indent level by two spaces, or crashes if the indent + // level is zero. + void Outdent() { + if (indent_.empty() || + indent_.size() < initial_indent_level_ * 2) { + GOOGLE_LOG(DFATAL) << " Outdent() without matching Indent()."; + return; + } + + indent_.resize(indent_.size() - 2); + } + + // Print text to the output stream. + void Print(const string& str) { + Print(str.data(), str.size()); + } + + // Print text to the output stream. + void Print(const char* text) { + Print(text, strlen(text)); + } + + // Print text to the output stream. + void Print(const char* text, int size) { + int pos = 0; // The number of bytes we've written so far. + + for (int i = 0; i < size; i++) { + if (text[i] == '\n') { + // Saw newline. If there is more text, we may need to insert an indent + // here. So, write what we have so far, including the '\n'. + Write(text + pos, i - pos + 1); + pos = i + 1; + + // Setting this true will cause the next Write() to insert an indent + // first. + at_start_of_line_ = true; + } + } + + // Write the rest. + Write(text + pos, size - pos); + } + + // True if any write to the underlying stream failed. (We don't just + // crash in this case because this is an I/O failure, not a programming + // error.) + bool failed() const { return failed_; } + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TextGenerator); + + void Write(const char* data, int size) { + if (failed_) return; + if (size == 0) return; + + if (at_start_of_line_) { + // Insert an indent. + at_start_of_line_ = false; + Write(indent_.data(), indent_.size()); + if (failed_) return; + } + + while (size > buffer_size_) { + // Data exceeds space in the buffer. Copy what we can and request a + // new buffer. + memcpy(buffer_, data, buffer_size_); + data += buffer_size_; + size -= buffer_size_; + void* void_buffer; + failed_ = !output_->Next(&void_buffer, &buffer_size_); + if (failed_) return; + buffer_ = reinterpret_cast(void_buffer); + } + + // Buffer is big enough to receive the data; copy it. + memcpy(buffer_, data, size); + buffer_ += size; + buffer_size_ -= size; + } + + io::ZeroCopyOutputStream* const output_; + char* buffer_; + int buffer_size_; + bool at_start_of_line_; + bool failed_; + + string indent_; + int initial_indent_level_; +}; + +// =========================================================================== + +TextFormat::Finder::~Finder() { +} + +TextFormat::Parser::Parser() + : error_collector_(NULL), + finder_(NULL), + allow_partial_(false) { +} + +TextFormat::Parser::~Parser() {} + +bool TextFormat::Parser::Parse(io::ZeroCopyInputStream* input, + Message* output) { + output->Clear(); + ParserImpl parser(output->GetDescriptor(), input, error_collector_, + finder_, ParserImpl::FORBID_SINGULAR_OVERWRITES); + return MergeUsingImpl(input, output, &parser); +} + +bool TextFormat::Parser::ParseFromString(const string& input, + Message* output) { + io::ArrayInputStream input_stream(input.data(), input.size()); + return Parse(&input_stream, output); +} + +bool TextFormat::Parser::Merge(io::ZeroCopyInputStream* input, + Message* output) { + ParserImpl parser(output->GetDescriptor(), input, error_collector_, + finder_, ParserImpl::ALLOW_SINGULAR_OVERWRITES); + return MergeUsingImpl(input, output, &parser); +} + +bool TextFormat::Parser::MergeFromString(const string& input, + Message* output) { + io::ArrayInputStream input_stream(input.data(), input.size()); + return Merge(&input_stream, output); +} + +bool TextFormat::Parser::MergeUsingImpl(io::ZeroCopyInputStream* input, + Message* output, + ParserImpl* parser_impl) { + if (!parser_impl->Parse(output)) return false; + if (!allow_partial_ && !output->IsInitialized()) { + vector missing_fields; + output->FindInitializationErrors(&missing_fields); + parser_impl->ReportError(-1, 0, "Message missing required fields: " + + JoinStrings(missing_fields, ", ")); + return false; + } + return true; +} + +bool TextFormat::Parser::ParseFieldValueFromString( + const string& input, + const FieldDescriptor* field, + Message* output) { + io::ArrayInputStream input_stream(input.data(), input.size()); + ParserImpl parser(output->GetDescriptor(), &input_stream, error_collector_, + finder_, ParserImpl::ALLOW_SINGULAR_OVERWRITES); + return parser.ParseField(field, output); +} + +/* static */ bool TextFormat::Parse(io::ZeroCopyInputStream* input, + Message* output) { + return Parser().Parse(input, output); +} + +/* static */ bool TextFormat::Merge(io::ZeroCopyInputStream* input, + Message* output) { + return Parser().Merge(input, output); +} + +/* static */ bool TextFormat::ParseFromString(const string& input, + Message* output) { + return Parser().ParseFromString(input, output); +} + +/* static */ bool TextFormat::MergeFromString(const string& input, + Message* output) { + return Parser().MergeFromString(input, output); +} + +// =========================================================================== + +TextFormat::Printer::Printer() + : initial_indent_level_(0), + single_line_mode_(false), + use_short_repeated_primitives_(false), + utf8_string_escaping_(false) {} + +TextFormat::Printer::~Printer() {} + +bool TextFormat::Printer::PrintToString(const Message& message, + string* output) const { + GOOGLE_DCHECK(output) << "output specified is NULL"; + + output->clear(); + io::StringOutputStream output_stream(output); + + bool result = Print(message, &output_stream); + + return result; +} + +bool TextFormat::Printer::PrintUnknownFieldsToString( + const UnknownFieldSet& unknown_fields, + string* output) const { + GOOGLE_DCHECK(output) << "output specified is NULL"; + + output->clear(); + io::StringOutputStream output_stream(output); + return PrintUnknownFields(unknown_fields, &output_stream); +} + +bool TextFormat::Printer::Print(const Message& message, + io::ZeroCopyOutputStream* output) const { + TextGenerator generator(output, initial_indent_level_); + + Print(message, generator); + + // Output false if the generator failed internally. + return !generator.failed(); +} + +bool TextFormat::Printer::PrintUnknownFields( + const UnknownFieldSet& unknown_fields, + io::ZeroCopyOutputStream* output) const { + TextGenerator generator(output, initial_indent_level_); + + PrintUnknownFields(unknown_fields, generator); + + // Output false if the generator failed internally. + return !generator.failed(); +} + +void TextFormat::Printer::Print(const Message& message, + TextGenerator& generator) const { + const Reflection* reflection = message.GetReflection(); + vector fields; + reflection->ListFields(message, &fields); + for (int i = 0; i < fields.size(); i++) { + PrintField(message, reflection, fields[i], generator); + } + PrintUnknownFields(reflection->GetUnknownFields(message), generator); +} + +void TextFormat::Printer::PrintFieldValueToString( + const Message& message, + const FieldDescriptor* field, + int index, + string* output) const { + + GOOGLE_DCHECK(output) << "output specified is NULL"; + + output->clear(); + io::StringOutputStream output_stream(output); + TextGenerator generator(&output_stream, initial_indent_level_); + + PrintFieldValue(message, message.GetReflection(), field, index, generator); +} + +void TextFormat::Printer::PrintField(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextGenerator& generator) const { + if (use_short_repeated_primitives_ && + field->is_repeated() && + field->cpp_type() != FieldDescriptor::CPPTYPE_STRING && + field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { + PrintShortRepeatedField(message, reflection, field, generator); + return; + } + + int count = 0; + + if (field->is_repeated()) { + count = reflection->FieldSize(message, field); + } else if (reflection->HasField(message, field)) { + count = 1; + } + + for (int j = 0; j < count; ++j) { + PrintFieldName(message, reflection, field, generator); + + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (single_line_mode_) { + generator.Print(" { "); + } else { + generator.Print(" {\n"); + generator.Indent(); + } + } else { + generator.Print(": "); + } + + // Write the field value. + int field_index = j; + if (!field->is_repeated()) { + field_index = -1; + } + + PrintFieldValue(message, reflection, field, field_index, generator); + + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (single_line_mode_) { + generator.Print("} "); + } else { + generator.Outdent(); + generator.Print("}\n"); + } + } else { + if (single_line_mode_) { + generator.Print(" "); + } else { + generator.Print("\n"); + } + } + } +} + +void TextFormat::Printer::PrintShortRepeatedField( + const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextGenerator& generator) const { + // Print primitive repeated field in short form. + PrintFieldName(message, reflection, field, generator); + + int size = reflection->FieldSize(message, field); + generator.Print(": ["); + for (int i = 0; i < size; i++) { + if (i > 0) generator.Print(", "); + PrintFieldValue(message, reflection, field, i, generator); + } + if (single_line_mode_) { + generator.Print("] "); + } else { + generator.Print("]\n"); + } +} + +void TextFormat::Printer::PrintFieldName(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextGenerator& generator) const { + if (field->is_extension()) { + generator.Print("["); + // We special-case MessageSet elements for compatibility with proto1. + if (field->containing_type()->options().message_set_wire_format() + && field->type() == FieldDescriptor::TYPE_MESSAGE + && field->is_optional() + && field->extension_scope() == field->message_type()) { + generator.Print(field->message_type()->full_name()); + } else { + generator.Print(field->full_name()); + } + generator.Print("]"); + } else { + if (field->type() == FieldDescriptor::TYPE_GROUP) { + // Groups must be serialized with their original capitalization. + generator.Print(field->message_type()->name()); + } else { + generator.Print(field->name()); + } + } +} + +void TextFormat::Printer::PrintFieldValue( + const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + int index, + TextGenerator& generator) const { + GOOGLE_DCHECK(field->is_repeated() || (index == -1)) + << "Index must be -1 for non-repeated fields"; + + switch (field->cpp_type()) { +#define OUTPUT_FIELD(CPPTYPE, METHOD, TO_STRING) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: \ + generator.Print(TO_STRING(field->is_repeated() ? \ + reflection->GetRepeated##METHOD(message, field, index) : \ + reflection->Get##METHOD(message, field))); \ + break; \ + + OUTPUT_FIELD( INT32, Int32, SimpleItoa); + OUTPUT_FIELD( INT64, Int64, SimpleItoa); + OUTPUT_FIELD(UINT32, UInt32, SimpleItoa); + OUTPUT_FIELD(UINT64, UInt64, SimpleItoa); + OUTPUT_FIELD( FLOAT, Float, SimpleFtoa); + OUTPUT_FIELD(DOUBLE, Double, SimpleDtoa); +#undef OUTPUT_FIELD + + case FieldDescriptor::CPPTYPE_STRING: { + string scratch; + const string& value = field->is_repeated() ? + reflection->GetRepeatedStringReference( + message, field, index, &scratch) : + reflection->GetStringReference(message, field, &scratch); + + generator.Print("\""); + if (utf8_string_escaping_) { + generator.Print(strings::Utf8SafeCEscape(value)); + } else { + generator.Print(CEscape(value)); + } + generator.Print("\""); + + break; + } + + case FieldDescriptor::CPPTYPE_BOOL: + if (field->is_repeated()) { + generator.Print(reflection->GetRepeatedBool(message, field, index) + ? "true" : "false"); + } else { + generator.Print(reflection->GetBool(message, field) + ? "true" : "false"); + } + break; + + case FieldDescriptor::CPPTYPE_ENUM: + generator.Print(field->is_repeated() ? + reflection->GetRepeatedEnum(message, field, index)->name() : + reflection->GetEnum(message, field)->name()); + break; + + case FieldDescriptor::CPPTYPE_MESSAGE: + Print(field->is_repeated() ? + reflection->GetRepeatedMessage(message, field, index) : + reflection->GetMessage(message, field), + generator); + break; + } +} + +/* static */ bool TextFormat::Print(const Message& message, + io::ZeroCopyOutputStream* output) { + return Printer().Print(message, output); +} + +/* static */ bool TextFormat::PrintUnknownFields( + const UnknownFieldSet& unknown_fields, + io::ZeroCopyOutputStream* output) { + return Printer().PrintUnknownFields(unknown_fields, output); +} + +/* static */ bool TextFormat::PrintToString( + const Message& message, string* output) { + return Printer().PrintToString(message, output); +} + +/* static */ bool TextFormat::PrintUnknownFieldsToString( + const UnknownFieldSet& unknown_fields, string* output) { + return Printer().PrintUnknownFieldsToString(unknown_fields, output); +} + +/* static */ void TextFormat::PrintFieldValueToString( + const Message& message, + const FieldDescriptor* field, + int index, + string* output) { + return Printer().PrintFieldValueToString(message, field, index, output); +} + +/* static */ bool TextFormat::ParseFieldValueFromString( + const string& input, + const FieldDescriptor* field, + Message* message) { + return Parser().ParseFieldValueFromString(input, field, message); +} + +// Prints an integer as hex with a fixed number of digits dependent on the +// integer type. +template +static string PaddedHex(IntType value) { + string result; + result.reserve(sizeof(value) * 2); + for (int i = sizeof(value) * 2 - 1; i >= 0; i--) { + result.push_back(int_to_hex_digit(value >> (i*4) & 0x0F)); + } + return result; +} + +void TextFormat::Printer::PrintUnknownFields( + const UnknownFieldSet& unknown_fields, TextGenerator& generator) const { + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + string field_number = SimpleItoa(field.number()); + + switch (field.type()) { + case UnknownField::TYPE_VARINT: + generator.Print(field_number); + generator.Print(": "); + generator.Print(SimpleItoa(field.varint())); + if (single_line_mode_) { + generator.Print(" "); + } else { + generator.Print("\n"); + } + break; + case UnknownField::TYPE_FIXED32: { + generator.Print(field_number); + generator.Print(": 0x"); + char buffer[kFastToBufferSize]; + generator.Print(FastHex32ToBuffer(field.fixed32(), buffer)); + if (single_line_mode_) { + generator.Print(" "); + } else { + generator.Print("\n"); + } + break; + } + case UnknownField::TYPE_FIXED64: { + generator.Print(field_number); + generator.Print(": 0x"); + char buffer[kFastToBufferSize]; + generator.Print(FastHex64ToBuffer(field.fixed64(), buffer)); + if (single_line_mode_) { + generator.Print(" "); + } else { + generator.Print("\n"); + } + break; + } + case UnknownField::TYPE_LENGTH_DELIMITED: { + generator.Print(field_number); + const string& value = field.length_delimited(); + UnknownFieldSet embedded_unknown_fields; + if (!value.empty() && embedded_unknown_fields.ParseFromString(value)) { + // This field is parseable as a Message. + // So it is probably an embedded message. + if (single_line_mode_) { + generator.Print(" { "); + } else { + generator.Print(" {\n"); + generator.Indent(); + } + PrintUnknownFields(embedded_unknown_fields, generator); + if (single_line_mode_) { + generator.Print("} "); + } else { + generator.Outdent(); + generator.Print("}\n"); + } + } else { + // This field is not parseable as a Message. + // So it is probably just a plain string. + generator.Print(": \""); + generator.Print(CEscape(value)); + generator.Print("\""); + if (single_line_mode_) { + generator.Print(" "); + } else { + generator.Print("\n"); + } + } + break; + } + case UnknownField::TYPE_GROUP: + generator.Print(field_number); + if (single_line_mode_) { + generator.Print(" { "); + } else { + generator.Print(" {\n"); + generator.Indent(); + } + PrintUnknownFields(field.group(), generator); + if (single_line_mode_) { + generator.Print("} "); + } else { + generator.Outdent(); + generator.Print("}\n"); + } + break; + } + } +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/text_format.h b/depends/protobuf/google/protobuf/text_format.h new file mode 100644 index 000000000..03c049102 --- /dev/null +++ b/depends/protobuf/google/protobuf/text_format.h @@ -0,0 +1,285 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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: jschorr@google.com (Joseph Schorr) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// Utilities for printing and parsing protocol messages in a human-readable, +// text-based format. + +#ifndef GOOGLE_PROTOBUF_TEXT_FORMAT_H__ +#define GOOGLE_PROTOBUF_TEXT_FORMAT_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { + +namespace io { + class ErrorCollector; // tokenizer.h +} + +// This class implements protocol buffer text format. Printing and parsing +// protocol messages in text format is useful for debugging and human editing +// of messages. +// +// This class is really a namespace that contains only static methods. +class LIBPROTOBUF_EXPORT TextFormat { + public: + // Outputs a textual representation of the given message to the given + // output stream. + static bool Print(const Message& message, io::ZeroCopyOutputStream* output); + + // Print the fields in an UnknownFieldSet. They are printed by tag number + // only. Embedded messages are heuristically identified by attempting to + // parse them. + static bool PrintUnknownFields(const UnknownFieldSet& unknown_fields, + io::ZeroCopyOutputStream* output); + + // Like Print(), but outputs directly to a string. + static bool PrintToString(const Message& message, string* output); + + // Like PrintUnknownFields(), but outputs directly to a string. + static bool PrintUnknownFieldsToString(const UnknownFieldSet& unknown_fields, + string* output); + + // Outputs a textual representation of the value of the field supplied on + // the message supplied. For non-repeated fields, an index of -1 must + // be supplied. Note that this method will print the default value for a + // field if it is not set. + static void PrintFieldValueToString(const Message& message, + const FieldDescriptor* field, + int index, + string* output); + + // Class for those users which require more fine-grained control over how + // a protobuffer message is printed out. + class LIBPROTOBUF_EXPORT Printer { + public: + Printer(); + ~Printer(); + + // Like TextFormat::Print + bool Print(const Message& message, io::ZeroCopyOutputStream* output) const; + // Like TextFormat::PrintUnknownFields + bool PrintUnknownFields(const UnknownFieldSet& unknown_fields, + io::ZeroCopyOutputStream* output) const; + // Like TextFormat::PrintToString + bool PrintToString(const Message& message, string* output) const; + // Like TextFormat::PrintUnknownFieldsToString + bool PrintUnknownFieldsToString(const UnknownFieldSet& unknown_fields, + string* output) const; + // Like TextFormat::PrintFieldValueToString + void PrintFieldValueToString(const Message& message, + const FieldDescriptor* field, + int index, + string* output) const; + + // Adjust the initial indent level of all output. Each indent level is + // equal to two spaces. + void SetInitialIndentLevel(int indent_level) { + initial_indent_level_ = indent_level; + } + + // If printing in single line mode, then the entire message will be output + // on a single line with no line breaks. + void SetSingleLineMode(bool single_line_mode) { + single_line_mode_ = single_line_mode; + } + + // Set true to print repeated primitives in a format like: + // field_name: [1, 2, 3, 4] + // instead of printing each value on its own line. Short format applies + // only to primitive values -- i.e. everything except strings and + // sub-messages/groups. + void SetUseShortRepeatedPrimitives(bool use_short_repeated_primitives) { + use_short_repeated_primitives_ = use_short_repeated_primitives; + } + + // Set true to output UTF-8 instead of ASCII. The only difference + // is that bytes >= 0x80 in string fields will not be escaped, + // because they are assumed to be part of UTF-8 multi-byte + // sequences. + void SetUseUtf8StringEscaping(bool as_utf8) { + utf8_string_escaping_ = as_utf8; + } + + private: + // Forward declaration of an internal class used to print the text + // output to the OutputStream (see text_format.cc for implementation). + class TextGenerator; + + // Internal Print method, used for writing to the OutputStream via + // the TextGenerator class. + void Print(const Message& message, + TextGenerator& generator) const; + + // Print a single field. + void PrintField(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextGenerator& generator) const; + + // Print a repeated primitive field in short form. + void PrintShortRepeatedField(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextGenerator& generator) const; + + // Print the name of a field -- i.e. everything that comes before the + // ':' for a single name/value pair. + void PrintFieldName(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextGenerator& generator) const; + + // Outputs a textual representation of the value of the field supplied on + // the message supplied or the default value if not set. + void PrintFieldValue(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + int index, + TextGenerator& generator) const; + + // Print the fields in an UnknownFieldSet. They are printed by tag number + // only. Embedded messages are heuristically identified by attempting to + // parse them. + void PrintUnknownFields(const UnknownFieldSet& unknown_fields, + TextGenerator& generator) const; + + int initial_indent_level_; + + bool single_line_mode_; + + bool use_short_repeated_primitives_; + + bool utf8_string_escaping_; + }; + + // Parses a text-format protocol message from the given input stream to + // the given message object. This function parses the format written + // by Print(). + static bool Parse(io::ZeroCopyInputStream* input, Message* output); + // Like Parse(), but reads directly from a string. + static bool ParseFromString(const string& input, Message* output); + + // Like Parse(), but the data is merged into the given message, as if + // using Message::MergeFrom(). + static bool Merge(io::ZeroCopyInputStream* input, Message* output); + // Like Merge(), but reads directly from a string. + static bool MergeFromString(const string& input, Message* output); + + // Parse the given text as a single field value and store it into the + // given field of the given message. If the field is a repeated field, + // the new value will be added to the end + static bool ParseFieldValueFromString(const string& input, + const FieldDescriptor* field, + Message* message); + + // Interface that TextFormat::Parser can use to find extensions. + // This class may be extended in the future to find more information + // like fields, etc. + class LIBPROTOBUF_EXPORT Finder { + public: + virtual ~Finder(); + + // Try to find an extension of *message by fully-qualified field + // name. Returns NULL if no extension is known for this name or number. + virtual const FieldDescriptor* FindExtension( + Message* message, + const string& name) const = 0; + }; + + // For more control over parsing, use this class. + class LIBPROTOBUF_EXPORT Parser { + public: + Parser(); + ~Parser(); + + // Like TextFormat::Parse(). + bool Parse(io::ZeroCopyInputStream* input, Message* output); + // Like TextFormat::ParseFromString(). + bool ParseFromString(const string& input, Message* output); + // Like TextFormat::Merge(). + bool Merge(io::ZeroCopyInputStream* input, Message* output); + // Like TextFormat::MergeFromString(). + bool MergeFromString(const string& input, Message* output); + + // Set where to report parse errors. If NULL (the default), errors will + // be printed to stderr. + void RecordErrorsTo(io::ErrorCollector* error_collector) { + error_collector_ = error_collector; + } + + // Set how parser finds extensions. If NULL (the default), the + // parser will use the standard Reflection object associated with + // the message being parsed. + void SetFinder(Finder* finder) { + finder_ = finder; + } + + // Normally parsing fails if, after parsing, output->IsInitialized() + // returns false. Call AllowPartialMessage(true) to skip this check. + void AllowPartialMessage(bool allow) { + allow_partial_ = allow; + } + + // Like TextFormat::ParseFieldValueFromString + bool ParseFieldValueFromString(const string& input, + const FieldDescriptor* field, + Message* output); + + private: + // Forward declaration of an internal class used to parse text + // representations (see text_format.cc for implementation). + class ParserImpl; + + // Like TextFormat::Merge(). The provided implementation is used + // to do the parsing. + bool MergeUsingImpl(io::ZeroCopyInputStream* input, + Message* output, + ParserImpl* parser_impl); + + io::ErrorCollector* error_collector_; + Finder* finder_; + bool allow_partial_; + }; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TextFormat); +}; + +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_TEXT_FORMAT_H__ diff --git a/depends/protobuf/google/protobuf/unknown_field_set.cc b/depends/protobuf/google/protobuf/unknown_field_set.cc new file mode 100644 index 000000000..e1f8b838f --- /dev/null +++ b/depends/protobuf/google/protobuf/unknown_field_set.cc @@ -0,0 +1,204 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { + +UnknownFieldSet::UnknownFieldSet() + : fields_(NULL) {} + +UnknownFieldSet::~UnknownFieldSet() { + Clear(); + delete fields_; +} + +void UnknownFieldSet::ClearFallback() { + GOOGLE_DCHECK(fields_ != NULL); + for (int i = 0; i < fields_->size(); i++) { + (*fields_)[i].Delete(); + } + fields_->clear(); +} + +void UnknownFieldSet::MergeFrom(const UnknownFieldSet& other) { + for (int i = 0; i < other.field_count(); i++) { + AddField(other.field(i)); + } +} + +int UnknownFieldSet::SpaceUsedExcludingSelf() const { + if (fields_ == NULL) return 0; + + int total_size = sizeof(*fields_) + sizeof(UnknownField) * fields_->size(); + for (int i = 0; i < fields_->size(); i++) { + const UnknownField& field = (*fields_)[i]; + switch (field.type()) { + case UnknownField::TYPE_LENGTH_DELIMITED: + total_size += sizeof(*field.length_delimited_) + + internal::StringSpaceUsedExcludingSelf(*field.length_delimited_); + break; + case UnknownField::TYPE_GROUP: + total_size += field.group_->SpaceUsed(); + break; + default: + break; + } + } + return total_size; +} + +int UnknownFieldSet::SpaceUsed() const { + return sizeof(*this) + SpaceUsedExcludingSelf(); +} + +void UnknownFieldSet::AddVarint(int number, uint64 value) { + if (fields_ == NULL) fields_ = new vector; + UnknownField field; + field.number_ = number; + field.type_ = UnknownField::TYPE_VARINT; + field.varint_ = value; + fields_->push_back(field); +} + +void UnknownFieldSet::AddFixed32(int number, uint32 value) { + if (fields_ == NULL) fields_ = new vector; + UnknownField field; + field.number_ = number; + field.type_ = UnknownField::TYPE_FIXED32; + field.fixed32_ = value; + fields_->push_back(field); +} + +void UnknownFieldSet::AddFixed64(int number, uint64 value) { + if (fields_ == NULL) fields_ = new vector; + UnknownField field; + field.number_ = number; + field.type_ = UnknownField::TYPE_FIXED64; + field.fixed64_ = value; + fields_->push_back(field); +} + +string* UnknownFieldSet::AddLengthDelimited(int number) { + if (fields_ == NULL) fields_ = new vector; + UnknownField field; + field.number_ = number; + field.type_ = UnknownField::TYPE_LENGTH_DELIMITED; + field.length_delimited_ = new string; + fields_->push_back(field); + return field.length_delimited_; +} + +UnknownFieldSet* UnknownFieldSet::AddGroup(int number) { + if (fields_ == NULL) fields_ = new vector; + UnknownField field; + field.number_ = number; + field.type_ = UnknownField::TYPE_GROUP; + field.group_ = new UnknownFieldSet; + fields_->push_back(field); + return field.group_; +} + +void UnknownFieldSet::AddField(const UnknownField& field) { + if (fields_ == NULL) fields_ = new vector; + fields_->push_back(field); + fields_->back().DeepCopy(); +} + +bool UnknownFieldSet::MergeFromCodedStream(io::CodedInputStream* input) { + + UnknownFieldSet other; + if (internal::WireFormat::SkipMessage(input, &other) && + input->ConsumedEntireMessage()) { + MergeFrom(other); + return true; + } else { + return false; + } +} + +bool UnknownFieldSet::ParseFromCodedStream(io::CodedInputStream* input) { + Clear(); + return MergeFromCodedStream(input); +} + +bool UnknownFieldSet::ParseFromZeroCopyStream(io::ZeroCopyInputStream* input) { + io::CodedInputStream coded_input(input); + return ParseFromCodedStream(&coded_input) && + coded_input.ConsumedEntireMessage(); +} + +bool UnknownFieldSet::ParseFromArray(const void* data, int size) { + io::ArrayInputStream input(data, size); + return ParseFromZeroCopyStream(&input); +} + +void UnknownField::Delete() { + switch (type()) { + case UnknownField::TYPE_LENGTH_DELIMITED: + delete length_delimited_; + break; + case UnknownField::TYPE_GROUP: + delete group_; + break; + default: + break; + } +} + +void UnknownField::DeepCopy() { + switch (type()) { + case UnknownField::TYPE_LENGTH_DELIMITED: + length_delimited_ = new string(*length_delimited_); + break; + case UnknownField::TYPE_GROUP: { + UnknownFieldSet* group = new UnknownFieldSet; + group->MergeFrom(*group_); + group_ = group; + break; + } + default: + break; + } +} + +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/unknown_field_set.h b/depends/protobuf/google/protobuf/unknown_field_set.h new file mode 100644 index 000000000..84c2e2b60 --- /dev/null +++ b/depends/protobuf/google/protobuf/unknown_field_set.h @@ -0,0 +1,268 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. +// +// Contains classes used to keep track of unrecognized fields seen while +// parsing a protocol message. + +#ifndef GOOGLE_PROTOBUF_UNKNOWN_FIELD_SET_H__ +#define GOOGLE_PROTOBUF_UNKNOWN_FIELD_SET_H__ + +#include +#include +#include + +namespace google { +namespace protobuf { + +class Message; // message.h +class UnknownField; // below + +// An UnknownFieldSet contains fields that were encountered while parsing a +// message but were not defined by its type. Keeping track of these can be +// useful, especially in that they may be written if the message is serialized +// again without being cleared in between. This means that software which +// simply receives messages and forwards them to other servers does not need +// to be updated every time a new field is added to the message definition. +// +// To get the UnknownFieldSet attached to any message, call +// Reflection::GetUnknownFields(). +// +// This class is necessarily tied to the protocol buffer wire format, unlike +// the Reflection interface which is independent of any serialization scheme. +class LIBPROTOBUF_EXPORT UnknownFieldSet { + public: + UnknownFieldSet(); + ~UnknownFieldSet(); + + // Remove all fields. + inline void Clear(); + + // Is this set empty? + inline bool empty() const; + + // Merge the contents of some other UnknownFieldSet with this one. + void MergeFrom(const UnknownFieldSet& other); + + // Swaps the contents of some other UnknownFieldSet with this one. + inline void Swap(UnknownFieldSet* x); + + // Computes (an estimate of) the total number of bytes currently used for + // storing the unknown fields in memory. Does NOT include + // sizeof(*this) in the calculation. + int SpaceUsedExcludingSelf() const; + + // Version of SpaceUsed() including sizeof(*this). + int SpaceUsed() const; + + // Returns the number of fields present in the UnknownFieldSet. + inline int field_count() const; + // Get a field in the set, where 0 <= index < field_count(). The fields + // appear in the order in which they were added. + inline const UnknownField& field(int index) const; + // Get a mutable pointer to a field in the set, where + // 0 <= index < field_count(). The fields appear in the order in which + // they were added. + inline UnknownField* mutable_field(int index); + + // Adding fields --------------------------------------------------- + + void AddVarint(int number, uint64 value); + void AddFixed32(int number, uint32 value); + void AddFixed64(int number, uint64 value); + void AddLengthDelimited(int number, const string& value); + string* AddLengthDelimited(int number); + UnknownFieldSet* AddGroup(int number); + + // Adds an unknown field from another set. + void AddField(const UnknownField& field); + + // Parsing helpers ------------------------------------------------- + // These work exactly like the similarly-named methods of Message. + + bool MergeFromCodedStream(io::CodedInputStream* input); + bool ParseFromCodedStream(io::CodedInputStream* input); + bool ParseFromZeroCopyStream(io::ZeroCopyInputStream* input); + bool ParseFromArray(const void* data, int size); + inline bool ParseFromString(const string& data) { + return ParseFromArray(data.data(), data.size()); + } + + private: + void ClearFallback(); + + vector* fields_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UnknownFieldSet); +}; + +// Represents one field in an UnknownFieldSet. +class LIBPROTOBUF_EXPORT UnknownField { + public: + enum Type { + TYPE_VARINT, + TYPE_FIXED32, + TYPE_FIXED64, + TYPE_LENGTH_DELIMITED, + TYPE_GROUP + }; + + // The field's tag number, as seen on the wire. + inline int number() const; + + // The field type. + inline Type type() const; + + // Accessors ------------------------------------------------------- + // Each method works only for UnknownFields of the corresponding type. + + inline uint64 varint() const; + inline uint32 fixed32() const; + inline uint64 fixed64() const; + inline const string& length_delimited() const; + inline const UnknownFieldSet& group() const; + + inline void set_varint(uint64 value); + inline void set_fixed32(uint32 value); + inline void set_fixed64(uint64 value); + inline void set_length_delimited(const string& value); + inline string* mutable_length_delimited(); + inline UnknownFieldSet* mutable_group(); + + private: + friend class UnknownFieldSet; + + // If this UnknownField contains a pointer, delete it. + void Delete(); + + // Make a deep copy of any pointers in this UnknownField. + void DeepCopy(); + + unsigned int number_ : 29; + unsigned int type_ : 3; + union { + uint64 varint_; + uint32 fixed32_; + uint64 fixed64_; + string* length_delimited_; + UnknownFieldSet* group_; + }; +}; + +// =================================================================== +// inline implementations + +inline void UnknownFieldSet::Clear() { + if (fields_ != NULL) { + ClearFallback(); + } +} + +inline bool UnknownFieldSet::empty() const { + return fields_ == NULL || fields_->empty(); +} + +inline void UnknownFieldSet::Swap(UnknownFieldSet* x) { + std::swap(fields_, x->fields_); +} + +inline int UnknownFieldSet::field_count() const { + return (fields_ == NULL) ? 0 : fields_->size(); +} +inline const UnknownField& UnknownFieldSet::field(int index) const { + return (*fields_)[index]; +} +inline UnknownField* UnknownFieldSet::mutable_field(int index) { + return &(*fields_)[index]; +} + +inline void UnknownFieldSet::AddLengthDelimited( + int number, const string& value) { + AddLengthDelimited(number)->assign(value); +} + +inline int UnknownField::number() const { return number_; } +inline UnknownField::Type UnknownField::type() const { + return static_cast(type_); +} + +inline uint64 UnknownField::varint () const { + GOOGLE_DCHECK_EQ(type_, TYPE_VARINT); + return varint_; +} +inline uint32 UnknownField::fixed32() const { + GOOGLE_DCHECK_EQ(type_, TYPE_FIXED32); + return fixed32_; +} +inline uint64 UnknownField::fixed64() const { + GOOGLE_DCHECK_EQ(type_, TYPE_FIXED64); + return fixed64_; +} +inline const string& UnknownField::length_delimited() const { + GOOGLE_DCHECK_EQ(type_, TYPE_LENGTH_DELIMITED); + return *length_delimited_; +} +inline const UnknownFieldSet& UnknownField::group() const { + GOOGLE_DCHECK_EQ(type_, TYPE_GROUP); + return *group_; +} + +inline void UnknownField::set_varint(uint64 value) { + GOOGLE_DCHECK_EQ(type_, TYPE_VARINT); + varint_ = value; +} +inline void UnknownField::set_fixed32(uint32 value) { + GOOGLE_DCHECK_EQ(type_, TYPE_FIXED32); + fixed32_ = value; +} +inline void UnknownField::set_fixed64(uint64 value) { + GOOGLE_DCHECK_EQ(type_, TYPE_FIXED64); + fixed64_ = value; +} +inline void UnknownField::set_length_delimited(const string& value) { + GOOGLE_DCHECK_EQ(type_, TYPE_LENGTH_DELIMITED); + length_delimited_->assign(value); +} +inline string* UnknownField::mutable_length_delimited() { + GOOGLE_DCHECK_EQ(type_, TYPE_LENGTH_DELIMITED); + return length_delimited_; +} +inline UnknownFieldSet* UnknownField::mutable_group() { + GOOGLE_DCHECK_EQ(type_, TYPE_GROUP); + return group_; +} + +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_UNKNOWN_FIELD_SET_H__ diff --git a/depends/protobuf/google/protobuf/wire_format.cc b/depends/protobuf/google/protobuf/wire_format.cc new file mode 100644 index 000000000..831a57945 --- /dev/null +++ b/depends/protobuf/google/protobuf/wire_format.cc @@ -0,0 +1,1069 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + + +namespace google { +namespace protobuf { +namespace internal { + +using internal::WireFormatLite; + +namespace { + +// This function turns out to be convenient when using some macros later. +inline int GetEnumNumber(const EnumValueDescriptor* descriptor) { + return descriptor->number(); +} + +} // anonymous namespace + +// =================================================================== + +bool UnknownFieldSetFieldSkipper::SkipField( + io::CodedInputStream* input, uint32 tag) { + return WireFormat::SkipField(input, tag, unknown_fields_); +} + +bool UnknownFieldSetFieldSkipper::SkipMessage(io::CodedInputStream* input) { + return WireFormat::SkipMessage(input, unknown_fields_); +} + +void UnknownFieldSetFieldSkipper::SkipUnknownEnum( + int field_number, int value) { + unknown_fields_->AddVarint(field_number, value); +} + +bool WireFormat::SkipField(io::CodedInputStream* input, uint32 tag, + UnknownFieldSet* unknown_fields) { + int number = WireFormatLite::GetTagFieldNumber(tag); + + switch (WireFormatLite::GetTagWireType(tag)) { + case WireFormatLite::WIRETYPE_VARINT: { + uint64 value; + if (!input->ReadVarint64(&value)) return false; + if (unknown_fields != NULL) unknown_fields->AddVarint(number, value); + return true; + } + case WireFormatLite::WIRETYPE_FIXED64: { + uint64 value; + if (!input->ReadLittleEndian64(&value)) return false; + if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value); + return true; + } + case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (unknown_fields == NULL) { + if (!input->Skip(length)) return false; + } else { + if (!input->ReadString(unknown_fields->AddLengthDelimited(number), + length)) { + return false; + } + } + return true; + } + case WireFormatLite::WIRETYPE_START_GROUP: { + if (!input->IncrementRecursionDepth()) return false; + if (!SkipMessage(input, (unknown_fields == NULL) ? + NULL : unknown_fields->AddGroup(number))) { + return false; + } + input->DecrementRecursionDepth(); + // Check that the ending tag matched the starting tag. + if (!input->LastTagWas(WireFormatLite::MakeTag( + WireFormatLite::GetTagFieldNumber(tag), + WireFormatLite::WIRETYPE_END_GROUP))) { + return false; + } + return true; + } + case WireFormatLite::WIRETYPE_END_GROUP: { + return false; + } + case WireFormatLite::WIRETYPE_FIXED32: { + uint32 value; + if (!input->ReadLittleEndian32(&value)) return false; + if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value); + return true; + } + default: { + return false; + } + } +} + +bool WireFormat::SkipMessage(io::CodedInputStream* input, + UnknownFieldSet* unknown_fields) { + while(true) { + uint32 tag = input->ReadTag(); + if (tag == 0) { + // End of input. This is a valid place to end, so return true. + return true; + } + + WireFormatLite::WireType wire_type = WireFormatLite::GetTagWireType(tag); + + if (wire_type == WireFormatLite::WIRETYPE_END_GROUP) { + // Must be the end of the message. + return true; + } + + if (!SkipField(input, tag, unknown_fields)) return false; + } +} + +void WireFormat::SerializeUnknownFields(const UnknownFieldSet& unknown_fields, + io::CodedOutputStream* output) { + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + switch (field.type()) { + case UnknownField::TYPE_VARINT: + output->WriteVarint32(WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_VARINT)); + output->WriteVarint64(field.varint()); + break; + case UnknownField::TYPE_FIXED32: + output->WriteVarint32(WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_FIXED32)); + output->WriteLittleEndian32(field.fixed32()); + break; + case UnknownField::TYPE_FIXED64: + output->WriteVarint32(WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_FIXED64)); + output->WriteLittleEndian64(field.fixed64()); + break; + case UnknownField::TYPE_LENGTH_DELIMITED: + output->WriteVarint32(WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED)); + output->WriteVarint32(field.length_delimited().size()); + output->WriteString(field.length_delimited()); + break; + case UnknownField::TYPE_GROUP: + output->WriteVarint32(WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_START_GROUP)); + SerializeUnknownFields(field.group(), output); + output->WriteVarint32(WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_END_GROUP)); + break; + } + } +} + +uint8* WireFormat::SerializeUnknownFieldsToArray( + const UnknownFieldSet& unknown_fields, + uint8* target) { + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + + switch (field.type()) { + case UnknownField::TYPE_VARINT: + target = WireFormatLite::WriteInt64ToArray( + field.number(), field.varint(), target); + break; + case UnknownField::TYPE_FIXED32: + target = WireFormatLite::WriteFixed32ToArray( + field.number(), field.fixed32(), target); + break; + case UnknownField::TYPE_FIXED64: + target = WireFormatLite::WriteFixed64ToArray( + field.number(), field.fixed64(), target); + break; + case UnknownField::TYPE_LENGTH_DELIMITED: + target = WireFormatLite::WriteBytesToArray( + field.number(), field.length_delimited(), target); + break; + case UnknownField::TYPE_GROUP: + target = WireFormatLite::WriteTagToArray( + field.number(), WireFormatLite::WIRETYPE_START_GROUP, target); + target = SerializeUnknownFieldsToArray(field.group(), target); + target = WireFormatLite::WriteTagToArray( + field.number(), WireFormatLite::WIRETYPE_END_GROUP, target); + break; + } + } + return target; +} + +void WireFormat::SerializeUnknownMessageSetItems( + const UnknownFieldSet& unknown_fields, + io::CodedOutputStream* output) { + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + // The only unknown fields that are allowed to exist in a MessageSet are + // messages, which are length-delimited. + if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) { + const string& data = field.length_delimited(); + + // Start group. + output->WriteVarint32(WireFormatLite::kMessageSetItemStartTag); + + // Write type ID. + output->WriteVarint32(WireFormatLite::kMessageSetTypeIdTag); + output->WriteVarint32(field.number()); + + // Write message. + output->WriteVarint32(WireFormatLite::kMessageSetMessageTag); + output->WriteVarint32(data.size()); + output->WriteString(data); + + // End group. + output->WriteVarint32(WireFormatLite::kMessageSetItemEndTag); + } + } +} + +uint8* WireFormat::SerializeUnknownMessageSetItemsToArray( + const UnknownFieldSet& unknown_fields, + uint8* target) { + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + + // The only unknown fields that are allowed to exist in a MessageSet are + // messages, which are length-delimited. + if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) { + const string& data = field.length_delimited(); + + // Start group. + target = io::CodedOutputStream::WriteTagToArray( + WireFormatLite::kMessageSetItemStartTag, target); + + // Write type ID. + target = io::CodedOutputStream::WriteTagToArray( + WireFormatLite::kMessageSetTypeIdTag, target); + target = io::CodedOutputStream::WriteVarint32ToArray( + field.number(), target); + + // Write message. + target = io::CodedOutputStream::WriteTagToArray( + WireFormatLite::kMessageSetMessageTag, target); + target = io::CodedOutputStream::WriteVarint32ToArray(data.size(), target); + target = io::CodedOutputStream::WriteStringToArray(data, target); + + // End group. + target = io::CodedOutputStream::WriteTagToArray( + WireFormatLite::kMessageSetItemEndTag, target); + } + } + + return target; +} + +int WireFormat::ComputeUnknownFieldsSize( + const UnknownFieldSet& unknown_fields) { + int size = 0; + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + + switch (field.type()) { + case UnknownField::TYPE_VARINT: + size += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_VARINT)); + size += io::CodedOutputStream::VarintSize64(field.varint()); + break; + case UnknownField::TYPE_FIXED32: + size += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_FIXED32)); + size += sizeof(int32); + break; + case UnknownField::TYPE_FIXED64: + size += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_FIXED64)); + size += sizeof(int64); + break; + case UnknownField::TYPE_LENGTH_DELIMITED: + size += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED)); + size += io::CodedOutputStream::VarintSize32( + field.length_delimited().size()); + size += field.length_delimited().size(); + break; + case UnknownField::TYPE_GROUP: + size += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_START_GROUP)); + size += ComputeUnknownFieldsSize(field.group()); + size += io::CodedOutputStream::VarintSize32( + WireFormatLite::MakeTag(field.number(), + WireFormatLite::WIRETYPE_END_GROUP)); + break; + } + } + + return size; +} + +int WireFormat::ComputeUnknownMessageSetItemsSize( + const UnknownFieldSet& unknown_fields) { + int size = 0; + for (int i = 0; i < unknown_fields.field_count(); i++) { + const UnknownField& field = unknown_fields.field(i); + + // The only unknown fields that are allowed to exist in a MessageSet are + // messages, which are length-delimited. + if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) { + size += WireFormatLite::kMessageSetItemTagsSize; + size += io::CodedOutputStream::VarintSize32(field.number()); + size += io::CodedOutputStream::VarintSize32( + field.length_delimited().size()); + size += field.length_delimited().size(); + } + } + + return size; +} + +// =================================================================== + +bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, + Message* message) { + const Descriptor* descriptor = message->GetDescriptor(); + const Reflection* message_reflection = message->GetReflection(); + + while(true) { + uint32 tag = input->ReadTag(); + if (tag == 0) { + // End of input. This is a valid place to end, so return true. + return true; + } + + if (WireFormatLite::GetTagWireType(tag) == + WireFormatLite::WIRETYPE_END_GROUP) { + // Must be the end of the message. + return true; + } + + const FieldDescriptor* field = NULL; + + if (descriptor != NULL) { + int field_number = WireFormatLite::GetTagFieldNumber(tag); + field = descriptor->FindFieldByNumber(field_number); + + // If that failed, check if the field is an extension. + if (field == NULL && descriptor->IsExtensionNumber(field_number)) { + if (input->GetExtensionPool() == NULL) { + field = message_reflection->FindKnownExtensionByNumber(field_number); + } else { + field = input->GetExtensionPool() + ->FindExtensionByNumber(descriptor, field_number); + } + } + + // If that failed, but we're a MessageSet, and this is the tag for a + // MessageSet item, then parse that. + if (field == NULL && + descriptor->options().message_set_wire_format() && + tag == WireFormatLite::kMessageSetItemStartTag) { + if (!ParseAndMergeMessageSetItem(input, message)) { + return false; + } + continue; // Skip ParseAndMergeField(); already taken care of. + } + } + + if (!ParseAndMergeField(tag, field, message, input)) { + return false; + } + } +} + +bool WireFormat::ParseAndMergeField( + uint32 tag, + const FieldDescriptor* field, // May be NULL for unknown + Message* message, + io::CodedInputStream* input) { + const Reflection* message_reflection = message->GetReflection(); + + enum { UNKNOWN, NORMAL_FORMAT, PACKED_FORMAT } value_format; + + if (field == NULL) { + value_format = UNKNOWN; + } else if (WireFormatLite::GetTagWireType(tag) == + WireTypeForFieldType(field->type())) { + value_format = NORMAL_FORMAT; + } else if (field->is_packable() && + WireFormatLite::GetTagWireType(tag) == + WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + value_format = PACKED_FORMAT; + } else { + // We don't recognize this field. Either the field number is unknown + // or the wire type doesn't match. Put it in our unknown field set. + value_format = UNKNOWN; + } + + if (value_format == UNKNOWN) { + return SkipField(input, tag, + message_reflection->MutableUnknownFields(message)); + } else if (value_format == PACKED_FORMAT) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + io::CodedInputStream::Limit limit = input->PushLimit(length); + + switch (field->type()) { +#define HANDLE_PACKED_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD) \ + case FieldDescriptor::TYPE_##TYPE: { \ + while (input->BytesUntilLimit() > 0) { \ + CPPTYPE value; \ + if (!WireFormatLite::ReadPrimitive< \ + CPPTYPE, WireFormatLite::TYPE_##TYPE>(input, &value)) \ + return false; \ + message_reflection->Add##CPPTYPE_METHOD(message, field, value); \ + } \ + break; \ + } + + HANDLE_PACKED_TYPE( INT32, int32, Int32) + HANDLE_PACKED_TYPE( INT64, int64, Int64) + HANDLE_PACKED_TYPE(SINT32, int32, Int32) + HANDLE_PACKED_TYPE(SINT64, int64, Int64) + HANDLE_PACKED_TYPE(UINT32, uint32, UInt32) + HANDLE_PACKED_TYPE(UINT64, uint64, UInt64) + + HANDLE_PACKED_TYPE( FIXED32, uint32, UInt32) + HANDLE_PACKED_TYPE( FIXED64, uint64, UInt64) + HANDLE_PACKED_TYPE(SFIXED32, int32, Int32) + HANDLE_PACKED_TYPE(SFIXED64, int64, Int64) + + HANDLE_PACKED_TYPE(FLOAT , float , Float ) + HANDLE_PACKED_TYPE(DOUBLE, double, Double) + + HANDLE_PACKED_TYPE(BOOL, bool, Bool) +#undef HANDLE_PACKED_TYPE + + case FieldDescriptor::TYPE_ENUM: { + while (input->BytesUntilLimit() > 0) { + int value; + if (!WireFormatLite::ReadPrimitive( + input, &value)) return false; + const EnumValueDescriptor* enum_value = + field->enum_type()->FindValueByNumber(value); + if (enum_value != NULL) { + message_reflection->AddEnum(message, field, enum_value); + } + } + + break; + } + + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_GROUP: + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_BYTES: + // Can't have packed fields of these types: these should be caught by + // the protocol compiler. + return false; + break; + } + + input->PopLimit(limit); + } else { + // Non-packed value (value_format == NORMAL_FORMAT) + switch (field->type()) { +#define HANDLE_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD) \ + case FieldDescriptor::TYPE_##TYPE: { \ + CPPTYPE value; \ + if (!WireFormatLite::ReadPrimitive< \ + CPPTYPE, WireFormatLite::TYPE_##TYPE>(input, &value)) \ + return false; \ + if (field->is_repeated()) { \ + message_reflection->Add##CPPTYPE_METHOD(message, field, value); \ + } else { \ + message_reflection->Set##CPPTYPE_METHOD(message, field, value); \ + } \ + break; \ + } + + HANDLE_TYPE( INT32, int32, Int32) + HANDLE_TYPE( INT64, int64, Int64) + HANDLE_TYPE(SINT32, int32, Int32) + HANDLE_TYPE(SINT64, int64, Int64) + HANDLE_TYPE(UINT32, uint32, UInt32) + HANDLE_TYPE(UINT64, uint64, UInt64) + + HANDLE_TYPE( FIXED32, uint32, UInt32) + HANDLE_TYPE( FIXED64, uint64, UInt64) + HANDLE_TYPE(SFIXED32, int32, Int32) + HANDLE_TYPE(SFIXED64, int64, Int64) + + HANDLE_TYPE(FLOAT , float , Float ) + HANDLE_TYPE(DOUBLE, double, Double) + + HANDLE_TYPE(BOOL, bool, Bool) +#undef HANDLE_TYPE + + case FieldDescriptor::TYPE_ENUM: { + int value; + if (!WireFormatLite::ReadPrimitive( + input, &value)) return false; + const EnumValueDescriptor* enum_value = + field->enum_type()->FindValueByNumber(value); + if (enum_value != NULL) { + if (field->is_repeated()) { + message_reflection->AddEnum(message, field, enum_value); + } else { + message_reflection->SetEnum(message, field, enum_value); + } + } else { + // The enum value is not one of the known values. Add it to the + // UnknownFieldSet. + int64 sign_extended_value = static_cast(value); + message_reflection->MutableUnknownFields(message) + ->AddVarint(WireFormatLite::GetTagFieldNumber(tag), + sign_extended_value); + } + break; + } + + // Handle strings separately so that we can optimize the ctype=CORD case. + case FieldDescriptor::TYPE_STRING: { + string value; + if (!WireFormatLite::ReadString(input, &value)) return false; + VerifyUTF8String(value.data(), value.length(), PARSE); + if (field->is_repeated()) { + message_reflection->AddString(message, field, value); + } else { + message_reflection->SetString(message, field, value); + } + break; + } + + case FieldDescriptor::TYPE_BYTES: { + string value; + if (!WireFormatLite::ReadBytes(input, &value)) return false; + if (field->is_repeated()) { + message_reflection->AddString(message, field, value); + } else { + message_reflection->SetString(message, field, value); + } + break; + } + + case FieldDescriptor::TYPE_GROUP: { + Message* sub_message; + if (field->is_repeated()) { + sub_message = message_reflection->AddMessage( + message, field, input->GetExtensionFactory()); + } else { + sub_message = message_reflection->MutableMessage( + message, field, input->GetExtensionFactory()); + } + + if (!WireFormatLite::ReadGroup(WireFormatLite::GetTagFieldNumber(tag), + input, sub_message)) + return false; + break; + } + + case FieldDescriptor::TYPE_MESSAGE: { + Message* sub_message; + if (field->is_repeated()) { + sub_message = message_reflection->AddMessage( + message, field, input->GetExtensionFactory()); + } else { + sub_message = message_reflection->MutableMessage( + message, field, input->GetExtensionFactory()); + } + + if (!WireFormatLite::ReadMessage(input, sub_message)) return false; + break; + } + } + } + + return true; +} + +bool WireFormat::ParseAndMergeMessageSetItem( + io::CodedInputStream* input, + Message* message) { + const Reflection* message_reflection = message->GetReflection(); + + // This method parses a group which should contain two fields: + // required int32 type_id = 2; + // required data message = 3; + + // Once we see a type_id, we'll construct a fake tag for this extension + // which is the tag it would have had under the proto2 extensions wire + // format. + uint32 fake_tag = 0; + + // Once we see a type_id, we'll look up the FieldDescriptor for the + // extension. + const FieldDescriptor* field = NULL; + + // If we see message data before the type_id, we'll append it to this so + // we can parse it later. This will probably never happen in practice, + // as no MessageSet encoder I know of writes the message before the type ID. + // But, it's technically valid so we should allow it. + // TODO(kenton): Use a Cord instead? Do I care? + string message_data; + + while (true) { + uint32 tag = input->ReadTag(); + if (tag == 0) return false; + + switch (tag) { + case WireFormatLite::kMessageSetTypeIdTag: { + uint32 type_id; + if (!input->ReadVarint32(&type_id)) return false; + fake_tag = WireFormatLite::MakeTag( + type_id, WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + field = message_reflection->FindKnownExtensionByNumber(type_id); + + if (!message_data.empty()) { + // We saw some message data before the type_id. Have to parse it + // now. + io::ArrayInputStream raw_input(message_data.data(), + message_data.size()); + io::CodedInputStream sub_input(&raw_input); + if (!ParseAndMergeField(fake_tag, field, message, + &sub_input)) { + return false; + } + message_data.clear(); + } + + break; + } + + case WireFormatLite::kMessageSetMessageTag: { + if (fake_tag == 0) { + // We haven't seen a type_id yet. Append this data to message_data. + string temp; + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (!input->ReadString(&temp, length)) return false; + message_data.append(temp); + } else { + // Already saw type_id, so we can parse this directly. + if (!ParseAndMergeField(fake_tag, field, message, input)) { + return false; + } + } + + break; + } + + case WireFormatLite::kMessageSetItemEndTag: { + return true; + } + + default: { + if (!SkipField(input, tag, NULL)) return false; + } + } + } +} + +// =================================================================== + +void WireFormat::SerializeWithCachedSizes( + const Message& message, + int size, io::CodedOutputStream* output) { + const Descriptor* descriptor = message.GetDescriptor(); + const Reflection* message_reflection = message.GetReflection(); + int expected_endpoint = output->ByteCount() + size; + + vector fields; + message_reflection->ListFields(message, &fields); + for (int i = 0; i < fields.size(); i++) { + SerializeFieldWithCachedSizes(fields[i], message, output); + } + + if (descriptor->options().message_set_wire_format()) { + SerializeUnknownMessageSetItems( + message_reflection->GetUnknownFields(message), output); + } else { + SerializeUnknownFields( + message_reflection->GetUnknownFields(message), output); + } + + GOOGLE_CHECK_EQ(output->ByteCount(), expected_endpoint) + << ": Protocol message serialized to a size different from what was " + "originally expected. Perhaps it was modified by another thread " + "during serialization?"; +} + +void WireFormat::SerializeFieldWithCachedSizes( + const FieldDescriptor* field, + const Message& message, + io::CodedOutputStream* output) { + const Reflection* message_reflection = message.GetReflection(); + + if (field->is_extension() && + field->containing_type()->options().message_set_wire_format() && + field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + !field->is_repeated()) { + SerializeMessageSetItemWithCachedSizes(field, message, output); + return; + } + + int count = 0; + + if (field->is_repeated()) { + count = message_reflection->FieldSize(message, field); + } else if (message_reflection->HasField(message, field)) { + count = 1; + } + + const bool is_packed = field->options().packed(); + if (is_packed && count > 0) { + WireFormatLite::WriteTag(field->number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + const int data_size = FieldDataOnlyByteSize(field, message); + output->WriteVarint32(data_size); + } + + for (int j = 0; j < count; j++) { + switch (field->type()) { +#define HANDLE_PRIMITIVE_TYPE(TYPE, CPPTYPE, TYPE_METHOD, CPPTYPE_METHOD) \ + case FieldDescriptor::TYPE_##TYPE: { \ + const CPPTYPE value = field->is_repeated() ? \ + message_reflection->GetRepeated##CPPTYPE_METHOD( \ + message, field, j) : \ + message_reflection->Get##CPPTYPE_METHOD( \ + message, field); \ + if (is_packed) { \ + WireFormatLite::Write##TYPE_METHOD##NoTag(value, output); \ + } else { \ + WireFormatLite::Write##TYPE_METHOD(field->number(), value, output); \ + } \ + break; \ + } + + HANDLE_PRIMITIVE_TYPE( INT32, int32, Int32, Int32) + HANDLE_PRIMITIVE_TYPE( INT64, int64, Int64, Int64) + HANDLE_PRIMITIVE_TYPE(SINT32, int32, SInt32, Int32) + HANDLE_PRIMITIVE_TYPE(SINT64, int64, SInt64, Int64) + HANDLE_PRIMITIVE_TYPE(UINT32, uint32, UInt32, UInt32) + HANDLE_PRIMITIVE_TYPE(UINT64, uint64, UInt64, UInt64) + + HANDLE_PRIMITIVE_TYPE( FIXED32, uint32, Fixed32, UInt32) + HANDLE_PRIMITIVE_TYPE( FIXED64, uint64, Fixed64, UInt64) + HANDLE_PRIMITIVE_TYPE(SFIXED32, int32, SFixed32, Int32) + HANDLE_PRIMITIVE_TYPE(SFIXED64, int64, SFixed64, Int64) + + HANDLE_PRIMITIVE_TYPE(FLOAT , float , Float , Float ) + HANDLE_PRIMITIVE_TYPE(DOUBLE, double, Double, Double) + + HANDLE_PRIMITIVE_TYPE(BOOL, bool, Bool, Bool) +#undef HANDLE_PRIMITIVE_TYPE + +#define HANDLE_TYPE(TYPE, TYPE_METHOD, CPPTYPE_METHOD) \ + case FieldDescriptor::TYPE_##TYPE: \ + WireFormatLite::Write##TYPE_METHOD( \ + field->number(), \ + field->is_repeated() ? \ + message_reflection->GetRepeated##CPPTYPE_METHOD( \ + message, field, j) : \ + message_reflection->Get##CPPTYPE_METHOD(message, field), \ + output); \ + break; + + HANDLE_TYPE(GROUP , Group , Message) + HANDLE_TYPE(MESSAGE, Message, Message) +#undef HANDLE_TYPE + + case FieldDescriptor::TYPE_ENUM: { + const EnumValueDescriptor* value = field->is_repeated() ? + message_reflection->GetRepeatedEnum(message, field, j) : + message_reflection->GetEnum(message, field); + if (is_packed) { + WireFormatLite::WriteEnumNoTag(value->number(), output); + } else { + WireFormatLite::WriteEnum(field->number(), value->number(), output); + } + break; + } + + // Handle strings separately so that we can get string references + // instead of copying. + case FieldDescriptor::TYPE_STRING: { + string scratch; + const string& value = field->is_repeated() ? + message_reflection->GetRepeatedStringReference( + message, field, j, &scratch) : + message_reflection->GetStringReference(message, field, &scratch); + VerifyUTF8String(value.data(), value.length(), SERIALIZE); + WireFormatLite::WriteString(field->number(), value, output); + break; + } + + case FieldDescriptor::TYPE_BYTES: { + string scratch; + const string& value = field->is_repeated() ? + message_reflection->GetRepeatedStringReference( + message, field, j, &scratch) : + message_reflection->GetStringReference(message, field, &scratch); + WireFormatLite::WriteBytes(field->number(), value, output); + break; + } + } + } +} + +void WireFormat::SerializeMessageSetItemWithCachedSizes( + const FieldDescriptor* field, + const Message& message, + io::CodedOutputStream* output) { + const Reflection* message_reflection = message.GetReflection(); + + // Start group. + output->WriteVarint32(WireFormatLite::kMessageSetItemStartTag); + + // Write type ID. + output->WriteVarint32(WireFormatLite::kMessageSetTypeIdTag); + output->WriteVarint32(field->number()); + + // Write message. + output->WriteVarint32(WireFormatLite::kMessageSetMessageTag); + + const Message& sub_message = message_reflection->GetMessage(message, field); + output->WriteVarint32(sub_message.GetCachedSize()); + sub_message.SerializeWithCachedSizes(output); + + // End group. + output->WriteVarint32(WireFormatLite::kMessageSetItemEndTag); +} + +// =================================================================== + +int WireFormat::ByteSize(const Message& message) { + const Descriptor* descriptor = message.GetDescriptor(); + const Reflection* message_reflection = message.GetReflection(); + + int our_size = 0; + + vector fields; + message_reflection->ListFields(message, &fields); + for (int i = 0; i < fields.size(); i++) { + our_size += FieldByteSize(fields[i], message); + } + + if (descriptor->options().message_set_wire_format()) { + our_size += ComputeUnknownMessageSetItemsSize( + message_reflection->GetUnknownFields(message)); + } else { + our_size += ComputeUnknownFieldsSize( + message_reflection->GetUnknownFields(message)); + } + + return our_size; +} + +int WireFormat::FieldByteSize( + const FieldDescriptor* field, + const Message& message) { + const Reflection* message_reflection = message.GetReflection(); + + if (field->is_extension() && + field->containing_type()->options().message_set_wire_format() && + field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + !field->is_repeated()) { + return MessageSetItemByteSize(field, message); + } + + int count = 0; + if (field->is_repeated()) { + count = message_reflection->FieldSize(message, field); + } else if (message_reflection->HasField(message, field)) { + count = 1; + } + + const int data_size = FieldDataOnlyByteSize(field, message); + int our_size = data_size; + if (field->options().packed()) { + if (data_size > 0) { + // Packed fields get serialized like a string, not their native type. + // Technically this doesn't really matter; the size only changes if it's + // a GROUP + our_size += TagSize(field->number(), FieldDescriptor::TYPE_STRING); + our_size += io::CodedOutputStream::VarintSize32(data_size); + } + } else { + our_size += count * TagSize(field->number(), field->type()); + } + return our_size; +} + +int WireFormat::FieldDataOnlyByteSize( + const FieldDescriptor* field, + const Message& message) { + const Reflection* message_reflection = message.GetReflection(); + + int count = 0; + if (field->is_repeated()) { + count = message_reflection->FieldSize(message, field); + } else if (message_reflection->HasField(message, field)) { + count = 1; + } + + int data_size = 0; + switch (field->type()) { +#define HANDLE_TYPE(TYPE, TYPE_METHOD, CPPTYPE_METHOD) \ + case FieldDescriptor::TYPE_##TYPE: \ + if (field->is_repeated()) { \ + for (int j = 0; j < count; j++) { \ + data_size += WireFormatLite::TYPE_METHOD##Size( \ + message_reflection->GetRepeated##CPPTYPE_METHOD( \ + message, field, j)); \ + } \ + } else { \ + data_size += WireFormatLite::TYPE_METHOD##Size( \ + message_reflection->Get##CPPTYPE_METHOD(message, field)); \ + } \ + break; + +#define HANDLE_FIXED_TYPE(TYPE, TYPE_METHOD) \ + case FieldDescriptor::TYPE_##TYPE: \ + data_size += count * WireFormatLite::k##TYPE_METHOD##Size; \ + break; + + HANDLE_TYPE( INT32, Int32, Int32) + HANDLE_TYPE( INT64, Int64, Int64) + HANDLE_TYPE(SINT32, SInt32, Int32) + HANDLE_TYPE(SINT64, SInt64, Int64) + HANDLE_TYPE(UINT32, UInt32, UInt32) + HANDLE_TYPE(UINT64, UInt64, UInt64) + + HANDLE_FIXED_TYPE( FIXED32, Fixed32) + HANDLE_FIXED_TYPE( FIXED64, Fixed64) + HANDLE_FIXED_TYPE(SFIXED32, SFixed32) + HANDLE_FIXED_TYPE(SFIXED64, SFixed64) + + HANDLE_FIXED_TYPE(FLOAT , Float ) + HANDLE_FIXED_TYPE(DOUBLE, Double) + + HANDLE_FIXED_TYPE(BOOL, Bool) + + HANDLE_TYPE(GROUP , Group , Message) + HANDLE_TYPE(MESSAGE, Message, Message) +#undef HANDLE_TYPE +#undef HANDLE_FIXED_TYPE + + case FieldDescriptor::TYPE_ENUM: { + if (field->is_repeated()) { + for (int j = 0; j < count; j++) { + data_size += WireFormatLite::EnumSize( + message_reflection->GetRepeatedEnum(message, field, j)->number()); + } + } else { + data_size += WireFormatLite::EnumSize( + message_reflection->GetEnum(message, field)->number()); + } + break; + } + + // Handle strings separately so that we can get string references + // instead of copying. + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: { + for (int j = 0; j < count; j++) { + string scratch; + const string& value = field->is_repeated() ? + message_reflection->GetRepeatedStringReference( + message, field, j, &scratch) : + message_reflection->GetStringReference(message, field, &scratch); + data_size += WireFormatLite::StringSize(value); + } + break; + } + } + return data_size; +} + +int WireFormat::MessageSetItemByteSize( + const FieldDescriptor* field, + const Message& message) { + const Reflection* message_reflection = message.GetReflection(); + + int our_size = WireFormatLite::kMessageSetItemTagsSize; + + // type_id + our_size += io::CodedOutputStream::VarintSize32(field->number()); + + // message + const Message& sub_message = message_reflection->GetMessage(message, field); + int message_size = sub_message.ByteSize(); + + our_size += io::CodedOutputStream::VarintSize32(message_size); + our_size += message_size; + + return our_size; +} + +void WireFormat::VerifyUTF8StringFallback(const char* data, + int size, + Operation op) { + if (!IsStructurallyValidUTF8(data, size)) { + const char* operation_str = NULL; + switch (op) { + case PARSE: + operation_str = "parsing"; + break; + case SERIALIZE: + operation_str = "serializing"; + break; + // no default case: have the compiler warn if a case is not covered. + } + GOOGLE_LOG(ERROR) << "Encountered string containing invalid UTF-8 data while " + << operation_str + << " protocol buffer. Strings must contain only UTF-8; " + "use the 'bytes' type for raw bytes."; + } +} + + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/wire_format.h b/depends/protobuf/google/protobuf/wire_format.h new file mode 100644 index 000000000..c75392508 --- /dev/null +++ b/depends/protobuf/google/protobuf/wire_format.h @@ -0,0 +1,304 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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) +// atenasio@google.com (Chris Atenasio) (ZigZag transform) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// This header is logically internal, but is made public because it is used +// from protocol-compiler-generated code, which may reside in other components. + +#ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_H__ +#define GOOGLE_PROTOBUF_WIRE_FORMAT_H__ + +#include +#include +#include +#include +#include + +// Do UTF-8 validation on string type in Debug build only +#ifndef NDEBUG +#define GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED +#endif + +namespace google { +namespace protobuf { + namespace io { + class CodedInputStream; // coded_stream.h + class CodedOutputStream; // coded_stream.h + } + class UnknownFieldSet; // unknown_field_set.h +} + +namespace protobuf { +namespace internal { + +// This class is for internal use by the protocol buffer library and by +// protocol-complier-generated message classes. It must not be called +// directly by clients. +// +// This class contains code for implementing the binary protocol buffer +// wire format via reflection. The WireFormatLite class implements the +// non-reflection based routines. +// +// This class is really a namespace that contains only static methods +class LIBPROTOBUF_EXPORT WireFormat { + public: + + // Given a field return its WireType + static inline WireFormatLite::WireType WireTypeForField( + const FieldDescriptor* field); + + // Given a FieldSescriptor::Type return its WireType + static inline WireFormatLite::WireType WireTypeForFieldType( + FieldDescriptor::Type type); + + // Compute the byte size of a tag. For groups, this includes both the start + // and end tags. + static inline int TagSize(int field_number, FieldDescriptor::Type type); + + // These procedures can be used to implement the methods of Message which + // handle parsing and serialization of the protocol buffer wire format + // using only the Reflection interface. When you ask the protocol + // compiler to optimize for code size rather than speed, it will implement + // those methods in terms of these procedures. Of course, these are much + // slower than the specialized implementations which the protocol compiler + // generates when told to optimize for speed. + + // Read a message in protocol buffer wire format. + // + // This procedure reads either to the end of the input stream or through + // a WIRETYPE_END_GROUP tag ending the message, whichever comes first. + // It returns false if the input is invalid. + // + // Required fields are NOT checked by this method. You must call + // IsInitialized() on the resulting message yourself. + static bool ParseAndMergePartial(io::CodedInputStream* input, + Message* message); + + // Serialize a message in protocol buffer wire format. + // + // Any embedded messages within the message must have their correct sizes + // cached. However, the top-level message need not; its size is passed as + // a parameter to this procedure. + // + // These return false iff the underlying stream returns a write error. + static void SerializeWithCachedSizes( + const Message& message, + int size, io::CodedOutputStream* output); + + // Implements Message::ByteSize() via reflection. WARNING: The result + // of this method is *not* cached anywhere. However, all embedded messages + // will have their ByteSize() methods called, so their sizes will be cached. + // Therefore, calling this method is sufficient to allow you to call + // WireFormat::SerializeWithCachedSizes() on the same object. + static int ByteSize(const Message& message); + + // ----------------------------------------------------------------- + // Helpers for dealing with unknown fields + + // Skips a field value of the given WireType. The input should start + // positioned immediately after the tag. If unknown_fields is non-NULL, + // the contents of the field will be added to it. + static bool SkipField(io::CodedInputStream* input, uint32 tag, + UnknownFieldSet* unknown_fields); + + // Reads and ignores a message from the input. If unknown_fields is non-NULL, + // the contents will be added to it. + static bool SkipMessage(io::CodedInputStream* input, + UnknownFieldSet* unknown_fields); + + // Write the contents of an UnknownFieldSet to the output. + static void SerializeUnknownFields(const UnknownFieldSet& unknown_fields, + io::CodedOutputStream* output); + // Same as above, except writing directly to the provided buffer. + // Requires that the buffer have sufficient capacity for + // ComputeUnknownFieldsSize(unknown_fields). + // + // Returns a pointer past the last written byte. + static uint8* SerializeUnknownFieldsToArray( + const UnknownFieldSet& unknown_fields, + uint8* target); + + // Same thing except for messages that have the message_set_wire_format + // option. + static void SerializeUnknownMessageSetItems( + const UnknownFieldSet& unknown_fields, + io::CodedOutputStream* output); + // Same as above, except writing directly to the provided buffer. + // Requires that the buffer have sufficient capacity for + // ComputeUnknownMessageSetItemsSize(unknown_fields). + // + // Returns a pointer past the last written byte. + static uint8* SerializeUnknownMessageSetItemsToArray( + const UnknownFieldSet& unknown_fields, + uint8* target); + + // Compute the size of the UnknownFieldSet on the wire. + static int ComputeUnknownFieldsSize(const UnknownFieldSet& unknown_fields); + + // Same thing except for messages that have the message_set_wire_format + // option. + static int ComputeUnknownMessageSetItemsSize( + const UnknownFieldSet& unknown_fields); + + + // Helper functions for encoding and decoding tags. (Inlined below and in + // _inl.h) + // + // This is different from MakeTag(field->number(), field->type()) in the case + // of packed repeated fields. + static uint32 MakeTag(const FieldDescriptor* field); + + // Parse a single field. The input should start out positioned immidately + // after the tag. + static bool ParseAndMergeField( + uint32 tag, + const FieldDescriptor* field, // May be NULL for unknown + Message* message, + io::CodedInputStream* input); + + // Serialize a single field. + static void SerializeFieldWithCachedSizes( + const FieldDescriptor* field, // Cannot be NULL + const Message& message, + io::CodedOutputStream* output); + + // Compute size of a single field. If the field is a message type, this + // will call ByteSize() for the embedded message, insuring that it caches + // its size. + static int FieldByteSize( + const FieldDescriptor* field, // Cannot be NULL + const Message& message); + + // Parse/serialize a MessageSet::Item group. Used with messages that use + // opion message_set_wire_format = true. + static bool ParseAndMergeMessageSetItem( + io::CodedInputStream* input, + Message* message); + static void SerializeMessageSetItemWithCachedSizes( + const FieldDescriptor* field, + const Message& message, + io::CodedOutputStream* output); + static int MessageSetItemByteSize( + const FieldDescriptor* field, + const Message& message); + + // Computes the byte size of a field, excluding tags. For packed fields, it + // only includes the size of the raw data, and not the size of the total + // length, but for other length-delimited types, the size of the length is + // included. + static int FieldDataOnlyByteSize( + const FieldDescriptor* field, // Cannot be NULL + const Message& message); + + enum Operation { + PARSE, + SERIALIZE, + }; + + // Verifies that a string field is valid UTF8, logging an error if not. + static void VerifyUTF8String(const char* data, int size, Operation op); + + private: + // Verifies that a string field is valid UTF8, logging an error if not. + static void VerifyUTF8StringFallback( + const char* data, + int size, + Operation op); + + + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(WireFormat); +}; + +// Subclass of FieldSkipper which saves skipped fields to an UnknownFieldSet. +class LIBPROTOBUF_EXPORT UnknownFieldSetFieldSkipper : public FieldSkipper { + public: + UnknownFieldSetFieldSkipper(UnknownFieldSet* unknown_fields) + : unknown_fields_(unknown_fields) {} + virtual ~UnknownFieldSetFieldSkipper() {} + + // implements FieldSkipper ----------------------------------------- + virtual bool SkipField(io::CodedInputStream* input, uint32 tag); + virtual bool SkipMessage(io::CodedInputStream* input); + virtual void SkipUnknownEnum(int field_number, int value); + + private: + UnknownFieldSet* unknown_fields_; +}; + +// inline methods ==================================================== + +inline WireFormatLite::WireType WireFormat::WireTypeForField( + const FieldDescriptor* field) { + if (field->options().packed()) { + return WireFormatLite::WIRETYPE_LENGTH_DELIMITED; + } else { + return WireTypeForFieldType(field->type()); + } +} + +inline WireFormatLite::WireType WireFormat::WireTypeForFieldType( + FieldDescriptor::Type type) { + // Some compilers don't like enum -> enum casts, so we implicit_cast to + // int first. + return WireFormatLite::WireTypeForFieldType( + static_cast( + implicit_cast(type))); +} + +inline uint32 WireFormat::MakeTag(const FieldDescriptor* field) { + return WireFormatLite::MakeTag(field->number(), WireTypeForField(field)); +} + +inline int WireFormat::TagSize(int field_number, FieldDescriptor::Type type) { + // Some compilers don't like enum -> enum casts, so we implicit_cast to + // int first. + return WireFormatLite::TagSize(field_number, + static_cast( + implicit_cast(type))); +} + +inline void WireFormat::VerifyUTF8String(const char* data, int size, + WireFormat::Operation op) { +#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED + WireFormat::VerifyUTF8StringFallback(data, size, op); +#endif +} + + +} // namespace internal +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_WIRE_FORMAT_H__ diff --git a/depends/protobuf/google/protobuf/wire_format_lite.cc b/depends/protobuf/google/protobuf/wire_format_lite.cc new file mode 100644 index 000000000..d347d1169 --- /dev/null +++ b/depends/protobuf/google/protobuf/wire_format_lite.cc @@ -0,0 +1,359 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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 + +namespace google { +namespace protobuf { +namespace internal { + +#ifndef _MSC_VER // MSVC doesn't like definitions of inline constants, GCC + // requires them. +const int WireFormatLite::kMessageSetItemStartTag; +const int WireFormatLite::kMessageSetItemEndTag; +const int WireFormatLite::kMessageSetTypeIdTag; +const int WireFormatLite::kMessageSetMessageTag; + +#endif + +const int WireFormatLite::kMessageSetItemTagsSize = + io::CodedOutputStream::VarintSize32(kMessageSetItemStartTag) + + io::CodedOutputStream::VarintSize32(kMessageSetItemEndTag) + + io::CodedOutputStream::VarintSize32(kMessageSetTypeIdTag) + + io::CodedOutputStream::VarintSize32(kMessageSetMessageTag); + +const WireFormatLite::CppType +WireFormatLite::kFieldTypeToCppTypeMap[MAX_FIELD_TYPE + 1] = { + static_cast(0), // 0 is reserved for errors + + CPPTYPE_DOUBLE, // TYPE_DOUBLE + CPPTYPE_FLOAT, // TYPE_FLOAT + CPPTYPE_INT64, // TYPE_INT64 + CPPTYPE_UINT64, // TYPE_UINT64 + CPPTYPE_INT32, // TYPE_INT32 + CPPTYPE_UINT64, // TYPE_FIXED64 + CPPTYPE_UINT32, // TYPE_FIXED32 + CPPTYPE_BOOL, // TYPE_BOOL + CPPTYPE_STRING, // TYPE_STRING + CPPTYPE_MESSAGE, // TYPE_GROUP + CPPTYPE_MESSAGE, // TYPE_MESSAGE + CPPTYPE_STRING, // TYPE_BYTES + CPPTYPE_UINT32, // TYPE_UINT32 + CPPTYPE_ENUM, // TYPE_ENUM + CPPTYPE_INT32, // TYPE_SFIXED32 + CPPTYPE_INT64, // TYPE_SFIXED64 + CPPTYPE_INT32, // TYPE_SINT32 + CPPTYPE_INT64, // TYPE_SINT64 +}; + +const WireFormatLite::WireType +WireFormatLite::kWireTypeForFieldType[MAX_FIELD_TYPE + 1] = { + static_cast(-1), // invalid + WireFormatLite::WIRETYPE_FIXED64, // TYPE_DOUBLE + WireFormatLite::WIRETYPE_FIXED32, // TYPE_FLOAT + WireFormatLite::WIRETYPE_VARINT, // TYPE_INT64 + WireFormatLite::WIRETYPE_VARINT, // TYPE_UINT64 + WireFormatLite::WIRETYPE_VARINT, // TYPE_INT32 + WireFormatLite::WIRETYPE_FIXED64, // TYPE_FIXED64 + WireFormatLite::WIRETYPE_FIXED32, // TYPE_FIXED32 + WireFormatLite::WIRETYPE_VARINT, // TYPE_BOOL + WireFormatLite::WIRETYPE_LENGTH_DELIMITED, // TYPE_STRING + WireFormatLite::WIRETYPE_START_GROUP, // TYPE_GROUP + WireFormatLite::WIRETYPE_LENGTH_DELIMITED, // TYPE_MESSAGE + WireFormatLite::WIRETYPE_LENGTH_DELIMITED, // TYPE_BYTES + WireFormatLite::WIRETYPE_VARINT, // TYPE_UINT32 + WireFormatLite::WIRETYPE_VARINT, // TYPE_ENUM + WireFormatLite::WIRETYPE_FIXED32, // TYPE_SFIXED32 + WireFormatLite::WIRETYPE_FIXED64, // TYPE_SFIXED64 + WireFormatLite::WIRETYPE_VARINT, // TYPE_SINT32 + WireFormatLite::WIRETYPE_VARINT, // TYPE_SINT64 +}; + +bool WireFormatLite::SkipField( + io::CodedInputStream* input, uint32 tag) { + switch (WireFormatLite::GetTagWireType(tag)) { + case WireFormatLite::WIRETYPE_VARINT: { + uint64 value; + if (!input->ReadVarint64(&value)) return false; + return true; + } + case WireFormatLite::WIRETYPE_FIXED64: { + uint64 value; + if (!input->ReadLittleEndian64(&value)) return false; + return true; + } + case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (!input->Skip(length)) return false; + return true; + } + case WireFormatLite::WIRETYPE_START_GROUP: { + if (!input->IncrementRecursionDepth()) return false; + if (!SkipMessage(input)) return false; + input->DecrementRecursionDepth(); + // Check that the ending tag matched the starting tag. + if (!input->LastTagWas(WireFormatLite::MakeTag( + WireFormatLite::GetTagFieldNumber(tag), + WireFormatLite::WIRETYPE_END_GROUP))) { + return false; + } + return true; + } + case WireFormatLite::WIRETYPE_END_GROUP: { + return false; + } + case WireFormatLite::WIRETYPE_FIXED32: { + uint32 value; + if (!input->ReadLittleEndian32(&value)) return false; + return true; + } + default: { + return false; + } + } +} + +bool WireFormatLite::SkipMessage(io::CodedInputStream* input) { + while(true) { + uint32 tag = input->ReadTag(); + if (tag == 0) { + // End of input. This is a valid place to end, so return true. + return true; + } + + WireFormatLite::WireType wire_type = WireFormatLite::GetTagWireType(tag); + + if (wire_type == WireFormatLite::WIRETYPE_END_GROUP) { + // Must be the end of the message. + return true; + } + + if (!SkipField(input, tag)) return false; + } +} + +bool FieldSkipper::SkipField( + io::CodedInputStream* input, uint32 tag) { + return WireFormatLite::SkipField(input, tag); +} + +bool FieldSkipper::SkipMessage(io::CodedInputStream* input) { + return WireFormatLite::SkipMessage(input); +} + +void FieldSkipper::SkipUnknownEnum( + int field_number, int value) { + // Nothing. +} + +bool WireFormatLite::ReadPackedEnumNoInline(io::CodedInputStream* input, + bool (*is_valid)(int), + RepeatedField* values) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + io::CodedInputStream::Limit limit = input->PushLimit(length); + while (input->BytesUntilLimit() > 0) { + int value; + if (!google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, WireFormatLite::TYPE_ENUM>(input, &value)) { + return false; + } + if (is_valid(value)) { + values->Add(value); + } + } + input->PopLimit(limit); + return true; +} + +void WireFormatLite::WriteInt32(int field_number, int32 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteInt32NoTag(value, output); +} +void WireFormatLite::WriteInt64(int field_number, int64 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteInt64NoTag(value, output); +} +void WireFormatLite::WriteUInt32(int field_number, uint32 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteUInt32NoTag(value, output); +} +void WireFormatLite::WriteUInt64(int field_number, uint64 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteUInt64NoTag(value, output); +} +void WireFormatLite::WriteSInt32(int field_number, int32 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteSInt32NoTag(value, output); +} +void WireFormatLite::WriteSInt64(int field_number, int64 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteSInt64NoTag(value, output); +} +void WireFormatLite::WriteFixed32(int field_number, uint32 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_FIXED32, output); + WriteFixed32NoTag(value, output); +} +void WireFormatLite::WriteFixed64(int field_number, uint64 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_FIXED64, output); + WriteFixed64NoTag(value, output); +} +void WireFormatLite::WriteSFixed32(int field_number, int32 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_FIXED32, output); + WriteSFixed32NoTag(value, output); +} +void WireFormatLite::WriteSFixed64(int field_number, int64 value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_FIXED64, output); + WriteSFixed64NoTag(value, output); +} +void WireFormatLite::WriteFloat(int field_number, float value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_FIXED32, output); + WriteFloatNoTag(value, output); +} +void WireFormatLite::WriteDouble(int field_number, double value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_FIXED64, output); + WriteDoubleNoTag(value, output); +} +void WireFormatLite::WriteBool(int field_number, bool value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteBoolNoTag(value, output); +} +void WireFormatLite::WriteEnum(int field_number, int value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_VARINT, output); + WriteEnumNoTag(value, output); +} + +void WireFormatLite::WriteString(int field_number, const string& value, + io::CodedOutputStream* output) { + // String is for UTF-8 text only + WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(value.size()); + output->WriteString(value); +} +void WireFormatLite::WriteBytes(int field_number, const string& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(value.size()); + output->WriteString(value); +} + + +void WireFormatLite::WriteGroup(int field_number, + const MessageLite& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_START_GROUP, output); + value.SerializeWithCachedSizes(output); + WriteTag(field_number, WIRETYPE_END_GROUP, output); +} + +void WireFormatLite::WriteMessage(int field_number, + const MessageLite& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); + const int size = value.GetCachedSize(); + output->WriteVarint32(size); + value.SerializeWithCachedSizes(output); +} + +void WireFormatLite::WriteGroupMaybeToArray(int field_number, + const MessageLite& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_START_GROUP, output); + const int size = value.GetCachedSize(); + uint8* target = output->GetDirectBufferForNBytesAndAdvance(size); + if (target != NULL) { + uint8* end = value.SerializeWithCachedSizesToArray(target); + GOOGLE_DCHECK_EQ(end - target, size); + } else { + value.SerializeWithCachedSizes(output); + } + WriteTag(field_number, WIRETYPE_END_GROUP, output); +} + +void WireFormatLite::WriteMessageMaybeToArray(int field_number, + const MessageLite& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); + const int size = value.GetCachedSize(); + output->WriteVarint32(size); + uint8* target = output->GetDirectBufferForNBytesAndAdvance(size); + if (target != NULL) { + uint8* end = value.SerializeWithCachedSizesToArray(target); + GOOGLE_DCHECK_EQ(end - target, size); + } else { + value.SerializeWithCachedSizes(output); + } +} + +bool WireFormatLite::ReadString(io::CodedInputStream* input, + string* value) { + // String is for UTF-8 text only + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (!input->InternalReadStringInline(value, length)) return false; + return true; +} +bool WireFormatLite::ReadBytes(io::CodedInputStream* input, + string* value) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + return input->InternalReadStringInline(value, length); +} + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/depends/protobuf/google/protobuf/wire_format_lite.h b/depends/protobuf/google/protobuf/wire_format_lite.h new file mode 100644 index 000000000..e3d5b2d8d --- /dev/null +++ b/depends/protobuf/google/protobuf/wire_format_lite.h @@ -0,0 +1,620 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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) +// atenasio@google.com (Chris Atenasio) (ZigZag transform) +// wink@google.com (Wink Saville) (refactored from wire_format.h) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// This header is logically internal, but is made public because it is used +// from protocol-compiler-generated code, which may reside in other components. + +#ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__ +#define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__ + +#include +#include + +namespace google { + +namespace protobuf { + template class RepeatedField; // repeated_field.h + namespace io { + class CodedInputStream; // coded_stream.h + class CodedOutputStream; // coded_stream.h + } +} + +namespace protobuf { +namespace internal { + +class StringPieceField; + +// This class is for internal use by the protocol buffer library and by +// protocol-complier-generated message classes. It must not be called +// directly by clients. +// +// This class contains helpers for implementing the binary protocol buffer +// wire format without the need for reflection. Use WireFormat when using +// reflection. +// +// This class is really a namespace that contains only static methods. +class LIBPROTOBUF_EXPORT WireFormatLite { + public: + + // ----------------------------------------------------------------- + // Helper constants and functions related to the format. These are + // mostly meant for internal and generated code to use. + + // The wire format is composed of a sequence of tag/value pairs, each + // of which contains the value of one field (or one element of a repeated + // field). Each tag is encoded as a varint. The lower bits of the tag + // identify its wire type, which specifies the format of the data to follow. + // The rest of the bits contain the field number. Each type of field (as + // declared by FieldDescriptor::Type, in descriptor.h) maps to one of + // these wire types. Immediately following each tag is the field's value, + // encoded in the format specified by the wire type. Because the tag + // identifies the encoding of this data, it is possible to skip + // unrecognized fields for forwards compatibility. + + enum WireType { + WIRETYPE_VARINT = 0, + WIRETYPE_FIXED64 = 1, + WIRETYPE_LENGTH_DELIMITED = 2, + WIRETYPE_START_GROUP = 3, + WIRETYPE_END_GROUP = 4, + WIRETYPE_FIXED32 = 5, + }; + + // Lite alternative to FieldDescriptor::Type. Must be kept in sync. + enum FieldType { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18, + MAX_FIELD_TYPE = 18, + }; + + // Lite alternative to FieldDescriptor::CppType. Must be kept in sync. + enum CppType { + CPPTYPE_INT32 = 1, + CPPTYPE_INT64 = 2, + CPPTYPE_UINT32 = 3, + CPPTYPE_UINT64 = 4, + CPPTYPE_DOUBLE = 5, + CPPTYPE_FLOAT = 6, + CPPTYPE_BOOL = 7, + CPPTYPE_ENUM = 8, + CPPTYPE_STRING = 9, + CPPTYPE_MESSAGE = 10, + MAX_CPPTYPE = 10, + }; + + // Helper method to get the CppType for a particular Type. + static CppType FieldTypeToCppType(FieldType type); + + // Given a FieldSescriptor::Type return its WireType + static inline WireFormatLite::WireType WireTypeForFieldType( + WireFormatLite::FieldType type) { + return kWireTypeForFieldType[type]; + } + + // Number of bits in a tag which identify the wire type. + static const int kTagTypeBits = 3; + // Mask for those bits. + static const uint32 kTagTypeMask = (1 << kTagTypeBits) - 1; + + // Helper functions for encoding and decoding tags. (Inlined below and in + // _inl.h) + // + // This is different from MakeTag(field->number(), field->type()) in the case + // of packed repeated fields. + static uint32 MakeTag(int field_number, WireType type); + static WireType GetTagWireType(uint32 tag); + static int GetTagFieldNumber(uint32 tag); + + // Compute the byte size of a tag. For groups, this includes both the start + // and end tags. + static inline int TagSize(int field_number, WireFormatLite::FieldType type); + + // Skips a field value with the given tag. The input should start + // positioned immediately after the tag. Skipped values are simply discarded, + // not recorded anywhere. See WireFormat::SkipField() for a version that + // records to an UnknownFieldSet. + static bool SkipField(io::CodedInputStream* input, uint32 tag); + + // Reads and ignores a message from the input. Skipped values are simply + // discarded, not recorded anywhere. See WireFormat::SkipMessage() for a + // version that records to an UnknownFieldSet. + static bool SkipMessage(io::CodedInputStream* input); + +// This macro does the same thing as WireFormatLite::MakeTag(), but the +// result is usable as a compile-time constant, which makes it usable +// as a switch case or a template input. WireFormatLite::MakeTag() is more +// type-safe, though, so prefer it if possible. +#define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \ + static_cast( \ + ((FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ + | (TYPE)) + + // These are the tags for the old MessageSet format, which was defined as: + // message MessageSet { + // repeated group Item = 1 { + // required int32 type_id = 2; + // required string message = 3; + // } + // } + static const int kMessageSetItemNumber = 1; + static const int kMessageSetTypeIdNumber = 2; + static const int kMessageSetMessageNumber = 3; + static const int kMessageSetItemStartTag = + GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kMessageSetItemNumber, + WireFormatLite::WIRETYPE_START_GROUP); + static const int kMessageSetItemEndTag = + GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kMessageSetItemNumber, + WireFormatLite::WIRETYPE_END_GROUP); + static const int kMessageSetTypeIdTag = + GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kMessageSetTypeIdNumber, + WireFormatLite::WIRETYPE_VARINT); + static const int kMessageSetMessageTag = + GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kMessageSetMessageNumber, + WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + + // Byte size of all tags of a MessageSet::Item combined. + static const int kMessageSetItemTagsSize; + + // Helper functions for converting between floats/doubles and IEEE-754 + // uint32s/uint64s so that they can be written. (Assumes your platform + // uses IEEE-754 floats.) + static uint32 EncodeFloat(float value); + static float DecodeFloat(uint32 value); + static uint64 EncodeDouble(double value); + static double DecodeDouble(uint64 value); + + // Helper functions for mapping signed integers to unsigned integers in + // such a way that numbers with small magnitudes will encode to smaller + // varints. If you simply static_cast a negative number to an unsigned + // number and varint-encode it, it will always take 10 bytes, defeating + // the purpose of varint. So, for the "sint32" and "sint64" field types, + // we ZigZag-encode the values. + static uint32 ZigZagEncode32(int32 n); + static int32 ZigZagDecode32(uint32 n); + static uint64 ZigZagEncode64(int64 n); + static int64 ZigZagDecode64(uint64 n); + + // ================================================================= + // Methods for reading/writing individual field. The implementations + // of these methods are defined in wire_format_lite_inl.h; you must #include + // that file to use these. + +// Avoid ugly line wrapping +#define input io::CodedInputStream* input +#define output io::CodedOutputStream* output +#define field_number int field_number +#define INL GOOGLE_ATTRIBUTE_ALWAYS_INLINE + + // Read fields, not including tags. The assumption is that you already + // read the tag to determine what field to read. + + // For primitive fields, we just use a templatized routine parameterized by + // the represented type and the FieldType. These are specialized with the + // appropriate definition for each declared type. + template + static inline bool ReadPrimitive(input, CType* value) INL; + + // Reads repeated primitive values, with optimizations for repeats. + // tag_size and tag should both be compile-time constants provided by the + // protocol compiler. + template + static inline bool ReadRepeatedPrimitive(int tag_size, + uint32 tag, + input, + RepeatedField* value) INL; + + // Identical to ReadRepeatedPrimitive, except will not inline the + // implementation. + template + static bool ReadRepeatedPrimitiveNoInline(int tag_size, + uint32 tag, + input, + RepeatedField* value); + + // Reads a primitive value directly from the provided buffer. It returns a + // pointer past the segment of data that was read. + // + // This is only implemented for the types with fixed wire size, e.g. + // float, double, and the (s)fixed* types. + template + static inline const uint8* ReadPrimitiveFromArray(const uint8* buffer, + CType* value) INL; + + // Reads a primitive packed field. + // + // This is only implemented for packable types. + template + static inline bool ReadPackedPrimitive(input, + RepeatedField* value) INL; + + // Identical to ReadPackedPrimitive, except will not inline the + // implementation. + template + static bool ReadPackedPrimitiveNoInline(input, RepeatedField* value); + + // Read a packed enum field. Values for which is_valid() returns false are + // dropped. + static bool ReadPackedEnumNoInline(input, + bool (*is_valid)(int), + RepeatedField* value); + + static bool ReadString(input, string* value); + static bool ReadBytes (input, string* value); + + static inline bool ReadGroup (field_number, input, MessageLite* value); + static inline bool ReadMessage(input, MessageLite* value); + + // Like above, but de-virtualize the call to MergePartialFromCodedStream(). + // The pointer must point at an instance of MessageType, *not* a subclass (or + // the subclass must not override MergePartialFromCodedStream()). + template + static inline bool ReadGroupNoVirtual(field_number, input, + MessageType* value); + template + static inline bool ReadMessageNoVirtual(input, MessageType* value); + + // Write a tag. The Write*() functions typically include the tag, so + // normally there's no need to call this unless using the Write*NoTag() + // variants. + static inline void WriteTag(field_number, WireType type, output) INL; + + // Write fields, without tags. + static inline void WriteInt32NoTag (int32 value, output) INL; + static inline void WriteInt64NoTag (int64 value, output) INL; + static inline void WriteUInt32NoTag (uint32 value, output) INL; + static inline void WriteUInt64NoTag (uint64 value, output) INL; + static inline void WriteSInt32NoTag (int32 value, output) INL; + static inline void WriteSInt64NoTag (int64 value, output) INL; + static inline void WriteFixed32NoTag (uint32 value, output) INL; + static inline void WriteFixed64NoTag (uint64 value, output) INL; + static inline void WriteSFixed32NoTag(int32 value, output) INL; + static inline void WriteSFixed64NoTag(int64 value, output) INL; + static inline void WriteFloatNoTag (float value, output) INL; + static inline void WriteDoubleNoTag (double value, output) INL; + static inline void WriteBoolNoTag (bool value, output) INL; + static inline void WriteEnumNoTag (int value, output) INL; + + // Write fields, including tags. + static void WriteInt32 (field_number, int32 value, output); + static void WriteInt64 (field_number, int64 value, output); + static void WriteUInt32 (field_number, uint32 value, output); + static void WriteUInt64 (field_number, uint64 value, output); + static void WriteSInt32 (field_number, int32 value, output); + static void WriteSInt64 (field_number, int64 value, output); + static void WriteFixed32 (field_number, uint32 value, output); + static void WriteFixed64 (field_number, uint64 value, output); + static void WriteSFixed32(field_number, int32 value, output); + static void WriteSFixed64(field_number, int64 value, output); + static void WriteFloat (field_number, float value, output); + static void WriteDouble (field_number, double value, output); + static void WriteBool (field_number, bool value, output); + static void WriteEnum (field_number, int value, output); + + static void WriteString(field_number, const string& value, output); + static void WriteBytes (field_number, const string& value, output); + + static void WriteGroup( + field_number, const MessageLite& value, output); + static void WriteMessage( + field_number, const MessageLite& value, output); + // Like above, but these will check if the output stream has enough + // space to write directly to a flat array. + static void WriteGroupMaybeToArray( + field_number, const MessageLite& value, output); + static void WriteMessageMaybeToArray( + field_number, const MessageLite& value, output); + + // Like above, but de-virtualize the call to SerializeWithCachedSizes(). The + // pointer must point at an instance of MessageType, *not* a subclass (or + // the subclass must not override SerializeWithCachedSizes()). + template + static inline void WriteGroupNoVirtual( + field_number, const MessageType& value, output); + template + static inline void WriteMessageNoVirtual( + field_number, const MessageType& value, output); + +#undef output +#define output uint8* target + + // Like above, but use only *ToArray methods of CodedOutputStream. + static inline uint8* WriteTagToArray(field_number, WireType type, output) INL; + + // Write fields, without tags. + static inline uint8* WriteInt32NoTagToArray (int32 value, output) INL; + static inline uint8* WriteInt64NoTagToArray (int64 value, output) INL; + static inline uint8* WriteUInt32NoTagToArray (uint32 value, output) INL; + static inline uint8* WriteUInt64NoTagToArray (uint64 value, output) INL; + static inline uint8* WriteSInt32NoTagToArray (int32 value, output) INL; + static inline uint8* WriteSInt64NoTagToArray (int64 value, output) INL; + static inline uint8* WriteFixed32NoTagToArray (uint32 value, output) INL; + static inline uint8* WriteFixed64NoTagToArray (uint64 value, output) INL; + static inline uint8* WriteSFixed32NoTagToArray(int32 value, output) INL; + static inline uint8* WriteSFixed64NoTagToArray(int64 value, output) INL; + static inline uint8* WriteFloatNoTagToArray (float value, output) INL; + static inline uint8* WriteDoubleNoTagToArray (double value, output) INL; + static inline uint8* WriteBoolNoTagToArray (bool value, output) INL; + static inline uint8* WriteEnumNoTagToArray (int value, output) INL; + + // Write fields, including tags. + static inline uint8* WriteInt32ToArray( + field_number, int32 value, output) INL; + static inline uint8* WriteInt64ToArray( + field_number, int64 value, output) INL; + static inline uint8* WriteUInt32ToArray( + field_number, uint32 value, output) INL; + static inline uint8* WriteUInt64ToArray( + field_number, uint64 value, output) INL; + static inline uint8* WriteSInt32ToArray( + field_number, int32 value, output) INL; + static inline uint8* WriteSInt64ToArray( + field_number, int64 value, output) INL; + static inline uint8* WriteFixed32ToArray( + field_number, uint32 value, output) INL; + static inline uint8* WriteFixed64ToArray( + field_number, uint64 value, output) INL; + static inline uint8* WriteSFixed32ToArray( + field_number, int32 value, output) INL; + static inline uint8* WriteSFixed64ToArray( + field_number, int64 value, output) INL; + static inline uint8* WriteFloatToArray( + field_number, float value, output) INL; + static inline uint8* WriteDoubleToArray( + field_number, double value, output) INL; + static inline uint8* WriteBoolToArray( + field_number, bool value, output) INL; + static inline uint8* WriteEnumToArray( + field_number, int value, output) INL; + + static inline uint8* WriteStringToArray( + field_number, const string& value, output) INL; + static inline uint8* WriteBytesToArray( + field_number, const string& value, output) INL; + + static inline uint8* WriteGroupToArray( + field_number, const MessageLite& value, output) INL; + static inline uint8* WriteMessageToArray( + field_number, const MessageLite& value, output) INL; + + // Like above, but de-virtualize the call to SerializeWithCachedSizes(). The + // pointer must point at an instance of MessageType, *not* a subclass (or + // the subclass must not override SerializeWithCachedSizes()). + template + static inline uint8* WriteGroupNoVirtualToArray( + field_number, const MessageType& value, output) INL; + template + static inline uint8* WriteMessageNoVirtualToArray( + field_number, const MessageType& value, output) INL; + +#undef output +#undef input +#undef INL + +#undef field_number + + // Compute the byte size of a field. The XxSize() functions do NOT include + // the tag, so you must also call TagSize(). (This is because, for repeated + // fields, you should only call TagSize() once and multiply it by the element + // count, but you may have to call XxSize() for each individual element.) + static inline int Int32Size ( int32 value); + static inline int Int64Size ( int64 value); + static inline int UInt32Size (uint32 value); + static inline int UInt64Size (uint64 value); + static inline int SInt32Size ( int32 value); + static inline int SInt64Size ( int64 value); + static inline int EnumSize ( int value); + + // These types always have the same size. + static const int kFixed32Size = 4; + static const int kFixed64Size = 8; + static const int kSFixed32Size = 4; + static const int kSFixed64Size = 8; + static const int kFloatSize = 4; + static const int kDoubleSize = 8; + static const int kBoolSize = 1; + + static inline int StringSize(const string& value); + static inline int BytesSize (const string& value); + + static inline int GroupSize (const MessageLite& value); + static inline int MessageSize(const MessageLite& value); + + // Like above, but de-virtualize the call to ByteSize(). The + // pointer must point at an instance of MessageType, *not* a subclass (or + // the subclass must not override ByteSize()). + template + static inline int GroupSizeNoVirtual (const MessageType& value); + template + static inline int MessageSizeNoVirtual(const MessageType& value); + + private: + // A helper method for the repeated primitive reader. This method has + // optimizations for primitive types that have fixed size on the wire, and + // can be read using potentially faster paths. + template + static inline bool ReadRepeatedFixedSizePrimitive( + int tag_size, + uint32 tag, + google::protobuf::io::CodedInputStream* input, + RepeatedField* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; + + static const CppType kFieldTypeToCppTypeMap[]; + static const WireFormatLite::WireType kWireTypeForFieldType[]; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(WireFormatLite); +}; + +// A class which deals with unknown values. The default implementation just +// discards them. WireFormat defines a subclass which writes to an +// UnknownFieldSet. This class is used by ExtensionSet::ParseField(), since +// ExtensionSet is part of the lite library but UnknownFieldSet is not. +class LIBPROTOBUF_EXPORT FieldSkipper { + public: + FieldSkipper() {} + virtual ~FieldSkipper() {} + + // Skip a field whose tag has already been consumed. + virtual bool SkipField(io::CodedInputStream* input, uint32 tag); + + // Skip an entire message or group, up to an end-group tag (which is consumed) + // or end-of-stream. + virtual bool SkipMessage(io::CodedInputStream* input); + + // Deal with an already-parsed unrecognized enum value. The default + // implementation does nothing, but the UnknownFieldSet-based implementation + // saves it as an unknown varint. + virtual void SkipUnknownEnum(int field_number, int value); +}; + +// inline methods ==================================================== + +inline WireFormatLite::CppType +WireFormatLite::FieldTypeToCppType(FieldType type) { + return kFieldTypeToCppTypeMap[type]; +} + +inline uint32 WireFormatLite::MakeTag(int field_number, WireType type) { + return GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(field_number, type); +} + +inline WireFormatLite::WireType WireFormatLite::GetTagWireType(uint32 tag) { + return static_cast(tag & kTagTypeMask); +} + +inline int WireFormatLite::GetTagFieldNumber(uint32 tag) { + return static_cast(tag >> kTagTypeBits); +} + +inline int WireFormatLite::TagSize(int field_number, + WireFormatLite::FieldType type) { + int result = io::CodedOutputStream::VarintSize32( + field_number << kTagTypeBits); + if (type == TYPE_GROUP) { + // Groups have both a start and an end tag. + return result * 2; + } else { + return result; + } +} + +inline uint32 WireFormatLite::EncodeFloat(float value) { + union {float f; uint32 i;}; + f = value; + return i; +} + +inline float WireFormatLite::DecodeFloat(uint32 value) { + union {float f; uint32 i;}; + i = value; + return f; +} + +inline uint64 WireFormatLite::EncodeDouble(double value) { + union {double f; uint64 i;}; + f = value; + return i; +} + +inline double WireFormatLite::DecodeDouble(uint64 value) { + union {double f; uint64 i;}; + i = value; + return f; +} + +// ZigZag Transform: Encodes signed integers so that they can be +// effectively used with varint encoding. +// +// varint operates on unsigned integers, encoding smaller numbers into +// fewer bytes. If you try to use it on a signed integer, it will treat +// this number as a very large unsigned integer, which means that even +// small signed numbers like -1 will take the maximum number of bytes +// (10) to encode. ZigZagEncode() maps signed integers to unsigned +// in such a way that those with a small absolute value will have smaller +// encoded values, making them appropriate for encoding using varint. +// +// int32 -> uint32 +// ------------------------- +// 0 -> 0 +// -1 -> 1 +// 1 -> 2 +// -2 -> 3 +// ... -> ... +// 2147483647 -> 4294967294 +// -2147483648 -> 4294967295 +// +// >> encode >> +// << decode << + +inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { + // Note: the right-shift must be arithmetic + return (n << 1) ^ (n >> 31); +} + +inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { + return (n >> 1) ^ -static_cast(n & 1); +} + +inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { + // Note: the right-shift must be arithmetic + return (n << 1) ^ (n >> 63); +} + +inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { + return (n >> 1) ^ -static_cast(n & 1); +} + +} // namespace internal +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__ diff --git a/depends/protobuf/google/protobuf/wire_format_lite_inl.h b/depends/protobuf/google/protobuf/wire_format_lite_inl.h new file mode 100644 index 000000000..103b0bd0c --- /dev/null +++ b/depends/protobuf/google/protobuf/wire_format_lite_inl.h @@ -0,0 +1,774 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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) +// wink@google.com (Wink Saville) (refactored from wire_format.h) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ +#define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ + +#include +#include +#include +#include +#include +#include +#include + + +namespace google { +namespace protobuf { +namespace internal { + +// Implementation details of ReadPrimitive. + +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int32* value) { + uint32 temp; + if (!input->ReadVarint32(&temp)) return false; + *value = static_cast(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int64* value) { + uint64 temp; + if (!input->ReadVarint64(&temp)) return false; + *value = static_cast(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + uint32* value) { + return input->ReadVarint32(value); +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + uint64* value) { + return input->ReadVarint64(value); +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int32* value) { + uint32 temp; + if (!input->ReadVarint32(&temp)) return false; + *value = ZigZagDecode32(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int64* value) { + uint64 temp; + if (!input->ReadVarint64(&temp)) return false; + *value = ZigZagDecode64(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + uint32* value) { + return input->ReadLittleEndian32(value); +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + uint64* value) { + return input->ReadLittleEndian64(value); +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int32* value) { + uint32 temp; + if (!input->ReadLittleEndian32(&temp)) return false; + *value = static_cast(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int64* value) { + uint64 temp; + if (!input->ReadLittleEndian64(&temp)) return false; + *value = static_cast(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + float* value) { + uint32 temp; + if (!input->ReadLittleEndian32(&temp)) return false; + *value = DecodeFloat(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + double* value) { + uint64 temp; + if (!input->ReadLittleEndian64(&temp)) return false; + *value = DecodeDouble(temp); + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + bool* value) { + uint32 temp; + if (!input->ReadVarint32(&temp)) return false; + *value = temp != 0; + return true; +} +template <> +inline bool WireFormatLite::ReadPrimitive( + io::CodedInputStream* input, + int* value) { + uint32 temp; + if (!input->ReadVarint32(&temp)) return false; + *value = static_cast(temp); + return true; +} + +template <> +inline const uint8* WireFormatLite::ReadPrimitiveFromArray< + uint32, WireFormatLite::TYPE_FIXED32>( + const uint8* buffer, + uint32* value) { + return io::CodedInputStream::ReadLittleEndian32FromArray(buffer, value); +} +template <> +inline const uint8* WireFormatLite::ReadPrimitiveFromArray< + uint64, WireFormatLite::TYPE_FIXED64>( + const uint8* buffer, + uint64* value) { + return io::CodedInputStream::ReadLittleEndian64FromArray(buffer, value); +} +template <> +inline const uint8* WireFormatLite::ReadPrimitiveFromArray< + int32, WireFormatLite::TYPE_SFIXED32>( + const uint8* buffer, + int32* value) { + uint32 temp; + buffer = io::CodedInputStream::ReadLittleEndian32FromArray(buffer, &temp); + *value = static_cast(temp); + return buffer; +} +template <> +inline const uint8* WireFormatLite::ReadPrimitiveFromArray< + int64, WireFormatLite::TYPE_SFIXED64>( + const uint8* buffer, + int64* value) { + uint64 temp; + buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); + *value = static_cast(temp); + return buffer; +} +template <> +inline const uint8* WireFormatLite::ReadPrimitiveFromArray< + float, WireFormatLite::TYPE_FLOAT>( + const uint8* buffer, + float* value) { + uint32 temp; + buffer = io::CodedInputStream::ReadLittleEndian32FromArray(buffer, &temp); + *value = DecodeFloat(temp); + return buffer; +} +template <> +inline const uint8* WireFormatLite::ReadPrimitiveFromArray< + double, WireFormatLite::TYPE_DOUBLE>( + const uint8* buffer, + double* value) { + uint64 temp; + buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); + *value = DecodeDouble(temp); + return buffer; +} + +template +inline bool WireFormatLite::ReadRepeatedPrimitive(int, // tag_size, unused. + uint32 tag, + io::CodedInputStream* input, + RepeatedField* values) { + CType value; + if (!ReadPrimitive(input, &value)) return false; + values->Add(value); + int elements_already_reserved = values->Capacity() - values->size(); + while (elements_already_reserved > 0 && input->ExpectTag(tag)) { + if (!ReadPrimitive(input, &value)) return false; + values->AddAlreadyReserved(value); + elements_already_reserved--; + } + return true; +} + +template +inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( + int tag_size, + uint32 tag, + io::CodedInputStream* input, + RepeatedField* values) { + GOOGLE_DCHECK_EQ(UInt32Size(tag), tag_size); + CType value; + if (!ReadPrimitive(input, &value)) + return false; + values->Add(value); + + // For fixed size values, repeated values can be read more quickly by + // reading directly from a raw array. + // + // We can get a tight loop by only reading as many elements as can be + // added to the RepeatedField without having to do any resizing. Additionally, + // we only try to read as many elements as are available from the current + // buffer space. Doing so avoids having to perform boundary checks when + // reading the value: the maximum number of elements that can be read is + // known outside of the loop. + const void* void_pointer; + int size; + input->GetDirectBufferPointerInline(&void_pointer, &size); + if (size > 0) { + const uint8* buffer = reinterpret_cast(void_pointer); + // The number of bytes each type occupies on the wire. + const int per_value_size = tag_size + sizeof(value); + + int elements_available = min(values->Capacity() - values->size(), + size / per_value_size); + int num_read = 0; + while (num_read < elements_available && + (buffer = io::CodedInputStream::ExpectTagFromArray( + buffer, tag)) != NULL) { + buffer = ReadPrimitiveFromArray(buffer, &value); + values->AddAlreadyReserved(value); + ++num_read; + } + const int read_bytes = num_read * per_value_size; + if (read_bytes > 0) { + input->Skip(read_bytes); + } + } + return true; +} + +// Specializations of ReadRepeatedPrimitive for the fixed size types, which use +// the optimized code path. +#define READ_REPEATED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \ +template <> \ +inline bool WireFormatLite::ReadRepeatedPrimitive< \ + CPPTYPE, WireFormatLite::DECLARED_TYPE>( \ + int tag_size, \ + uint32 tag, \ + io::CodedInputStream* input, \ + RepeatedField* values) { \ + return ReadRepeatedFixedSizePrimitive< \ + CPPTYPE, WireFormatLite::DECLARED_TYPE>( \ + tag_size, tag, input, values); \ +} + +READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32); +READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64); +READ_REPEATED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32); +READ_REPEATED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64); +READ_REPEATED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT); +READ_REPEATED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE); + +#undef READ_REPEATED_FIXED_SIZE_PRIMITIVE + +template +bool WireFormatLite::ReadRepeatedPrimitiveNoInline( + int tag_size, + uint32 tag, + io::CodedInputStream* input, + RepeatedField* value) { + return ReadRepeatedPrimitive( + tag_size, tag, input, value); +} + +template +inline bool WireFormatLite::ReadPackedPrimitive(io::CodedInputStream* input, + RepeatedField* values) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + io::CodedInputStream::Limit limit = input->PushLimit(length); + while (input->BytesUntilLimit() > 0) { + CType value; + if (!ReadPrimitive(input, &value)) return false; + values->Add(value); + } + input->PopLimit(limit); + return true; +} + +template +bool WireFormatLite::ReadPackedPrimitiveNoInline(io::CodedInputStream* input, + RepeatedField* values) { + return ReadPackedPrimitive(input, values); +} + + +inline bool WireFormatLite::ReadGroup(int field_number, + io::CodedInputStream* input, + MessageLite* value) { + if (!input->IncrementRecursionDepth()) return false; + if (!value->MergePartialFromCodedStream(input)) return false; + input->DecrementRecursionDepth(); + // Make sure the last thing read was an end tag for this group. + if (!input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP))) { + return false; + } + return true; +} +inline bool WireFormatLite::ReadMessage(io::CodedInputStream* input, + MessageLite* value) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (!input->IncrementRecursionDepth()) return false; + io::CodedInputStream::Limit limit = input->PushLimit(length); + if (!value->MergePartialFromCodedStream(input)) return false; + // Make sure that parsing stopped when the limit was hit, not at an endgroup + // tag. + if (!input->ConsumedEntireMessage()) return false; + input->PopLimit(limit); + input->DecrementRecursionDepth(); + return true; +} + +// We name the template parameter something long and extremely unlikely to occur +// elsewhere because a *qualified* member access expression designed to avoid +// virtual dispatch, C++03 [basic.lookup.classref] 3.4.5/4 requires that the +// name of the qualifying class to be looked up both in the context of the full +// expression (finding the template parameter) and in the context of the object +// whose member we are accessing. This could potentially find a nested type +// within that object. The standard goes on to require these names to refer to +// the same entity, which this collision would violate. The lack of a safe way +// to avoid this collision appears to be a defect in the standard, but until it +// is corrected, we choose the name to avoid accidental collisions. +template +inline bool WireFormatLite::ReadGroupNoVirtual( + int field_number, io::CodedInputStream* input, + MessageType_WorkAroundCppLookupDefect* value) { + if (!input->IncrementRecursionDepth()) return false; + if (!value-> + MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input)) + return false; + input->DecrementRecursionDepth(); + // Make sure the last thing read was an end tag for this group. + if (!input->LastTagWas(MakeTag(field_number, WIRETYPE_END_GROUP))) { + return false; + } + return true; +} +template +inline bool WireFormatLite::ReadMessageNoVirtual( + io::CodedInputStream* input, MessageType_WorkAroundCppLookupDefect* value) { + uint32 length; + if (!input->ReadVarint32(&length)) return false; + if (!input->IncrementRecursionDepth()) return false; + io::CodedInputStream::Limit limit = input->PushLimit(length); + if (!value-> + MessageType_WorkAroundCppLookupDefect::MergePartialFromCodedStream(input)) + return false; + // Make sure that parsing stopped when the limit was hit, not at an endgroup + // tag. + if (!input->ConsumedEntireMessage()) return false; + input->PopLimit(limit); + input->DecrementRecursionDepth(); + return true; +} + +// =================================================================== + +inline void WireFormatLite::WriteTag(int field_number, WireType type, + io::CodedOutputStream* output) { + output->WriteTag(MakeTag(field_number, type)); +} + +inline void WireFormatLite::WriteInt32NoTag(int32 value, + io::CodedOutputStream* output) { + output->WriteVarint32SignExtended(value); +} +inline void WireFormatLite::WriteInt64NoTag(int64 value, + io::CodedOutputStream* output) { + output->WriteVarint64(static_cast(value)); +} +inline void WireFormatLite::WriteUInt32NoTag(uint32 value, + io::CodedOutputStream* output) { + output->WriteVarint32(value); +} +inline void WireFormatLite::WriteUInt64NoTag(uint64 value, + io::CodedOutputStream* output) { + output->WriteVarint64(value); +} +inline void WireFormatLite::WriteSInt32NoTag(int32 value, + io::CodedOutputStream* output) { + output->WriteVarint32(ZigZagEncode32(value)); +} +inline void WireFormatLite::WriteSInt64NoTag(int64 value, + io::CodedOutputStream* output) { + output->WriteVarint64(ZigZagEncode64(value)); +} +inline void WireFormatLite::WriteFixed32NoTag(uint32 value, + io::CodedOutputStream* output) { + output->WriteLittleEndian32(value); +} +inline void WireFormatLite::WriteFixed64NoTag(uint64 value, + io::CodedOutputStream* output) { + output->WriteLittleEndian64(value); +} +inline void WireFormatLite::WriteSFixed32NoTag(int32 value, + io::CodedOutputStream* output) { + output->WriteLittleEndian32(static_cast(value)); +} +inline void WireFormatLite::WriteSFixed64NoTag(int64 value, + io::CodedOutputStream* output) { + output->WriteLittleEndian64(static_cast(value)); +} +inline void WireFormatLite::WriteFloatNoTag(float value, + io::CodedOutputStream* output) { + output->WriteLittleEndian32(EncodeFloat(value)); +} +inline void WireFormatLite::WriteDoubleNoTag(double value, + io::CodedOutputStream* output) { + output->WriteLittleEndian64(EncodeDouble(value)); +} +inline void WireFormatLite::WriteBoolNoTag(bool value, + io::CodedOutputStream* output) { + output->WriteVarint32(value ? 1 : 0); +} +inline void WireFormatLite::WriteEnumNoTag(int value, + io::CodedOutputStream* output) { + output->WriteVarint32SignExtended(value); +} + +// See comment on ReadGroupNoVirtual to understand the need for this template +// parameter name. +template +inline void WireFormatLite::WriteGroupNoVirtual( + int field_number, const MessageType_WorkAroundCppLookupDefect& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_START_GROUP, output); + value.MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizes(output); + WriteTag(field_number, WIRETYPE_END_GROUP, output); +} +template +inline void WireFormatLite::WriteMessageNoVirtual( + int field_number, const MessageType_WorkAroundCppLookupDefect& value, + io::CodedOutputStream* output) { + WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32( + value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()); + value.MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizes(output); +} + +// =================================================================== + +inline uint8* WireFormatLite::WriteTagToArray(int field_number, + WireType type, + uint8* target) { + return io::CodedOutputStream::WriteTagToArray(MakeTag(field_number, type), + target); +} + +inline uint8* WireFormatLite::WriteInt32NoTagToArray(int32 value, + uint8* target) { + return io::CodedOutputStream::WriteVarint32SignExtendedToArray(value, target); +} +inline uint8* WireFormatLite::WriteInt64NoTagToArray(int64 value, + uint8* target) { + return io::CodedOutputStream::WriteVarint64ToArray( + static_cast(value), target); +} +inline uint8* WireFormatLite::WriteUInt32NoTagToArray(uint32 value, + uint8* target) { + return io::CodedOutputStream::WriteVarint32ToArray(value, target); +} +inline uint8* WireFormatLite::WriteUInt64NoTagToArray(uint64 value, + uint8* target) { + return io::CodedOutputStream::WriteVarint64ToArray(value, target); +} +inline uint8* WireFormatLite::WriteSInt32NoTagToArray(int32 value, + uint8* target) { + return io::CodedOutputStream::WriteVarint32ToArray(ZigZagEncode32(value), + target); +} +inline uint8* WireFormatLite::WriteSInt64NoTagToArray(int64 value, + uint8* target) { + return io::CodedOutputStream::WriteVarint64ToArray(ZigZagEncode64(value), + target); +} +inline uint8* WireFormatLite::WriteFixed32NoTagToArray(uint32 value, + uint8* target) { + return io::CodedOutputStream::WriteLittleEndian32ToArray(value, target); +} +inline uint8* WireFormatLite::WriteFixed64NoTagToArray(uint64 value, + uint8* target) { + return io::CodedOutputStream::WriteLittleEndian64ToArray(value, target); +} +inline uint8* WireFormatLite::WriteSFixed32NoTagToArray(int32 value, + uint8* target) { + return io::CodedOutputStream::WriteLittleEndian32ToArray( + static_cast(value), target); +} +inline uint8* WireFormatLite::WriteSFixed64NoTagToArray(int64 value, + uint8* target) { + return io::CodedOutputStream::WriteLittleEndian64ToArray( + static_cast(value), target); +} +inline uint8* WireFormatLite::WriteFloatNoTagToArray(float value, + uint8* target) { + return io::CodedOutputStream::WriteLittleEndian32ToArray(EncodeFloat(value), + target); +} +inline uint8* WireFormatLite::WriteDoubleNoTagToArray(double value, + uint8* target) { + return io::CodedOutputStream::WriteLittleEndian64ToArray(EncodeDouble(value), + target); +} +inline uint8* WireFormatLite::WriteBoolNoTagToArray(bool value, + uint8* target) { + return io::CodedOutputStream::WriteVarint32ToArray(value ? 1 : 0, target); +} +inline uint8* WireFormatLite::WriteEnumNoTagToArray(int value, + uint8* target) { + return io::CodedOutputStream::WriteVarint32SignExtendedToArray(value, target); +} + +inline uint8* WireFormatLite::WriteInt32ToArray(int field_number, + int32 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteInt32NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteInt64ToArray(int field_number, + int64 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteInt64NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteUInt32ToArray(int field_number, + uint32 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteUInt32NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteUInt64ToArray(int field_number, + uint64 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteUInt64NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteSInt32ToArray(int field_number, + int32 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteSInt32NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteSInt64ToArray(int field_number, + int64 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteSInt64NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteFixed32ToArray(int field_number, + uint32 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); + return WriteFixed32NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteFixed64ToArray(int field_number, + uint64 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); + return WriteFixed64NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteSFixed32ToArray(int field_number, + int32 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); + return WriteSFixed32NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteSFixed64ToArray(int field_number, + int64 value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); + return WriteSFixed64NoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteFloatToArray(int field_number, + float value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); + return WriteFloatNoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteDoubleToArray(int field_number, + double value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); + return WriteDoubleNoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteBoolToArray(int field_number, + bool value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteBoolNoTagToArray(value, target); +} +inline uint8* WireFormatLite::WriteEnumToArray(int field_number, + int value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); + return WriteEnumNoTagToArray(value, target); +} + +inline uint8* WireFormatLite::WriteStringToArray(int field_number, + const string& value, + uint8* target) { + // String is for UTF-8 text only + // WARNING: In wire_format.cc, both strings and bytes are handled by + // WriteString() to avoid code duplication. If the implementations become + // different, you will need to update that usage. + target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); + target = io::CodedOutputStream::WriteVarint32ToArray(value.size(), target); + return io::CodedOutputStream::WriteStringToArray(value, target); +} +inline uint8* WireFormatLite::WriteBytesToArray(int field_number, + const string& value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); + target = io::CodedOutputStream::WriteVarint32ToArray(value.size(), target); + return io::CodedOutputStream::WriteStringToArray(value, target); +} + + +inline uint8* WireFormatLite::WriteGroupToArray(int field_number, + const MessageLite& value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target); + target = value.SerializeWithCachedSizesToArray(target); + return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target); +} +inline uint8* WireFormatLite::WriteMessageToArray(int field_number, + const MessageLite& value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); + target = io::CodedOutputStream::WriteVarint32ToArray( + value.GetCachedSize(), target); + return value.SerializeWithCachedSizesToArray(target); +} + +// See comment on ReadGroupNoVirtual to understand the need for this template +// parameter name. +template +inline uint8* WireFormatLite::WriteGroupNoVirtualToArray( + int field_number, const MessageType_WorkAroundCppLookupDefect& value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target); + target = value.MessageType_WorkAroundCppLookupDefect + ::SerializeWithCachedSizesToArray(target); + return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target); +} +template +inline uint8* WireFormatLite::WriteMessageNoVirtualToArray( + int field_number, const MessageType_WorkAroundCppLookupDefect& value, + uint8* target) { + target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); + target = io::CodedOutputStream::WriteVarint32ToArray( + value.MessageType_WorkAroundCppLookupDefect::GetCachedSize(), target); + return value.MessageType_WorkAroundCppLookupDefect + ::SerializeWithCachedSizesToArray(target); +} + +// =================================================================== + +inline int WireFormatLite::Int32Size(int32 value) { + return io::CodedOutputStream::VarintSize32SignExtended(value); +} +inline int WireFormatLite::Int64Size(int64 value) { + return io::CodedOutputStream::VarintSize64(static_cast(value)); +} +inline int WireFormatLite::UInt32Size(uint32 value) { + return io::CodedOutputStream::VarintSize32(value); +} +inline int WireFormatLite::UInt64Size(uint64 value) { + return io::CodedOutputStream::VarintSize64(value); +} +inline int WireFormatLite::SInt32Size(int32 value) { + return io::CodedOutputStream::VarintSize32(ZigZagEncode32(value)); +} +inline int WireFormatLite::SInt64Size(int64 value) { + return io::CodedOutputStream::VarintSize64(ZigZagEncode64(value)); +} +inline int WireFormatLite::EnumSize(int value) { + return io::CodedOutputStream::VarintSize32SignExtended(value); +} + +inline int WireFormatLite::StringSize(const string& value) { + return io::CodedOutputStream::VarintSize32(value.size()) + + value.size(); +} +inline int WireFormatLite::BytesSize(const string& value) { + return io::CodedOutputStream::VarintSize32(value.size()) + + value.size(); +} + + +inline int WireFormatLite::GroupSize(const MessageLite& value) { + return value.ByteSize(); +} +inline int WireFormatLite::MessageSize(const MessageLite& value) { + int size = value.ByteSize(); + return io::CodedOutputStream::VarintSize32(size) + size; +} + +// See comment on ReadGroupNoVirtual to understand the need for this template +// parameter name. +template +inline int WireFormatLite::GroupSizeNoVirtual( + const MessageType_WorkAroundCppLookupDefect& value) { + return value.MessageType_WorkAroundCppLookupDefect::ByteSize(); +} +template +inline int WireFormatLite::MessageSizeNoVirtual( + const MessageType_WorkAroundCppLookupDefect& value) { + int size = value.MessageType_WorkAroundCppLookupDefect::ByteSize(); + return io::CodedOutputStream::VarintSize32(size) + size; +} + +} // namespace internal +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ diff --git a/depends/protobuf/src/Makefile.am b/depends/protobuf/src/Makefile.am deleted file mode 100644 index 02abe5503..000000000 --- a/depends/protobuf/src/Makefile.am +++ /dev/null @@ -1,918 +0,0 @@ -## Process this file with automake to produce Makefile.in - -if HAVE_ZLIB -GZCHECKPROGRAMS = zcgzip zcgunzip -GZHEADERS = google/protobuf/io/gzip_stream.h -GZTESTS = google/protobuf/io/gzip_stream_unittest.sh -ZLIB_DEF = -DHAVE_ZLIB=1 -else -GZCHECKPROGRAMS = -GZHEADERS = -GZTESTS = -ZLIB_DEF = -endif - -if HAVE_PTHREAD -PTHREAD_DEF = -DHAVE_PTHREAD=1 -else -PTHREAD_DEF = -endif - -PROTOBUF_VERSION = 32:10:0 - -if GCC -# Turn on all warnings except for sign comparison (we ignore sign comparison -# in Google so our code base have tons of such warnings). -NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) -Wall -Wno-sign-compare -else -NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) -endif - -AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) - -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. -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/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: - rm -f *.loT - -CLEANFILES = $(protoc_outputs) unittest_proto_middleman \ - testzip.jar testzip.list testzip.proto testzip.zip \ - no_warning_test.cc - -MAINTAINERCLEANFILES = \ - Makefile.in - -nobase_include_HEADERS = \ - 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/arenaz_sampler.h \ - google/protobuf/compiler/code_generator.h \ - google/protobuf/compiler/command_line_interface.h \ - google/protobuf/compiler/cpp/cpp_generator.h \ - google/protobuf/compiler/cpp/file.h \ - google/protobuf/compiler/cpp/generator.h \ - google/protobuf/compiler/cpp/helpers.h \ - google/protobuf/compiler/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/generator.h \ - google/protobuf/compiler/java/java_generator.h \ - google/protobuf/compiler/java/kotlin_generator.h \ - google/protobuf/compiler/java/names.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/generator.h \ - google/protobuf/compiler/python/pyi_generator.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/endian.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_tctable_decl.h \ - google/protobuf/generated_message_tctable_impl.h \ - 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/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_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_internal.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/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/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) -libprotobuf_lite_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined -if HAVE_LD_VERSION_SCRIPT -libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map -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/arenaz_sampler.cc \ - google/protobuf/extension_set.cc \ - google/protobuf/generated_enum_util.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/common.cc \ - google/protobuf/stubs/int128.cc \ - google/protobuf/stubs/int128.h \ - google/protobuf/stubs/mathutil.h \ - google/protobuf/stubs/status.cc \ - google/protobuf/stubs/status_macros.h \ - google/protobuf/stubs/statusor.cc \ - google/protobuf/stubs/statusor.h \ - google/protobuf/stubs/stringpiece.cc \ - 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/wire_format_lite.cc - -libprotobuf_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) -libprotobuf_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined -if HAVE_LD_VERSION_SCRIPT -libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map -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/compiler/importer.cc \ - google/protobuf/compiler/parser.cc \ - google/protobuf/descriptor.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_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_ops.cc \ - google/protobuf/service.cc \ - google/protobuf/source_context.pb.cc \ - google/protobuf/struct.pb.cc \ - google/protobuf/stubs/substitute.cc \ - google/protobuf/stubs/substitute.h \ - google/protobuf/text_format.cc \ - google/protobuf/timestamp.pb.cc \ - google/protobuf/type.pb.cc \ - google/protobuf/unknown_field_set.cc \ - google/protobuf/util/delimited_message_util.cc \ - google/protobuf/util/field_comparator.cc \ - google/protobuf/util/field_mask_util.cc \ - google/protobuf/util/internal/constants.h \ - google/protobuf/util/internal/datapiece.cc \ - google/protobuf/util/internal/datapiece.h \ - google/protobuf/util/internal/default_value_objectwriter.cc \ - google/protobuf/util/internal/default_value_objectwriter.h \ - google/protobuf/util/internal/error_listener.cc \ - google/protobuf/util/internal/error_listener.h \ - google/protobuf/util/internal/expecting_objectwriter.h \ - google/protobuf/util/internal/field_mask_utility.cc \ - google/protobuf/util/internal/field_mask_utility.h \ - google/protobuf/util/internal/json_escaping.cc \ - google/protobuf/util/internal/json_escaping.h \ - google/protobuf/util/internal/json_objectwriter.cc \ - google/protobuf/util/internal/json_objectwriter.h \ - google/protobuf/util/internal/json_stream_parser.cc \ - google/protobuf/util/internal/json_stream_parser.h \ - google/protobuf/util/internal/location_tracker.h \ - google/protobuf/util/internal/mock_error_listener.h \ - google/protobuf/util/internal/object_location_tracker.h \ - 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/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.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/wire_format.cc \ - google/protobuf/wrappers.pb.cc - -nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) - -libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la -libprotoc_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined -if HAVE_LD_VERSION_SCRIPT -libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map -EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map -endif -libprotoc_la_SOURCES = \ - google/protobuf/compiler/code_generator.cc \ - google/protobuf/compiler/command_line_interface.cc \ - google/protobuf/compiler/cpp/enum.cc \ - google/protobuf/compiler/cpp/enum.h \ - google/protobuf/compiler/cpp/enum_field.cc \ - google/protobuf/compiler/cpp/enum_field.h \ - google/protobuf/compiler/cpp/extension.cc \ - google/protobuf/compiler/cpp/extension.h \ - google/protobuf/compiler/cpp/field.cc \ - google/protobuf/compiler/cpp/field.h \ - google/protobuf/compiler/cpp/file.cc \ - google/protobuf/compiler/cpp/generator.cc \ - google/protobuf/compiler/cpp/helpers.cc \ - google/protobuf/compiler/cpp/map_field.cc \ - google/protobuf/compiler/cpp/map_field.h \ - google/protobuf/compiler/cpp/message.cc \ - google/protobuf/compiler/cpp/message.h \ - google/protobuf/compiler/cpp/message_field.cc \ - google/protobuf/compiler/cpp/message_field.h \ - google/protobuf/compiler/cpp/message_layout_helper.h \ - google/protobuf/compiler/cpp/options.h \ - google/protobuf/compiler/cpp/padding_optimizer.cc \ - google/protobuf/compiler/cpp/padding_optimizer.h \ - google/protobuf/compiler/cpp/parse_function_generator.cc \ - google/protobuf/compiler/cpp/parse_function_generator.h \ - google/protobuf/compiler/cpp/primitive_field.cc \ - google/protobuf/compiler/cpp/primitive_field.h \ - google/protobuf/compiler/cpp/service.cc \ - google/protobuf/compiler/cpp/service.h \ - google/protobuf/compiler/cpp/string_field.cc \ - google/protobuf/compiler/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/context.cc \ - google/protobuf/compiler/java/context.h \ - google/protobuf/compiler/java/doc_comment.cc \ - google/protobuf/compiler/java/doc_comment.h \ - google/protobuf/compiler/java/enum.cc \ - google/protobuf/compiler/java/enum.h \ - google/protobuf/compiler/java/enum_field.cc \ - google/protobuf/compiler/java/enum_field.h \ - google/protobuf/compiler/java/enum_field_lite.cc \ - google/protobuf/compiler/java/enum_field_lite.h \ - google/protobuf/compiler/java/enum_lite.cc \ - google/protobuf/compiler/java/enum_lite.h \ - google/protobuf/compiler/java/extension.cc \ - google/protobuf/compiler/java/extension.h \ - google/protobuf/compiler/java/extension_lite.cc \ - google/protobuf/compiler/java/extension_lite.h \ - google/protobuf/compiler/java/field.cc \ - google/protobuf/compiler/java/field.h \ - google/protobuf/compiler/java/file.cc \ - google/protobuf/compiler/java/file.h \ - google/protobuf/compiler/java/generator.cc \ - google/protobuf/compiler/java/generator_factory.cc \ - google/protobuf/compiler/java/generator_factory.h \ - google/protobuf/compiler/java/helpers.cc \ - google/protobuf/compiler/java/helpers.h \ - google/protobuf/compiler/java/kotlin_generator.cc \ - google/protobuf/compiler/java/map_field.cc \ - google/protobuf/compiler/java/map_field.h \ - google/protobuf/compiler/java/map_field_lite.cc \ - google/protobuf/compiler/java/map_field_lite.h \ - google/protobuf/compiler/java/message.cc \ - google/protobuf/compiler/java/message.h \ - google/protobuf/compiler/java/message_builder.cc \ - google/protobuf/compiler/java/message_builder.h \ - google/protobuf/compiler/java/message_builder_lite.cc \ - google/protobuf/compiler/java/message_builder_lite.h \ - google/protobuf/compiler/java/message_field.cc \ - google/protobuf/compiler/java/message_field.h \ - google/protobuf/compiler/java/message_field_lite.cc \ - google/protobuf/compiler/java/message_field_lite.h \ - google/protobuf/compiler/java/message_lite.cc \ - google/protobuf/compiler/java/message_lite.h \ - google/protobuf/compiler/java/name_resolver.cc \ - google/protobuf/compiler/java/name_resolver.h \ - google/protobuf/compiler/java/options.h \ - google/protobuf/compiler/java/primitive_field.cc \ - google/protobuf/compiler/java/primitive_field.h \ - google/protobuf/compiler/java/primitive_field_lite.cc \ - google/protobuf/compiler/java/primitive_field_lite.h \ - google/protobuf/compiler/java/service.cc \ - google/protobuf/compiler/java/service.h \ - google/protobuf/compiler/java/shared_code_generator.cc \ - google/protobuf/compiler/java/shared_code_generator.h \ - google/protobuf/compiler/java/string_field.cc \ - google/protobuf/compiler/java/string_field.h \ - google/protobuf/compiler/java/string_field_lite.cc \ - google/protobuf/compiler/java/string_field_lite.h \ - google/protobuf/compiler/objectivec/objectivec_enum.cc \ - google/protobuf/compiler/objectivec/objectivec_enum.h \ - google/protobuf/compiler/objectivec/objectivec_enum_field.cc \ - google/protobuf/compiler/objectivec/objectivec_enum_field.h \ - google/protobuf/compiler/objectivec/objectivec_extension.cc \ - google/protobuf/compiler/objectivec/objectivec_extension.h \ - google/protobuf/compiler/objectivec/objectivec_field.cc \ - google/protobuf/compiler/objectivec/objectivec_field.h \ - google/protobuf/compiler/objectivec/objectivec_file.cc \ - 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_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_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/generator.cc \ - google/protobuf/compiler/python/helpers.cc \ - google/protobuf/compiler/python/helpers.h \ - google/protobuf/compiler/python/pyi_generator.cc \ - google/protobuf/compiler/ruby/ruby_generator.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 - -bin_PROGRAMS = protoc -protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la -protoc_SOURCES = google/protobuf/compiler/main.cc - -# Tests ============================================================== - -protoc_inputs = \ - google/protobuf/any_test.proto \ - google/protobuf/compiler/cpp/test_bad_identifiers.proto \ - google/protobuf/compiler/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.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.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 \ - google/protobuf/util/internal/testdata/anys.proto \ - google/protobuf/util/internal/testdata/books.proto \ - google/protobuf/util/internal/testdata/default_value.proto \ - google/protobuf/util/internal/testdata/default_value_test.proto \ - google/protobuf/util/internal/testdata/field_mask.proto \ - google/protobuf/util/internal/testdata/maps.proto \ - google/protobuf/util/internal/testdata/oneofs.proto \ - google/protobuf/util/internal/testdata/proto3.proto \ - google/protobuf/util/internal/testdata/struct.proto \ - google/protobuf/util/internal/testdata/timestamp_duration.proto \ - 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 - -EXTRA_DIST = \ - $(protoc_inputs) \ - 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/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/util/package_info.h \ - libprotobuf-lite.map \ - libprotobuf.map \ - libprotoc.map \ - solaris/libstdc++.la - -protoc_lite_outputs = \ - google/protobuf/map_lite_unittest.pb.cc \ - google/protobuf/map_lite_unittest.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_lite.pb.cc \ - google/protobuf/unittest_lite.pb.h - -protoc_outputs = \ - $(protoc_lite_outputs) \ - google/protobuf/any_test.pb.cc \ - google/protobuf/any_test.pb.h \ - google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc \ - google/protobuf/compiler/cpp/test_bad_identifiers.pb.h \ - google/protobuf/compiler/cpp/test_large_enum_value.pb.cc \ - google/protobuf/compiler/cpp/test_large_enum_value.pb.h \ - google/protobuf/map_proto2_unittest.pb.cc \ - 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 \ - google/protobuf/unittest_custom_options.pb.h \ - google/protobuf/unittest_drop_unknown_fields.pb.cc \ - google/protobuf/unittest_drop_unknown_fields.pb.h \ - google/protobuf/unittest_embed_optimize_for.pb.cc \ - google/protobuf/unittest_embed_optimize_for.pb.h \ - google/protobuf/unittest_empty.pb.cc \ - google/protobuf/unittest_empty.pb.h \ - google/protobuf/unittest_enormous_descriptor.pb.cc \ - google/protobuf/unittest_enormous_descriptor.pb.h \ - google/protobuf/unittest_import.pb.cc \ - google/protobuf/unittest_import.pb.h \ - google/protobuf/unittest_import_public.pb.cc \ - google/protobuf/unittest_import_public.pb.h \ - google/protobuf/unittest_lazy_dependencies.pb.cc \ - google/protobuf/unittest_lazy_dependencies.pb.h \ - google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc \ - google/protobuf/unittest_lazy_dependencies_custom_option.pb.h \ - google/protobuf/unittest_lazy_dependencies_enum.pb.cc \ - google/protobuf/unittest_lazy_dependencies_enum.pb.h \ - google/protobuf/unittest_lite_imports_nonlite.pb.cc \ - google/protobuf/unittest_lite_imports_nonlite.pb.h \ - google/protobuf/unittest_mset.pb.cc \ - 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_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_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 \ - google/protobuf/unittest_proto3_arena.pb.h \ - google/protobuf/unittest_proto3_arena_lite.pb.cc \ - 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 \ - google/protobuf/util/internal/testdata/anys.pb.h \ - google/protobuf/util/internal/testdata/books.pb.cc \ - google/protobuf/util/internal/testdata/books.pb.h \ - google/protobuf/util/internal/testdata/default_value.pb.cc \ - google/protobuf/util/internal/testdata/default_value.pb.h \ - google/protobuf/util/internal/testdata/default_value_test.pb.cc \ - google/protobuf/util/internal/testdata/default_value_test.pb.h \ - google/protobuf/util/internal/testdata/field_mask.pb.cc \ - google/protobuf/util/internal/testdata/field_mask.pb.h \ - google/protobuf/util/internal/testdata/maps.pb.cc \ - google/protobuf/util/internal/testdata/maps.pb.h \ - google/protobuf/util/internal/testdata/oneofs.pb.cc \ - google/protobuf/util/internal/testdata/oneofs.pb.h \ - google/protobuf/util/internal/testdata/proto3.pb.cc \ - google/protobuf/util/internal/testdata/proto3.pb.h \ - google/protobuf/util/internal/testdata/struct.pb.cc \ - google/protobuf/util/internal/testdata/struct.pb.h \ - google/protobuf/util/internal/testdata/timestamp_duration.pb.cc \ - google/protobuf/util/internal/testdata/timestamp_duration.pb.h \ - google/protobuf/util/internal/testdata/wrappers.pb.cc \ - google/protobuf/util/internal/testdata/wrappers.pb.h \ - google/protobuf/util/json_format.pb.cc \ - google/protobuf/util/json_format.pb.h \ - google/protobuf/util/json_format_proto3.pb.cc \ - google/protobuf/util/json_format_proto3.pb.h \ - google/protobuf/util/message_differencer_unittest.pb.cc \ - google/protobuf/util/message_differencer_unittest.pb.h - -if USE_EXTERNAL_PROTOC - -unittest_proto_middleman: $(protoc_inputs) - $(PROTOC) -I$(srcdir) --cpp_out=. $^ - touch unittest_proto_middleman - -else - -# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is -# 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) --experimental_allow_proto3_optional ) - touch unittest_proto_middleman - -endif - -$(protoc_outputs): unittest_proto_middleman - -COMMON_TEST_SOURCES = \ - $(COMMON_LITE_TEST_SOURCES) \ - google/protobuf/compiler/cpp/unittest.h \ - google/protobuf/map_test_util.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/file.cc \ - 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 -GOOGLETEST_SRC_DIR=$(srcdir)/../third_party/googletest/googletest -GOOGLEMOCK_SRC_DIR=$(srcdir)/../third_party/googletest/googlemock -check_PROGRAMS = protoc protobuf-test protobuf-lazy-descriptor-test \ - protobuf-lite-test test_plugin protobuf-lite-arena-test \ - no-warning-test $(GZCHECKPROGRAMS) -protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \ - -I$(GOOGLEMOCK_SRC_DIR)/include -# Disable optimization for tests unless the user explicitly asked for it, -# since test_util.cc takes forever to compile with optimization (with GCC). -# See configure.ac for more info. -protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_test_SOURCES = \ - $(COMMON_TEST_SOURCES) \ - google/protobuf/any_test.cc \ - google/protobuf/arena_unittest.cc \ - google/protobuf/arenastring_unittest.cc \ - google/protobuf/arenaz_sampler_test.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/bootstrap_unittest.cc \ - google/protobuf/compiler/cpp/message_size_unittest.cc \ - google/protobuf/compiler/cpp/metadata_test.cc \ - google/protobuf/compiler/cpp/move_unittest.cc \ - google/protobuf/compiler/cpp/plugin_unittest.cc \ - google/protobuf/compiler/cpp/unittest.cc \ - google/protobuf/compiler/cpp/unittest.inc \ - 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/doc_comment_unittest.cc \ - google/protobuf/compiler/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/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/generated_message_tctable_lite_test.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 \ - google/protobuf/preserve_unknown_enum_test.cc \ - google/protobuf/proto3_arena_lite_unittest.cc \ - google/protobuf/proto3_arena_unittest.cc \ - google/protobuf/proto3_lite_unittest.cc \ - google/protobuf/proto3_lite_unittest.inc \ - 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/util/delimited_message_util_test.cc \ - google/protobuf/util/field_comparator_test.cc \ - google/protobuf/util/field_mask_util_test.cc \ - google/protobuf/util/internal/default_value_objectwriter_test.cc \ - google/protobuf/util/internal/json_objectwriter_test.cc \ - google/protobuf/util/internal/json_stream_parser_test.cc \ - google/protobuf/util/internal/protostream_objectsource_test.cc \ - google/protobuf/util/internal/protostream_objectwriter_test.cc \ - google/protobuf/util/internal/type_info_test_helper.cc \ - google/protobuf/util/json_util_test.cc \ - google/protobuf/util/message_differencer_unittest.cc \ - google/protobuf/util/time_util_test.cc \ - google/protobuf/util/type_resolver_util_test.cc \ - google/protobuf/well_known_types_unittest.cc \ - google/protobuf/wire_format_unittest.cc \ - google/protobuf/wire_format_unittest.inc - -nodist_protobuf_test_SOURCES = $(protoc_outputs) -$(am_protobuf_test_OBJECTS): unittest_proto_middleman - -# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined. -protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \ - libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -protobuf_lazy_descriptor_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \ - -I$(GOOGLETEST_SRC_DIR)/include \ - -DPROTOBUF_TEST_NO_DESCRIPTORS -protobuf_lazy_descriptor_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_lazy_descriptor_test_SOURCES = \ - google/protobuf/compiler/cpp/unittest.cc \ - $(COMMON_TEST_SOURCES) -nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs) -$(am_protobuf_lazy_descriptor_test_OBJECTS): unittest_proto_middleman - -COMMON_LITE_TEST_SOURCES = \ - google/protobuf/arena_test_util.cc \ - 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 - -# Build lite_unittest separately, since it doesn't use gtest. It can't -# depend on gtest because our internal version of gtest depend on proto -# full runtime and we want to make sure this test builds without full -# runtime. -protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -protobuf_lite_test_CPPFLAGS= -I$(GOOGLEMOCK_SRC_DIR)/include \ - -I$(GOOGLETEST_SRC_DIR)/include -protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_lite_test_SOURCES = \ - google/protobuf/lite_unittest.cc \ - $(COMMON_LITE_TEST_SOURCES) -nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs) -$(am_protobuf_lite_test_OBJECTS): unittest_proto_middleman - -# lite_arena_unittest depends on gtest because teboring@ found that without -# gtest when building the test internally our memory sanitizer doesn't detect -# memory leaks (don't know why). -protobuf_lite_arena_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -protobuf_lite_arena_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \ - -I$(GOOGLETEST_SRC_DIR)/include -protobuf_lite_arena_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_lite_arena_test_SOURCES = \ - google/protobuf/lite_arena_unittest.cc \ - $(COMMON_LITE_TEST_SOURCES) -nodist_protobuf_lite_arena_test_SOURCES = $(protoc_lite_outputs) -$(am_protobuf_lite_arena_test_OBJECTS): unittest_proto_middleman - -# Test plugin binary. -test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.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 - -if HAVE_ZLIB -zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la -zcgzip_SOURCES = google/protobuf/testing/zcgzip.cc - -zcgunzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la -zcgunzip_SOURCES = google/protobuf/testing/zcgunzip.cc -endif - -# This test target is to ensure all our public header files and generated -# code is free from warnings. We have to be more pedantic about these -# files because they are compiled by users with different compiler flags. -no_warning_test.cc: - echo "// Generated from Makefile.am" > no_warning_test.cc - for FILE in $(nobase_include_HEADERS); do \ - 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 - -no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la -no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ - -Wall -Wextra -Werror -Wno-unused-parameter -nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs) - -TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ - google/protobuf/compiler/zip_output_unittest.sh $(GZTESTS) \ - protobuf-lite-arena-test no-warning-test diff --git a/depends/protobuf/src/Makefile.in b/depends/protobuf/src/Makefile.in deleted file mode 100644 index 344b0b9c8..000000000 --- a/depends/protobuf/src/Makefile.in +++ /dev/null @@ -1,9522 +0,0 @@ -# Makefile.in generated by automake 1.16.5 from Makefile.am. -# @configure_input@ - -# 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, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_1 = -Wl,--version-script=$(srcdir)/libprotobuf-lite.map -@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_2 = -Wl,--version-script=$(srcdir)/libprotobuf.map -@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_3 = -Wl,--version-script=$(srcdir)/libprotoc.map -bin_PROGRAMS = protoc$(EXEEXT) -check_PROGRAMS = protoc$(EXEEXT) protobuf-test$(EXEEXT) \ - protobuf-lazy-descriptor-test$(EXEEXT) \ - protobuf-lite-test$(EXEEXT) test_plugin$(EXEEXT) \ - protobuf-lite-arena-test$(EXEEXT) no-warning-test$(EXEEXT) \ - $(am__EXEEXT_1) -TESTS = protobuf-test$(EXEEXT) protobuf-lazy-descriptor-test$(EXEEXT) \ - protobuf-lite-test$(EXEEXT) \ - google/protobuf/compiler/zip_output_unittest.sh \ - $(am__EXEEXT_2) protobuf-lite-arena-test$(EXEEXT) \ - no-warning-test$(EXEEXT) -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ac_system_extensions.m4 \ - $(top_srcdir)/m4/acx_check_suncc.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_prog_cc_for_build.m4 \ - $(top_srcdir)/m4/ax_prog_cxx_for_build.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/stl_hash.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(nobase_dist_proto_DATA) \ - $(am__nobase_include_HEADERS_DIST) $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(protodir)" "$(DESTDIR)$(includedir)" -@HAVE_ZLIB_TRUE@am__EXEEXT_1 = zcgzip$(EXEEXT) zcgunzip$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -LTLIBRARIES = $(lib_LTLIBRARIES) -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/any_lite.lo \ - google/protobuf/arena.lo google/protobuf/arenastring.lo \ - google/protobuf/arenaz_sampler.lo \ - google/protobuf/extension_set.lo \ - google/protobuf/generated_enum_util.lo \ - google/protobuf/generated_message_tctable_lite.lo \ - google/protobuf/generated_message_util.lo \ - google/protobuf/implicit_weak_message.lo \ - google/protobuf/inlined_string_field.lo \ - google/protobuf/io/coded_stream.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/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@) -am__v_lt_0 = --silent -am__v_lt_1 = -libprotobuf_lite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(libprotobuf_lite_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -libprotobuf_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am__objects_1 = google/protobuf/any_lite.lo google/protobuf/arena.lo \ - google/protobuf/arenastring.lo \ - google/protobuf/arenaz_sampler.lo \ - google/protobuf/extension_set.lo \ - google/protobuf/generated_enum_util.lo \ - google/protobuf/generated_message_tctable_lite.lo \ - google/protobuf/generated_message_util.lo \ - google/protobuf/implicit_weak_message.lo \ - google/protobuf/inlined_string_field.lo \ - google/protobuf/io/coded_stream.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/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/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_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 \ - google/protobuf/struct.pb.lo \ - google/protobuf/stubs/substitute.lo \ - google/protobuf/text_format.lo google/protobuf/timestamp.pb.lo \ - google/protobuf/type.pb.lo \ - google/protobuf/unknown_field_set.lo \ - google/protobuf/util/delimited_message_util.lo \ - google/protobuf/util/field_comparator.lo \ - google/protobuf/util/field_mask_util.lo \ - google/protobuf/util/internal/datapiece.lo \ - google/protobuf/util/internal/default_value_objectwriter.lo \ - google/protobuf/util/internal/error_listener.lo \ - google/protobuf/util/internal/field_mask_utility.lo \ - google/protobuf/util/internal/json_escaping.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/type_info.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/wire_format.lo google/protobuf/wrappers.pb.lo -nodist_libprotobuf_la_OBJECTS = -libprotobuf_la_OBJECTS = $(am_libprotobuf_la_OBJECTS) \ - $(nodist_libprotobuf_la_OBJECTS) -libprotobuf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(libprotobuf_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -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/cpp/enum.lo \ - google/protobuf/compiler/cpp/enum_field.lo \ - google/protobuf/compiler/cpp/extension.lo \ - google/protobuf/compiler/cpp/field.lo \ - google/protobuf/compiler/cpp/file.lo \ - google/protobuf/compiler/cpp/generator.lo \ - google/protobuf/compiler/cpp/helpers.lo \ - google/protobuf/compiler/cpp/map_field.lo \ - google/protobuf/compiler/cpp/message.lo \ - google/protobuf/compiler/cpp/message_field.lo \ - google/protobuf/compiler/cpp/padding_optimizer.lo \ - google/protobuf/compiler/cpp/parse_function_generator.lo \ - google/protobuf/compiler/cpp/primitive_field.lo \ - google/protobuf/compiler/cpp/service.lo \ - google/protobuf/compiler/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/context.lo \ - google/protobuf/compiler/java/doc_comment.lo \ - google/protobuf/compiler/java/enum.lo \ - google/protobuf/compiler/java/enum_field.lo \ - google/protobuf/compiler/java/enum_field_lite.lo \ - google/protobuf/compiler/java/enum_lite.lo \ - google/protobuf/compiler/java/extension.lo \ - google/protobuf/compiler/java/extension_lite.lo \ - google/protobuf/compiler/java/field.lo \ - google/protobuf/compiler/java/file.lo \ - google/protobuf/compiler/java/generator.lo \ - google/protobuf/compiler/java/generator_factory.lo \ - google/protobuf/compiler/java/helpers.lo \ - google/protobuf/compiler/java/kotlin_generator.lo \ - google/protobuf/compiler/java/map_field.lo \ - google/protobuf/compiler/java/map_field_lite.lo \ - google/protobuf/compiler/java/message.lo \ - google/protobuf/compiler/java/message_builder.lo \ - google/protobuf/compiler/java/message_builder_lite.lo \ - google/protobuf/compiler/java/message_field.lo \ - google/protobuf/compiler/java/message_field_lite.lo \ - google/protobuf/compiler/java/message_lite.lo \ - google/protobuf/compiler/java/name_resolver.lo \ - google/protobuf/compiler/java/primitive_field.lo \ - google/protobuf/compiler/java/primitive_field_lite.lo \ - google/protobuf/compiler/java/service.lo \ - google/protobuf/compiler/java/shared_code_generator.lo \ - google/protobuf/compiler/java/string_field.lo \ - google/protobuf/compiler/java/string_field_lite.lo \ - google/protobuf/compiler/objectivec/objectivec_enum.lo \ - google/protobuf/compiler/objectivec/objectivec_enum_field.lo \ - google/protobuf/compiler/objectivec/objectivec_extension.lo \ - google/protobuf/compiler/objectivec/objectivec_field.lo \ - google/protobuf/compiler/objectivec/objectivec_file.lo \ - google/protobuf/compiler/objectivec/objectivec_generator.lo \ - google/protobuf/compiler/objectivec/objectivec_helpers.lo \ - google/protobuf/compiler/objectivec/objectivec_map_field.lo \ - google/protobuf/compiler/objectivec/objectivec_message.lo \ - google/protobuf/compiler/objectivec/objectivec_message_field.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/generator.lo \ - google/protobuf/compiler/python/helpers.lo \ - google/protobuf/compiler/python/pyi_generator.lo \ - google/protobuf/compiler/ruby/ruby_generator.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_import_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-test_bad_identifiers.pb.$(OBJEXT) \ - google/protobuf/compiler/cpp/no_warning_test-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) \ - google/protobuf/no_warning_test-unittest_embed_optimize_for.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_empty.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_enormous_descriptor.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_import.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_import_public.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_lazy_dependencies.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_lazy_dependencies_enum.pb.$(OBJEXT) \ - 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_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_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) \ - google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-default_value_test.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-maps.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-proto3.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-struct.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.$(OBJEXT) \ - google/protobuf/util/no_warning_test-json_format.pb.$(OBJEXT) \ - google/protobuf/util/no_warning_test-json_format_proto3.pb.$(OBJEXT) \ - google/protobuf/util/no_warning_test-message_differencer_unittest.pb.$(OBJEXT) -nodist_no_warning_test_OBJECTS = \ - no_warning_test-no_warning_test.$(OBJEXT) $(am__objects_3) -no_warning_test_OBJECTS = $(nodist_no_warning_test_OBJECTS) -no_warning_test_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \ - libprotoc.la -no_warning_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(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-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-unittest.$(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) \ - 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-test_bad_identifiers.pb.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-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) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_import.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.$(OBJEXT) \ - 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_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_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) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.$(OBJEXT) \ - 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_7) -protobuf_lazy_descriptor_test_OBJECTS = \ - $(am_protobuf_lazy_descriptor_test_OBJECTS) \ - $(nodist_protobuf_lazy_descriptor_test_OBJECTS) -protobuf_lazy_descriptor_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - libprotobuf.la libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -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_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_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) \ - 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) -protobuf_lite_arena_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - libprotobuf-lite.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -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_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_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) \ - 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) \ - libprotobuf-lite.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -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_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-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-arena_unittest.$(OBJEXT) \ - google/protobuf/protobuf_test-arenastring_unittest.$(OBJEXT) \ - google/protobuf/protobuf_test-arenaz_sampler_test.$(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-bootstrap_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-message_size_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-metadata_test.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-move_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-plugin_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-unittest.$(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-doc_comment_unittest.$(OBJEXT) \ - google/protobuf/compiler/java/protobuf_test-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-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-generated_message_tctable_lite_test.$(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) \ - google/protobuf/protobuf_test-no_field_presence_test.$(OBJEXT) \ - google/protobuf/protobuf_test-preserve_unknown_enum_test.$(OBJEXT) \ - google/protobuf/protobuf_test-proto3_arena_lite_unittest.$(OBJEXT) \ - google/protobuf/protobuf_test-proto3_arena_unittest.$(OBJEXT) \ - google/protobuf/protobuf_test-proto3_lite_unittest.$(OBJEXT) \ - 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/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) \ - google/protobuf/util/internal/protobuf_test-default_value_objectwriter_test.$(OBJEXT) \ - google/protobuf/util/internal/protobuf_test-json_objectwriter_test.$(OBJEXT) \ - google/protobuf/util/internal/protobuf_test-json_stream_parser_test.$(OBJEXT) \ - google/protobuf/util/internal/protobuf_test-protostream_objectsource_test.$(OBJEXT) \ - google/protobuf/util/internal/protobuf_test-protostream_objectwriter_test.$(OBJEXT) \ - google/protobuf/util/internal/protobuf_test-type_info_test_helper.$(OBJEXT) \ - google/protobuf/util/protobuf_test-json_util_test.$(OBJEXT) \ - 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) \ - 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_import_lite.pb.$(OBJEXT) \ - 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-test_bad_identifiers.pb.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-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) \ - google/protobuf/protobuf_test-unittest_embed_optimize_for.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_empty.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_enormous_descriptor.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_import.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_import_public.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_lazy_dependencies.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_lazy_dependencies_enum.pb.$(OBJEXT) \ - 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_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_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) \ - google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-default_value_test.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-maps.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-proto3.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-struct.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.$(OBJEXT) \ - google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.$(OBJEXT) \ - 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_15) -protobuf_test_OBJECTS = $(am_protobuf_test_OBJECTS) \ - $(nodist_protobuf_test_OBJECTS) -protobuf_test_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \ - libprotoc.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la -protobuf_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(protobuf_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -am_protoc_OBJECTS = google/protobuf/compiler/main.$(OBJEXT) -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/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 -am__zcgunzip_SOURCES_DIST = google/protobuf/testing/zcgunzip.cc -@HAVE_ZLIB_TRUE@am_zcgunzip_OBJECTS = \ -@HAVE_ZLIB_TRUE@ google/protobuf/testing/zcgunzip.$(OBJEXT) -zcgunzip_OBJECTS = $(am_zcgunzip_OBJECTS) -@HAVE_ZLIB_TRUE@zcgunzip_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@HAVE_ZLIB_TRUE@ libprotobuf.la -am__zcgzip_SOURCES_DIST = google/protobuf/testing/zcgzip.cc -@HAVE_ZLIB_TRUE@am_zcgzip_OBJECTS = \ -@HAVE_ZLIB_TRUE@ google/protobuf/testing/zcgzip.$(OBJEXT) -zcgzip_OBJECTS = $(am_zcgzip_OBJECTS) -@HAVE_ZLIB_TRUE@zcgzip_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@HAVE_ZLIB_TRUE@ libprotobuf.la -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ - google/protobuf/$(DEPDIR)/any.Plo \ - google/protobuf/$(DEPDIR)/any.pb.Plo \ - 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)/arenaz_sampler.Plo \ - google/protobuf/$(DEPDIR)/descriptor.Plo \ - google/protobuf/$(DEPDIR)/descriptor.pb.Plo \ - google/protobuf/$(DEPDIR)/descriptor_database.Plo \ - google/protobuf/$(DEPDIR)/duration.pb.Plo \ - google/protobuf/$(DEPDIR)/dynamic_message.Plo \ - google/protobuf/$(DEPDIR)/empty.pb.Plo \ - google/protobuf/$(DEPDIR)/extension_set.Plo \ - 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_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 \ - google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.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_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 \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.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 \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.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_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 \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.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 \ - google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_test_util.Po \ - google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.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_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 \ - google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.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_test-any_test.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_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-generated_message_tctable_lite_test.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 \ - google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.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 \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.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_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 \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.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 \ - google/protobuf/$(DEPDIR)/text_format.Plo \ - google/protobuf/$(DEPDIR)/timestamp.pb.Plo \ - google/protobuf/$(DEPDIR)/type.pb.Plo \ - google/protobuf/$(DEPDIR)/unknown_field_set.Plo \ - google/protobuf/$(DEPDIR)/wire_format.Plo \ - google/protobuf/$(DEPDIR)/wire_format_lite.Plo \ - google/protobuf/$(DEPDIR)/wrappers.pb.Plo \ - google/protobuf/compiler/$(DEPDIR)/code_generator.Plo \ - google/protobuf/compiler/$(DEPDIR)/command_line_interface.Plo \ - google/protobuf/compiler/$(DEPDIR)/importer.Plo \ - google/protobuf/compiler/$(DEPDIR)/main.Po \ - google/protobuf/compiler/$(DEPDIR)/parser.Plo \ - google/protobuf/compiler/$(DEPDIR)/plugin.Plo \ - google/protobuf/compiler/$(DEPDIR)/plugin.pb.Plo \ - google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po \ - google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po \ - google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po \ - google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po \ - google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po \ - google/protobuf/compiler/$(DEPDIR)/subprocess.Plo \ - google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Po \ - google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Po \ - google/protobuf/compiler/$(DEPDIR)/zip_writer.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/enum.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/enum_field.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/extension.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/field.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/file.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/generator.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/helpers.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/map_field.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/message.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/message_field.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/padding_optimizer.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/parse_function_generator.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/primitive_field.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Po \ - google/protobuf/compiler/cpp/$(DEPDIR)/service.Plo \ - google/protobuf/compiler/cpp/$(DEPDIR)/string_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_doc_comment.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_field_base.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_generator.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_helpers.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_map_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_primitive_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_reflection_class.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_enum_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_message_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_primitive_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_source_generator_base.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/csharp_wrapper_field.Plo \ - google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po \ - google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po \ - google/protobuf/compiler/java/$(DEPDIR)/context.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/doc_comment.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/enum.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/enum_field.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/enum_field_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/enum_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/extension.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/extension_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/field.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/file.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/generator.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/generator_factory.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/helpers.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/kotlin_generator.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/map_field.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/map_field_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/message.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/message_builder.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/message_builder_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/message_field.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/message_field_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/message_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/name_resolver.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/primitive_field.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/primitive_field_lite.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Po \ - google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Po \ - google/protobuf/compiler/java/$(DEPDIR)/service.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/shared_code_generator.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/string_field.Plo \ - google/protobuf/compiler/java/$(DEPDIR)/string_field_lite.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum_field.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_extension.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_field.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_file.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_generator.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_helpers.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_map_field.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message_field.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_oneof.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_primitive_field.Plo \ - google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po \ - google/protobuf/compiler/php/$(DEPDIR)/php_generator.Plo \ - google/protobuf/compiler/python/$(DEPDIR)/generator.Plo \ - google/protobuf/compiler/python/$(DEPDIR)/helpers.Plo \ - google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Po \ - google/protobuf/compiler/python/$(DEPDIR)/pyi_generator.Plo \ - google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po \ - google/protobuf/compiler/ruby/$(DEPDIR)/ruby_generator.Plo \ - google/protobuf/io/$(DEPDIR)/coded_stream.Plo \ - google/protobuf/io/$(DEPDIR)/gzip_stream.Plo \ - google/protobuf/io/$(DEPDIR)/io_win32.Plo \ - google/protobuf/io/$(DEPDIR)/printer.Plo \ - google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po \ - google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po \ - google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po \ - google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po \ - google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po \ - google/protobuf/io/$(DEPDIR)/strtod.Plo \ - google/protobuf/io/$(DEPDIR)/tokenizer.Plo \ - google/protobuf/io/$(DEPDIR)/zero_copy_stream.Plo \ - google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl.Plo \ - google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl_lite.Plo \ - google/protobuf/stubs/$(DEPDIR)/bytestream.Plo \ - google/protobuf/stubs/$(DEPDIR)/common.Plo \ - google/protobuf/stubs/$(DEPDIR)/int128.Plo \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po \ - google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po \ - google/protobuf/stubs/$(DEPDIR)/status.Plo \ - google/protobuf/stubs/$(DEPDIR)/statusor.Plo \ - google/protobuf/stubs/$(DEPDIR)/stringpiece.Plo \ - google/protobuf/stubs/$(DEPDIR)/stringprintf.Plo \ - google/protobuf/stubs/$(DEPDIR)/structurally_valid.Plo \ - google/protobuf/stubs/$(DEPDIR)/strutil.Plo \ - google/protobuf/stubs/$(DEPDIR)/substitute.Plo \ - google/protobuf/stubs/$(DEPDIR)/time.Plo \ - google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Po \ - google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po \ - google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po \ - google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po \ - google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po \ - google/protobuf/testing/$(DEPDIR)/zcgunzip.Po \ - google/protobuf/testing/$(DEPDIR)/zcgzip.Po \ - google/protobuf/util/$(DEPDIR)/delimited_message_util.Plo \ - google/protobuf/util/$(DEPDIR)/field_comparator.Plo \ - google/protobuf/util/$(DEPDIR)/field_mask_util.Plo \ - google/protobuf/util/$(DEPDIR)/json_util.Plo \ - google/protobuf/util/$(DEPDIR)/message_differencer.Plo \ - google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Po \ - google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Po \ - google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Po \ - google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Po \ - google/protobuf/util/$(DEPDIR)/time_util.Plo \ - google/protobuf/util/$(DEPDIR)/type_resolver_util.Plo \ - google/protobuf/util/internal/$(DEPDIR)/datapiece.Plo \ - google/protobuf/util/internal/$(DEPDIR)/default_value_objectwriter.Plo \ - google/protobuf/util/internal/$(DEPDIR)/error_listener.Plo \ - google/protobuf/util/internal/$(DEPDIR)/field_mask_utility.Plo \ - google/protobuf/util/internal/$(DEPDIR)/json_escaping.Plo \ - google/protobuf/util/internal/$(DEPDIR)/json_objectwriter.Plo \ - google/protobuf/util/internal/$(DEPDIR)/json_stream_parser.Plo \ - google/protobuf/util/internal/$(DEPDIR)/object_writer.Plo \ - google/protobuf/util/internal/$(DEPDIR)/proto_writer.Plo \ - google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Po \ - google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Po \ - google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Po \ - google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Po \ - google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Po \ - google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.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)/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 \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Po \ - google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Po -am__mv = mv -f -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libprotobuf_lite_la_SOURCES) $(libprotobuf_la_SOURCES) \ - $(nodist_libprotobuf_la_SOURCES) $(libprotoc_la_SOURCES) \ - $(nodist_no_warning_test_SOURCES) \ - $(protobuf_lazy_descriptor_test_SOURCES) \ - $(nodist_protobuf_lazy_descriptor_test_SOURCES) \ - $(protobuf_lite_arena_test_SOURCES) \ - $(nodist_protobuf_lite_arena_test_SOURCES) \ - $(protobuf_lite_test_SOURCES) \ - $(nodist_protobuf_lite_test_SOURCES) $(protobuf_test_SOURCES) \ - $(nodist_protobuf_test_SOURCES) $(protoc_SOURCES) \ - $(test_plugin_SOURCES) $(zcgunzip_SOURCES) $(zcgzip_SOURCES) -DIST_SOURCES = $(libprotobuf_lite_la_SOURCES) \ - $(libprotobuf_la_SOURCES) $(libprotoc_la_SOURCES) \ - $(protobuf_lazy_descriptor_test_SOURCES) \ - $(protobuf_lite_arena_test_SOURCES) \ - $(protobuf_lite_test_SOURCES) $(protobuf_test_SOURCES) \ - $(protoc_SOURCES) $(test_plugin_SOURCES) \ - $(am__zcgunzip_SOURCES_DIST) $(am__zcgzip_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(nobase_dist_proto_DATA) -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/arenaz_sampler.h \ - google/protobuf/compiler/code_generator.h \ - google/protobuf/compiler/command_line_interface.h \ - google/protobuf/compiler/cpp/cpp_generator.h \ - google/protobuf/compiler/cpp/file.h \ - google/protobuf/compiler/cpp/generator.h \ - google/protobuf/compiler/cpp/helpers.h \ - google/protobuf/compiler/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/generator.h \ - google/protobuf/compiler/java/java_generator.h \ - google/protobuf/compiler/java/kotlin_generator.h \ - google/protobuf/compiler/java/names.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/generator.h \ - google/protobuf/compiler/python/pyi_generator.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/endian.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_tctable_decl.h \ - google/protobuf/generated_message_tctable_impl.h \ - 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/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_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_internal.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/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/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, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -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 = \ -@HAVE_ZLIB_TRUE@ google/protobuf/io/gzip_stream_unittest.sh -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -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 README.md -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_EXEEXT = @BUILD_EXEEXT@ -BUILD_OBJEXT = @BUILD_OBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ -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@ -CXXCPP_FOR_BUILD = @CXXCPP_FOR_BUILD@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ -CXX_FOR_BUILD = @CXX_FOR_BUILD@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DIST_LANG = @DIST_LANG@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ETAGS = @ETAGS@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FILECMD = @FILECMD@ -GREP = @GREP@ -HAVE_CXX11 = @HAVE_CXX11@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -ISAINFO = @ISAINFO@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ -LIBATOMIC_LIBS = @LIBATOMIC_LIBS@ -LIBLOG_LIBS = @LIBLOG_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCDEPMODE = @OBJCDEPMODE@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POW_LIB = @POW_LIB@ -PROTOBUF_OPT_FLAG = @PROTOBUF_OPT_FLAG@ -PROTOC = @PROTOC@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_CXX_FOR_BUILD = @ac_ct_CXX_FOR_BUILD@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -@HAVE_ZLIB_FALSE@GZCHECKPROGRAMS = -@HAVE_ZLIB_TRUE@GZCHECKPROGRAMS = zcgzip zcgunzip -@HAVE_ZLIB_FALSE@GZHEADERS = -@HAVE_ZLIB_TRUE@GZHEADERS = google/protobuf/io/gzip_stream.h -@HAVE_ZLIB_FALSE@GZTESTS = -@HAVE_ZLIB_TRUE@GZTESTS = google/protobuf/io/gzip_stream_unittest.sh -@HAVE_ZLIB_FALSE@ZLIB_DEF = -@HAVE_ZLIB_TRUE@ZLIB_DEF = -DHAVE_ZLIB=1 -@HAVE_PTHREAD_FALSE@PTHREAD_DEF = -@HAVE_PTHREAD_TRUE@PTHREAD_DEF = -DHAVE_PTHREAD=1 -PROTOBUF_VERSION = 32:10: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) ${LIBLOG_LIBS} - -# If I say "dist_include_DATA", automake complains that $(includedir) is not -# a "legitimate" directory for DATA. Screw you, automake. -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/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 \ - no_warning_test.cc - -MAINTAINERCLEANFILES = \ - Makefile.in - -nobase_include_HEADERS = \ - 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/arenaz_sampler.h \ - google/protobuf/compiler/code_generator.h \ - google/protobuf/compiler/command_line_interface.h \ - google/protobuf/compiler/cpp/cpp_generator.h \ - google/protobuf/compiler/cpp/file.h \ - google/protobuf/compiler/cpp/generator.h \ - google/protobuf/compiler/cpp/helpers.h \ - google/protobuf/compiler/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/generator.h \ - google/protobuf/compiler/java/java_generator.h \ - google/protobuf/compiler/java/kotlin_generator.h \ - google/protobuf/compiler/java/names.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/generator.h \ - google/protobuf/compiler/python/pyi_generator.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/endian.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_tctable_decl.h \ - google/protobuf/generated_message_tctable_impl.h \ - 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/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_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_internal.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/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/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) -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/arenaz_sampler.cc \ - google/protobuf/extension_set.cc \ - google/protobuf/generated_enum_util.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/common.cc \ - google/protobuf/stubs/int128.cc \ - google/protobuf/stubs/int128.h \ - google/protobuf/stubs/mathutil.h \ - google/protobuf/stubs/status.cc \ - google/protobuf/stubs/status_macros.h \ - google/protobuf/stubs/statusor.cc \ - google/protobuf/stubs/statusor.h \ - google/protobuf/stubs/stringpiece.cc \ - 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/wire_format_lite.cc - -libprotobuf_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) -libprotobuf_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) \ - -export-dynamic -no-undefined $(am__append_2) -@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/compiler/importer.cc \ - google/protobuf/compiler/parser.cc \ - google/protobuf/descriptor.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_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_ops.cc \ - google/protobuf/service.cc \ - google/protobuf/source_context.pb.cc \ - google/protobuf/struct.pb.cc \ - google/protobuf/stubs/substitute.cc \ - google/protobuf/stubs/substitute.h \ - google/protobuf/text_format.cc \ - google/protobuf/timestamp.pb.cc \ - google/protobuf/type.pb.cc \ - google/protobuf/unknown_field_set.cc \ - google/protobuf/util/delimited_message_util.cc \ - google/protobuf/util/field_comparator.cc \ - google/protobuf/util/field_mask_util.cc \ - google/protobuf/util/internal/constants.h \ - google/protobuf/util/internal/datapiece.cc \ - google/protobuf/util/internal/datapiece.h \ - google/protobuf/util/internal/default_value_objectwriter.cc \ - google/protobuf/util/internal/default_value_objectwriter.h \ - google/protobuf/util/internal/error_listener.cc \ - google/protobuf/util/internal/error_listener.h \ - google/protobuf/util/internal/expecting_objectwriter.h \ - google/protobuf/util/internal/field_mask_utility.cc \ - google/protobuf/util/internal/field_mask_utility.h \ - google/protobuf/util/internal/json_escaping.cc \ - google/protobuf/util/internal/json_escaping.h \ - google/protobuf/util/internal/json_objectwriter.cc \ - google/protobuf/util/internal/json_objectwriter.h \ - google/protobuf/util/internal/json_stream_parser.cc \ - google/protobuf/util/internal/json_stream_parser.h \ - google/protobuf/util/internal/location_tracker.h \ - google/protobuf/util/internal/mock_error_listener.h \ - google/protobuf/util/internal/object_location_tracker.h \ - 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/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.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/wire_format.cc \ - google/protobuf/wrappers.pb.cc - -nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) -libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la -libprotoc_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) \ - -export-dynamic -no-undefined $(am__append_3) -@HAVE_LD_VERSION_SCRIPT_TRUE@EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map -libprotoc_la_SOURCES = \ - google/protobuf/compiler/code_generator.cc \ - google/protobuf/compiler/command_line_interface.cc \ - google/protobuf/compiler/cpp/enum.cc \ - google/protobuf/compiler/cpp/enum.h \ - google/protobuf/compiler/cpp/enum_field.cc \ - google/protobuf/compiler/cpp/enum_field.h \ - google/protobuf/compiler/cpp/extension.cc \ - google/protobuf/compiler/cpp/extension.h \ - google/protobuf/compiler/cpp/field.cc \ - google/protobuf/compiler/cpp/field.h \ - google/protobuf/compiler/cpp/file.cc \ - google/protobuf/compiler/cpp/generator.cc \ - google/protobuf/compiler/cpp/helpers.cc \ - google/protobuf/compiler/cpp/map_field.cc \ - google/protobuf/compiler/cpp/map_field.h \ - google/protobuf/compiler/cpp/message.cc \ - google/protobuf/compiler/cpp/message.h \ - google/protobuf/compiler/cpp/message_field.cc \ - google/protobuf/compiler/cpp/message_field.h \ - google/protobuf/compiler/cpp/message_layout_helper.h \ - google/protobuf/compiler/cpp/options.h \ - google/protobuf/compiler/cpp/padding_optimizer.cc \ - google/protobuf/compiler/cpp/padding_optimizer.h \ - google/protobuf/compiler/cpp/parse_function_generator.cc \ - google/protobuf/compiler/cpp/parse_function_generator.h \ - google/protobuf/compiler/cpp/primitive_field.cc \ - google/protobuf/compiler/cpp/primitive_field.h \ - google/protobuf/compiler/cpp/service.cc \ - google/protobuf/compiler/cpp/service.h \ - google/protobuf/compiler/cpp/string_field.cc \ - google/protobuf/compiler/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/context.cc \ - google/protobuf/compiler/java/context.h \ - google/protobuf/compiler/java/doc_comment.cc \ - google/protobuf/compiler/java/doc_comment.h \ - google/protobuf/compiler/java/enum.cc \ - google/protobuf/compiler/java/enum.h \ - google/protobuf/compiler/java/enum_field.cc \ - google/protobuf/compiler/java/enum_field.h \ - google/protobuf/compiler/java/enum_field_lite.cc \ - google/protobuf/compiler/java/enum_field_lite.h \ - google/protobuf/compiler/java/enum_lite.cc \ - google/protobuf/compiler/java/enum_lite.h \ - google/protobuf/compiler/java/extension.cc \ - google/protobuf/compiler/java/extension.h \ - google/protobuf/compiler/java/extension_lite.cc \ - google/protobuf/compiler/java/extension_lite.h \ - google/protobuf/compiler/java/field.cc \ - google/protobuf/compiler/java/field.h \ - google/protobuf/compiler/java/file.cc \ - google/protobuf/compiler/java/file.h \ - google/protobuf/compiler/java/generator.cc \ - google/protobuf/compiler/java/generator_factory.cc \ - google/protobuf/compiler/java/generator_factory.h \ - google/protobuf/compiler/java/helpers.cc \ - google/protobuf/compiler/java/helpers.h \ - google/protobuf/compiler/java/kotlin_generator.cc \ - google/protobuf/compiler/java/map_field.cc \ - google/protobuf/compiler/java/map_field.h \ - google/protobuf/compiler/java/map_field_lite.cc \ - google/protobuf/compiler/java/map_field_lite.h \ - google/protobuf/compiler/java/message.cc \ - google/protobuf/compiler/java/message.h \ - google/protobuf/compiler/java/message_builder.cc \ - google/protobuf/compiler/java/message_builder.h \ - google/protobuf/compiler/java/message_builder_lite.cc \ - google/protobuf/compiler/java/message_builder_lite.h \ - google/protobuf/compiler/java/message_field.cc \ - google/protobuf/compiler/java/message_field.h \ - google/protobuf/compiler/java/message_field_lite.cc \ - google/protobuf/compiler/java/message_field_lite.h \ - google/protobuf/compiler/java/message_lite.cc \ - google/protobuf/compiler/java/message_lite.h \ - google/protobuf/compiler/java/name_resolver.cc \ - google/protobuf/compiler/java/name_resolver.h \ - google/protobuf/compiler/java/options.h \ - google/protobuf/compiler/java/primitive_field.cc \ - google/protobuf/compiler/java/primitive_field.h \ - google/protobuf/compiler/java/primitive_field_lite.cc \ - google/protobuf/compiler/java/primitive_field_lite.h \ - google/protobuf/compiler/java/service.cc \ - google/protobuf/compiler/java/service.h \ - google/protobuf/compiler/java/shared_code_generator.cc \ - google/protobuf/compiler/java/shared_code_generator.h \ - google/protobuf/compiler/java/string_field.cc \ - google/protobuf/compiler/java/string_field.h \ - google/protobuf/compiler/java/string_field_lite.cc \ - google/protobuf/compiler/java/string_field_lite.h \ - google/protobuf/compiler/objectivec/objectivec_enum.cc \ - google/protobuf/compiler/objectivec/objectivec_enum.h \ - google/protobuf/compiler/objectivec/objectivec_enum_field.cc \ - google/protobuf/compiler/objectivec/objectivec_enum_field.h \ - google/protobuf/compiler/objectivec/objectivec_extension.cc \ - google/protobuf/compiler/objectivec/objectivec_extension.h \ - google/protobuf/compiler/objectivec/objectivec_field.cc \ - google/protobuf/compiler/objectivec/objectivec_field.h \ - google/protobuf/compiler/objectivec/objectivec_file.cc \ - 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_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_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/generator.cc \ - google/protobuf/compiler/python/helpers.cc \ - google/protobuf/compiler/python/helpers.h \ - google/protobuf/compiler/python/pyi_generator.cc \ - google/protobuf/compiler/ruby/ruby_generator.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 - -protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la -protoc_SOURCES = google/protobuf/compiler/main.cc - -# Tests ============================================================== -protoc_inputs = \ - google/protobuf/any_test.proto \ - google/protobuf/compiler/cpp/test_bad_identifiers.proto \ - google/protobuf/compiler/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.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.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 \ - google/protobuf/util/internal/testdata/anys.proto \ - google/protobuf/util/internal/testdata/books.proto \ - google/protobuf/util/internal/testdata/default_value.proto \ - google/protobuf/util/internal/testdata/default_value_test.proto \ - google/protobuf/util/internal/testdata/field_mask.proto \ - google/protobuf/util/internal/testdata/maps.proto \ - google/protobuf/util/internal/testdata/oneofs.proto \ - google/protobuf/util/internal/testdata/proto3.proto \ - google/protobuf/util/internal/testdata/struct.proto \ - google/protobuf/util/internal/testdata/timestamp_duration.proto \ - 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 - -EXTRA_DIST = \ - $(protoc_inputs) \ - 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/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/util/package_info.h \ - libprotobuf-lite.map \ - libprotobuf.map \ - libprotoc.map \ - solaris/libstdc++.la - -protoc_lite_outputs = \ - google/protobuf/map_lite_unittest.pb.cc \ - google/protobuf/map_lite_unittest.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_lite.pb.cc \ - google/protobuf/unittest_lite.pb.h - -protoc_outputs = \ - $(protoc_lite_outputs) \ - google/protobuf/any_test.pb.cc \ - google/protobuf/any_test.pb.h \ - google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc \ - google/protobuf/compiler/cpp/test_bad_identifiers.pb.h \ - google/protobuf/compiler/cpp/test_large_enum_value.pb.cc \ - google/protobuf/compiler/cpp/test_large_enum_value.pb.h \ - google/protobuf/map_proto2_unittest.pb.cc \ - 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 \ - google/protobuf/unittest_custom_options.pb.h \ - google/protobuf/unittest_drop_unknown_fields.pb.cc \ - google/protobuf/unittest_drop_unknown_fields.pb.h \ - google/protobuf/unittest_embed_optimize_for.pb.cc \ - google/protobuf/unittest_embed_optimize_for.pb.h \ - google/protobuf/unittest_empty.pb.cc \ - google/protobuf/unittest_empty.pb.h \ - google/protobuf/unittest_enormous_descriptor.pb.cc \ - google/protobuf/unittest_enormous_descriptor.pb.h \ - google/protobuf/unittest_import.pb.cc \ - google/protobuf/unittest_import.pb.h \ - google/protobuf/unittest_import_public.pb.cc \ - google/protobuf/unittest_import_public.pb.h \ - google/protobuf/unittest_lazy_dependencies.pb.cc \ - google/protobuf/unittest_lazy_dependencies.pb.h \ - google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc \ - google/protobuf/unittest_lazy_dependencies_custom_option.pb.h \ - google/protobuf/unittest_lazy_dependencies_enum.pb.cc \ - google/protobuf/unittest_lazy_dependencies_enum.pb.h \ - google/protobuf/unittest_lite_imports_nonlite.pb.cc \ - google/protobuf/unittest_lite_imports_nonlite.pb.h \ - google/protobuf/unittest_mset.pb.cc \ - 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_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_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 \ - google/protobuf/unittest_proto3_arena.pb.h \ - google/protobuf/unittest_proto3_arena_lite.pb.cc \ - 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 \ - google/protobuf/util/internal/testdata/anys.pb.h \ - google/protobuf/util/internal/testdata/books.pb.cc \ - google/protobuf/util/internal/testdata/books.pb.h \ - google/protobuf/util/internal/testdata/default_value.pb.cc \ - google/protobuf/util/internal/testdata/default_value.pb.h \ - google/protobuf/util/internal/testdata/default_value_test.pb.cc \ - google/protobuf/util/internal/testdata/default_value_test.pb.h \ - google/protobuf/util/internal/testdata/field_mask.pb.cc \ - google/protobuf/util/internal/testdata/field_mask.pb.h \ - google/protobuf/util/internal/testdata/maps.pb.cc \ - google/protobuf/util/internal/testdata/maps.pb.h \ - google/protobuf/util/internal/testdata/oneofs.pb.cc \ - google/protobuf/util/internal/testdata/oneofs.pb.h \ - google/protobuf/util/internal/testdata/proto3.pb.cc \ - google/protobuf/util/internal/testdata/proto3.pb.h \ - google/protobuf/util/internal/testdata/struct.pb.cc \ - google/protobuf/util/internal/testdata/struct.pb.h \ - google/protobuf/util/internal/testdata/timestamp_duration.pb.cc \ - google/protobuf/util/internal/testdata/timestamp_duration.pb.h \ - google/protobuf/util/internal/testdata/wrappers.pb.cc \ - google/protobuf/util/internal/testdata/wrappers.pb.h \ - google/protobuf/util/json_format.pb.cc \ - google/protobuf/util/json_format.pb.h \ - google/protobuf/util/json_format_proto3.pb.cc \ - google/protobuf/util/json_format_proto3.pb.h \ - google/protobuf/util/message_differencer_unittest.pb.cc \ - google/protobuf/util/message_differencer_unittest.pb.h - -COMMON_TEST_SOURCES = \ - $(COMMON_LITE_TEST_SOURCES) \ - google/protobuf/compiler/cpp/unittest.h \ - google/protobuf/map_test_util.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/file.cc \ - 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 -GOOGLETEST_SRC_DIR = $(srcdir)/../third_party/googletest/googletest -GOOGLEMOCK_SRC_DIR = $(srcdir)/../third_party/googletest/googlemock -protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la - -protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \ - -I$(GOOGLEMOCK_SRC_DIR)/include - -# Disable optimization for tests unless the user explicitly asked for it, -# since test_util.cc takes forever to compile with optimization (with GCC). -# See configure.ac for more info. -protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_test_SOURCES = \ - $(COMMON_TEST_SOURCES) \ - google/protobuf/any_test.cc \ - google/protobuf/arena_unittest.cc \ - google/protobuf/arenastring_unittest.cc \ - google/protobuf/arenaz_sampler_test.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/bootstrap_unittest.cc \ - google/protobuf/compiler/cpp/message_size_unittest.cc \ - google/protobuf/compiler/cpp/metadata_test.cc \ - google/protobuf/compiler/cpp/move_unittest.cc \ - google/protobuf/compiler/cpp/plugin_unittest.cc \ - google/protobuf/compiler/cpp/unittest.cc \ - google/protobuf/compiler/cpp/unittest.inc \ - 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/doc_comment_unittest.cc \ - google/protobuf/compiler/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/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/generated_message_tctable_lite_test.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 \ - google/protobuf/preserve_unknown_enum_test.cc \ - google/protobuf/proto3_arena_lite_unittest.cc \ - google/protobuf/proto3_arena_unittest.cc \ - google/protobuf/proto3_lite_unittest.cc \ - google/protobuf/proto3_lite_unittest.inc \ - 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/util/delimited_message_util_test.cc \ - google/protobuf/util/field_comparator_test.cc \ - google/protobuf/util/field_mask_util_test.cc \ - google/protobuf/util/internal/default_value_objectwriter_test.cc \ - google/protobuf/util/internal/json_objectwriter_test.cc \ - google/protobuf/util/internal/json_stream_parser_test.cc \ - google/protobuf/util/internal/protostream_objectsource_test.cc \ - google/protobuf/util/internal/protostream_objectwriter_test.cc \ - google/protobuf/util/internal/type_info_test_helper.cc \ - google/protobuf/util/json_util_test.cc \ - google/protobuf/util/message_differencer_unittest.cc \ - google/protobuf/util/time_util_test.cc \ - google/protobuf/util/type_resolver_util_test.cc \ - google/protobuf/well_known_types_unittest.cc \ - google/protobuf/wire_format_unittest.cc \ - google/protobuf/wire_format_unittest.inc - -nodist_protobuf_test_SOURCES = $(protoc_outputs) - -# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined. -protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \ - libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la - -protobuf_lazy_descriptor_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \ - -I$(GOOGLETEST_SRC_DIR)/include \ - -DPROTOBUF_TEST_NO_DESCRIPTORS - -protobuf_lazy_descriptor_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_lazy_descriptor_test_SOURCES = \ - google/protobuf/compiler/cpp/unittest.cc \ - $(COMMON_TEST_SOURCES) - -nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs) -COMMON_LITE_TEST_SOURCES = \ - google/protobuf/arena_test_util.cc \ - 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 - - -# Build lite_unittest separately, since it doesn't use gtest. It can't -# depend on gtest because our internal version of gtest depend on proto -# full runtime and we want to make sure this test builds without full -# runtime. -protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la - -protobuf_lite_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \ - -I$(GOOGLETEST_SRC_DIR)/include - -protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_lite_test_SOURCES = \ - google/protobuf/lite_unittest.cc \ - $(COMMON_LITE_TEST_SOURCES) - -nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs) - -# lite_arena_unittest depends on gtest because teboring@ found that without -# gtest when building the test internally our memory sanitizer doesn't detect -# memory leaks (don't know why). -protobuf_lite_arena_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \ - $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la - -protobuf_lite_arena_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \ - -I$(GOOGLETEST_SRC_DIR)/include - -protobuf_lite_arena_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -protobuf_lite_arena_test_SOURCES = \ - google/protobuf/lite_arena_unittest.cc \ - $(COMMON_LITE_TEST_SOURCES) - -nodist_protobuf_lite_arena_test_SOURCES = $(protoc_lite_outputs) - -# Test plugin binary. -test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \ - $(GOOGLETEST_BUILD_DIR)/lib/libgtest.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 - -@HAVE_ZLIB_TRUE@zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la -@HAVE_ZLIB_TRUE@zcgzip_SOURCES = google/protobuf/testing/zcgzip.cc -@HAVE_ZLIB_TRUE@zcgunzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la -@HAVE_ZLIB_TRUE@zcgunzip_SOURCES = google/protobuf/testing/zcgunzip.cc -no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la -no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ - -Wall -Wextra -Werror -Wno-unused-parameter - -nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs) -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .lo .log .o .obj .test .test$(EXEEXT) .trs -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } -google/protobuf/$(am__dirstamp): - @$(MKDIR_P) google/protobuf - @: > google/protobuf/$(am__dirstamp) -google/protobuf/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/$(DEPDIR) - @: > google/protobuf/$(DEPDIR)/$(am__dirstamp) -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/arenaz_sampler.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_tctable_lite.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/implicit_weak_message.lo: \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(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: \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/zero_copy_stream_impl.lo: \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -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/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/duration.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/dynamic_message.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/empty.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/extension_set_heavy.lo: \ - google/protobuf/$(am__dirstamp) \ - 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_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) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/reflection_ops.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/service.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/source_context.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/struct.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/substitute.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/text_format.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/timestamp.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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/util/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/util - @: > google/protobuf/util/$(am__dirstamp) -google/protobuf/util/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/util/$(DEPDIR) - @: > google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/delimited_message_util.lo: \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/field_comparator.lo: \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/field_mask_util.lo: \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/util/internal - @: > google/protobuf/util/internal/$(am__dirstamp) -google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/util/internal/$(DEPDIR) - @: > google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/datapiece.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/default_value_objectwriter.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/error_listener.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/field_mask_utility.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/json_escaping.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/json_objectwriter.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/json_stream_parser.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/object_writer.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/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protostream_objectsource.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/$(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/utility.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/json_util.lo: \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/message_differencer.lo: \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/time_util.lo: \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/compiler/code_generator.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/command_line_interface.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) -google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/cpp/$(DEPDIR) - @: > google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/enum.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/enum_field.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/extension.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/field.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/file.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/generator.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/helpers.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/map_field.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/message.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/message_field.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/padding_optimizer.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/parse_function_generator.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/primitive_field.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/service.lo: \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/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) -google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/java/$(DEPDIR) - @: > google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/context.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/doc_comment.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/enum.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/enum_field.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/enum_field_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/enum_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/extension.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/extension_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/field.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/file.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/generator.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/generator_factory.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/helpers.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/kotlin_generator.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/map_field.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/map_field_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/message.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/message_builder.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/message_builder_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/message_field.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/message_field_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/message_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/name_resolver.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/primitive_field.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/primitive_field_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/service.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/shared_code_generator.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/string_field.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/string_field_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/objectivec - @: > google/protobuf/compiler/objectivec/$(am__dirstamp) -google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/objectivec/$(DEPDIR) - @: > google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_enum.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_enum_field.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_extension.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_field.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_file.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_generator.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_helpers.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_map_field.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_message.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_message_field.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_oneof.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/objectivec_primitive_field.lo: \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/php/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/php - @: > google/protobuf/compiler/php/$(am__dirstamp) -google/protobuf/compiler/php/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/php/$(DEPDIR) - @: > 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) -google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/python/$(DEPDIR) - @: > google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/python/generator.lo: \ - google/protobuf/compiler/python/$(am__dirstamp) \ - google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/python/helpers.lo: \ - google/protobuf/compiler/python/$(am__dirstamp) \ - google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/python/pyi_generator.lo: \ - google/protobuf/compiler/python/$(am__dirstamp) \ - google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/ruby/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/ruby - @: > google/protobuf/compiler/ruby/$(am__dirstamp) -google/protobuf/compiler/ruby/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/ruby/$(DEPDIR) - @: > 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/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_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) -google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-map_proto2_unittest.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/no_warning_test-unittest_custom_options.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_drop_unknown_fields.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_embed_optimize_for.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_empty.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_enormous_descriptor.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_import.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_import_public.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_lazy_dependencies.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_lazy_dependencies_enum.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_lite_imports_nonlite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_mset.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_field_presence.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_no_generic_services.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_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_proto3.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_proto3_arena.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/util/internal/testdata/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/util/internal/testdata - @: > google/protobuf/util/internal/testdata/$(am__dirstamp) -google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/util/internal/testdata/$(DEPDIR) - @: > google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-anys.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-books.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-default_value_test.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-maps.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-proto3.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-struct.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/no_warning_test-json_format.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/no_warning_test-json_format_proto3.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/no_warning_test-message_differencer_unittest.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) - -no-warning-test$(EXEEXT): $(no_warning_test_OBJECTS) $(no_warning_test_DEPENDENCIES) $(EXTRA_no_warning_test_DEPENDENCIES) - @rm -f no-warning-test$(EXEEXT) - $(AM_V_CXXLD)$(no_warning_test_LINK) $(no_warning_test_OBJECTS) $(no_warning_test_LDADD) $(LIBS) -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/testing/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/testing - @: > 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-file.$(OBJEXT): \ - google/protobuf/testing/$(am__dirstamp) \ - google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) -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_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) -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_import.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_field_presence.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_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_proto3.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_lazy_descriptor_test-json_format.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) - -protobuf-lazy-descriptor-test$(EXEEXT): $(protobuf_lazy_descriptor_test_OBJECTS) $(protobuf_lazy_descriptor_test_DEPENDENCIES) $(EXTRA_protobuf_lazy_descriptor_test_DEPENDENCIES) - @rm -f protobuf-lazy-descriptor-test$(EXEEXT) - $(AM_V_CXXLD)$(protobuf_lazy_descriptor_test_LINK) $(protobuf_lazy_descriptor_test_OBJECTS) $(protobuf_lazy_descriptor_test_LDADD) $(LIBS) -google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_arena_test-arena_test_util.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_arena_test-map_lite_test_util.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_arena_test-test_util_lite.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_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) - $(AM_V_CXXLD)$(protobuf_lite_arena_test_LINK) $(protobuf_lite_arena_test_OBJECTS) $(protobuf_lite_arena_test_LDADD) $(LIBS) -google/protobuf/protobuf_lite_test-lite_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_test-arena_test_util.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_test-map_lite_test_util.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_test-test_util_lite.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_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/protobuf_test-arena_test_util.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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/protobuf_test-arenaz_sampler_test.$(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-bootstrap_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-message_size_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/cpp/protobuf_test-move_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-plugin_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-unittest.$(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-doc_comment_unittest.$(OBJEXT): \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/protobuf_test-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-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) -google/protobuf/protobuf_test-descriptor_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-drop_unknown_fields_test.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-dynamic_message_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-extension_set_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-generated_message_reflection_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-generated_message_tctable_lite_test.$(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) -google/protobuf/protobuf_test-map_test.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-message_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-no_field_presence_test.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-preserve_unknown_enum_test.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-proto3_arena_lite_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-proto3_arena_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-proto3_lite_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-reflection_ops_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-repeated_field_reflection_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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/util/protobuf_test-delimited_message_util_test.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-field_comparator_test.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-field_mask_util_test.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protobuf_test-default_value_objectwriter_test.$(OBJEXT): \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protobuf_test-json_objectwriter_test.$(OBJEXT): \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protobuf_test-json_stream_parser_test.$(OBJEXT): \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protobuf_test-protostream_objectsource_test.$(OBJEXT): \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protobuf_test-protostream_objectwriter_test.$(OBJEXT): \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protobuf_test-type_info_test_helper.$(OBJEXT): \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-json_util_test.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-message_differencer_unittest.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-time_util_test.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-type_resolver_util_test.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(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/protobuf_test-map_lite_unittest.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) -google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.pb.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.pb.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-map_proto2_unittest.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/protobuf_test-unittest_custom_options.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_drop_unknown_fields.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_embed_optimize_for.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_empty.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_enormous_descriptor.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_import.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_import_public.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_lazy_dependencies.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_lazy_dependencies_enum.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_lite_imports_nonlite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_mset.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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_field_presence.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_no_generic_services.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_optimize_for.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_preserve_unknown_enum2.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) -google/protobuf/protobuf_test-unittest_proto3_arena.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -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) -google/protobuf/util/internal/testdata/protobuf_test-anys.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-books.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-default_value_test.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-maps.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-proto3.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-struct.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.$(OBJEXT): \ - google/protobuf/util/internal/testdata/$(am__dirstamp) \ - google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-json_format.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-json_format_proto3.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/protobuf_test-message_differencer_unittest.pb.$(OBJEXT): \ - google/protobuf/util/$(am__dirstamp) \ - google/protobuf/util/$(DEPDIR)/$(am__dirstamp) - -protobuf-test$(EXEEXT): $(protobuf_test_OBJECTS) $(protobuf_test_DEPENDENCIES) $(EXTRA_protobuf_test_DEPENDENCIES) - @rm -f protobuf-test$(EXEEXT) - $(AM_V_CXXLD)$(protobuf_test_LINK) $(protobuf_test_OBJECTS) $(protobuf_test_LDADD) $(LIBS) -google/protobuf/compiler/main.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) - -protoc$(EXEEXT): $(protoc_OBJECTS) $(protoc_DEPENDENCIES) $(EXTRA_protoc_DEPENDENCIES) - @rm -f protoc$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(protoc_OBJECTS) $(protoc_LDADD) $(LIBS) -google/protobuf/compiler/test_plugin-mock_code_generator.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(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) - $(AM_V_CXXLD)$(CXXLINK) $(test_plugin_OBJECTS) $(test_plugin_LDADD) $(LIBS) -google/protobuf/testing/zcgunzip.$(OBJEXT): \ - google/protobuf/testing/$(am__dirstamp) \ - google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) - -zcgunzip$(EXEEXT): $(zcgunzip_OBJECTS) $(zcgunzip_DEPENDENCIES) $(EXTRA_zcgunzip_DEPENDENCIES) - @rm -f zcgunzip$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(zcgunzip_OBJECTS) $(zcgunzip_LDADD) $(LIBS) -google/protobuf/testing/zcgzip.$(OBJEXT): \ - google/protobuf/testing/$(am__dirstamp) \ - google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) - -zcgzip$(EXEEXT): $(zcgzip_OBJECTS) $(zcgzip_DEPENDENCIES) $(EXTRA_zcgzip_DEPENDENCIES) - @rm -f zcgzip$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(zcgzip_OBJECTS) $(zcgzip_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f google/protobuf/*.$(OBJEXT) - -rm -f google/protobuf/*.lo - -rm -f google/protobuf/compiler/*.$(OBJEXT) - -rm -f google/protobuf/compiler/*.lo - -rm -f google/protobuf/compiler/cpp/*.$(OBJEXT) - -rm -f google/protobuf/compiler/cpp/*.lo - -rm -f google/protobuf/compiler/csharp/*.$(OBJEXT) - -rm -f google/protobuf/compiler/csharp/*.lo - -rm -f google/protobuf/compiler/java/*.$(OBJEXT) - -rm -f google/protobuf/compiler/java/*.lo - -rm -f google/protobuf/compiler/objectivec/*.$(OBJEXT) - -rm -f google/protobuf/compiler/objectivec/*.lo - -rm -f google/protobuf/compiler/php/*.$(OBJEXT) - -rm -f google/protobuf/compiler/php/*.lo - -rm -f google/protobuf/compiler/python/*.$(OBJEXT) - -rm -f google/protobuf/compiler/python/*.lo - -rm -f google/protobuf/compiler/ruby/*.$(OBJEXT) - -rm -f google/protobuf/compiler/ruby/*.lo - -rm -f google/protobuf/io/*.$(OBJEXT) - -rm -f google/protobuf/io/*.lo - -rm -f google/protobuf/stubs/*.$(OBJEXT) - -rm -f google/protobuf/stubs/*.lo - -rm -f google/protobuf/testing/*.$(OBJEXT) - -rm -f google/protobuf/util/*.$(OBJEXT) - -rm -f google/protobuf/util/*.lo - -rm -f google/protobuf/util/internal/*.$(OBJEXT) - -rm -f google/protobuf/util/internal/*.lo - -rm -f google/protobuf/util/internal/testdata/*.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_warning_test-no_warning_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/any.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/any.pb.Plo@am__quote@ # am--include-marker -@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)/arenaz_sampler.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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/duration.pb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/dynamic_message.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/empty.pb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/extension_set.Plo@am__quote@ # am--include-marker -@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_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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po@am__quote@ # am--include-marker -@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_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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Po@am__quote@ # am--include-marker -@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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po@am__quote@ # am--include-marker -@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_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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.Po@am__quote@ # am--include-marker -@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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_test_util.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Po@am__quote@ # am--include-marker -@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_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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Po@am__quote@ # am--include-marker -@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_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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Po@am__quote@ # am--include-marker -@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-generated_message_tctable_lite_test.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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Po@am__quote@ # am--include-marker -@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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po@am__quote@ # am--include-marker -@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_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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Po@am__quote@ # am--include-marker -@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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/text_format.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/timestamp.pb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/type.pb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/unknown_field_set.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/wire_format.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/wire_format_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/wrappers.pb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/code_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/command_line_interface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/importer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/main.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/parser.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/plugin.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/plugin.pb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/subprocess.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/$(DEPDIR)/zip_writer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/enum.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/enum_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/extension.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/file.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/helpers.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/map_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/message.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/message_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/padding_optimizer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/parse_function_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/primitive_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/service.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/string_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_doc_comment.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_field_base.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_helpers.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_map_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_primitive_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_reflection_class.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_enum_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_message_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_primitive_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_source_generator_base.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/csharp_wrapper_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/context.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/doc_comment.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/enum.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/enum_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/enum_field_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/enum_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/extension.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/extension_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/file.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/generator_factory.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/helpers.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/kotlin_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/map_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/map_field_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/message.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/message_builder.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/message_builder_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/message_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/message_field_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/message_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/name_resolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/primitive_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/primitive_field_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/service.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/shared_code_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/string_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/string_field_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_extension.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_file.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_helpers.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_map_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_oneof.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_primitive_field.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/php/$(DEPDIR)/php_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/python/$(DEPDIR)/generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/python/$(DEPDIR)/helpers.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/python/$(DEPDIR)/pyi_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/ruby/$(DEPDIR)/ruby_generator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/coded_stream.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/gzip_stream.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/io_win32.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/printer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/strtod.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/tokenizer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/zero_copy_stream.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl_lite.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/bytestream.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/common.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/int128.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/status.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/statusor.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/stringpiece.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/stringprintf.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/structurally_valid.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/strutil.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/substitute.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/stubs/$(DEPDIR)/time.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/zcgunzip.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/testing/$(DEPDIR)/zcgzip.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/delimited_message_util.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/field_comparator.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/field_mask_util.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/json_util.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/message_differencer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/time_util.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/$(DEPDIR)/type_resolver_util.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/datapiece.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/default_value_objectwriter.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/error_listener.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/field_mask_utility.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/json_escaping.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/json_objectwriter.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/json_stream_parser.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/object_writer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/proto_writer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Po@am__quote@ # am--include-marker -@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)/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 -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -no_warning_test-no_warning_test.o: no_warning_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT no_warning_test-no_warning_test.o -MD -MP -MF $(DEPDIR)/no_warning_test-no_warning_test.Tpo -c -o no_warning_test-no_warning_test.o `test -f 'no_warning_test.cc' || echo '$(srcdir)/'`no_warning_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/no_warning_test-no_warning_test.Tpo $(DEPDIR)/no_warning_test-no_warning_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='no_warning_test.cc' object='no_warning_test-no_warning_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) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o no_warning_test-no_warning_test.o `test -f 'no_warning_test.cc' || echo '$(srcdir)/'`no_warning_test.cc - -no_warning_test-no_warning_test.obj: no_warning_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT no_warning_test-no_warning_test.obj -MD -MP -MF $(DEPDIR)/no_warning_test-no_warning_test.Tpo -c -o no_warning_test-no_warning_test.obj `if test -f 'no_warning_test.cc'; then $(CYGPATH_W) 'no_warning_test.cc'; else $(CYGPATH_W) '$(srcdir)/no_warning_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/no_warning_test-no_warning_test.Tpo $(DEPDIR)/no_warning_test-no_warning_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='no_warning_test.cc' object='no_warning_test-no_warning_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) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o no_warning_test-no_warning_test.obj `if test -f 'no_warning_test.cc'; then $(CYGPATH_W) 'no_warning_test.cc'; else $(CYGPATH_W) '$(srcdir)/no_warning_test.cc'; fi` - -google/protobuf/no_warning_test-map_lite_unittest.pb.o: google/protobuf/map_lite_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-map_lite_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Tpo -c -o google/protobuf/no_warning_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)/no_warning_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/no_warning_test-map_lite_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-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc - -google/protobuf/no_warning_test-map_lite_unittest.pb.obj: google/protobuf/map_lite_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-map_lite_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/no_warning_test-map_lite_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-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_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 - -google/protobuf/no_warning_test-unittest_import_lite.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` -@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.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_import_lite.pb.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_import_public_lite.pb.o: google/protobuf/unittest_import_public_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_public_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_import_public_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_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc - -google/protobuf/no_warning_test-unittest_import_public_lite.pb.obj: google/protobuf/unittest_import_public_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_public_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_import_public_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.pb.cc' object='google/protobuf/no_warning_test-any_test.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-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/any_test.pb.cc - -google/protobuf/no_warning_test-any_test.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Tpo -c -o google/protobuf/no_warning_test-any_test.pb.obj `if test -f 'google/protobuf/any_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.pb.cc' object='google/protobuf/no_warning_test-any_test.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-any_test.pb.obj `if test -f 'google/protobuf/any_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.pb.cc'; fi` - -google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.o: google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Tpo -c -o google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.o `test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' object='google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.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/compiler/cpp/no_warning_test-test_bad_identifiers.pb.o `test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc - -google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.obj: google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Tpo -c -o google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' object='google/protobuf/compiler/cpp/no_warning_test-test_bad_identifiers.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/compiler/cpp/no_warning_test-test_bad_identifiers.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; fi` - -google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.o: google/protobuf/compiler/cpp/test_large_enum_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Tpo -c -o google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.o `test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_large_enum_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' object='google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.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/compiler/cpp/no_warning_test-test_large_enum_value.pb.o `test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_large_enum_value.pb.cc - -google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.obj: google/protobuf/compiler/cpp/test_large_enum_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Tpo -c -o google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' object='google/protobuf/compiler/cpp/no_warning_test-test_large_enum_value.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/compiler/cpp/no_warning_test-test_large_enum_value.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; fi` - -google/protobuf/no_warning_test-map_proto2_unittest.pb.o: google/protobuf/map_proto2_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-map_proto2_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Tpo -c -o google/protobuf/no_warning_test-map_proto2_unittest.pb.o `test -f 'google/protobuf/map_proto2_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_proto2_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_proto2_unittest.pb.cc' object='google/protobuf/no_warning_test-map_proto2_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-map_proto2_unittest.pb.o `test -f 'google/protobuf/map_proto2_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_proto2_unittest.pb.cc - -google/protobuf/no_warning_test-map_proto2_unittest.pb.obj: google/protobuf/map_proto2_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-map_proto2_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Tpo -c -o google/protobuf/no_warning_test-map_proto2_unittest.pb.obj `if test -f 'google/protobuf/map_proto2_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_proto2_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_proto2_unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_proto2_unittest.pb.cc' object='google/protobuf/no_warning_test-map_proto2_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-map_proto2_unittest.pb.obj `if test -f 'google/protobuf/map_proto2_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_proto2_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_proto2_unittest.pb.cc'; fi` - -google/protobuf/no_warning_test-map_unittest.pb.o: google/protobuf/map_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-map_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Tpo -c -o google/protobuf/no_warning_test-map_unittest.pb.o `test -f 'google/protobuf/map_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_unittest.pb.cc' object='google/protobuf/no_warning_test-map_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-map_unittest.pb.o `test -f 'google/protobuf/map_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_unittest.pb.cc - -google/protobuf/no_warning_test-map_unittest.pb.obj: google/protobuf/map_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-map_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_unittest.pb.cc' object='google/protobuf/no_warning_test-map_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-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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_arena.pb.cc' object='google/protobuf/no_warning_test-unittest_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_arena.pb.o `test -f 'google/protobuf/unittest_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_arena.pb.cc - -google/protobuf/no_warning_test-unittest_arena.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_arena.pb.obj `if test -f 'google/protobuf/unittest_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_arena.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_arena.pb.cc' object='google/protobuf/no_warning_test-unittest_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_arena.pb.obj `if test -f 'google/protobuf/unittest_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_arena.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_custom_options.pb.o: google/protobuf/unittest_custom_options.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_custom_options.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_custom_options.pb.o `test -f 'google/protobuf/unittest_custom_options.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_custom_options.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_custom_options.pb.cc' object='google/protobuf/no_warning_test-unittest_custom_options.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_custom_options.pb.o `test -f 'google/protobuf/unittest_custom_options.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_custom_options.pb.cc - -google/protobuf/no_warning_test-unittest_custom_options.pb.obj: google/protobuf/unittest_custom_options.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_custom_options.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_custom_options.pb.obj `if test -f 'google/protobuf/unittest_custom_options.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_custom_options.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_custom_options.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_custom_options.pb.cc' object='google/protobuf/no_warning_test-unittest_custom_options.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_custom_options.pb.obj `if test -f 'google/protobuf/unittest_custom_options.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_custom_options.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_custom_options.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_drop_unknown_fields.pb.o: google/protobuf/unittest_drop_unknown_fields.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_drop_unknown_fields.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_drop_unknown_fields.pb.o `test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_drop_unknown_fields.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_drop_unknown_fields.pb.cc' object='google/protobuf/no_warning_test-unittest_drop_unknown_fields.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_drop_unknown_fields.pb.o `test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_drop_unknown_fields.pb.cc - -google/protobuf/no_warning_test-unittest_drop_unknown_fields.pb.obj: google/protobuf/unittest_drop_unknown_fields.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_drop_unknown_fields.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_drop_unknown_fields.pb.obj `if test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_drop_unknown_fields.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_drop_unknown_fields.pb.cc' object='google/protobuf/no_warning_test-unittest_drop_unknown_fields.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_drop_unknown_fields.pb.obj `if test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_drop_unknown_fields.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_embed_optimize_for.pb.o: google/protobuf/unittest_embed_optimize_for.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_embed_optimize_for.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_embed_optimize_for.pb.o `test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_embed_optimize_for.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_embed_optimize_for.pb.cc' object='google/protobuf/no_warning_test-unittest_embed_optimize_for.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_embed_optimize_for.pb.o `test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_embed_optimize_for.pb.cc - -google/protobuf/no_warning_test-unittest_embed_optimize_for.pb.obj: google/protobuf/unittest_embed_optimize_for.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_embed_optimize_for.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_embed_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_embed_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_embed_optimize_for.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_embed_optimize_for.pb.cc' object='google/protobuf/no_warning_test-unittest_embed_optimize_for.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_embed_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_embed_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_embed_optimize_for.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_empty.pb.o: google/protobuf/unittest_empty.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_empty.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_empty.pb.o `test -f 'google/protobuf/unittest_empty.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_empty.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_empty.pb.cc' object='google/protobuf/no_warning_test-unittest_empty.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_empty.pb.o `test -f 'google/protobuf/unittest_empty.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_empty.pb.cc - -google/protobuf/no_warning_test-unittest_empty.pb.obj: google/protobuf/unittest_empty.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_empty.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_empty.pb.obj `if test -f 'google/protobuf/unittest_empty.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_empty.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_empty.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_empty.pb.cc' object='google/protobuf/no_warning_test-unittest_empty.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_empty.pb.obj `if test -f 'google/protobuf/unittest_empty.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_empty.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_empty.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_enormous_descriptor.pb.o: google/protobuf/unittest_enormous_descriptor.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_enormous_descriptor.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_enormous_descriptor.pb.o `test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_enormous_descriptor.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_enormous_descriptor.pb.cc' object='google/protobuf/no_warning_test-unittest_enormous_descriptor.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_enormous_descriptor.pb.o `test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_enormous_descriptor.pb.cc - -google/protobuf/no_warning_test-unittest_enormous_descriptor.pb.obj: google/protobuf/unittest_enormous_descriptor.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_enormous_descriptor.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_enormous_descriptor.pb.obj `if test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_enormous_descriptor.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_enormous_descriptor.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_enormous_descriptor.pb.cc' object='google/protobuf/no_warning_test-unittest_enormous_descriptor.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_enormous_descriptor.pb.obj `if test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_enormous_descriptor.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_enormous_descriptor.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_import.pb.o: google/protobuf/unittest_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_import.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import.pb.o `test -f 'google/protobuf/unittest_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import.pb.cc' object='google/protobuf/no_warning_test-unittest_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_import.pb.o `test -f 'google/protobuf/unittest_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import.pb.cc - -google/protobuf/no_warning_test-unittest_import.pb.obj: google/protobuf/unittest_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_import.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import.pb.obj `if test -f 'google/protobuf/unittest_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import.pb.cc' object='google/protobuf/no_warning_test-unittest_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_import.pb.obj `if test -f 'google/protobuf/unittest_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_import_public.pb.o: google/protobuf/unittest_import_public.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_public.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import_public.pb.o `test -f 'google/protobuf/unittest_import_public.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public.pb.cc' object='google/protobuf/no_warning_test-unittest_import_public.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_public.pb.o `test -f 'google/protobuf/unittest_import_public.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public.pb.cc - -google/protobuf/no_warning_test-unittest_import_public.pb.obj: google/protobuf/unittest_import_public.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_public.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import_public.pb.obj `if test -f 'google/protobuf/unittest_import_public.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public.pb.cc' object='google/protobuf/no_warning_test-unittest_import_public.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_import_public.pb.obj `if test -f 'google/protobuf/unittest_import_public.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_lazy_dependencies.pb.o: google/protobuf/unittest_lazy_dependencies.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_lazy_dependencies.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lazy_dependencies.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies.pb.cc' object='google/protobuf/no_warning_test-unittest_lazy_dependencies.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_lazy_dependencies.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies.pb.cc - -google/protobuf/no_warning_test-unittest_lazy_dependencies.pb.obj: google/protobuf/unittest_lazy_dependencies.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_lazy_dependencies.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lazy_dependencies.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies.pb.cc' object='google/protobuf/no_warning_test-unittest_lazy_dependencies.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_lazy_dependencies.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.pb.o: google/protobuf/unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' object='google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc - -google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.pb.obj: google/protobuf/unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' object='google/protobuf/no_warning_test-unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_lazy_dependencies_enum.pb.o: google/protobuf/unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lazy_dependencies_enum.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_enum.pb.cc' object='google/protobuf/no_warning_test-unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_enum.pb.cc - -google/protobuf/no_warning_test-unittest_lazy_dependencies_enum.pb.obj: google/protobuf/unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lazy_dependencies_enum.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_enum.pb.cc' object='google/protobuf/no_warning_test-unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_lite_imports_nonlite.pb.o: google/protobuf/unittest_lite_imports_nonlite.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_imports_nonlite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lite_imports_nonlite.pb.o `test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite_imports_nonlite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite_imports_nonlite.pb.cc' object='google/protobuf/no_warning_test-unittest_lite_imports_nonlite.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_imports_nonlite.pb.o `test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite_imports_nonlite.pb.cc - -google/protobuf/no_warning_test-unittest_lite_imports_nonlite.pb.obj: google/protobuf/unittest_lite_imports_nonlite.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_imports_nonlite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lite_imports_nonlite.pb.obj `if test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite_imports_nonlite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite_imports_nonlite.pb.cc' object='google/protobuf/no_warning_test-unittest_lite_imports_nonlite.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_imports_nonlite.pb.obj `if test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite_imports_nonlite.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_mset.pb.o: google/protobuf/unittest_mset.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_mset.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_mset.pb.o `test -f 'google/protobuf/unittest_mset.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset.pb.cc' object='google/protobuf/no_warning_test-unittest_mset.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_mset.pb.o `test -f 'google/protobuf/unittest_mset.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset.pb.cc - -google/protobuf/no_warning_test-unittest_mset.pb.obj: google/protobuf/unittest_mset.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_mset.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_mset.pb.obj `if test -f 'google/protobuf/unittest_mset.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset.pb.cc' object='google/protobuf/no_warning_test-unittest_mset.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_mset.pb.obj `if test -f 'google/protobuf/unittest_mset.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_mset_wire_format.pb.o: google/protobuf/unittest_mset_wire_format.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_mset_wire_format.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_mset_wire_format.pb.o `test -f 'google/protobuf/unittest_mset_wire_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset_wire_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset_wire_format.pb.cc' object='google/protobuf/no_warning_test-unittest_mset_wire_format.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_mset_wire_format.pb.o `test -f 'google/protobuf/unittest_mset_wire_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset_wire_format.pb.cc - -google/protobuf/no_warning_test-unittest_mset_wire_format.pb.obj: google/protobuf/unittest_mset_wire_format.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_mset_wire_format.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset_wire_format.pb.cc' object='google/protobuf/no_warning_test-unittest_mset_wire_format.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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_field_presence.pb.cc' object='google/protobuf/no_warning_test-unittest_no_field_presence.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_field_presence.pb.o `test -f 'google/protobuf/unittest_no_field_presence.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_field_presence.pb.cc - -google/protobuf/no_warning_test-unittest_no_field_presence.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_no_field_presence.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_field_presence.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_field_presence.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_field_presence.pb.cc' object='google/protobuf/no_warning_test-unittest_no_field_presence.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_field_presence.pb.obj `if test -f 'google/protobuf/unittest_no_field_presence.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_field_presence.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_field_presence.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_no_generic_services.pb.o: google/protobuf/unittest_no_generic_services.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_generic_services.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_generic_services.pb.o `test -f 'google/protobuf/unittest_no_generic_services.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_generic_services.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_generic_services.pb.cc' object='google/protobuf/no_warning_test-unittest_no_generic_services.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_generic_services.pb.o `test -f 'google/protobuf/unittest_no_generic_services.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_generic_services.pb.cc - -google/protobuf/no_warning_test-unittest_no_generic_services.pb.obj: google/protobuf/unittest_no_generic_services.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_generic_services.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_generic_services.pb.obj `if test -f 'google/protobuf/unittest_no_generic_services.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_generic_services.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_generic_services.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_generic_services.pb.cc' object='google/protobuf/no_warning_test-unittest_no_generic_services.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_generic_services.pb.obj `if test -f 'google/protobuf/unittest_no_generic_services.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_generic_services.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_generic_services.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_optimize_for.pb.o: google/protobuf/unittest_optimize_for.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_optimize_for.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_optimize_for.pb.o `test -f 'google/protobuf/unittest_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_optimize_for.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_optimize_for.pb.cc' object='google/protobuf/no_warning_test-unittest_optimize_for.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_optimize_for.pb.o `test -f 'google/protobuf/unittest_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_optimize_for.pb.cc - -google/protobuf/no_warning_test-unittest_optimize_for.pb.obj: google/protobuf/unittest_optimize_for.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_optimize_for.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_optimize_for.pb.cc' object='google/protobuf/no_warning_test-unittest_optimize_for.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_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_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_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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum2.pb.cc' object='google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.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_enum2.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum2.pb.cc - -google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.obj: 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.obj -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.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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum2.pb.cc' object='google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3.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.pb.o `test -f 'google/protobuf/unittest_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3.pb.cc - -google/protobuf/no_warning_test-unittest_proto3.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3.pb.obj `if test -f 'google/protobuf/unittest_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3.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.pb.obj `if test -f 'google/protobuf/unittest_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_proto3_arena.pb.o: google/protobuf/unittest_proto3_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_proto3_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_arena.pb.o `test -f 'google/protobuf/unittest_proto3_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_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_proto3_arena.pb.o `test -f 'google/protobuf/unittest_proto3_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena.pb.cc - -google/protobuf/no_warning_test-unittest_proto3_arena.pb.obj: google/protobuf/unittest_proto3_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_proto3_arena.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_arena.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_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_proto3_arena.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.o: google/protobuf/unittest_proto3_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_proto3_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.o `test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_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_proto3_arena_lite.pb.o `test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena_lite.pb.cc - -google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.obj: google/protobuf/unittest_proto3_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_proto3_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_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_proto3_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena_lite.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_proto3_lite.pb.o: google/protobuf/unittest_proto3_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_proto3_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_lite.pb.o `test -f 'google/protobuf/unittest_proto3_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_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_proto3_lite.pb.o `test -f 'google/protobuf/unittest_proto3_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_lite.pb.cc - -google/protobuf/no_warning_test-unittest_proto3_lite.pb.obj: google/protobuf/unittest_proto3_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_proto3_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_well_known_types.pb.cc' object='google/protobuf/no_warning_test-unittest_well_known_types.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_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 - -google/protobuf/no_warning_test-unittest_well_known_types.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_well_known_types.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_well_known_types.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_well_known_types.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_well_known_types.pb.cc' object='google/protobuf/no_warning_test-unittest_well_known_types.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_well_known_types.pb.obj `if test -f 'google/protobuf/unittest_well_known_types.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_well_known_types.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_well_known_types.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-anys.pb.o: google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-anys.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-anys.pb.o `test -f 'google/protobuf/util/internal/testdata/anys.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/anys.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-anys.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/util/internal/testdata/no_warning_test-anys.pb.o `test -f 'google/protobuf/util/internal/testdata/anys.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/anys.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-anys.pb.obj: google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-anys.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-anys.pb.obj `if test -f 'google/protobuf/util/internal/testdata/anys.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/anys.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/anys.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/anys.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-anys.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/util/internal/testdata/no_warning_test-anys.pb.obj `if test -f 'google/protobuf/util/internal/testdata/anys.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/anys.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/anys.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-books.pb.o: google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-books.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-books.pb.o `test -f 'google/protobuf/util/internal/testdata/books.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/books.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-books.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/util/internal/testdata/no_warning_test-books.pb.o `test -f 'google/protobuf/util/internal/testdata/books.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/books.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-books.pb.obj: google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-books.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-books.pb.obj `if test -f 'google/protobuf/util/internal/testdata/books.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/books.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/books.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/books.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-books.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/util/internal/testdata/no_warning_test-books.pb.obj `if test -f 'google/protobuf/util/internal/testdata/books.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/books.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/books.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.o: google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-default_value.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/util/internal/testdata/no_warning_test-default_value.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.obj: google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-default_value.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-default_value.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/util/internal/testdata/no_warning_test-default_value.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-default_value_test.pb.o: google/protobuf/util/internal/testdata/default_value_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/util/internal/testdata/no_warning_test-default_value_test.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-default_value_test.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value_test.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value_test.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-default_value_test.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/util/internal/testdata/no_warning_test-default_value_test.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value_test.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-default_value_test.pb.obj: google/protobuf/util/internal/testdata/default_value_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/util/internal/testdata/no_warning_test-default_value_test.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-default_value_test.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value_test.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value_test.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-default_value_test.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/util/internal/testdata/no_warning_test-default_value_test.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value_test.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.o: google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.o `test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/field_mask.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-field_mask.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/util/internal/testdata/no_warning_test-field_mask.pb.o `test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/field_mask.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.obj: google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-field_mask.pb.obj `if test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/field_mask.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/field_mask.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-field_mask.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/util/internal/testdata/no_warning_test-field_mask.pb.obj `if test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/field_mask.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-maps.pb.o: google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-maps.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-maps.pb.o `test -f 'google/protobuf/util/internal/testdata/maps.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/maps.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-maps.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/util/internal/testdata/no_warning_test-maps.pb.o `test -f 'google/protobuf/util/internal/testdata/maps.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/maps.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-maps.pb.obj: google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-maps.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-maps.pb.obj `if test -f 'google/protobuf/util/internal/testdata/maps.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/maps.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/maps.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/maps.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-maps.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/util/internal/testdata/no_warning_test-maps.pb.obj `if test -f 'google/protobuf/util/internal/testdata/maps.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/maps.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/maps.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.o: google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.o `test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/oneofs.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-oneofs.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/util/internal/testdata/no_warning_test-oneofs.pb.o `test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/oneofs.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.obj: google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-oneofs.pb.obj `if test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/oneofs.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/oneofs.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-oneofs.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/util/internal/testdata/no_warning_test-oneofs.pb.obj `if test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/oneofs.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-proto3.pb.o: google/protobuf/util/internal/testdata/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/util/internal/testdata/no_warning_test-proto3.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-proto3.pb.o `test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/proto3.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/proto3.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-proto3.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/util/internal/testdata/no_warning_test-proto3.pb.o `test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/proto3.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-proto3.pb.obj: google/protobuf/util/internal/testdata/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/util/internal/testdata/no_warning_test-proto3.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-proto3.pb.obj `if test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/proto3.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/proto3.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-proto3.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/util/internal/testdata/no_warning_test-proto3.pb.obj `if test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/proto3.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-struct.pb.o: google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-struct.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-struct.pb.o `test -f 'google/protobuf/util/internal/testdata/struct.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/struct.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-struct.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/util/internal/testdata/no_warning_test-struct.pb.o `test -f 'google/protobuf/util/internal/testdata/struct.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/struct.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-struct.pb.obj: google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-struct.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-struct.pb.obj `if test -f 'google/protobuf/util/internal/testdata/struct.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/struct.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/struct.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/struct.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-struct.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/util/internal/testdata/no_warning_test-struct.pb.obj `if test -f 'google/protobuf/util/internal/testdata/struct.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/struct.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/struct.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.o: google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.o `test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.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/util/internal/testdata/no_warning_test-timestamp_duration.pb.o `test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/timestamp_duration.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.obj: google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.pb.obj `if test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-timestamp_duration.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/util/internal/testdata/no_warning_test-timestamp_duration.pb.obj `if test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; fi` - -google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.o: google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.o `test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/wrappers.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-wrappers.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/util/internal/testdata/no_warning_test-wrappers.pb.o `test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/wrappers.pb.cc - -google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.obj: google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Tpo -c -o google/protobuf/util/internal/testdata/no_warning_test-wrappers.pb.obj `if test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/wrappers.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/wrappers.pb.cc' object='google/protobuf/util/internal/testdata/no_warning_test-wrappers.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/util/internal/testdata/no_warning_test-wrappers.pb.obj `if test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/wrappers.pb.cc'; fi` - -google/protobuf/util/no_warning_test-json_format.pb.o: google/protobuf/util/json_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/no_warning_test-json_format.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Tpo -c -o google/protobuf/util/no_warning_test-json_format.pb.o `test -f 'google/protobuf/util/json_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Tpo google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format.pb.cc' object='google/protobuf/util/no_warning_test-json_format.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/util/no_warning_test-json_format.pb.o `test -f 'google/protobuf/util/json_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format.pb.cc - -google/protobuf/util/no_warning_test-json_format.pb.obj: google/protobuf/util/json_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/no_warning_test-json_format.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Tpo -c -o google/protobuf/util/no_warning_test-json_format.pb.obj `if test -f 'google/protobuf/util/json_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Tpo google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format.pb.cc' object='google/protobuf/util/no_warning_test-json_format.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/util/no_warning_test-json_format.pb.obj `if test -f 'google/protobuf/util/json_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format.pb.cc'; fi` - -google/protobuf/util/no_warning_test-json_format_proto3.pb.o: google/protobuf/util/json_format_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/util/no_warning_test-json_format_proto3.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Tpo -c -o google/protobuf/util/no_warning_test-json_format_proto3.pb.o `test -f 'google/protobuf/util/json_format_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format_proto3.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Tpo google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format_proto3.pb.cc' object='google/protobuf/util/no_warning_test-json_format_proto3.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/util/no_warning_test-json_format_proto3.pb.o `test -f 'google/protobuf/util/json_format_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format_proto3.pb.cc - -google/protobuf/util/no_warning_test-json_format_proto3.pb.obj: google/protobuf/util/json_format_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/util/no_warning_test-json_format_proto3.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Tpo -c -o google/protobuf/util/no_warning_test-json_format_proto3.pb.obj `if test -f 'google/protobuf/util/json_format_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format_proto3.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Tpo google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format_proto3.pb.cc' object='google/protobuf/util/no_warning_test-json_format_proto3.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/util/no_warning_test-json_format_proto3.pb.obj `if test -f 'google/protobuf/util/json_format_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format_proto3.pb.cc'; fi` - -google/protobuf/util/no_warning_test-message_differencer_unittest.pb.o: google/protobuf/util/message_differencer_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/util/no_warning_test-message_differencer_unittest.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Tpo -c -o google/protobuf/util/no_warning_test-message_differencer_unittest.pb.o `test -f 'google/protobuf/util/message_differencer_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Tpo google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.pb.cc' object='google/protobuf/util/no_warning_test-message_differencer_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/util/no_warning_test-message_differencer_unittest.pb.o `test -f 'google/protobuf/util/message_differencer_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.pb.cc - -google/protobuf/util/no_warning_test-message_differencer_unittest.pb.obj: google/protobuf/util/message_differencer_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/util/no_warning_test-message_differencer_unittest.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Tpo -c -o google/protobuf/util/no_warning_test-message_differencer_unittest.pb.obj `if test -f 'google/protobuf/util/message_differencer_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Tpo google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.pb.cc' object='google/protobuf/util/no_warning_test-message_differencer_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/util/no_warning_test-message_differencer_unittest.pb.obj `if test -f 'google/protobuf/util/message_differencer_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.pb.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.o: google/protobuf/compiler/cpp/unittest.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/compiler/cpp/protobuf_lazy_descriptor_test-unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.o `test -f 'google/protobuf/compiler/cpp/unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/unittest.cc' object='google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-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_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.o `test -f 'google/protobuf/compiler/cpp/unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/unittest.cc - -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.obj: google/protobuf/compiler/cpp/unittest.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/compiler/cpp/protobuf_lazy_descriptor_test-unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.obj `if test -f 'google/protobuf/compiler/cpp/unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/unittest.cc' object='google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-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_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-unittest.obj `if test -f 'google/protobuf/compiler/cpp/unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/unittest.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.o: google/protobuf/arena_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-arena_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_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_lazy_descriptor_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_lazy_descriptor_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_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc - -google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.obj: google/protobuf/arena_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-arena_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_lazy_descriptor_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util.cc' object='google/protobuf/protobuf_lazy_descriptor_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_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -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 - -google/protobuf/protobuf_lazy_descriptor_test-test_util.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Tpo -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` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util.cc' object='google/protobuf/protobuf_lazy_descriptor_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_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-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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/protobuf_lazy_descriptor_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_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -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 - -google/protobuf/testing/protobuf_lazy_descriptor_test-file.obj: 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.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Tpo -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` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/protobuf_lazy_descriptor_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_lite_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-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.obj: 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.obj -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.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` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_lite_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-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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_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) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -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 - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import_lite.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_import_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_import_lite.pb.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.o: google/protobuf/unittest_import_public_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_public_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_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_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.obj: google/protobuf/unittest_import_public_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_public_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-any_test.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-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/any_test.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-any_test.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/any_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-any_test.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-any_test.pb.obj `if test -f 'google/protobuf/any_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.pb.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.o: google/protobuf/compiler/cpp/test_bad_identifiers.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/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.o `test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' object='google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.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/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.o `test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc - -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.obj: google/protobuf/compiler/cpp/test_bad_identifiers.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/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' object='google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.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/compiler/cpp/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.o: google/protobuf/compiler/cpp/test_large_enum_value.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/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.o `test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_large_enum_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' object='google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.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/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.o `test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_large_enum_value.pb.cc - -google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.obj: google/protobuf/compiler/cpp/test_large_enum_value.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/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' object='google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.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/compiler/cpp/protobuf_lazy_descriptor_test-test_large_enum_value.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.o: google/protobuf/map_proto2_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_proto2_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.o `test -f 'google/protobuf/map_proto2_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_proto2_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_proto2_unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_proto2_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-map_proto2_unittest.pb.o `test -f 'google/protobuf/map_proto2_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_proto2_unittest.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.obj: google/protobuf/map_proto2_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_proto2_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.obj `if test -f 'google/protobuf/map_proto2_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_proto2_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_proto2_unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_proto2_unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_proto2_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-map_proto2_unittest.pb.obj `if test -f 'google/protobuf/map_proto2_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_proto2_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_proto2_unittest.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.o: google/protobuf/map_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_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.o `test -f 'google/protobuf/map_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_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-map_unittest.pb.o `test -f 'google/protobuf/map_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_unittest.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.obj: google/protobuf/map_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_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_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-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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_arena.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_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_arena.pb.o `test -f 'google/protobuf/unittest_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_arena.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_arena.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_arena.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_arena.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_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_arena.pb.obj `if test -f 'google/protobuf/unittest_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_arena.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.pb.o: google/protobuf/unittest_custom_options.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_custom_options.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.pb.o `test -f 'google/protobuf/unittest_custom_options.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_custom_options.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_custom_options.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.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_custom_options.pb.o `test -f 'google/protobuf/unittest_custom_options.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_custom_options.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.pb.obj: google/protobuf/unittest_custom_options.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_custom_options.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.pb.obj `if test -f 'google/protobuf/unittest_custom_options.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_custom_options.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_custom_options.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_custom_options.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.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_custom_options.pb.obj `if test -f 'google/protobuf/unittest_custom_options.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_custom_options.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_custom_options.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.o: google/protobuf/unittest_drop_unknown_fields.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_drop_unknown_fields.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.o `test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_drop_unknown_fields.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_drop_unknown_fields.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.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_drop_unknown_fields.pb.o `test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_drop_unknown_fields.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.obj: google/protobuf/unittest_drop_unknown_fields.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_drop_unknown_fields.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.obj `if test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_drop_unknown_fields.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_drop_unknown_fields.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.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_drop_unknown_fields.pb.obj `if test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_drop_unknown_fields.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.o: google/protobuf/unittest_embed_optimize_for.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_embed_optimize_for.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.o `test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_embed_optimize_for.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_embed_optimize_for.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.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_embed_optimize_for.pb.o `test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_embed_optimize_for.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.obj: google/protobuf/unittest_embed_optimize_for.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_embed_optimize_for.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_embed_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_embed_optimize_for.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_embed_optimize_for.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.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_embed_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_embed_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_embed_optimize_for.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.pb.o: google/protobuf/unittest_empty.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_empty.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.pb.o `test -f 'google/protobuf/unittest_empty.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_empty.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_empty.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.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_empty.pb.o `test -f 'google/protobuf/unittest_empty.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_empty.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.pb.obj: google/protobuf/unittest_empty.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_empty.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.pb.obj `if test -f 'google/protobuf/unittest_empty.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_empty.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_empty.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_empty.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_empty.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_empty.pb.obj `if test -f 'google/protobuf/unittest_empty.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_empty.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_empty.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.o: google/protobuf/unittest_enormous_descriptor.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_enormous_descriptor.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.o `test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_enormous_descriptor.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_enormous_descriptor.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.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_enormous_descriptor.pb.o `test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_enormous_descriptor.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.obj: google/protobuf/unittest_enormous_descriptor.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_enormous_descriptor.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.obj `if test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_enormous_descriptor.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_enormous_descriptor.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_enormous_descriptor.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.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_enormous_descriptor.pb.obj `if test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_enormous_descriptor.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_enormous_descriptor.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import.pb.o: google/protobuf/unittest_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_import.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import.pb.o `test -f 'google/protobuf/unittest_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_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_import.pb.o `test -f 'google/protobuf/unittest_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import.pb.obj: google/protobuf/unittest_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_import.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import.pb.obj `if test -f 'google/protobuf/unittest_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_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_import.pb.obj `if test -f 'google/protobuf/unittest_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.pb.o: google/protobuf/unittest_import_public.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_public.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.pb.o `test -f 'google/protobuf/unittest_import_public.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.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_import_public.pb.o `test -f 'google/protobuf/unittest_import_public.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.pb.obj: google/protobuf/unittest_import_public.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_public.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.pb.obj `if test -f 'google/protobuf/unittest_import_public.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public.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_import_public.pb.obj `if test -f 'google/protobuf/unittest_import_public.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.o: google/protobuf/unittest_lazy_dependencies.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_lazy_dependencies.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.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_lazy_dependencies.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.obj: google/protobuf/unittest_lazy_dependencies.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_lazy_dependencies.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.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_lazy_dependencies.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.o: google/protobuf/unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.obj: google/protobuf/unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.o: google/protobuf/unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_enum.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_enum.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.obj: google/protobuf/unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_enum.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.o: google/protobuf/unittest_lite_imports_nonlite.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_imports_nonlite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.o `test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite_imports_nonlite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite_imports_nonlite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.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_imports_nonlite.pb.o `test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite_imports_nonlite.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.obj: google/protobuf/unittest_lite_imports_nonlite.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_imports_nonlite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.obj `if test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite_imports_nonlite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite_imports_nonlite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.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_imports_nonlite.pb.obj `if test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite_imports_nonlite.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.o: google/protobuf/unittest_mset.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_mset.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.o `test -f 'google/protobuf/unittest_mset.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.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_mset.pb.o `test -f 'google/protobuf/unittest_mset.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.obj: google/protobuf/unittest_mset.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_mset.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.obj `if test -f 'google/protobuf/unittest_mset.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.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_mset.pb.obj `if test -f 'google/protobuf/unittest_mset.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.o: google/protobuf/unittest_mset_wire_format.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_mset_wire_format.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.o `test -f 'google/protobuf/unittest_mset_wire_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset_wire_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset_wire_format.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.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_mset_wire_format.pb.o `test -f 'google/protobuf/unittest_mset_wire_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset_wire_format.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.obj: google/protobuf/unittest_mset_wire_format.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_mset_wire_format.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset_wire_format.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_field_presence.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.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_field_presence.pb.o `test -f 'google/protobuf/unittest_no_field_presence.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_field_presence.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_no_field_presence.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_field_presence.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_field_presence.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_field_presence.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.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_field_presence.pb.obj `if test -f 'google/protobuf/unittest_no_field_presence.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_field_presence.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_field_presence.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.o: google/protobuf/unittest_no_generic_services.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_generic_services.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.o `test -f 'google/protobuf/unittest_no_generic_services.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_generic_services.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_generic_services.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.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_generic_services.pb.o `test -f 'google/protobuf/unittest_no_generic_services.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_generic_services.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.obj: google/protobuf/unittest_no_generic_services.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_generic_services.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.obj `if test -f 'google/protobuf/unittest_no_generic_services.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_generic_services.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_generic_services.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_generic_services.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.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_generic_services.pb.obj `if test -f 'google/protobuf/unittest_no_generic_services.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_generic_services.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_generic_services.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.o: google/protobuf/unittest_optimize_for.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_optimize_for.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.o `test -f 'google/protobuf/unittest_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_optimize_for.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_optimize_for.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.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_optimize_for.pb.o `test -f 'google/protobuf/unittest_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_optimize_for.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.obj: google/protobuf/unittest_optimize_for.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_optimize_for.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_optimize_for.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.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_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_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_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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum2.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.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_enum2.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum2.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.obj: 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.obj -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.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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum2.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.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.pb.o `test -f 'google/protobuf/unittest_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.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.pb.obj `if test -f 'google/protobuf/unittest_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.o: google/protobuf/unittest_proto3_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_proto3_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.o `test -f 'google/protobuf/unittest_proto3_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_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_proto3_arena.pb.o `test -f 'google/protobuf/unittest_proto3_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.obj: google/protobuf/unittest_proto3_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_proto3_arena.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_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_proto3_arena.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.o: google/protobuf/unittest_proto3_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_proto3_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.o `test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_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_proto3_arena_lite.pb.o `test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena_lite.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.obj: google/protobuf/unittest_proto3_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_proto3_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_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_proto3_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena_lite.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.o: google/protobuf/unittest_proto3_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_proto3_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.o `test -f 'google/protobuf/unittest_proto3_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_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_proto3_lite.pb.o `test -f 'google/protobuf/unittest_proto3_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_lite.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.obj: google/protobuf/unittest_proto3_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_proto3_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_well_known_types.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.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_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 - -google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_well_known_types.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_well_known_types.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_well_known_types.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_well_known_types.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.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_well_known_types.pb.obj `if test -f 'google/protobuf/unittest_well_known_types.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_well_known_types.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_well_known_types.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.o: google/protobuf/util/internal/testdata/anys.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/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.o `test -f 'google/protobuf/util/internal/testdata/anys.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/anys.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.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/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.o `test -f 'google/protobuf/util/internal/testdata/anys.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/anys.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.obj: google/protobuf/util/internal/testdata/anys.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/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.obj `if test -f 'google/protobuf/util/internal/testdata/anys.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/anys.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/anys.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/anys.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.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/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.obj `if test -f 'google/protobuf/util/internal/testdata/anys.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/anys.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/anys.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.o: google/protobuf/util/internal/testdata/books.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/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.o `test -f 'google/protobuf/util/internal/testdata/books.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/books.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.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/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.o `test -f 'google/protobuf/util/internal/testdata/books.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/books.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.obj: google/protobuf/util/internal/testdata/books.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/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.obj `if test -f 'google/protobuf/util/internal/testdata/books.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/books.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/books.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/books.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.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/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.obj `if test -f 'google/protobuf/util/internal/testdata/books.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/books.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/books.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.o: google/protobuf/util/internal/testdata/default_value.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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.obj: google/protobuf/util/internal/testdata/default_value.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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.o: google/protobuf/util/internal/testdata/default_value_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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value_test.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value_test.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value_test.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.obj: google/protobuf/util/internal/testdata/default_value_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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value_test.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value_test.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.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/util/internal/testdata/protobuf_lazy_descriptor_test-default_value_test.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value_test.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.o: google/protobuf/util/internal/testdata/field_mask.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/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.o `test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/field_mask.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.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/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.o `test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/field_mask.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.obj: google/protobuf/util/internal/testdata/field_mask.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/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.obj `if test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/field_mask.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/field_mask.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.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/util/internal/testdata/protobuf_lazy_descriptor_test-field_mask.pb.obj `if test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/field_mask.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.o: google/protobuf/util/internal/testdata/maps.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/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.o `test -f 'google/protobuf/util/internal/testdata/maps.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/maps.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.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/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.o `test -f 'google/protobuf/util/internal/testdata/maps.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/maps.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.obj: google/protobuf/util/internal/testdata/maps.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/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.obj `if test -f 'google/protobuf/util/internal/testdata/maps.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/maps.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/maps.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/maps.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-maps.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/util/internal/testdata/protobuf_lazy_descriptor_test-maps.pb.obj `if test -f 'google/protobuf/util/internal/testdata/maps.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/maps.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/maps.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.o: google/protobuf/util/internal/testdata/oneofs.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/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.o `test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/oneofs.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.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/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.o `test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/oneofs.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.obj: google/protobuf/util/internal/testdata/oneofs.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/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.obj `if test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/oneofs.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/oneofs.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.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/util/internal/testdata/protobuf_lazy_descriptor_test-oneofs.pb.obj `if test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/oneofs.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.o: google/protobuf/util/internal/testdata/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/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.o `test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/proto3.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/proto3.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.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/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.o `test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/proto3.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.obj: google/protobuf/util/internal/testdata/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/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.obj `if test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/proto3.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/proto3.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.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/util/internal/testdata/protobuf_lazy_descriptor_test-proto3.pb.obj `if test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/proto3.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.o: google/protobuf/util/internal/testdata/struct.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/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.o `test -f 'google/protobuf/util/internal/testdata/struct.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/struct.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.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/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.o `test -f 'google/protobuf/util/internal/testdata/struct.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/struct.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.obj: google/protobuf/util/internal/testdata/struct.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/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.obj `if test -f 'google/protobuf/util/internal/testdata/struct.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/struct.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/struct.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/struct.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-struct.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/util/internal/testdata/protobuf_lazy_descriptor_test-struct.pb.obj `if test -f 'google/protobuf/util/internal/testdata/struct.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/struct.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/struct.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.o: google/protobuf/util/internal/testdata/timestamp_duration.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/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.o `test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.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/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.o `test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/timestamp_duration.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.obj: google/protobuf/util/internal/testdata/timestamp_duration.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/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.obj `if test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.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/util/internal/testdata/protobuf_lazy_descriptor_test-timestamp_duration.pb.obj `if test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.o: google/protobuf/util/internal/testdata/wrappers.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/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.o `test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/wrappers.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.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/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.o `test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/wrappers.pb.cc - -google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.obj: google/protobuf/util/internal/testdata/wrappers.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/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.obj `if test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/wrappers.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/wrappers.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.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/util/internal/testdata/protobuf_lazy_descriptor_test-wrappers.pb.obj `if test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/wrappers.pb.cc'; fi` - -google/protobuf/util/protobuf_lazy_descriptor_test-json_format.pb.o: google/protobuf/util/json_format.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/util/protobuf_lazy_descriptor_test-json_format.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Tpo -c -o google/protobuf/util/protobuf_lazy_descriptor_test-json_format.pb.o `test -f 'google/protobuf/util/json_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format.pb.cc' object='google/protobuf/util/protobuf_lazy_descriptor_test-json_format.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/util/protobuf_lazy_descriptor_test-json_format.pb.o `test -f 'google/protobuf/util/json_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format.pb.cc - -google/protobuf/util/protobuf_lazy_descriptor_test-json_format.pb.obj: google/protobuf/util/json_format.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/util/protobuf_lazy_descriptor_test-json_format.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Tpo -c -o google/protobuf/util/protobuf_lazy_descriptor_test-json_format.pb.obj `if test -f 'google/protobuf/util/json_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format.pb.cc' object='google/protobuf/util/protobuf_lazy_descriptor_test-json_format.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/util/protobuf_lazy_descriptor_test-json_format.pb.obj `if test -f 'google/protobuf/util/json_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format.pb.cc'; fi` - -google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.o: google/protobuf/util/json_format_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/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Tpo -c -o google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.o `test -f 'google/protobuf/util/json_format_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format_proto3.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format_proto3.pb.cc' object='google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.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/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.o `test -f 'google/protobuf/util/json_format_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format_proto3.pb.cc - -google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.obj: google/protobuf/util/json_format_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/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Tpo -c -o google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.obj `if test -f 'google/protobuf/util/json_format_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format_proto3.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format_proto3.pb.cc' object='google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.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/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.obj `if test -f 'google/protobuf/util/json_format_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format_proto3.pb.cc'; fi` - -google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.o: google/protobuf/util/message_differencer_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/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Tpo -c -o google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.o `test -f 'google/protobuf/util/message_differencer_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.pb.cc' object='google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_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/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.o `test -f 'google/protobuf/util/message_differencer_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.pb.cc - -google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.obj: google/protobuf/util/message_differencer_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/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Tpo -c -o google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.obj `if test -f 'google/protobuf/util/message_differencer_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.pb.cc' object='google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_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/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.obj `if test -f 'google/protobuf/util/message_differencer_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.pb.cc'; fi` - -google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.o: google/protobuf/lite_arena_unittest.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-lite_arena_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Tpo -c -o google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.o `test -f 'google/protobuf/lite_arena_unittest.cc' || echo '$(srcdir)/'`google/protobuf/lite_arena_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/lite_arena_unittest.cc' object='google/protobuf/protobuf_lite_arena_test-lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.o `test -f 'google/protobuf/lite_arena_unittest.cc' || echo '$(srcdir)/'`google/protobuf/lite_arena_unittest.cc - -google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.obj: google/protobuf/lite_arena_unittest.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-lite_arena_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Tpo -c -o google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.obj `if test -f 'google/protobuf/lite_arena_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/lite_arena_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/lite_arena_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/lite_arena_unittest.cc' object='google/protobuf/protobuf_lite_arena_test-lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.obj `if test -f 'google/protobuf/lite_arena_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/lite_arena_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/lite_arena_unittest.cc'; fi` - -google/protobuf/protobuf_lite_arena_test-arena_test_util.o: google/protobuf/arena_test_util.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-arena_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc - -google/protobuf/protobuf_lite_arena_test-arena_test_util.obj: google/protobuf/arena_test_util.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-arena_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-map_lite_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_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_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-map_lite_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_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_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-test_util_lite.o: google/protobuf/test_util_lite.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-test_util_lite.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc - -google/protobuf/protobuf_lite_arena_test-test_util_lite.obj: google/protobuf/test_util_lite.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-test_util_lite.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_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_lite_arena_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_lite_arena_test-map_lite_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_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc - -google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.obj: google/protobuf/map_lite_unittest.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-map_lite_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_lite_arena_test-map_lite_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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_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) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -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 - -google/protobuf/protobuf_lite_arena_test-unittest_import_lite.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_import_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_import_lite.pb.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` - -google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.o: google/protobuf/unittest_import_public_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_public_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_import_public_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_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc - -google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.obj: google/protobuf/unittest_import_public_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_public_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_import_public_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/lite_unittest.cc' object='google/protobuf/protobuf_lite_test-lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-lite_unittest.o `test -f 'google/protobuf/lite_unittest.cc' || echo '$(srcdir)/'`google/protobuf/lite_unittest.cc - -google/protobuf/protobuf_lite_test-lite_unittest.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Tpo -c -o google/protobuf/protobuf_lite_test-lite_unittest.obj `if test -f 'google/protobuf/lite_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/lite_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/lite_unittest.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/lite_unittest.cc' object='google/protobuf/protobuf_lite_test-lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-lite_unittest.obj `if test -f 'google/protobuf/lite_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/lite_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/lite_unittest.cc'; fi` - -google/protobuf/protobuf_lite_test-arena_test_util.o: google/protobuf/arena_test_util.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-arena_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc - -google/protobuf/protobuf_lite_test-arena_test_util.obj: google/protobuf/arena_test_util.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-arena_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_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_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-map_lite_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_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_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_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_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-map_lite_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_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_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_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_lite_test-test_util_lite.o: google/protobuf/test_util_lite.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-test_util_lite.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc - -google/protobuf/protobuf_lite_test-test_util_lite.obj: google/protobuf/test_util_lite.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-test_util_lite.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_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_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-map_lite_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Tpo -c -o google/protobuf/protobuf_lite_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_lite_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_lite_test-map_lite_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_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc - -google/protobuf/protobuf_lite_test-map_lite_unittest.pb.obj: google/protobuf/map_lite_unittest.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-map_lite_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_lite_test-map_lite_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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_lite_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) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -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 - -google/protobuf/protobuf_lite_test-unittest_import_lite.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_import_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_import_lite.pb.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` - -google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.o: google/protobuf/unittest_import_public_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_public_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_import_public_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_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc - -google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.obj: google/protobuf/unittest_import_public_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_public_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_import_public_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_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_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_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-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/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/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/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/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/protobuf_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc - -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/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/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/protobuf_test-reflection_tester.o `test -f 'google/protobuf/reflection_tester.cc' || echo '$(srcdir)/'`google/protobuf/reflection_tester.cc - -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/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/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-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/testing/protobuf_test-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.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@ -@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` - -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/testing/protobuf_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.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@ -@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` - -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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-any_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-any_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.cc' object='google/protobuf/protobuf_test-any_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-any_test.o `test -f 'google/protobuf/any_test.cc' || echo '$(srcdir)/'`google/protobuf/any_test.cc - -google/protobuf/protobuf_test-any_test.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-any_test.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-any_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-any_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.cc' object='google/protobuf/protobuf_test-any_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/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-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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_unittest.cc' object='google/protobuf/protobuf_test-arena_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-arena_unittest.o `test -f 'google/protobuf/arena_unittest.cc' || echo '$(srcdir)/'`google/protobuf/arena_unittest.cc - -google/protobuf/protobuf_test-arena_unittest.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_unittest.cc' object='google/protobuf/protobuf_test-arena_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-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-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-arenaz_sampler_test.o: google/protobuf/arenaz_sampler_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-arenaz_sampler_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Tpo -c -o google/protobuf/protobuf_test-arenaz_sampler_test.o `test -f 'google/protobuf/arenaz_sampler_test.cc' || echo '$(srcdir)/'`google/protobuf/arenaz_sampler_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arenaz_sampler_test.cc' object='google/protobuf/protobuf_test-arenaz_sampler_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-arenaz_sampler_test.o `test -f 'google/protobuf/arenaz_sampler_test.cc' || echo '$(srcdir)/'`google/protobuf/arenaz_sampler_test.cc - -google/protobuf/protobuf_test-arenaz_sampler_test.obj: google/protobuf/arenaz_sampler_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-arenaz_sampler_test.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Tpo -c -o google/protobuf/protobuf_test-arenaz_sampler_test.obj `if test -f 'google/protobuf/arenaz_sampler_test.cc'; then $(CYGPATH_W) 'google/protobuf/arenaz_sampler_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arenaz_sampler_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arenaz_sampler_test.cc' object='google/protobuf/protobuf_test-arenaz_sampler_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/protobuf_test-arenaz_sampler_test.obj `if test -f 'google/protobuf/arenaz_sampler_test.cc'; then $(CYGPATH_W) 'google/protobuf/arenaz_sampler_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arenaz_sampler_test.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-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-bootstrap_unittest.o: google/protobuf/compiler/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-bootstrap_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-bootstrap_unittest.o `test -f 'google/protobuf/compiler/cpp/bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/bootstrap_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-bootstrap_unittest.o `test -f 'google/protobuf/compiler/cpp/bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/bootstrap_unittest.cc - -google/protobuf/compiler/cpp/protobuf_test-bootstrap_unittest.obj: google/protobuf/compiler/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-bootstrap_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/cpp/bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/bootstrap_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/bootstrap_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/cpp/bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/bootstrap_unittest.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_test-message_size_unittest.o: google/protobuf/compiler/cpp/message_size_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-message_size_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-message_size_unittest.o `test -f 'google/protobuf/compiler/cpp/message_size_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/message_size_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/message_size_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-message_size_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-message_size_unittest.o `test -f 'google/protobuf/compiler/cpp/message_size_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/message_size_unittest.cc - -google/protobuf/compiler/cpp/protobuf_test-message_size_unittest.obj: google/protobuf/compiler/cpp/message_size_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-message_size_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-message_size_unittest.obj `if test -f 'google/protobuf/compiler/cpp/message_size_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/message_size_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/message_size_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/message_size_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-message_size_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-message_size_unittest.obj `if test -f 'google/protobuf/compiler/cpp/message_size_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/message_size_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/message_size_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/cpp/protobuf_test-move_unittest.o: google/protobuf/compiler/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-move_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-move_unittest.o `test -f 'google/protobuf/compiler/cpp/move_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/move_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/move_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-move_unittest.o `test -f 'google/protobuf/compiler/cpp/move_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/move_unittest.cc - -google/protobuf/compiler/cpp/protobuf_test-move_unittest.obj: google/protobuf/compiler/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-move_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-move_unittest.obj `if test -f 'google/protobuf/compiler/cpp/move_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/move_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/move_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/move_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-move_unittest.obj `if test -f 'google/protobuf/compiler/cpp/move_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/move_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/move_unittest.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_test-plugin_unittest.o: google/protobuf/compiler/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-plugin_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-plugin_unittest.o `test -f 'google/protobuf/compiler/cpp/plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/plugin_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-plugin_unittest.o `test -f 'google/protobuf/compiler/cpp/plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/plugin_unittest.cc - -google/protobuf/compiler/cpp/protobuf_test-plugin_unittest.obj: google/protobuf/compiler/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-plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-plugin_unittest.obj `if test -f 'google/protobuf/compiler/cpp/plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/plugin_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/plugin_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-plugin_unittest.obj `if test -f 'google/protobuf/compiler/cpp/plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/plugin_unittest.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_test-unittest.o: google/protobuf/compiler/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-unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-unittest.o `test -f 'google/protobuf/compiler/cpp/unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-unittest.o `test -f 'google/protobuf/compiler/cpp/unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/unittest.cc - -google/protobuf/compiler/cpp/protobuf_test-unittest.obj: google/protobuf/compiler/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-unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-unittest.obj `if test -f 'google/protobuf/compiler/cpp/unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-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-unittest.obj `if test -f 'google/protobuf/compiler/cpp/unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/unittest.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-doc_comment_unittest.o: google/protobuf/compiler/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-doc_comment_unittest.o -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-doc_comment_unittest.o `test -f 'google/protobuf/compiler/java/doc_comment_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/doc_comment_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/doc_comment_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-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-doc_comment_unittest.o `test -f 'google/protobuf/compiler/java/doc_comment_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/doc_comment_unittest.cc - -google/protobuf/compiler/java/protobuf_test-doc_comment_unittest.obj: google/protobuf/compiler/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-doc_comment_unittest.obj -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-doc_comment_unittest.obj `if test -f 'google/protobuf/compiler/java/doc_comment_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/doc_comment_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/doc_comment_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/doc_comment_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-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-doc_comment_unittest.obj `if test -f 'google/protobuf/compiler/java/doc_comment_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/doc_comment_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/doc_comment_unittest.cc'; fi` - -google/protobuf/compiler/java/protobuf_test-plugin_unittest.o: google/protobuf/compiler/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-plugin_unittest.o -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-plugin_unittest.o `test -f 'google/protobuf/compiler/java/plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/plugin_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-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-plugin_unittest.o `test -f 'google/protobuf/compiler/java/plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/plugin_unittest.cc - -google/protobuf/compiler/java/protobuf_test-plugin_unittest.obj: google/protobuf/compiler/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-plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-plugin_unittest.obj `if test -f 'google/protobuf/compiler/java/plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/plugin_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/plugin_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-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-plugin_unittest.obj `if test -f 'google/protobuf/compiler/java/plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/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-plugin_unittest.o: google/protobuf/compiler/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-plugin_unittest.o -MD -MP -MF google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo -c -o google/protobuf/compiler/python/protobuf_test-plugin_unittest.o `test -f 'google/protobuf/compiler/python/plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/python/plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/python/plugin_unittest.cc' object='google/protobuf/compiler/python/protobuf_test-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-plugin_unittest.o `test -f 'google/protobuf/compiler/python/plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/python/plugin_unittest.cc - -google/protobuf/compiler/python/protobuf_test-plugin_unittest.obj: google/protobuf/compiler/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-plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo -c -o google/protobuf/compiler/python/protobuf_test-plugin_unittest.obj `if test -f 'google/protobuf/compiler/python/plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/python/plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/python/plugin_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Tpo google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/python/plugin_unittest.cc' object='google/protobuf/compiler/python/protobuf_test-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-plugin_unittest.obj `if test -f 'google/protobuf/compiler/python/plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/python/plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/drop_unknown_fields_test.cc' object='google/protobuf/protobuf_test-drop_unknown_fields_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-drop_unknown_fields_test.o `test -f 'google/protobuf/drop_unknown_fields_test.cc' || echo '$(srcdir)/'`google/protobuf/drop_unknown_fields_test.cc - -google/protobuf/protobuf_test-drop_unknown_fields_test.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Tpo -c -o google/protobuf/protobuf_test-drop_unknown_fields_test.obj `if test -f 'google/protobuf/drop_unknown_fields_test.cc'; then $(CYGPATH_W) 'google/protobuf/drop_unknown_fields_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/drop_unknown_fields_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/drop_unknown_fields_test.cc' object='google/protobuf/protobuf_test-drop_unknown_fields_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/protobuf_test-drop_unknown_fields_test.obj `if test -f 'google/protobuf/drop_unknown_fields_test.cc'; then $(CYGPATH_W) 'google/protobuf/drop_unknown_fields_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/drop_unknown_fields_test.cc'; fi` - -google/protobuf/protobuf_test-dynamic_message_unittest.o: google/protobuf/dynamic_message_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-dynamic_message_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Tpo -c -o google/protobuf/protobuf_test-dynamic_message_unittest.o `test -f 'google/protobuf/dynamic_message_unittest.cc' || echo '$(srcdir)/'`google/protobuf/dynamic_message_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/dynamic_message_unittest.cc' object='google/protobuf/protobuf_test-dynamic_message_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-dynamic_message_unittest.o `test -f 'google/protobuf/dynamic_message_unittest.cc' || echo '$(srcdir)/'`google/protobuf/dynamic_message_unittest.cc - -google/protobuf/protobuf_test-dynamic_message_unittest.obj: google/protobuf/dynamic_message_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-dynamic_message_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Tpo -c -o google/protobuf/protobuf_test-dynamic_message_unittest.obj `if test -f 'google/protobuf/dynamic_message_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/dynamic_message_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/dynamic_message_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/dynamic_message_unittest.cc' object='google/protobuf/protobuf_test-dynamic_message_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-dynamic_message_unittest.obj `if test -f 'google/protobuf/dynamic_message_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/dynamic_message_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/dynamic_message_unittest.cc'; fi` - -google/protobuf/protobuf_test-extension_set_unittest.o: google/protobuf/extension_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-extension_set_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Tpo -c -o google/protobuf/protobuf_test-extension_set_unittest.o `test -f 'google/protobuf/extension_set_unittest.cc' || echo '$(srcdir)/'`google/protobuf/extension_set_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/extension_set_unittest.cc' object='google/protobuf/protobuf_test-extension_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-extension_set_unittest.o `test -f 'google/protobuf/extension_set_unittest.cc' || echo '$(srcdir)/'`google/protobuf/extension_set_unittest.cc - -google/protobuf/protobuf_test-extension_set_unittest.obj: google/protobuf/extension_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-extension_set_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Tpo -c -o google/protobuf/protobuf_test-extension_set_unittest.obj `if test -f 'google/protobuf/extension_set_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/extension_set_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/extension_set_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/extension_set_unittest.cc' object='google/protobuf/protobuf_test-extension_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-extension_set_unittest.obj `if test -f 'google/protobuf/extension_set_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/extension_set_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/extension_set_unittest.cc'; fi` - -google/protobuf/protobuf_test-generated_message_reflection_unittest.o: google/protobuf/generated_message_reflection_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-generated_message_reflection_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Tpo -c -o google/protobuf/protobuf_test-generated_message_reflection_unittest.o `test -f 'google/protobuf/generated_message_reflection_unittest.cc' || echo '$(srcdir)/'`google/protobuf/generated_message_reflection_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/generated_message_reflection_unittest.cc' object='google/protobuf/protobuf_test-generated_message_reflection_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-generated_message_reflection_unittest.o `test -f 'google/protobuf/generated_message_reflection_unittest.cc' || echo '$(srcdir)/'`google/protobuf/generated_message_reflection_unittest.cc - -google/protobuf/protobuf_test-generated_message_reflection_unittest.obj: google/protobuf/generated_message_reflection_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-generated_message_reflection_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/generated_message_reflection_unittest.cc' object='google/protobuf/protobuf_test-generated_message_reflection_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-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-generated_message_tctable_lite_test.o: google/protobuf/generated_message_tctable_lite_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-generated_message_tctable_lite_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-generated_message_tctable_lite_test.Tpo -c -o google/protobuf/protobuf_test-generated_message_tctable_lite_test.o `test -f 'google/protobuf/generated_message_tctable_lite_test.cc' || echo '$(srcdir)/'`google/protobuf/generated_message_tctable_lite_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-generated_message_tctable_lite_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-generated_message_tctable_lite_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/generated_message_tctable_lite_test.cc' object='google/protobuf/protobuf_test-generated_message_tctable_lite_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-generated_message_tctable_lite_test.o `test -f 'google/protobuf/generated_message_tctable_lite_test.cc' || echo '$(srcdir)/'`google/protobuf/generated_message_tctable_lite_test.cc - -google/protobuf/protobuf_test-generated_message_tctable_lite_test.obj: google/protobuf/generated_message_tctable_lite_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-generated_message_tctable_lite_test.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-generated_message_tctable_lite_test.Tpo -c -o google/protobuf/protobuf_test-generated_message_tctable_lite_test.obj `if test -f 'google/protobuf/generated_message_tctable_lite_test.cc'; then $(CYGPATH_W) 'google/protobuf/generated_message_tctable_lite_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/generated_message_tctable_lite_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-generated_message_tctable_lite_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-generated_message_tctable_lite_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/generated_message_tctable_lite_test.cc' object='google/protobuf/protobuf_test-generated_message_tctable_lite_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/protobuf_test-generated_message_tctable_lite_test.obj `if test -f 'google/protobuf/generated_message_tctable_lite_test.cc'; then $(CYGPATH_W) 'google/protobuf/generated_message_tctable_lite_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/generated_message_tctable_lite_test.cc'; fi` - -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 - -google/protobuf/protobuf_test-map_field_test.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Tpo -c -o google/protobuf/protobuf_test-map_field_test.obj `if test -f 'google/protobuf/map_field_test.cc'; then $(CYGPATH_W) 'google/protobuf/map_field_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_field_test.cc'; fi` -@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.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-map_field_test.obj `if test -f 'google/protobuf/map_field_test.cc'; then $(CYGPATH_W) 'google/protobuf/map_field_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_field_test.cc'; fi` - -google/protobuf/protobuf_test-map_test.o: google/protobuf/map_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_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_test.Tpo -c -o google/protobuf/protobuf_test-map_test.o `test -f 'google/protobuf/map_test.cc' || echo '$(srcdir)/'`google/protobuf/map_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_test.cc' object='google/protobuf/protobuf_test-map_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_test.o `test -f 'google/protobuf/map_test.cc' || echo '$(srcdir)/'`google/protobuf/map_test.cc - -google/protobuf/protobuf_test-map_test.obj: google/protobuf/map_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_test.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_test.Tpo -c -o google/protobuf/protobuf_test-map_test.obj `if test -f 'google/protobuf/map_test.cc'; then $(CYGPATH_W) 'google/protobuf/map_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_test.cc' object='google/protobuf/protobuf_test-map_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/protobuf_test-map_test.obj `if test -f 'google/protobuf/map_test.cc'; then $(CYGPATH_W) 'google/protobuf/map_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_test.cc'; fi` - -google/protobuf/protobuf_test-message_unittest.o: google/protobuf/message_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-message_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Tpo -c -o google/protobuf/protobuf_test-message_unittest.o `test -f 'google/protobuf/message_unittest.cc' || echo '$(srcdir)/'`google/protobuf/message_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/message_unittest.cc' object='google/protobuf/protobuf_test-message_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-message_unittest.o `test -f 'google/protobuf/message_unittest.cc' || echo '$(srcdir)/'`google/protobuf/message_unittest.cc - -google/protobuf/protobuf_test-message_unittest.obj: google/protobuf/message_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-message_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Tpo -c -o google/protobuf/protobuf_test-message_unittest.obj `if test -f 'google/protobuf/message_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/message_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/message_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/message_unittest.cc' object='google/protobuf/protobuf_test-message_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-message_unittest.obj `if test -f 'google/protobuf/message_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/message_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/message_unittest.cc'; fi` - -google/protobuf/protobuf_test-no_field_presence_test.o: google/protobuf/no_field_presence_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-no_field_presence_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Tpo -c -o google/protobuf/protobuf_test-no_field_presence_test.o `test -f 'google/protobuf/no_field_presence_test.cc' || echo '$(srcdir)/'`google/protobuf/no_field_presence_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/no_field_presence_test.cc' object='google/protobuf/protobuf_test-no_field_presence_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-no_field_presence_test.o `test -f 'google/protobuf/no_field_presence_test.cc' || echo '$(srcdir)/'`google/protobuf/no_field_presence_test.cc - -google/protobuf/protobuf_test-no_field_presence_test.obj: google/protobuf/no_field_presence_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-no_field_presence_test.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Tpo -c -o google/protobuf/protobuf_test-no_field_presence_test.obj `if test -f 'google/protobuf/no_field_presence_test.cc'; then $(CYGPATH_W) 'google/protobuf/no_field_presence_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/no_field_presence_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/no_field_presence_test.cc' object='google/protobuf/protobuf_test-no_field_presence_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/protobuf_test-no_field_presence_test.obj `if test -f 'google/protobuf/no_field_presence_test.cc'; then $(CYGPATH_W) 'google/protobuf/no_field_presence_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/no_field_presence_test.cc'; fi` - -google/protobuf/protobuf_test-preserve_unknown_enum_test.o: google/protobuf/preserve_unknown_enum_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-preserve_unknown_enum_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Tpo -c -o google/protobuf/protobuf_test-preserve_unknown_enum_test.o `test -f 'google/protobuf/preserve_unknown_enum_test.cc' || echo '$(srcdir)/'`google/protobuf/preserve_unknown_enum_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/preserve_unknown_enum_test.cc' object='google/protobuf/protobuf_test-preserve_unknown_enum_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-preserve_unknown_enum_test.o `test -f 'google/protobuf/preserve_unknown_enum_test.cc' || echo '$(srcdir)/'`google/protobuf/preserve_unknown_enum_test.cc - -google/protobuf/protobuf_test-preserve_unknown_enum_test.obj: google/protobuf/preserve_unknown_enum_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-preserve_unknown_enum_test.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Tpo -c -o google/protobuf/protobuf_test-preserve_unknown_enum_test.obj `if test -f 'google/protobuf/preserve_unknown_enum_test.cc'; then $(CYGPATH_W) 'google/protobuf/preserve_unknown_enum_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/preserve_unknown_enum_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/preserve_unknown_enum_test.cc' object='google/protobuf/protobuf_test-preserve_unknown_enum_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/protobuf_test-preserve_unknown_enum_test.obj `if test -f 'google/protobuf/preserve_unknown_enum_test.cc'; then $(CYGPATH_W) 'google/protobuf/preserve_unknown_enum_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/preserve_unknown_enum_test.cc'; fi` - -google/protobuf/protobuf_test-proto3_arena_lite_unittest.o: google/protobuf/proto3_arena_lite_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-proto3_arena_lite_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Tpo -c -o google/protobuf/protobuf_test-proto3_arena_lite_unittest.o `test -f 'google/protobuf/proto3_arena_lite_unittest.cc' || echo '$(srcdir)/'`google/protobuf/proto3_arena_lite_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/proto3_arena_lite_unittest.cc' object='google/protobuf/protobuf_test-proto3_arena_lite_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-proto3_arena_lite_unittest.o `test -f 'google/protobuf/proto3_arena_lite_unittest.cc' || echo '$(srcdir)/'`google/protobuf/proto3_arena_lite_unittest.cc - -google/protobuf/protobuf_test-proto3_arena_lite_unittest.obj: google/protobuf/proto3_arena_lite_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-proto3_arena_lite_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Tpo -c -o google/protobuf/protobuf_test-proto3_arena_lite_unittest.obj `if test -f 'google/protobuf/proto3_arena_lite_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/proto3_arena_lite_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/proto3_arena_lite_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/proto3_arena_lite_unittest.cc' object='google/protobuf/protobuf_test-proto3_arena_lite_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-proto3_arena_lite_unittest.obj `if test -f 'google/protobuf/proto3_arena_lite_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/proto3_arena_lite_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/proto3_arena_lite_unittest.cc'; fi` - -google/protobuf/protobuf_test-proto3_arena_unittest.o: google/protobuf/proto3_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-proto3_arena_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Tpo -c -o google/protobuf/protobuf_test-proto3_arena_unittest.o `test -f 'google/protobuf/proto3_arena_unittest.cc' || echo '$(srcdir)/'`google/protobuf/proto3_arena_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/proto3_arena_unittest.cc' object='google/protobuf/protobuf_test-proto3_arena_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-proto3_arena_unittest.o `test -f 'google/protobuf/proto3_arena_unittest.cc' || echo '$(srcdir)/'`google/protobuf/proto3_arena_unittest.cc - -google/protobuf/protobuf_test-proto3_arena_unittest.obj: google/protobuf/proto3_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-proto3_arena_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Tpo -c -o google/protobuf/protobuf_test-proto3_arena_unittest.obj `if test -f 'google/protobuf/proto3_arena_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/proto3_arena_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/proto3_arena_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/proto3_arena_unittest.cc' object='google/protobuf/protobuf_test-proto3_arena_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-proto3_arena_unittest.obj `if test -f 'google/protobuf/proto3_arena_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/proto3_arena_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/proto3_arena_unittest.cc'; fi` - -google/protobuf/protobuf_test-proto3_lite_unittest.o: google/protobuf/proto3_lite_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-proto3_lite_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Tpo -c -o google/protobuf/protobuf_test-proto3_lite_unittest.o `test -f 'google/protobuf/proto3_lite_unittest.cc' || echo '$(srcdir)/'`google/protobuf/proto3_lite_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/proto3_lite_unittest.cc' object='google/protobuf/protobuf_test-proto3_lite_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-proto3_lite_unittest.o `test -f 'google/protobuf/proto3_lite_unittest.cc' || echo '$(srcdir)/'`google/protobuf/proto3_lite_unittest.cc - -google/protobuf/protobuf_test-proto3_lite_unittest.obj: google/protobuf/proto3_lite_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-proto3_lite_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Tpo -c -o google/protobuf/protobuf_test-proto3_lite_unittest.obj `if test -f 'google/protobuf/proto3_lite_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/proto3_lite_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/proto3_lite_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/proto3_lite_unittest.cc' object='google/protobuf/protobuf_test-proto3_lite_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-proto3_lite_unittest.obj `if test -f 'google/protobuf/proto3_lite_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/proto3_lite_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/proto3_lite_unittest.cc'; fi` - -google/protobuf/protobuf_test-reflection_ops_unittest.o: google/protobuf/reflection_ops_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-reflection_ops_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Tpo -c -o google/protobuf/protobuf_test-reflection_ops_unittest.o `test -f 'google/protobuf/reflection_ops_unittest.cc' || echo '$(srcdir)/'`google/protobuf/reflection_ops_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/reflection_ops_unittest.cc' object='google/protobuf/protobuf_test-reflection_ops_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-reflection_ops_unittest.o `test -f 'google/protobuf/reflection_ops_unittest.cc' || echo '$(srcdir)/'`google/protobuf/reflection_ops_unittest.cc - -google/protobuf/protobuf_test-reflection_ops_unittest.obj: google/protobuf/reflection_ops_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-reflection_ops_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Tpo -c -o google/protobuf/protobuf_test-reflection_ops_unittest.obj `if test -f 'google/protobuf/reflection_ops_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/reflection_ops_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/reflection_ops_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/reflection_ops_unittest.cc' object='google/protobuf/protobuf_test-reflection_ops_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-reflection_ops_unittest.obj `if test -f 'google/protobuf/reflection_ops_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/reflection_ops_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/reflection_ops_unittest.cc'; fi` - -google/protobuf/protobuf_test-repeated_field_reflection_unittest.o: google/protobuf/repeated_field_reflection_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-repeated_field_reflection_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Tpo -c -o google/protobuf/protobuf_test-repeated_field_reflection_unittest.o `test -f 'google/protobuf/repeated_field_reflection_unittest.cc' || echo '$(srcdir)/'`google/protobuf/repeated_field_reflection_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/repeated_field_reflection_unittest.cc' object='google/protobuf/protobuf_test-repeated_field_reflection_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-repeated_field_reflection_unittest.o `test -f 'google/protobuf/repeated_field_reflection_unittest.cc' || echo '$(srcdir)/'`google/protobuf/repeated_field_reflection_unittest.cc - -google/protobuf/protobuf_test-repeated_field_reflection_unittest.obj: google/protobuf/repeated_field_reflection_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-repeated_field_reflection_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Tpo -c -o google/protobuf/protobuf_test-repeated_field_reflection_unittest.obj `if test -f 'google/protobuf/repeated_field_reflection_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/repeated_field_reflection_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/repeated_field_reflection_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/repeated_field_reflection_unittest.cc' object='google/protobuf/protobuf_test-repeated_field_reflection_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-repeated_field_reflection_unittest.obj `if test -f 'google/protobuf/repeated_field_reflection_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/repeated_field_reflection_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/repeated_field_reflection_unittest.cc'; fi` - -google/protobuf/protobuf_test-repeated_field_unittest.o: google/protobuf/repeated_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-repeated_field_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Tpo -c -o google/protobuf/protobuf_test-repeated_field_unittest.o `test -f 'google/protobuf/repeated_field_unittest.cc' || echo '$(srcdir)/'`google/protobuf/repeated_field_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/repeated_field_unittest.cc' object='google/protobuf/protobuf_test-repeated_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-repeated_field_unittest.o `test -f 'google/protobuf/repeated_field_unittest.cc' || echo '$(srcdir)/'`google/protobuf/repeated_field_unittest.cc - -google/protobuf/protobuf_test-repeated_field_unittest.obj: google/protobuf/repeated_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-repeated_field_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/repeated_field_unittest.cc' object='google/protobuf/protobuf_test-repeated_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-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/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/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/stubs/protobuf_test-status_test.o `test -f 'google/protobuf/stubs/status_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/status_test.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@ -@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` - -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/stubs/protobuf_test-statusor_test.o `test -f 'google/protobuf/stubs/statusor_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/statusor_test.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@ -@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` - -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/stubs/protobuf_test-stringpiece_unittest.o `test -f 'google/protobuf/stubs/stringpiece_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringpiece_unittest.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@ -@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` - -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/stubs/protobuf_test-stringprintf_unittest.o `test -f 'google/protobuf/stubs/stringprintf_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringprintf_unittest.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@ -@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` - -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/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/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/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/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/stubs/protobuf_test-strutil_unittest.o `test -f 'google/protobuf/stubs/strutil_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/strutil_unittest.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@ -@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` - -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/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/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/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/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/stubs/protobuf_test-time_test.o `test -f 'google/protobuf/stubs/time_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/time_test.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@ -@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` - -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/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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/delimited_message_util_test.cc' object='google/protobuf/util/protobuf_test-delimited_message_util_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/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 - -google/protobuf/util/protobuf_test-delimited_message_util_test.obj: 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.obj -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.obj `if test -f 'google/protobuf/util/delimited_message_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/delimited_message_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/delimited_message_util_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/delimited_message_util_test.cc' object='google/protobuf/util/protobuf_test-delimited_message_util_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/util/protobuf_test-delimited_message_util_test.obj `if test -f 'google/protobuf/util/delimited_message_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/delimited_message_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/delimited_message_util_test.cc'; fi` - -google/protobuf/util/protobuf_test-field_comparator_test.o: google/protobuf/util/field_comparator_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-field_comparator_test.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Tpo -c -o google/protobuf/util/protobuf_test-field_comparator_test.o `test -f 'google/protobuf/util/field_comparator_test.cc' || echo '$(srcdir)/'`google/protobuf/util/field_comparator_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/field_comparator_test.cc' object='google/protobuf/util/protobuf_test-field_comparator_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/util/protobuf_test-field_comparator_test.o `test -f 'google/protobuf/util/field_comparator_test.cc' || echo '$(srcdir)/'`google/protobuf/util/field_comparator_test.cc - -google/protobuf/util/protobuf_test-field_comparator_test.obj: google/protobuf/util/field_comparator_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-field_comparator_test.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Tpo -c -o google/protobuf/util/protobuf_test-field_comparator_test.obj `if test -f 'google/protobuf/util/field_comparator_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/field_comparator_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/field_comparator_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/field_comparator_test.cc' object='google/protobuf/util/protobuf_test-field_comparator_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/util/protobuf_test-field_comparator_test.obj `if test -f 'google/protobuf/util/field_comparator_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/field_comparator_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/field_comparator_test.cc'; fi` - -google/protobuf/util/protobuf_test-field_mask_util_test.o: google/protobuf/util/field_mask_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-field_mask_util_test.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Tpo -c -o google/protobuf/util/protobuf_test-field_mask_util_test.o `test -f 'google/protobuf/util/field_mask_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/field_mask_util_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/field_mask_util_test.cc' object='google/protobuf/util/protobuf_test-field_mask_util_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/util/protobuf_test-field_mask_util_test.o `test -f 'google/protobuf/util/field_mask_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/field_mask_util_test.cc - -google/protobuf/util/protobuf_test-field_mask_util_test.obj: google/protobuf/util/field_mask_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-field_mask_util_test.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Tpo -c -o google/protobuf/util/protobuf_test-field_mask_util_test.obj `if test -f 'google/protobuf/util/field_mask_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/field_mask_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/field_mask_util_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/field_mask_util_test.cc' object='google/protobuf/util/protobuf_test-field_mask_util_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/util/protobuf_test-field_mask_util_test.obj `if test -f 'google/protobuf/util/field_mask_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/field_mask_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/field_mask_util_test.cc'; fi` - -google/protobuf/util/internal/protobuf_test-default_value_objectwriter_test.o: google/protobuf/util/internal/default_value_objectwriter_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/internal/protobuf_test-default_value_objectwriter_test.o -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-default_value_objectwriter_test.o `test -f 'google/protobuf/util/internal/default_value_objectwriter_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/default_value_objectwriter_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/default_value_objectwriter_test.cc' object='google/protobuf/util/internal/protobuf_test-default_value_objectwriter_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/util/internal/protobuf_test-default_value_objectwriter_test.o `test -f 'google/protobuf/util/internal/default_value_objectwriter_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/default_value_objectwriter_test.cc - -google/protobuf/util/internal/protobuf_test-default_value_objectwriter_test.obj: google/protobuf/util/internal/default_value_objectwriter_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/internal/protobuf_test-default_value_objectwriter_test.obj -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-default_value_objectwriter_test.obj `if test -f 'google/protobuf/util/internal/default_value_objectwriter_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/default_value_objectwriter_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/default_value_objectwriter_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/default_value_objectwriter_test.cc' object='google/protobuf/util/internal/protobuf_test-default_value_objectwriter_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/util/internal/protobuf_test-default_value_objectwriter_test.obj `if test -f 'google/protobuf/util/internal/default_value_objectwriter_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/default_value_objectwriter_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/default_value_objectwriter_test.cc'; fi` - -google/protobuf/util/internal/protobuf_test-json_objectwriter_test.o: google/protobuf/util/internal/json_objectwriter_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/internal/protobuf_test-json_objectwriter_test.o -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-json_objectwriter_test.o `test -f 'google/protobuf/util/internal/json_objectwriter_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/json_objectwriter_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/json_objectwriter_test.cc' object='google/protobuf/util/internal/protobuf_test-json_objectwriter_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/util/internal/protobuf_test-json_objectwriter_test.o `test -f 'google/protobuf/util/internal/json_objectwriter_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/json_objectwriter_test.cc - -google/protobuf/util/internal/protobuf_test-json_objectwriter_test.obj: google/protobuf/util/internal/json_objectwriter_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/internal/protobuf_test-json_objectwriter_test.obj -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-json_objectwriter_test.obj `if test -f 'google/protobuf/util/internal/json_objectwriter_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/json_objectwriter_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/json_objectwriter_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/json_objectwriter_test.cc' object='google/protobuf/util/internal/protobuf_test-json_objectwriter_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/util/internal/protobuf_test-json_objectwriter_test.obj `if test -f 'google/protobuf/util/internal/json_objectwriter_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/json_objectwriter_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/json_objectwriter_test.cc'; fi` - -google/protobuf/util/internal/protobuf_test-json_stream_parser_test.o: google/protobuf/util/internal/json_stream_parser_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/internal/protobuf_test-json_stream_parser_test.o -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-json_stream_parser_test.o `test -f 'google/protobuf/util/internal/json_stream_parser_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/json_stream_parser_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/json_stream_parser_test.cc' object='google/protobuf/util/internal/protobuf_test-json_stream_parser_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/util/internal/protobuf_test-json_stream_parser_test.o `test -f 'google/protobuf/util/internal/json_stream_parser_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/json_stream_parser_test.cc - -google/protobuf/util/internal/protobuf_test-json_stream_parser_test.obj: google/protobuf/util/internal/json_stream_parser_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/internal/protobuf_test-json_stream_parser_test.obj -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-json_stream_parser_test.obj `if test -f 'google/protobuf/util/internal/json_stream_parser_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/json_stream_parser_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/json_stream_parser_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/json_stream_parser_test.cc' object='google/protobuf/util/internal/protobuf_test-json_stream_parser_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/util/internal/protobuf_test-json_stream_parser_test.obj `if test -f 'google/protobuf/util/internal/json_stream_parser_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/json_stream_parser_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/json_stream_parser_test.cc'; fi` - -google/protobuf/util/internal/protobuf_test-protostream_objectsource_test.o: google/protobuf/util/internal/protostream_objectsource_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/internal/protobuf_test-protostream_objectsource_test.o -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-protostream_objectsource_test.o `test -f 'google/protobuf/util/internal/protostream_objectsource_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/protostream_objectsource_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/protostream_objectsource_test.cc' object='google/protobuf/util/internal/protobuf_test-protostream_objectsource_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/util/internal/protobuf_test-protostream_objectsource_test.o `test -f 'google/protobuf/util/internal/protostream_objectsource_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/protostream_objectsource_test.cc - -google/protobuf/util/internal/protobuf_test-protostream_objectsource_test.obj: google/protobuf/util/internal/protostream_objectsource_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/internal/protobuf_test-protostream_objectsource_test.obj -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-protostream_objectsource_test.obj `if test -f 'google/protobuf/util/internal/protostream_objectsource_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/protostream_objectsource_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/protostream_objectsource_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/protostream_objectsource_test.cc' object='google/protobuf/util/internal/protobuf_test-protostream_objectsource_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/util/internal/protobuf_test-protostream_objectsource_test.obj `if test -f 'google/protobuf/util/internal/protostream_objectsource_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/protostream_objectsource_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/protostream_objectsource_test.cc'; fi` - -google/protobuf/util/internal/protobuf_test-protostream_objectwriter_test.o: google/protobuf/util/internal/protostream_objectwriter_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/internal/protobuf_test-protostream_objectwriter_test.o -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-protostream_objectwriter_test.o `test -f 'google/protobuf/util/internal/protostream_objectwriter_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/protostream_objectwriter_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/protostream_objectwriter_test.cc' object='google/protobuf/util/internal/protobuf_test-protostream_objectwriter_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/util/internal/protobuf_test-protostream_objectwriter_test.o `test -f 'google/protobuf/util/internal/protostream_objectwriter_test.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/protostream_objectwriter_test.cc - -google/protobuf/util/internal/protobuf_test-protostream_objectwriter_test.obj: google/protobuf/util/internal/protostream_objectwriter_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/internal/protobuf_test-protostream_objectwriter_test.obj -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Tpo -c -o google/protobuf/util/internal/protobuf_test-protostream_objectwriter_test.obj `if test -f 'google/protobuf/util/internal/protostream_objectwriter_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/protostream_objectwriter_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/protostream_objectwriter_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/protostream_objectwriter_test.cc' object='google/protobuf/util/internal/protobuf_test-protostream_objectwriter_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/util/internal/protobuf_test-protostream_objectwriter_test.obj `if test -f 'google/protobuf/util/internal/protostream_objectwriter_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/protostream_objectwriter_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/protostream_objectwriter_test.cc'; fi` - -google/protobuf/util/internal/protobuf_test-type_info_test_helper.o: google/protobuf/util/internal/type_info_test_helper.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/protobuf_test-type_info_test_helper.o -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Tpo -c -o google/protobuf/util/internal/protobuf_test-type_info_test_helper.o `test -f 'google/protobuf/util/internal/type_info_test_helper.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/type_info_test_helper.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/type_info_test_helper.cc' object='google/protobuf/util/internal/protobuf_test-type_info_test_helper.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/util/internal/protobuf_test-type_info_test_helper.o `test -f 'google/protobuf/util/internal/type_info_test_helper.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/type_info_test_helper.cc - -google/protobuf/util/internal/protobuf_test-type_info_test_helper.obj: google/protobuf/util/internal/type_info_test_helper.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/protobuf_test-type_info_test_helper.obj -MD -MP -MF google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Tpo -c -o google/protobuf/util/internal/protobuf_test-type_info_test_helper.obj `if test -f 'google/protobuf/util/internal/type_info_test_helper.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/type_info_test_helper.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/type_info_test_helper.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Tpo google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/type_info_test_helper.cc' object='google/protobuf/util/internal/protobuf_test-type_info_test_helper.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/util/internal/protobuf_test-type_info_test_helper.obj `if test -f 'google/protobuf/util/internal/type_info_test_helper.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/type_info_test_helper.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/type_info_test_helper.cc'; fi` - -google/protobuf/util/protobuf_test-json_util_test.o: google/protobuf/util/json_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-json_util_test.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Tpo -c -o google/protobuf/util/protobuf_test-json_util_test.o `test -f 'google/protobuf/util/json_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/json_util_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_util_test.cc' object='google/protobuf/util/protobuf_test-json_util_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/util/protobuf_test-json_util_test.o `test -f 'google/protobuf/util/json_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/json_util_test.cc - -google/protobuf/util/protobuf_test-json_util_test.obj: google/protobuf/util/json_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-json_util_test.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Tpo -c -o google/protobuf/util/protobuf_test-json_util_test.obj `if test -f 'google/protobuf/util/json_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_util_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_util_test.cc' object='google/protobuf/util/protobuf_test-json_util_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/util/protobuf_test-json_util_test.obj `if test -f 'google/protobuf/util/json_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_util_test.cc'; fi` - -google/protobuf/util/protobuf_test-message_differencer_unittest.o: google/protobuf/util/message_differencer_unittest.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-message_differencer_unittest.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Tpo -c -o google/protobuf/util/protobuf_test-message_differencer_unittest.o `test -f 'google/protobuf/util/message_differencer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.cc' object='google/protobuf/util/protobuf_test-message_differencer_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/util/protobuf_test-message_differencer_unittest.o `test -f 'google/protobuf/util/message_differencer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.cc - -google/protobuf/util/protobuf_test-message_differencer_unittest.obj: google/protobuf/util/message_differencer_unittest.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-message_differencer_unittest.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Tpo -c -o google/protobuf/util/protobuf_test-message_differencer_unittest.obj `if test -f 'google/protobuf/util/message_differencer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.cc' object='google/protobuf/util/protobuf_test-message_differencer_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/util/protobuf_test-message_differencer_unittest.obj `if test -f 'google/protobuf/util/message_differencer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.cc'; fi` - -google/protobuf/util/protobuf_test-time_util_test.o: google/protobuf/util/time_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-time_util_test.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Tpo -c -o google/protobuf/util/protobuf_test-time_util_test.o `test -f 'google/protobuf/util/time_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/time_util_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/time_util_test.cc' object='google/protobuf/util/protobuf_test-time_util_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/util/protobuf_test-time_util_test.o `test -f 'google/protobuf/util/time_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/time_util_test.cc - -google/protobuf/util/protobuf_test-time_util_test.obj: google/protobuf/util/time_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-time_util_test.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Tpo -c -o google/protobuf/util/protobuf_test-time_util_test.obj `if test -f 'google/protobuf/util/time_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/time_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/time_util_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/time_util_test.cc' object='google/protobuf/util/protobuf_test-time_util_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/util/protobuf_test-time_util_test.obj `if test -f 'google/protobuf/util/time_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/time_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/time_util_test.cc'; fi` - -google/protobuf/util/protobuf_test-type_resolver_util_test.o: google/protobuf/util/type_resolver_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-type_resolver_util_test.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Tpo -c -o google/protobuf/util/protobuf_test-type_resolver_util_test.o `test -f 'google/protobuf/util/type_resolver_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/type_resolver_util_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/type_resolver_util_test.cc' object='google/protobuf/util/protobuf_test-type_resolver_util_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/util/protobuf_test-type_resolver_util_test.o `test -f 'google/protobuf/util/type_resolver_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/type_resolver_util_test.cc - -google/protobuf/util/protobuf_test-type_resolver_util_test.obj: google/protobuf/util/type_resolver_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-type_resolver_util_test.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/type_resolver_util_test.cc' object='google/protobuf/util/protobuf_test-type_resolver_util_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/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/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/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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_test-map_lite_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-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc - -google/protobuf/protobuf_test-map_lite_unittest.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_unittest.pb.cc' object='google/protobuf/protobuf_test-map_lite_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-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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_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) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -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 - -google/protobuf/protobuf_test-unittest_import_lite.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import_lite.pb.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_import_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_import_lite.pb.obj `if test -f 'google/protobuf/unittest_import_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_lite.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_import_public_lite.pb.o: google/protobuf/unittest_import_public_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_public_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_import_public_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_import_public_lite.pb.o `test -f 'google/protobuf/unittest_import_public_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public_lite.pb.cc - -google/protobuf/protobuf_test-unittest_import_public_lite.pb.obj: google/protobuf/unittest_import_public_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_public_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_import_public_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.pb.cc' object='google/protobuf/protobuf_test-any_test.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-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/any_test.pb.cc - -google/protobuf/protobuf_test-any_test.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Tpo -c -o google/protobuf/protobuf_test-any_test.pb.obj `if test -f 'google/protobuf/any_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/any_test.pb.cc' object='google/protobuf/protobuf_test-any_test.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-any_test.pb.obj `if test -f 'google/protobuf/any_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.pb.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.pb.o: google/protobuf/compiler/cpp/test_bad_identifiers.pb.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-test_bad_identifiers.pb.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.pb.o `test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' object='google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.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/compiler/cpp/protobuf_test-test_bad_identifiers.pb.o `test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc - -google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.pb.obj: google/protobuf/compiler/cpp/test_bad_identifiers.pb.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-test_bad_identifiers.pb.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc' object='google/protobuf/compiler/cpp/protobuf_test-test_bad_identifiers.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/compiler/cpp/protobuf_test-test_bad_identifiers.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_bad_identifiers.pb.cc'; fi` - -google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.pb.o: google/protobuf/compiler/cpp/test_large_enum_value.pb.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-test_large_enum_value.pb.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.pb.o `test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_large_enum_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' object='google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.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/compiler/cpp/protobuf_test-test_large_enum_value.pb.o `test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/test_large_enum_value.pb.cc - -google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.pb.obj: google/protobuf/compiler/cpp/test_large_enum_value.pb.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-test_large_enum_value.pb.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/test_large_enum_value.pb.cc' object='google/protobuf/compiler/cpp/protobuf_test-test_large_enum_value.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/compiler/cpp/protobuf_test-test_large_enum_value.pb.obj `if test -f 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/test_large_enum_value.pb.cc'; fi` - -google/protobuf/protobuf_test-map_proto2_unittest.pb.o: google/protobuf/map_proto2_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_proto2_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Tpo -c -o google/protobuf/protobuf_test-map_proto2_unittest.pb.o `test -f 'google/protobuf/map_proto2_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_proto2_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_proto2_unittest.pb.cc' object='google/protobuf/protobuf_test-map_proto2_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-map_proto2_unittest.pb.o `test -f 'google/protobuf/map_proto2_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_proto2_unittest.pb.cc - -google/protobuf/protobuf_test-map_proto2_unittest.pb.obj: google/protobuf/map_proto2_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_proto2_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Tpo -c -o google/protobuf/protobuf_test-map_proto2_unittest.pb.obj `if test -f 'google/protobuf/map_proto2_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_proto2_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_proto2_unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_proto2_unittest.pb.cc' object='google/protobuf/protobuf_test-map_proto2_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-map_proto2_unittest.pb.obj `if test -f 'google/protobuf/map_proto2_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_proto2_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_proto2_unittest.pb.cc'; fi` - -google/protobuf/protobuf_test-map_unittest.pb.o: google/protobuf/map_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_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Tpo -c -o google/protobuf/protobuf_test-map_unittest.pb.o `test -f 'google/protobuf/map_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_unittest.pb.cc' object='google/protobuf/protobuf_test-map_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-map_unittest.pb.o `test -f 'google/protobuf/map_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_unittest.pb.cc - -google/protobuf/protobuf_test-map_unittest.pb.obj: google/protobuf/map_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_unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_unittest.pb.cc' object='google/protobuf/protobuf_test-map_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-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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_arena.pb.cc' object='google/protobuf/protobuf_test-unittest_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_arena.pb.o `test -f 'google/protobuf/unittest_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_arena.pb.cc - -google/protobuf/protobuf_test-unittest_arena.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_arena.pb.obj `if test -f 'google/protobuf/unittest_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_arena.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_arena.pb.cc' object='google/protobuf/protobuf_test-unittest_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_arena.pb.obj `if test -f 'google/protobuf/unittest_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_arena.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_custom_options.pb.o: google/protobuf/unittest_custom_options.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_custom_options.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_custom_options.pb.o `test -f 'google/protobuf/unittest_custom_options.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_custom_options.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_custom_options.pb.cc' object='google/protobuf/protobuf_test-unittest_custom_options.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_custom_options.pb.o `test -f 'google/protobuf/unittest_custom_options.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_custom_options.pb.cc - -google/protobuf/protobuf_test-unittest_custom_options.pb.obj: google/protobuf/unittest_custom_options.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_custom_options.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_custom_options.pb.obj `if test -f 'google/protobuf/unittest_custom_options.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_custom_options.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_custom_options.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_custom_options.pb.cc' object='google/protobuf/protobuf_test-unittest_custom_options.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_custom_options.pb.obj `if test -f 'google/protobuf/unittest_custom_options.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_custom_options.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_custom_options.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_drop_unknown_fields.pb.o: google/protobuf/unittest_drop_unknown_fields.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_drop_unknown_fields.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_drop_unknown_fields.pb.o `test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_drop_unknown_fields.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_drop_unknown_fields.pb.cc' object='google/protobuf/protobuf_test-unittest_drop_unknown_fields.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_drop_unknown_fields.pb.o `test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_drop_unknown_fields.pb.cc - -google/protobuf/protobuf_test-unittest_drop_unknown_fields.pb.obj: google/protobuf/unittest_drop_unknown_fields.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_drop_unknown_fields.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_drop_unknown_fields.pb.obj `if test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_drop_unknown_fields.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_drop_unknown_fields.pb.cc' object='google/protobuf/protobuf_test-unittest_drop_unknown_fields.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_drop_unknown_fields.pb.obj `if test -f 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_drop_unknown_fields.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_drop_unknown_fields.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_embed_optimize_for.pb.o: google/protobuf/unittest_embed_optimize_for.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_embed_optimize_for.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_embed_optimize_for.pb.o `test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_embed_optimize_for.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_embed_optimize_for.pb.cc' object='google/protobuf/protobuf_test-unittest_embed_optimize_for.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_embed_optimize_for.pb.o `test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_embed_optimize_for.pb.cc - -google/protobuf/protobuf_test-unittest_embed_optimize_for.pb.obj: google/protobuf/unittest_embed_optimize_for.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_embed_optimize_for.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_embed_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_embed_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_embed_optimize_for.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_embed_optimize_for.pb.cc' object='google/protobuf/protobuf_test-unittest_embed_optimize_for.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_embed_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_embed_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_embed_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_embed_optimize_for.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_empty.pb.o: google/protobuf/unittest_empty.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_empty.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_empty.pb.o `test -f 'google/protobuf/unittest_empty.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_empty.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_empty.pb.cc' object='google/protobuf/protobuf_test-unittest_empty.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_empty.pb.o `test -f 'google/protobuf/unittest_empty.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_empty.pb.cc - -google/protobuf/protobuf_test-unittest_empty.pb.obj: google/protobuf/unittest_empty.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_empty.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_empty.pb.obj `if test -f 'google/protobuf/unittest_empty.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_empty.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_empty.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_empty.pb.cc' object='google/protobuf/protobuf_test-unittest_empty.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_empty.pb.obj `if test -f 'google/protobuf/unittest_empty.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_empty.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_empty.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_enormous_descriptor.pb.o: google/protobuf/unittest_enormous_descriptor.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_enormous_descriptor.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_enormous_descriptor.pb.o `test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_enormous_descriptor.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_enormous_descriptor.pb.cc' object='google/protobuf/protobuf_test-unittest_enormous_descriptor.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_enormous_descriptor.pb.o `test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_enormous_descriptor.pb.cc - -google/protobuf/protobuf_test-unittest_enormous_descriptor.pb.obj: google/protobuf/unittest_enormous_descriptor.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_enormous_descriptor.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_enormous_descriptor.pb.obj `if test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_enormous_descriptor.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_enormous_descriptor.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_enormous_descriptor.pb.cc' object='google/protobuf/protobuf_test-unittest_enormous_descriptor.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_enormous_descriptor.pb.obj `if test -f 'google/protobuf/unittest_enormous_descriptor.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_enormous_descriptor.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_enormous_descriptor.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_import.pb.o: google/protobuf/unittest_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_import.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import.pb.o `test -f 'google/protobuf/unittest_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import.pb.cc' object='google/protobuf/protobuf_test-unittest_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_import.pb.o `test -f 'google/protobuf/unittest_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import.pb.cc - -google/protobuf/protobuf_test-unittest_import.pb.obj: google/protobuf/unittest_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_import.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import.pb.obj `if test -f 'google/protobuf/unittest_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import.pb.cc' object='google/protobuf/protobuf_test-unittest_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_import.pb.obj `if test -f 'google/protobuf/unittest_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_import_public.pb.o: google/protobuf/unittest_import_public.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_public.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import_public.pb.o `test -f 'google/protobuf/unittest_import_public.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public.pb.cc' object='google/protobuf/protobuf_test-unittest_import_public.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_import_public.pb.o `test -f 'google/protobuf/unittest_import_public.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_public.pb.cc - -google/protobuf/protobuf_test-unittest_import_public.pb.obj: google/protobuf/unittest_import_public.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_public.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import_public.pb.obj `if test -f 'google/protobuf/unittest_import_public.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_public.pb.cc' object='google/protobuf/protobuf_test-unittest_import_public.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_import_public.pb.obj `if test -f 'google/protobuf/unittest_import_public.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_lazy_dependencies.pb.o: google/protobuf/unittest_lazy_dependencies.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_lazy_dependencies.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lazy_dependencies.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies.pb.cc' object='google/protobuf/protobuf_test-unittest_lazy_dependencies.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_lazy_dependencies.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies.pb.cc - -google/protobuf/protobuf_test-unittest_lazy_dependencies.pb.obj: google/protobuf/unittest_lazy_dependencies.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_lazy_dependencies.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lazy_dependencies.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies.pb.cc' object='google/protobuf/protobuf_test-unittest_lazy_dependencies.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_lazy_dependencies.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.pb.o: google/protobuf/unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' object='google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc - -google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.pb.obj: google/protobuf/unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc' object='google/protobuf/protobuf_test-unittest_lazy_dependencies_custom_option.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_lazy_dependencies_custom_option.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_custom_option.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_lazy_dependencies_enum.pb.o: google/protobuf/unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lazy_dependencies_enum.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_enum.pb.cc' object='google/protobuf/protobuf_test-unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.o `test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lazy_dependencies_enum.pb.cc - -google/protobuf/protobuf_test-unittest_lazy_dependencies_enum.pb.obj: google/protobuf/unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lazy_dependencies_enum.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lazy_dependencies_enum.pb.cc' object='google/protobuf/protobuf_test-unittest_lazy_dependencies_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_lazy_dependencies_enum.pb.obj `if test -f 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lazy_dependencies_enum.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_lite_imports_nonlite.pb.o: google/protobuf/unittest_lite_imports_nonlite.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_imports_nonlite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lite_imports_nonlite.pb.o `test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite_imports_nonlite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite_imports_nonlite.pb.cc' object='google/protobuf/protobuf_test-unittest_lite_imports_nonlite.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_imports_nonlite.pb.o `test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite_imports_nonlite.pb.cc - -google/protobuf/protobuf_test-unittest_lite_imports_nonlite.pb.obj: google/protobuf/unittest_lite_imports_nonlite.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_imports_nonlite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lite_imports_nonlite.pb.obj `if test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite_imports_nonlite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite_imports_nonlite.pb.cc' object='google/protobuf/protobuf_test-unittest_lite_imports_nonlite.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_imports_nonlite.pb.obj `if test -f 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite_imports_nonlite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite_imports_nonlite.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_mset.pb.o: google/protobuf/unittest_mset.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_mset.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_mset.pb.o `test -f 'google/protobuf/unittest_mset.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset.pb.cc' object='google/protobuf/protobuf_test-unittest_mset.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_mset.pb.o `test -f 'google/protobuf/unittest_mset.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset.pb.cc - -google/protobuf/protobuf_test-unittest_mset.pb.obj: google/protobuf/unittest_mset.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_mset.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_mset.pb.obj `if test -f 'google/protobuf/unittest_mset.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset.pb.cc' object='google/protobuf/protobuf_test-unittest_mset.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_mset.pb.obj `if test -f 'google/protobuf/unittest_mset.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_mset_wire_format.pb.o: google/protobuf/unittest_mset_wire_format.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_mset_wire_format.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_mset_wire_format.pb.o `test -f 'google/protobuf/unittest_mset_wire_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset_wire_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset_wire_format.pb.cc' object='google/protobuf/protobuf_test-unittest_mset_wire_format.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_mset_wire_format.pb.o `test -f 'google/protobuf/unittest_mset_wire_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_mset_wire_format.pb.cc - -google/protobuf/protobuf_test-unittest_mset_wire_format.pb.obj: google/protobuf/unittest_mset_wire_format.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_mset_wire_format.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_mset_wire_format.pb.cc' object='google/protobuf/protobuf_test-unittest_mset_wire_format.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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_field_presence.pb.cc' object='google/protobuf/protobuf_test-unittest_no_field_presence.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_field_presence.pb.o `test -f 'google/protobuf/unittest_no_field_presence.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_field_presence.pb.cc - -google/protobuf/protobuf_test-unittest_no_field_presence.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_no_field_presence.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_field_presence.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_field_presence.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_field_presence.pb.cc' object='google/protobuf/protobuf_test-unittest_no_field_presence.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_field_presence.pb.obj `if test -f 'google/protobuf/unittest_no_field_presence.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_field_presence.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_field_presence.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_no_generic_services.pb.o: google/protobuf/unittest_no_generic_services.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_generic_services.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_generic_services.pb.o `test -f 'google/protobuf/unittest_no_generic_services.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_generic_services.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_generic_services.pb.cc' object='google/protobuf/protobuf_test-unittest_no_generic_services.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_generic_services.pb.o `test -f 'google/protobuf/unittest_no_generic_services.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_generic_services.pb.cc - -google/protobuf/protobuf_test-unittest_no_generic_services.pb.obj: google/protobuf/unittest_no_generic_services.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_generic_services.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_generic_services.pb.obj `if test -f 'google/protobuf/unittest_no_generic_services.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_generic_services.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_generic_services.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_generic_services.pb.cc' object='google/protobuf/protobuf_test-unittest_no_generic_services.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_generic_services.pb.obj `if test -f 'google/protobuf/unittest_no_generic_services.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_generic_services.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_generic_services.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_optimize_for.pb.o: google/protobuf/unittest_optimize_for.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_optimize_for.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_optimize_for.pb.o `test -f 'google/protobuf/unittest_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_optimize_for.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_optimize_for.pb.cc' object='google/protobuf/protobuf_test-unittest_optimize_for.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_optimize_for.pb.o `test -f 'google/protobuf/unittest_optimize_for.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_optimize_for.pb.cc - -google/protobuf/protobuf_test-unittest_optimize_for.pb.obj: google/protobuf/unittest_optimize_for.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_optimize_for.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_optimize_for.pb.cc' object='google/protobuf/protobuf_test-unittest_optimize_for.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_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_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_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 -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum2.pb.cc' object='google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.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_enum2.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum2.pb.cc - -google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.obj: 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.obj -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.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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum2.pb.cc' object='google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.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_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3.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.pb.o `test -f 'google/protobuf/unittest_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3.pb.cc - -google/protobuf/protobuf_test-unittest_proto3.pb.obj: 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.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3.pb.obj `if test -f 'google/protobuf/unittest_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3.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.pb.obj `if test -f 'google/protobuf/unittest_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_proto3_arena.pb.o: google/protobuf/unittest_proto3_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_proto3_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_arena.pb.o `test -f 'google/protobuf/unittest_proto3_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_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_proto3_arena.pb.o `test -f 'google/protobuf/unittest_proto3_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena.pb.cc - -google/protobuf/protobuf_test-unittest_proto3_arena.pb.obj: google/protobuf/unittest_proto3_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_proto3_arena.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_arena.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_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_proto3_arena.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.o: google/protobuf/unittest_proto3_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_proto3_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.o `test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_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_proto3_arena_lite.pb.o `test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_arena_lite.pb.cc - -google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.obj: google/protobuf/unittest_proto3_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_proto3_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_arena_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_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_proto3_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_arena_lite.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_proto3_lite.pb.o: google/protobuf/unittest_proto3_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_proto3_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_lite.pb.o `test -f 'google/protobuf/unittest_proto3_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_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_proto3_lite.pb.o `test -f 'google/protobuf/unittest_proto3_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_lite.pb.cc - -google/protobuf/protobuf_test-unittest_proto3_lite.pb.obj: google/protobuf/unittest_proto3_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_proto3_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_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_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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_well_known_types.pb.cc' object='google/protobuf/protobuf_test-unittest_well_known_types.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_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 - -google/protobuf/protobuf_test-unittest_well_known_types.pb.obj: 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.obj -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.obj `if test -f 'google/protobuf/unittest_well_known_types.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_well_known_types.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_well_known_types.pb.cc'; fi` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_well_known_types.pb.cc' object='google/protobuf/protobuf_test-unittest_well_known_types.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_well_known_types.pb.obj `if test -f 'google/protobuf/unittest_well_known_types.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_well_known_types.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_well_known_types.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-anys.pb.o: google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-anys.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-anys.pb.o `test -f 'google/protobuf/util/internal/testdata/anys.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/anys.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-anys.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/util/internal/testdata/protobuf_test-anys.pb.o `test -f 'google/protobuf/util/internal/testdata/anys.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/anys.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-anys.pb.obj: google/protobuf/util/internal/testdata/anys.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-anys.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-anys.pb.obj `if test -f 'google/protobuf/util/internal/testdata/anys.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/anys.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/anys.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/anys.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-anys.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/util/internal/testdata/protobuf_test-anys.pb.obj `if test -f 'google/protobuf/util/internal/testdata/anys.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/anys.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/anys.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-books.pb.o: google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-books.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-books.pb.o `test -f 'google/protobuf/util/internal/testdata/books.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/books.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-books.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/util/internal/testdata/protobuf_test-books.pb.o `test -f 'google/protobuf/util/internal/testdata/books.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/books.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-books.pb.obj: google/protobuf/util/internal/testdata/books.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-books.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-books.pb.obj `if test -f 'google/protobuf/util/internal/testdata/books.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/books.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/books.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/books.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-books.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/util/internal/testdata/protobuf_test-books.pb.obj `if test -f 'google/protobuf/util/internal/testdata/books.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/books.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/books.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.o: google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-default_value.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/util/internal/testdata/protobuf_test-default_value.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.obj: google/protobuf/util/internal/testdata/default_value.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-default_value.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-default_value.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/util/internal/testdata/protobuf_test-default_value.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-default_value_test.pb.o: google/protobuf/util/internal/testdata/default_value_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/util/internal/testdata/protobuf_test-default_value_test.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-default_value_test.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value_test.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value_test.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-default_value_test.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/util/internal/testdata/protobuf_test-default_value_test.pb.o `test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/default_value_test.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-default_value_test.pb.obj: google/protobuf/util/internal/testdata/default_value_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/util/internal/testdata/protobuf_test-default_value_test.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-default_value_test.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value_test.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/default_value_test.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-default_value_test.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/util/internal/testdata/protobuf_test-default_value_test.pb.obj `if test -f 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/default_value_test.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/default_value_test.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.o: google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.o `test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/field_mask.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-field_mask.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/util/internal/testdata/protobuf_test-field_mask.pb.o `test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/field_mask.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.obj: google/protobuf/util/internal/testdata/field_mask.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-field_mask.pb.obj `if test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/field_mask.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/field_mask.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-field_mask.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/util/internal/testdata/protobuf_test-field_mask.pb.obj `if test -f 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/field_mask.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/field_mask.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-maps.pb.o: google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-maps.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-maps.pb.o `test -f 'google/protobuf/util/internal/testdata/maps.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/maps.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-maps.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/util/internal/testdata/protobuf_test-maps.pb.o `test -f 'google/protobuf/util/internal/testdata/maps.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/maps.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-maps.pb.obj: google/protobuf/util/internal/testdata/maps.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-maps.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-maps.pb.obj `if test -f 'google/protobuf/util/internal/testdata/maps.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/maps.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/maps.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/maps.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-maps.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/util/internal/testdata/protobuf_test-maps.pb.obj `if test -f 'google/protobuf/util/internal/testdata/maps.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/maps.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/maps.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.o: google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.o `test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/oneofs.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-oneofs.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/util/internal/testdata/protobuf_test-oneofs.pb.o `test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/oneofs.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.obj: google/protobuf/util/internal/testdata/oneofs.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-oneofs.pb.obj `if test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/oneofs.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/oneofs.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-oneofs.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/util/internal/testdata/protobuf_test-oneofs.pb.obj `if test -f 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/oneofs.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/oneofs.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-proto3.pb.o: google/protobuf/util/internal/testdata/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/util/internal/testdata/protobuf_test-proto3.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-proto3.pb.o `test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/proto3.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/proto3.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-proto3.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/util/internal/testdata/protobuf_test-proto3.pb.o `test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/proto3.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-proto3.pb.obj: google/protobuf/util/internal/testdata/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/util/internal/testdata/protobuf_test-proto3.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-proto3.pb.obj `if test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/proto3.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/proto3.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-proto3.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/util/internal/testdata/protobuf_test-proto3.pb.obj `if test -f 'google/protobuf/util/internal/testdata/proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/proto3.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-struct.pb.o: google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-struct.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-struct.pb.o `test -f 'google/protobuf/util/internal/testdata/struct.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/struct.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-struct.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/util/internal/testdata/protobuf_test-struct.pb.o `test -f 'google/protobuf/util/internal/testdata/struct.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/struct.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-struct.pb.obj: google/protobuf/util/internal/testdata/struct.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-struct.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-struct.pb.obj `if test -f 'google/protobuf/util/internal/testdata/struct.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/struct.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/struct.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/struct.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-struct.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/util/internal/testdata/protobuf_test-struct.pb.obj `if test -f 'google/protobuf/util/internal/testdata/struct.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/struct.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/struct.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.o: google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.o `test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.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/util/internal/testdata/protobuf_test-timestamp_duration.pb.o `test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/timestamp_duration.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.obj: google/protobuf/util/internal/testdata/timestamp_duration.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.pb.obj `if test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/timestamp_duration.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-timestamp_duration.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/util/internal/testdata/protobuf_test-timestamp_duration.pb.obj `if test -f 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/timestamp_duration.pb.cc'; fi` - -google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.o: google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.o -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.o `test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/wrappers.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-wrappers.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/util/internal/testdata/protobuf_test-wrappers.pb.o `test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/internal/testdata/wrappers.pb.cc - -google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.obj: google/protobuf/util/internal/testdata/wrappers.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.obj -MD -MP -MF google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Tpo -c -o google/protobuf/util/internal/testdata/protobuf_test-wrappers.pb.obj `if test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/wrappers.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Tpo google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/internal/testdata/wrappers.pb.cc' object='google/protobuf/util/internal/testdata/protobuf_test-wrappers.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/util/internal/testdata/protobuf_test-wrappers.pb.obj `if test -f 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/internal/testdata/wrappers.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/internal/testdata/wrappers.pb.cc'; fi` - -google/protobuf/util/protobuf_test-json_format.pb.o: google/protobuf/util/json_format.pb.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-json_format.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Tpo -c -o google/protobuf/util/protobuf_test-json_format.pb.o `test -f 'google/protobuf/util/json_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format.pb.cc' object='google/protobuf/util/protobuf_test-json_format.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/util/protobuf_test-json_format.pb.o `test -f 'google/protobuf/util/json_format.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format.pb.cc - -google/protobuf/util/protobuf_test-json_format.pb.obj: google/protobuf/util/json_format.pb.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-json_format.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Tpo -c -o google/protobuf/util/protobuf_test-json_format.pb.obj `if test -f 'google/protobuf/util/json_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format.pb.cc' object='google/protobuf/util/protobuf_test-json_format.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/util/protobuf_test-json_format.pb.obj `if test -f 'google/protobuf/util/json_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format.pb.cc'; fi` - -google/protobuf/util/protobuf_test-json_format_proto3.pb.o: google/protobuf/util/json_format_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/util/protobuf_test-json_format_proto3.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Tpo -c -o google/protobuf/util/protobuf_test-json_format_proto3.pb.o `test -f 'google/protobuf/util/json_format_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format_proto3.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format_proto3.pb.cc' object='google/protobuf/util/protobuf_test-json_format_proto3.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/util/protobuf_test-json_format_proto3.pb.o `test -f 'google/protobuf/util/json_format_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/json_format_proto3.pb.cc - -google/protobuf/util/protobuf_test-json_format_proto3.pb.obj: google/protobuf/util/json_format_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/util/protobuf_test-json_format_proto3.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Tpo -c -o google/protobuf/util/protobuf_test-json_format_proto3.pb.obj `if test -f 'google/protobuf/util/json_format_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format_proto3.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/json_format_proto3.pb.cc' object='google/protobuf/util/protobuf_test-json_format_proto3.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/util/protobuf_test-json_format_proto3.pb.obj `if test -f 'google/protobuf/util/json_format_proto3.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/json_format_proto3.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/json_format_proto3.pb.cc'; fi` - -google/protobuf/util/protobuf_test-message_differencer_unittest.pb.o: google/protobuf/util/message_differencer_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/util/protobuf_test-message_differencer_unittest.pb.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Tpo -c -o google/protobuf/util/protobuf_test-message_differencer_unittest.pb.o `test -f 'google/protobuf/util/message_differencer_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.pb.cc' object='google/protobuf/util/protobuf_test-message_differencer_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/util/protobuf_test-message_differencer_unittest.pb.o `test -f 'google/protobuf/util/message_differencer_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/util/message_differencer_unittest.pb.cc - -google/protobuf/util/protobuf_test-message_differencer_unittest.pb.obj: google/protobuf/util/message_differencer_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/util/protobuf_test-message_differencer_unittest.pb.obj -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Tpo -c -o google/protobuf/util/protobuf_test-message_differencer_unittest.pb.obj `if test -f 'google/protobuf/util/message_differencer_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Tpo google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/util/message_differencer_unittest.pb.cc' object='google/protobuf/util/protobuf_test-message_differencer_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/util/protobuf_test-message_differencer_unittest.pb.obj `if test -f 'google/protobuf/util/message_differencer_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/util/message_differencer_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/message_differencer_unittest.pb.cc'; fi` - -google/protobuf/compiler/test_plugin-mock_code_generator.o: google/protobuf/compiler/mock_code_generator.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-mock_code_generator.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Tpo -c -o google/protobuf/compiler/test_plugin-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)/test_plugin-mock_code_generator.Tpo google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/mock_code_generator.cc' object='google/protobuf/compiler/test_plugin-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) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/test_plugin-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/test_plugin-mock_code_generator.obj: google/protobuf/compiler/mock_code_generator.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-mock_code_generator.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Tpo -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` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Tpo google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/mock_code_generator.cc' object='google/protobuf/compiler/test_plugin-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) $(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/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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/test_plugin.cc' object='google/protobuf/compiler/test_plugin-test_plugin.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/compiler/test_plugin-test_plugin.o `test -f 'google/protobuf/compiler/test_plugin.cc' || echo '$(srcdir)/'`google/protobuf/compiler/test_plugin.cc - -google/protobuf/compiler/test_plugin-test_plugin.obj: 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.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Tpo -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` -@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 -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/test_plugin.cc' object='google/protobuf/compiler/test_plugin-test_plugin.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/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 - -clean-libtool: - -rm -rf .libs _libs - -rm -rf google/protobuf/.libs google/protobuf/_libs - -rm -rf google/protobuf/compiler/.libs google/protobuf/compiler/_libs - -rm -rf google/protobuf/compiler/cpp/.libs google/protobuf/compiler/cpp/_libs - -rm -rf google/protobuf/compiler/csharp/.libs google/protobuf/compiler/csharp/_libs - -rm -rf google/protobuf/compiler/java/.libs google/protobuf/compiler/java/_libs - -rm -rf google/protobuf/compiler/objectivec/.libs google/protobuf/compiler/objectivec/_libs - -rm -rf google/protobuf/compiler/php/.libs google/protobuf/compiler/php/_libs - -rm -rf google/protobuf/compiler/python/.libs google/protobuf/compiler/python/_libs - -rm -rf google/protobuf/compiler/ruby/.libs google/protobuf/compiler/ruby/_libs - -rm -rf google/protobuf/io/.libs google/protobuf/io/_libs - -rm -rf google/protobuf/stubs/.libs google/protobuf/stubs/_libs - -rm -rf google/protobuf/util/.libs google/protobuf/util/_libs - -rm -rf google/protobuf/util/internal/.libs google/protobuf/util/internal/_libs -install-nobase_dist_protoDATA: $(nobase_dist_proto_DATA) - @$(NORMAL_INSTALL) - @list='$(nobase_dist_proto_DATA)'; test -n "$(protodir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(protodir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(protodir)" || exit 1; \ - fi; \ - $(am__nobase_list) | while read dir files; do \ - xfiles=; for file in $$files; do \ - if test -f "$$file"; then xfiles="$$xfiles $$file"; \ - else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ - test -z "$$xfiles" || { \ - test "x$$dir" = x. || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(protodir)/$$dir'"; \ - $(MKDIR_P) "$(DESTDIR)$(protodir)/$$dir"; }; \ - echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(protodir)/$$dir'"; \ - $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(protodir)/$$dir" || exit $$?; }; \ - done - -uninstall-nobase_dist_protoDATA: - @$(NORMAL_UNINSTALL) - @list='$(nobase_dist_proto_DATA)'; test -n "$(protodir)" || list=; \ - $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ - dir='$(DESTDIR)$(protodir)'; $(am__uninstall_files_from_dir) -install-nobase_includeHEADERS: $(nobase_include_HEADERS) - @$(NORMAL_INSTALL) - @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ - fi; \ - $(am__nobase_list) | while read dir files; do \ - xfiles=; for file in $$files; do \ - if test -f "$$file"; then xfiles="$$xfiles $$file"; \ - else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ - test -z "$$xfiles" || { \ - test "x$$dir" = x. || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \ - $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \ - echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \ - $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \ - done - -uninstall-nobase_includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ - $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ - dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: $(check_PROGRAMS) - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_PROGRAMS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -protobuf-test.log: protobuf-test$(EXEEXT) - @p='protobuf-test$(EXEEXT)'; \ - b='protobuf-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -protobuf-lazy-descriptor-test.log: protobuf-lazy-descriptor-test$(EXEEXT) - @p='protobuf-lazy-descriptor-test$(EXEEXT)'; \ - b='protobuf-lazy-descriptor-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -protobuf-lite-test.log: protobuf-lite-test$(EXEEXT) - @p='protobuf-lite-test$(EXEEXT)'; \ - b='protobuf-lite-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -google/protobuf/compiler/zip_output_unittest.sh.log: google/protobuf/compiler/zip_output_unittest.sh - @p='google/protobuf/compiler/zip_output_unittest.sh'; \ - b='google/protobuf/compiler/zip_output_unittest.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -google/protobuf/io/gzip_stream_unittest.sh.log: google/protobuf/io/gzip_stream_unittest.sh - @p='google/protobuf/io/gzip_stream_unittest.sh'; \ - b='google/protobuf/io/gzip_stream_unittest.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -protobuf-lite-arena-test.log: protobuf-lite-arena-test$(EXEEXT) - @p='protobuf-lite-arena-test$(EXEEXT)'; \ - b='protobuf-lite-arena-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -no-warning-test.log: no-warning-test$(EXEEXT) - @p='no-warning-test$(EXEEXT)'; \ - b='no-warning-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@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 - -distdir-am: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -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"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f google/protobuf/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/$(am__dirstamp) - -rm -f google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/$(am__dirstamp) - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/cpp/$(am__dirstamp) - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/csharp/$(am__dirstamp) - -rm -f google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/java/$(am__dirstamp) - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/objectivec/$(am__dirstamp) - -rm -f google/protobuf/compiler/php/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/php/$(am__dirstamp) - -rm -f google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/python/$(am__dirstamp) - -rm -f google/protobuf/compiler/ruby/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/compiler/ruby/$(am__dirstamp) - -rm -f google/protobuf/io/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/io/$(am__dirstamp) - -rm -f google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/stubs/$(am__dirstamp) - -rm -f google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/testing/$(am__dirstamp) - -rm -f google/protobuf/util/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/util/$(am__dirstamp) - -rm -f google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/util/internal/$(am__dirstamp) - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/$(am__dirstamp) - -rm -f google/protobuf/util/internal/testdata/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/no_warning_test-no_warning_test.Po - -rm -f google/protobuf/$(DEPDIR)/any.Plo - -rm -f google/protobuf/$(DEPDIR)/any.pb.Plo - -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)/arenaz_sampler.Plo - -rm -f google/protobuf/$(DEPDIR)/descriptor.Plo - -rm -f google/protobuf/$(DEPDIR)/descriptor.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/descriptor_database.Plo - -rm -f google/protobuf/$(DEPDIR)/duration.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/dynamic_message.Plo - -rm -f google/protobuf/$(DEPDIR)/empty.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/extension_set.Plo - -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_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 - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_test_util.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Po - -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-generated_message_tctable_lite_test.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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/text_format.Plo - -rm -f google/protobuf/$(DEPDIR)/timestamp.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/type.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/unknown_field_set.Plo - -rm -f google/protobuf/$(DEPDIR)/wire_format.Plo - -rm -f google/protobuf/$(DEPDIR)/wire_format_lite.Plo - -rm -f google/protobuf/$(DEPDIR)/wrappers.pb.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/code_generator.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/command_line_interface.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/importer.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/main.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/parser.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/plugin.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/plugin.pb.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/subprocess.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/zip_writer.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/enum.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/enum_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/extension.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/file.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/generator.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/helpers.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/map_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/message.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/message_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/padding_optimizer.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/parse_function_generator.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/primitive_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/service.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/string_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_doc_comment.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_field_base.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_generator.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_helpers.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_map_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_primitive_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_reflection_class.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_enum_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_message_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_primitive_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_source_generator_base.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_wrapper_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po - -rm -f google/protobuf/compiler/java/$(DEPDIR)/context.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/doc_comment.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/extension.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/extension_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/file.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/generator.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/generator_factory.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/helpers.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/kotlin_generator.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/map_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/map_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_builder.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_builder_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/name_resolver.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/primitive_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/primitive_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Po - -rm -f google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Po - -rm -f google/protobuf/compiler/java/$(DEPDIR)/service.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/shared_code_generator.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/string_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/string_field_lite.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_extension.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_file.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_generator.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_helpers.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_map_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_oneof.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_primitive_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po - -rm -f google/protobuf/compiler/php/$(DEPDIR)/php_generator.Plo - -rm -f google/protobuf/compiler/python/$(DEPDIR)/generator.Plo - -rm -f google/protobuf/compiler/python/$(DEPDIR)/helpers.Plo - -rm -f google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Po - -rm -f google/protobuf/compiler/python/$(DEPDIR)/pyi_generator.Plo - -rm -f google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po - -rm -f google/protobuf/compiler/ruby/$(DEPDIR)/ruby_generator.Plo - -rm -f google/protobuf/io/$(DEPDIR)/coded_stream.Plo - -rm -f google/protobuf/io/$(DEPDIR)/gzip_stream.Plo - -rm -f google/protobuf/io/$(DEPDIR)/io_win32.Plo - -rm -f google/protobuf/io/$(DEPDIR)/printer.Plo - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/strtod.Plo - -rm -f google/protobuf/io/$(DEPDIR)/tokenizer.Plo - -rm -f google/protobuf/io/$(DEPDIR)/zero_copy_stream.Plo - -rm -f google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl.Plo - -rm -f google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl_lite.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/bytestream.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/common.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/int128.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/status.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/statusor.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/stringpiece.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/stringprintf.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/structurally_valid.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/strutil.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/substitute.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/time.Plo - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Po - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po - -rm -f google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po - -rm -f google/protobuf/testing/$(DEPDIR)/zcgunzip.Po - -rm -f google/protobuf/testing/$(DEPDIR)/zcgzip.Po - -rm -f google/protobuf/util/$(DEPDIR)/delimited_message_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/field_comparator.Plo - -rm -f google/protobuf/util/$(DEPDIR)/field_mask_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/json_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/message_differencer.Plo - -rm -f google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/time_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/type_resolver_util.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/datapiece.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/default_value_objectwriter.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/error_listener.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/field_mask_utility.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/json_escaping.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/json_objectwriter.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/json_stream_parser.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/object_writer.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/proto_writer.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Po - -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)/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 - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Po - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-nobase_dist_protoDATA \ - install-nobase_includeHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/no_warning_test-no_warning_test.Po - -rm -f google/protobuf/$(DEPDIR)/any.Plo - -rm -f google/protobuf/$(DEPDIR)/any.pb.Plo - -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)/arenaz_sampler.Plo - -rm -f google/protobuf/$(DEPDIR)/descriptor.Plo - -rm -f google/protobuf/$(DEPDIR)/descriptor.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/descriptor_database.Plo - -rm -f google/protobuf/$(DEPDIR)/duration.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/dynamic_message.Plo - -rm -f google/protobuf/$(DEPDIR)/empty.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/extension_set.Plo - -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_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 - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-map_lite_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-map_proto2_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-map_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_custom_options.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_drop_unknown_fields.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_embed_optimize_for.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_empty.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_enormous_descriptor.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_public_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_custom_option.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lazy_dependencies_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_embed_optimize_for.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_empty.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_enormous_descriptor.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_custom_option.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lazy_dependencies_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_test_util.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-map_lite_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-test_util_lite.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-test_util_lite.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arenaz_sampler_test.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Po - -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-generated_message_tctable_lite_test.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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_unittest.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-message_unittest.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-no_field_presence_test.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-preserve_unknown_enum_test.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_lite_unittest.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_custom_options.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_drop_unknown_fields.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_embed_optimize_for.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_empty.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_enormous_descriptor.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_public_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_custom_option.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lazy_dependencies_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po - -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_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 - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Po - -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 - -rm -f google/protobuf/$(DEPDIR)/text_format.Plo - -rm -f google/protobuf/$(DEPDIR)/timestamp.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/type.pb.Plo - -rm -f google/protobuf/$(DEPDIR)/unknown_field_set.Plo - -rm -f google/protobuf/$(DEPDIR)/wire_format.Plo - -rm -f google/protobuf/$(DEPDIR)/wire_format_lite.Plo - -rm -f google/protobuf/$(DEPDIR)/wrappers.pb.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/code_generator.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/command_line_interface.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/importer.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/main.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/parser.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/plugin.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/plugin.pb.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/subprocess.Plo - -rm -f google/protobuf/compiler/$(DEPDIR)/test_plugin-mock_code_generator.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Po - -rm -f google/protobuf/compiler/$(DEPDIR)/zip_writer.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/enum.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/enum_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/extension.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/file.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/generator.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/helpers.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/map_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/message.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/message_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_bad_identifiers.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/no_warning_test-test_large_enum_value.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/padding_optimizer.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/parse_function_generator.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/primitive_field.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_bad_identifiers.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-test_large_enum_value.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-bootstrap_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-message_size_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-move_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-plugin_unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_bad_identifiers.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-test_large_enum_value.pb.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-unittest.Po - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/service.Plo - -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/string_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_doc_comment.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_enum_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_field_base.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_generator.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_helpers.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_map_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_message_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_primitive_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_reflection_class.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_enum_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_message_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_repeated_primitive_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_source_generator_base.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/csharp_wrapper_field.Plo - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po - -rm -f google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po - -rm -f google/protobuf/compiler/java/$(DEPDIR)/context.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/doc_comment.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/enum_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/extension.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/extension_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/file.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/generator.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/generator_factory.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/helpers.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/kotlin_generator.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/map_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/map_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_builder.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_builder_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/message_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/name_resolver.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/primitive_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/primitive_field_lite.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-doc_comment_unittest.Po - -rm -f google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-plugin_unittest.Po - -rm -f google/protobuf/compiler/java/$(DEPDIR)/service.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/shared_code_generator.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/string_field.Plo - -rm -f google/protobuf/compiler/java/$(DEPDIR)/string_field_lite.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_enum_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_extension.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_file.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_generator.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_helpers.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_map_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_message_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_oneof.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/objectivec_primitive_field.Plo - -rm -f google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po - -rm -f google/protobuf/compiler/php/$(DEPDIR)/php_generator.Plo - -rm -f google/protobuf/compiler/python/$(DEPDIR)/generator.Plo - -rm -f google/protobuf/compiler/python/$(DEPDIR)/helpers.Plo - -rm -f google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-plugin_unittest.Po - -rm -f google/protobuf/compiler/python/$(DEPDIR)/pyi_generator.Plo - -rm -f google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po - -rm -f google/protobuf/compiler/ruby/$(DEPDIR)/ruby_generator.Plo - -rm -f google/protobuf/io/$(DEPDIR)/coded_stream.Plo - -rm -f google/protobuf/io/$(DEPDIR)/gzip_stream.Plo - -rm -f google/protobuf/io/$(DEPDIR)/io_win32.Plo - -rm -f google/protobuf/io/$(DEPDIR)/printer.Plo - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po - -rm -f google/protobuf/io/$(DEPDIR)/strtod.Plo - -rm -f google/protobuf/io/$(DEPDIR)/tokenizer.Plo - -rm -f google/protobuf/io/$(DEPDIR)/zero_copy_stream.Plo - -rm -f google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl.Plo - -rm -f google/protobuf/io/$(DEPDIR)/zero_copy_stream_impl_lite.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/bytestream.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/common.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/int128.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po - -rm -f google/protobuf/stubs/$(DEPDIR)/status.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/statusor.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/stringpiece.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/stringprintf.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/structurally_valid.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/strutil.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/substitute.Plo - -rm -f google/protobuf/stubs/$(DEPDIR)/time.Plo - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Po - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po - -rm -f google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po - -rm -f google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po - -rm -f google/protobuf/testing/$(DEPDIR)/zcgunzip.Po - -rm -f google/protobuf/testing/$(DEPDIR)/zcgzip.Po - -rm -f google/protobuf/util/$(DEPDIR)/delimited_message_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/field_comparator.Plo - -rm -f google/protobuf/util/$(DEPDIR)/field_mask_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/json_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/message_differencer.Plo - -rm -f google/protobuf/util/$(DEPDIR)/no_warning_test-json_format.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/no_warning_test-json_format_proto3.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/no_warning_test-message_differencer_unittest.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-json_format_proto3.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-field_comparator_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-field_mask_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-json_format.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-json_format_proto3.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-json_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-message_differencer_unittest.pb.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-time_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/protobuf_test-type_resolver_util_test.Po - -rm -f google/protobuf/util/$(DEPDIR)/time_util.Plo - -rm -f google/protobuf/util/$(DEPDIR)/type_resolver_util.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/datapiece.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/default_value_objectwriter.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/error_listener.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/field_mask_utility.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/json_escaping.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/json_objectwriter.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/json_stream_parser.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/object_writer.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/proto_writer.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-default_value_objectwriter_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_objectwriter_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-json_stream_parser_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectsource_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-protostream_objectwriter_test.Po - -rm -f google/protobuf/util/internal/$(DEPDIR)/protobuf_test-type_info_test_helper.Po - -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)/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 - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-default_value_test.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-field_mask.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-maps.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-oneofs.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-proto3.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-struct.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-timestamp_duration.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-wrappers.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-anys.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-books.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-default_value_test.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-field_mask.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-maps.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-oneofs.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-proto3.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-struct.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-timestamp_duration.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_lazy_descriptor_test-wrappers.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-anys.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-books.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-default_value_test.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-field_mask.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-maps.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-oneofs.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-proto3.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-struct.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-timestamp_duration.pb.Po - -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/protobuf_test-wrappers.pb.Po - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ - uninstall-nobase_dist_protoDATA \ - uninstall-nobase_includeHEADERS - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ - check-am clean clean-binPROGRAMS clean-checkPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-man \ - install-nobase_dist_protoDATA install-nobase_includeHEADERS \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am recheck tags tags-am uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ - uninstall-nobase_dist_protoDATA \ - uninstall-nobase_includeHEADERS - -.PRECIOUS: Makefile - - -# Not sure why these don't get cleaned automatically. -clean-local: - rm -f *.loT - -@USE_EXTERNAL_PROTOC_TRUE@unittest_proto_middleman: $(protoc_inputs) -@USE_EXTERNAL_PROTOC_TRUE@ $(PROTOC) -I$(srcdir) --cpp_out=. $^ -@USE_EXTERNAL_PROTOC_TRUE@ touch unittest_proto_middleman - -# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is -# 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) --experimental_allow_proto3_optional ) -@USE_EXTERNAL_PROTOC_FALSE@ touch unittest_proto_middleman - -$(protoc_outputs): unittest_proto_middleman -$(am_protobuf_test_OBJECTS): unittest_proto_middleman -$(am_protobuf_lazy_descriptor_test_OBJECTS): unittest_proto_middleman -$(am_protobuf_lite_test_OBJECTS): unittest_proto_middleman -$(am_protobuf_lite_arena_test_OBJECTS): unittest_proto_middleman - -# This test target is to ensure all our public header files and generated -# code is free from warnings. We have to be more pedantic about these -# files because they are compiled by users with different compiler flags. -no_warning_test.cc: - echo "// Generated from Makefile.am" > no_warning_test.cc - for FILE in $(nobase_include_HEADERS); do \ - 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 - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/depends/protobuf/src/README.md b/depends/protobuf/src/README.md deleted file mode 100644 index cf843d759..000000000 --- a/depends/protobuf/src/README.md +++ /dev/null @@ -1,234 +0,0 @@ -Protocol Buffers - Google's data interchange format -=================================================== - -Copyright 2008 Google Inc. - -https://developers.google.com/protocol-buffers/ - -C++ Installation - Unix ------------------------ - -To build protobuf from source, the following tools are needed: - - * autoconf - * automake - * libtool - * make - * g++ - * unzip - -On Ubuntu/Debian, you can install them with: - - 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. - -To get the source, download one of the release .tar.gz or .zip packages in the -release page: - - https://github.com/protocolbuffers/protobuf/releases/latest - -For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if -you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package -contains C++ source already); if you need C++ and multiple other languages, -download `protobuf-all-[VERSION].tar.gz`. - -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): - - 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: - - - ./configure - make -j$(nproc) # $(nproc) ensures it uses all cores for compilation - 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. - -For advanced usage information on configure and make, please refer to the -autoconf documentation: - - http://www.gnu.org/software/autoconf/manual/autoconf.html#Running-configure-Scripts - -**Hint on install location** - -By default, the package will be installed to /usr/local. However, -on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. -You can add it, but it may be easier to just install to /usr -instead. To do this, invoke configure as follows: - - ./configure --prefix=/usr - -If you already built the package with a different prefix, make sure -to run "make clean" before building again. - -**Compiling dependent packages** - -To compile a package that uses Protocol Buffers, you need to pass -various flags to your compiler and linker. As of version 2.2.0, -Protocol Buffers integrates with pkg-config to manage this. If you -have pkg-config installed, then you can invoke it to get a list of -flags like so: - - - pkg-config --cflags protobuf # print compiler flags - pkg-config --libs protobuf # print linker flags - pkg-config --cflags --libs protobuf # print both - - -For example: - - c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf` - -Note that packages written prior to the 2.2.0 release of Protocol -Buffers may not yet integrate with pkg-config to get flags, and may -not pass the correct set of flags to correctly link against -libprotobuf. If the package in question uses autoconf, you can -often fix the problem by invoking its configure script like: - - - configure CXXFLAGS="$(pkg-config --cflags protobuf)" \ - LIBS="$(pkg-config --libs protobuf)" - -This will force it to use the correct flags. - -If you are writing an autoconf-based package that uses Protocol -Buffers, you should probably use the PKG_CHECK_MODULES macro in your -configure script like: - - PKG_CHECK_MODULES([protobuf], [protobuf]) - -See the pkg-config man page for more info. - -If you only want protobuf-lite, substitute "protobuf-lite" in place -of "protobuf" in these examples. - -**Note for Mac users** - -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: - - sudo xcode-select --install - -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. - - sudo /opt/local/bin/port install autoconf automake libtool - -Alternative for Homebrew users: - - brew install autoconf automake libtool - -Then follow the Unix instructions above. - -**Note for cross-compiling** - -The makefiles normally invoke the protoc executable that they just -built in order to build tests. When cross-compiling, the protoc -executable may not be executable on the host machine. In this case, -you must build a copy of protoc for the host machine first, then use -the --with-protoc option to tell configure to use it instead. For -example: - - ./configure --with-protoc=protoc - -This will use the installed protoc (found in your $PATH) instead of -trying to execute the one built during the build process. You can -also use an executable that hasn't been installed. For example, if -you built the protobuf package for your host machine in ../host, -you might do: - - ./configure --with-protoc=../host/src/protoc - -Either way, you must make sure that the protoc executable you use -has the same version as the protobuf source code you are trying to -use it with. - -**Note for Solaris users** - -Solaris 10 x86 has a bug that will make linking fail, complaining -about libstdc++.la being invalid. We have included a work-around -in this package. To use the work-around, run configure as follows: - - ./configure LDFLAGS=-L$PWD/src/solaris - -See src/solaris/libstdc++.la for more info on this bug. - -**Note for HP C++ Tru64 users** - -To compile invoke configure as follows: - - ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM" - -Also, you will need to use gmake instead of make. - -**Note for AIX users** - -Compile using the IBM xlC C++ compiler as follows: - - ./configure CXX=xlC - -Also, you will need to use GNU `make` (`gmake`) instead of AIX `make`. - -C++ Installation - Windows --------------------------- - -If you only need the protoc binary, you can download it from the release -page: - - https://github.com/protocolbuffers/protobuf/releases/latest - -In the downloads section, download the zip file protoc-$VERSION-win32.zip. -It contains the protoc binary as well as public proto files of protobuf -library. - -Protobuf and its dependencies can be installed directly by using `vcpkg`: - - >vcpkg install protobuf protobuf:x64-windows - -If zlib support is desired, you'll also need to install the zlib feature: - - >vcpkg install protobuf[zlib] protobuf[zlib]:x64-windows - -See https://github.com/Microsoft/vcpkg for more information. - -To build from source using Microsoft Visual C++, see [cmake/README.md](../cmake/README.md). - -To build from source using Cygwin or MinGW, follow the Unix installation -instructions, above. - -Binary Compatibility Warning ----------------------------- - -Due to the nature of C++, it is unlikely that any two versions of the -Protocol Buffers C++ runtime libraries will have compatible ABIs. -That is, if you linked an executable against an older version of -libprotobuf, it is unlikely to work with a newer version without -re-compiling. This problem, when it occurs, will normally be detected -immediately on startup of your app. Still, you may want to consider -using static linkage. You can configure this package to install -static libraries only using: - - ./configure --disable-shared - -Usage ------ - -The complete documentation for Protocol Buffers is available via the -web at: - -https://developers.google.com/protocol-buffers/ diff --git a/depends/protobuf/src/google/protobuf/any.cc b/depends/protobuf/src/google/protobuf/any.cc deleted file mode 100644 index 346fa19f1..000000000 --- a/depends/protobuf/src/google/protobuf/any.cc +++ /dev/null @@ -1,82 +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 - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace internal { - -bool AnyMetadata::PackFrom(Arena* arena, const Message& message) { - return PackFrom(arena, message, kTypeGoogleApisComPrefix); -} - -bool AnyMetadata::PackFrom(Arena* arena, const Message& message, - StringPiece type_url_prefix) { - type_url_->Set( - GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena); - return message.SerializeToString(value_->Mutable(arena)); -} - -bool AnyMetadata::UnpackTo(Message* message) const { - if (!InternalIs(message->GetDescriptor()->full_name())) { - return false; - } - return message->ParseFromString(value_->Get()); -} - -bool GetAnyFieldDescriptors(const Message& message, - const FieldDescriptor** type_url_field, - const FieldDescriptor** value_field) { - const Descriptor* descriptor = message.GetDescriptor(); - if (descriptor->full_name() != kAnyFullTypeName) { - return false; - } - *type_url_field = descriptor->FindFieldByNumber(1); - *value_field = descriptor->FindFieldByNumber(2); - return (*type_url_field != nullptr && - (*type_url_field)->type() == FieldDescriptor::TYPE_STRING && - *value_field != nullptr && - (*value_field)->type() == FieldDescriptor::TYPE_BYTES); -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/any.h b/depends/protobuf/src/google/protobuf/any.h deleted file mode 100644 index 92ea2bb2c..000000000 --- a/depends/protobuf/src/google/protobuf/any.h +++ /dev/null @@ -1,157 +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_ANY_H__ -#define GOOGLE_PROTOBUF_ANY_H__ - -#include - -#include -#include -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { - -class FieldDescriptor; -class Message; - -namespace internal { - -extern const char kAnyFullTypeName[]; // "google.protobuf.Any". -extern const char kTypeGoogleApisComPrefix[]; // "type.googleapis.com/". -extern const char kTypeGoogleProdComPrefix[]; // "type.googleprod.com/". - -std::string GetTypeUrl(StringPiece message_name, - StringPiece type_url_prefix); - -// Helper class used to implement google::protobuf::Any. -class PROTOBUF_EXPORT AnyMetadata { - typedef ArenaStringPtr UrlType; - typedef ArenaStringPtr ValueType; - public: - // AnyMetadata does not take ownership of "type_url" and "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 - bool PackFrom(Arena* arena, const T& message) { - return InternalPackFrom(arena, message, kTypeGoogleApisComPrefix, - T::FullMessageName()); - } - - 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 - // with an optional "/" separator if the prefix doesn't already end with "/". - // 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 - bool PackFrom(Arena* arena, const T& message, - StringPiece type_url_prefix) { - return InternalPackFrom(arena, message, type_url_prefix, - T::FullMessageName()); - } - - 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 - // name after the last "/" of the type URL doesn't match the message's actual - // full name) or parsing the payload has failed. - template - bool UnpackTo(T* message) const { - return InternalUnpackTo(T::FullMessageName(), message); - } - - bool UnpackTo(Message* message) const; - - // Checks whether the type specified in the type URL matches the given type. - // A type is considered matching if its full name matches the full name after - // the last "/" in the type URL. - template - bool Is() const { - return InternalIs(T::FullMessageName()); - } - - private: - bool InternalPackFrom(Arena* arena, const MessageLite& message, - StringPiece type_url_prefix, - StringPiece type_name); - bool InternalUnpackTo(StringPiece type_name, - MessageLite* message) const; - bool InternalIs(StringPiece type_name) const; - - UrlType* type_url_; - ValueType* value_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AnyMetadata); -}; - -// Get the proto type name from Any::type_url value. For example, passing -// "type.googleapis.com/rpc.QueryOrigin" will return "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. -// -// NOTE: this function is available publicly as a static method on the -// generated message type: google::protobuf::Any::ParseAnyTypeUrl() -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(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 -// for "type_url" and "value" fields. -bool GetAnyFieldDescriptors(const Message& message, - const FieldDescriptor** type_url_field, - const FieldDescriptor** value_field); - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_ANY_H__ diff --git a/depends/protobuf/src/google/protobuf/any.pb.cc b/depends/protobuf/src/google/protobuf/any.pb.cc deleted file mode 100644 index c02f9eb7f..000000000 --- a/depends/protobuf/src/google/protobuf/any.pb.cc +++ /dev/null @@ -1,368 +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_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - -#if defined(__llvm__) - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wuninitialized" -#endif // __llvm__ -PROTOBUF_NAMESPACE_OPEN -PROTOBUF_CONSTEXPR Any::Any( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.value_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}} {} -struct AnyDefaultTypeInternal { - PROTOBUF_CONSTEXPR AnyDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~AnyDefaultTypeInternal() {} - union { - Any _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AnyDefaultTypeInternal _Any_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static ::_pb::Metadata file_level_metadata_google_2fprotobuf_2fany_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; -static constexpr ::_pb::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, _impl_.type_url_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.value_), -}; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Any)}, -}; - -static const ::_pb::Message* const file_default_instances[] = { - &::PROTOBUF_NAMESPACE_ID::_Any_default_instance_._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 ::_pbi::once_flag descriptor_table_google_2fprotobuf_2fany_2eproto_once; -const ::_pbi::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 ::_pbi::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_PRIORITY2 static ::_pbi::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 ::_pbi::GetAnyFieldDescriptors( - message, type_url_field, value_field); -} -bool Any::ParseAnyTypeUrl( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url, - std::string* full_type_name) { - return ::_pbi::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) { - SharedCtor(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Any) -} -Any::Any(const Any& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Any* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.type_url_){} - , decltype(_impl_.value_){} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.type_url_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.type_url_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_type_url().empty()) { - _this->_impl_.type_url_.Set(from._internal_type_url(), - _this->GetArenaForAllocation()); - } - _impl_.value_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.value_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_value().empty()) { - _this->_impl_.value_.Set(from._internal_value(), - _this->GetArenaForAllocation()); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) -} - -inline void Any::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.type_url_){} - , decltype(_impl_.value_){} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_} - }; - _impl_.type_url_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.type_url_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.value_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.value_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -Any::~Any() { - // @@protoc_insertion_point(destructor:google.protobuf.Any) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void Any::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.type_url_.Destroy(); - _impl_.value_.Destroy(); - _impl_._any_metadata_.~AnyMetadata(); -} - -void Any::SetCachedSize(int size) const { - _impl_._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; - - _impl_.type_url_.ClearToEmpty(); - _impl_.value_.ClearToEmpty(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* Any::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Any.type_url")); - } else - goto handle_unusual; - continue; - // bytes value = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { - auto str = _internal_mutable_value(); - ptr = ::_pbi::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 = ::_pbi::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, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Any::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Any::GetClassData() const { return &_class_data_; } - - -void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@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()) { - _this->_internal_set_type_url(from._internal_type_url()); - } - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); - } - _this->_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( - &_impl_.type_url_, lhs_arena, - &other->_impl_.type_url_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.value_, lhs_arena, - &other->_impl_.value_, rhs_arena - ); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Any::GetMetadata() const { - return ::_pbi::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) -#if defined(__llvm__) - #pragma clang diagnostic pop -#endif // __llvm__ -#include diff --git a/depends/protobuf/src/google/protobuf/any.pb.h b/depends/protobuf/src/google/protobuf/any.pb.h deleted file mode 100644 index 40837ea90..000000000 --- a/depends/protobuf/src/google/protobuf/any.pb.h +++ /dev/null @@ -1,384 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/any.proto - -#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fany_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fany_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3021000 -#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 3021010 < 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. -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fany_2eproto PROTOBUF_EXPORT -PROTOBUF_NAMESPACE_OPEN -namespace internal { -class AnyMetadata; -} // namespace internal -PROTOBUF_NAMESPACE_CLOSE - -// Internal implementation detail -- do not use these members. -struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto { - static const uint32_t offsets[]; -}; -PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto; -PROTOBUF_NAMESPACE_OPEN -class Any; -struct AnyDefaultTypeInternal; -PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(Arena*); -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -class PROTOBUF_EXPORT Any final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ { - public: - inline Any() : Any(nullptr) {} - ~Any() override; - explicit PROTOBUF_CONSTEXPR Any(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Any(const Any& from); - Any(Any&& from) noexcept - : Any() { - *this = ::std::move(from); - } - - inline Any& operator=(const Any& from) { - CopyFrom(from); - return *this; - } - inline Any& operator=(Any&& from) noexcept { - 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); - } - return *this; - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Any& default_instance() { - return *internal_default_instance(); - } - static inline const Any* internal_default_instance() { - return reinterpret_cast( - &_Any_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - // implements Any ----------------------------------------------- - - bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) { - GOOGLE_DCHECK_NE(&message, this); - return _impl_._any_metadata_.PackFrom(GetArena(), message); - } - bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message, - ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { - GOOGLE_DCHECK_NE(&message, this); - return _impl_._any_metadata_.PackFrom(GetArena(), message, type_url_prefix); - } - bool UnpackTo(::PROTOBUF_NAMESPACE_ID::Message* message) const { - return _impl_._any_metadata_.UnpackTo(message); - } - static bool GetAnyFieldDescriptors( - const ::PROTOBUF_NAMESPACE_ID::Message& message, - const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** type_url_field, - const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field); - template ::value>::type> - bool PackFrom(const T& message) { - return _impl_._any_metadata_.PackFrom(GetArena(), message); - } - template ::value>::type> - bool PackFrom(const T& message, - ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { - return _impl_._any_metadata_.PackFrom(GetArena(), message, type_url_prefix);} - template ::value>::type> - bool UnpackTo(T* message) const { - return _impl_._any_metadata_.UnpackTo(message); - } - template bool Is() const { - return _impl_._any_metadata_.Is(); - } - 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 ---------------------------------------------- - - Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Any& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Any& from) { - Any::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kTypeUrlFieldNumber = 1, - kValueFieldNumber = 2, - }; - // string type_url = 1; - void clear_type_url(); - const std::string& type_url() const; - template - void set_type_url(ArgT0&& arg0, ArgT... args); - std::string* mutable_type_url(); - PROTOBUF_NODISCARD std::string* release_type_url(); - void set_allocated_type_url(std::string* type_url); - private: - const std::string& _internal_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const std::string& value); - std::string* _internal_mutable_type_url(); - public: - - // bytes value = 2; - void clear_value(); - const std::string& value() const; - template - void set_value(ArgT0&& arg0, ArgT... args); - std::string* mutable_value(); - PROTOBUF_NODISCARD std::string* release_value(); - void set_allocated_value(std::string* value); - private: - const std::string& _internal_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value); - std::string* _internal_mutable_value(); - public: - - // @@protoc_insertion_point(class_scope:google.protobuf.Any) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_url_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr value_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata _any_metadata_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fany_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// Any - -// string type_url = 1; -inline void Any::clear_type_url() { - _impl_.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(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Any::set_type_url(ArgT0&& arg0, ArgT... args) { - - _impl_.type_url_.Set(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 _s; -} -inline const std::string& Any::_internal_type_url() const { - return _impl_.type_url_.Get(); -} -inline void Any::_internal_set_type_url(const std::string& value) { - - _impl_.type_url_.Set(value, GetArenaForAllocation()); -} -inline std::string* Any::_internal_mutable_type_url() { - - return _impl_.type_url_.Mutable(GetArenaForAllocation()); -} -inline std::string* Any::release_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url) - return _impl_.type_url_.Release(); -} -inline void Any::set_allocated_type_url(std::string* type_url) { - if (type_url != nullptr) { - - } else { - - } - _impl_.type_url_.SetAllocated(type_url, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.type_url_.IsDefault()) { - _impl_.type_url_.Set("", 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() { - _impl_.value_.ClearToEmpty(); -} -inline const std::string& Any::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Any.value) - return _internal_value(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Any::set_value(ArgT0&& arg0, ArgT... args) { - - _impl_.value_.SetBytes(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 _s; -} -inline const std::string& Any::_internal_value() const { - return _impl_.value_.Get(); -} -inline void Any::_internal_set_value(const std::string& value) { - - _impl_.value_.Set(value, GetArenaForAllocation()); -} -inline std::string* Any::_internal_mutable_value() { - - return _impl_.value_.Mutable(GetArenaForAllocation()); -} -inline std::string* Any::release_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Any.value) - return _impl_.value_.Release(); -} -inline void Any::set_allocated_value(std::string* value) { - if (value != nullptr) { - - } else { - - } - _impl_.value_.SetAllocated(value, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.value_.IsDefault()) { - _impl_.value_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value) -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ - -// @@protoc_insertion_point(namespace_scope) - -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) - -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fany_2eproto diff --git a/depends/protobuf/src/google/protobuf/any.proto b/depends/protobuf/src/google/protobuf/any.proto deleted file mode 100644 index e2c2042fd..000000000 --- a/depends/protobuf/src/google/protobuf/any.proto +++ /dev/null @@ -1,158 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -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; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := anypb.New(foo) -// if err != nil { -// ... -// } -// ... -// foo := &pb.Foo{} -// if err := any.UnmarshalTo(foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} diff --git a/depends/protobuf/src/google/protobuf/any_lite.cc b/depends/protobuf/src/google/protobuf/any_lite.cc deleted file mode 100644 index f283a31b0..000000000 --- a/depends/protobuf/src/google/protobuf/any_lite.cc +++ /dev/null @@ -1,96 +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 internal { - -std::string GetTypeUrl(StringPiece message_name, - StringPiece type_url_prefix) { - if (!type_url_prefix.empty() && - type_url_prefix[type_url_prefix.size() - 1] == '/') { - return StrCat(type_url_prefix, message_name); - } else { - return StrCat(type_url_prefix, "/", message_name); - } -} - -const char kAnyFullTypeName[] = "google.protobuf.Any"; -const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/"; -const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/"; - -bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message, - StringPiece type_url_prefix, - StringPiece type_name) { - type_url_->Set(GetTypeUrl(type_name, type_url_prefix), arena); - return message.SerializeToString(value_->Mutable(arena)); -} - -bool AnyMetadata::InternalUnpackTo(StringPiece type_name, - MessageLite* message) const { - if (!InternalIs(type_name)) { - return false; - } - return message->ParseFromString(value_->Get()); -} - -bool AnyMetadata::InternalIs(StringPiece type_name) const { - 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(StringPiece type_url, std::string* url_prefix, - std::string* full_type_name) { - 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 = std::string(type_url.substr(0, pos + 1)); - } - *full_type_name = std::string(type_url.substr(pos + 1)); - return true; -} - -bool ParseAnyTypeUrl(StringPiece type_url, std::string* full_type_name) { - return ParseAnyTypeUrl(type_url, nullptr, full_type_name); -} - -} // namespace internal -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/api.pb.cc b/depends/protobuf/src/google/protobuf/api.pb.cc deleted file mode 100644 index 24b60497c..000000000 --- a/depends/protobuf/src/google/protobuf/api.pb.cc +++ /dev/null @@ -1,1309 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/api.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include - -PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - -PROTOBUF_NAMESPACE_OPEN -PROTOBUF_CONSTEXPR Api::Api( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.methods_)*/{} - , /*decltype(_impl_.options_)*/{} - , /*decltype(_impl_.mixins_)*/{} - , /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.version_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.source_context_)*/nullptr - , /*decltype(_impl_.syntax_)*/0 - , /*decltype(_impl_._cached_size_)*/{}} {} -struct ApiDefaultTypeInternal { - PROTOBUF_CONSTEXPR ApiDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~ApiDefaultTypeInternal() {} - union { - Api _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ApiDefaultTypeInternal _Api_default_instance_; -PROTOBUF_CONSTEXPR Method::Method( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.options_)*/{} - , /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.request_type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.response_type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.request_streaming_)*/false - , /*decltype(_impl_.response_streaming_)*/false - , /*decltype(_impl_.syntax_)*/0 - , /*decltype(_impl_._cached_size_)*/{}} {} -struct MethodDefaultTypeInternal { - PROTOBUF_CONSTEXPR MethodDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~MethodDefaultTypeInternal() {} - union { - Method _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MethodDefaultTypeInternal _Method_default_instance_; -PROTOBUF_CONSTEXPR Mixin::Mixin( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.root_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_._cached_size_)*/{}} {} -struct MixinDefaultTypeInternal { - PROTOBUF_CONSTEXPR MixinDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~MixinDefaultTypeInternal() {} - union { - Mixin _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MixinDefaultTypeInternal _Mixin_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static ::_pb::Metadata file_level_metadata_google_2fprotobuf_2fapi_2eproto[3]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; - -const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.name_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.methods_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.options_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.version_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.source_context_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.mixins_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.syntax_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _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::Method, _impl_.name_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.request_type_url_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.request_streaming_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.response_type_url_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.response_streaming_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.options_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.syntax_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _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::Mixin, _impl_.name_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _impl_.root_), -}; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)}, - { 13, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, - { 26, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, -}; - -static const ::_pb::Message* const file_default_instances[] = { - &::PROTOBUF_NAMESPACE_ID::_Api_default_instance_._instance, - &::PROTOBUF_NAMESPACE_ID::_Method_default_instance_._instance, - &::PROTOBUF_NAMESPACE_ID::_Mixin_default_instance_._instance, -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\031google/protobuf/api.proto\022\017google.prot" - "obuf\032$google/protobuf/source_context.pro" - "to\032\032google/protobuf/type.proto\"\201\002\n\003Api\022\014" - "\n\004name\030\001 \001(\t\022(\n\007methods\030\002 \003(\0132\027.google.p" - "rotobuf.Method\022(\n\007options\030\003 \003(\0132\027.google" - ".protobuf.Option\022\017\n\007version\030\004 \001(\t\0226\n\016sou" - "rce_context\030\005 \001(\0132\036.google.protobuf.Sour" - "ceContext\022&\n\006mixins\030\006 \003(\0132\026.google.proto" - "buf.Mixin\022\'\n\006syntax\030\007 \001(\0162\027.google.proto" - "buf.Syntax\"\325\001\n\006Method\022\014\n\004name\030\001 \001(\t\022\030\n\020r" - "equest_type_url\030\002 \001(\t\022\031\n\021request_streami" - "ng\030\003 \001(\010\022\031\n\021response_type_url\030\004 \001(\t\022\032\n\022r" - "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(\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 ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fapi_2eproto_deps[2] = { - &::descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto, - &::descriptor_table_google_2fprotobuf_2ftype_2eproto, -}; -static ::_pbi::once_flag descriptor_table_google_2fprotobuf_2fapi_2eproto_once; -const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto = { - 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, file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto, - file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto, -}; -PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_google_2fprotobuf_2fapi_2eproto_getter() { - return &descriptor_table_google_2fprotobuf_2fapi_2eproto; -} - -// Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_google_2fprotobuf_2fapi_2eproto(&descriptor_table_google_2fprotobuf_2fapi_2eproto); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -class Api::_Internal { - public: - static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg); -}; - -const ::PROTOBUF_NAMESPACE_ID::SourceContext& -Api::_Internal::source_context(const Api* msg) { - return *msg->_impl_.source_context_; -} -void Api::clear_options() { - _impl_.options_.Clear(); -} -void Api::clear_source_context() { - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; - } - _impl_.source_context_ = nullptr; -} -Api::Api(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Api) -} -Api::Api(const Api& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Api* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.methods_){from._impl_.methods_} - , decltype(_impl_.options_){from._impl_.options_} - , decltype(_impl_.mixins_){from._impl_.mixins_} - , decltype(_impl_.name_){} - , decltype(_impl_.version_){} - , decltype(_impl_.source_context_){nullptr} - , decltype(_impl_.syntax_){} - , /*decltype(_impl_._cached_size_)*/{}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_name().empty()) { - _this->_impl_.name_.Set(from._internal_name(), - _this->GetArenaForAllocation()); - } - _impl_.version_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.version_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_version().empty()) { - _this->_impl_.version_.Set(from._internal_version(), - _this->GetArenaForAllocation()); - } - if (from._internal_has_source_context()) { - _this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_); - } - _this->_impl_.syntax_ = from._impl_.syntax_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.Api) -} - -inline void Api::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.methods_){arena} - , decltype(_impl_.options_){arena} - , decltype(_impl_.mixins_){arena} - , decltype(_impl_.name_){} - , decltype(_impl_.version_){} - , decltype(_impl_.source_context_){nullptr} - , decltype(_impl_.syntax_){0} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.version_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.version_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -Api::~Api() { - // @@protoc_insertion_point(destructor:google.protobuf.Api) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void Api::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.methods_.~RepeatedPtrField(); - _impl_.options_.~RepeatedPtrField(); - _impl_.mixins_.~RepeatedPtrField(); - _impl_.name_.Destroy(); - _impl_.version_.Destroy(); - if (this != internal_default_instance()) delete _impl_.source_context_; -} - -void Api::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); -} - -void Api::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Api) - uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_.methods_.Clear(); - _impl_.options_.Clear(); - _impl_.mixins_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.version_.ClearToEmpty(); - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; - } - _impl_.source_context_ = nullptr; - _impl_.syntax_ = 0; - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* Api::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // string name = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { - auto str = _internal_mutable_name(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Api.name")); - } else - goto handle_unusual; - continue; - // repeated .google.protobuf.Method methods = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { - ptr -= 1; - do { - ptr += 1; - ptr = ctx->ParseMessage(_internal_add_methods(), ptr); - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else - goto handle_unusual; - continue; - // repeated .google.protobuf.Option options = 3; - case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { - ptr -= 1; - do { - ptr += 1; - ptr = ctx->ParseMessage(_internal_add_options(), ptr); - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else - goto handle_unusual; - continue; - // string version = 4; - case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { - auto str = _internal_mutable_version(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Api.version")); - } else - goto handle_unusual; - continue; - // .google.protobuf.SourceContext source_context = 5; - case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { - ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // repeated .google.protobuf.Mixin mixins = 6; - case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { - ptr -= 1; - do { - ptr += 1; - ptr = ctx->ParseMessage(_internal_add_mixins(), ptr); - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else - goto handle_unusual; - continue; - // .google.protobuf.Syntax syntax = 7; - case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { - uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); - CHK_(ptr); - _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); - } else - 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* Api::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - // string name = 1; - 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, - "google.protobuf.Api.name"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_name(), target); - } - - // repeated .google.protobuf.Method methods = 2; - for (unsigned i = 0, - n = static_cast(this->_internal_methods_size()); i < n; i++) { - const auto& repfield = this->_internal_methods(i); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(2, repfield, repfield.GetCachedSize(), target, stream); - } - - // repeated .google.protobuf.Option options = 3; - for (unsigned i = 0, - n = static_cast(this->_internal_options_size()); i < n; i++) { - const auto& repfield = this->_internal_options(i); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(3, repfield, repfield.GetCachedSize(), target, stream); - } - - // string version = 4; - 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, - "google.protobuf.Api.version"); - target = stream->WriteStringMaybeAliased( - 4, this->_internal_version(), target); - } - - // .google.protobuf.SourceContext source_context = 5; - if (this->_internal_has_source_context()) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(5, _Internal::source_context(this), - _Internal::source_context(this).GetCachedSize(), target, stream); - } - - // repeated .google.protobuf.Mixin mixins = 6; - for (unsigned i = 0, - n = static_cast(this->_internal_mixins_size()); i < n; i++) { - const auto& repfield = this->_internal_mixins(i); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(6, repfield, repfield.GetCachedSize(), target, stream); - } - - // .google.protobuf.Syntax syntax = 7; - if (this->_internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 7, this->_internal_syntax(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::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.Api) - return target; -} - -size_t Api::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api) - 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.Method methods = 2; - total_size += 1UL * this->_internal_methods_size(); - for (const auto& msg : this->_impl_.methods_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - // repeated .google.protobuf.Option options = 3; - total_size += 1UL * this->_internal_options_size(); - for (const auto& msg : this->_impl_.options_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - // repeated .google.protobuf.Mixin mixins = 6; - total_size += 1UL * this->_internal_mixins_size(); - for (const auto& msg : this->_impl_.mixins_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - // string name = 1; - if (!this->_internal_name().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_name()); - } - - // string version = 4; - 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->_internal_has_source_context()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( - *_impl_.source_context_); - } - - // .google.protobuf.Syntax syntax = 7; - if (this->_internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_syntax()); - } - - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Api::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Api::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Api::GetClassData() const { return &_class_data_; } - - -void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - _this->_impl_.methods_.MergeFrom(from._impl_.methods_); - _this->_impl_.options_.MergeFrom(from._impl_.options_); - _this->_impl_.mixins_.MergeFrom(from._impl_.mixins_); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_version().empty()) { - _this->_internal_set_version(from._internal_version()); - } - if (from._internal_has_source_context()) { - _this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom( - from._internal_source_context()); - } - if (from._internal_syntax() != 0) { - _this->_internal_set_syntax(from._internal_syntax()); - } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); -} - -void Api::CopyFrom(const Api& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Api) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Api::IsInitialized() const { - return true; -} - -void Api::InternalSwap(Api* other) { - using std::swap; - auto* lhs_arena = GetArenaForAllocation(); - auto* rhs_arena = other->GetArenaForAllocation(); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.methods_.InternalSwap(&other->_impl_.methods_); - _impl_.options_.InternalSwap(&other->_impl_.options_); - _impl_.mixins_.InternalSwap(&other->_impl_.mixins_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.name_, lhs_arena, - &other->_impl_.name_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.version_, lhs_arena, - &other->_impl_.version_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_) - + sizeof(Api::_impl_.syntax_) - - PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_)>( - reinterpret_cast(&_impl_.source_context_), - reinterpret_cast(&other->_impl_.source_context_)); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Api::GetMetadata() const { - return ::_pbi::AssignDescriptors( - &descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, - file_level_metadata_google_2fprotobuf_2fapi_2eproto[0]); -} - -// =================================================================== - -class Method::_Internal { - public: -}; - -void Method::clear_options() { - _impl_.options_.Clear(); -} -Method::Method(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Method) -} -Method::Method(const Method& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Method* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.options_){from._impl_.options_} - , decltype(_impl_.name_){} - , decltype(_impl_.request_type_url_){} - , decltype(_impl_.response_type_url_){} - , decltype(_impl_.request_streaming_){} - , decltype(_impl_.response_streaming_){} - , decltype(_impl_.syntax_){} - , /*decltype(_impl_._cached_size_)*/{}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_name().empty()) { - _this->_impl_.name_.Set(from._internal_name(), - _this->GetArenaForAllocation()); - } - _impl_.request_type_url_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.request_type_url_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_request_type_url().empty()) { - _this->_impl_.request_type_url_.Set(from._internal_request_type_url(), - _this->GetArenaForAllocation()); - } - _impl_.response_type_url_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.response_type_url_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_response_type_url().empty()) { - _this->_impl_.response_type_url_.Set(from._internal_response_type_url(), - _this->GetArenaForAllocation()); - } - ::memcpy(&_impl_.request_streaming_, &from._impl_.request_streaming_, - static_cast(reinterpret_cast(&_impl_.syntax_) - - reinterpret_cast(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_)); - // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) -} - -inline void Method::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.options_){arena} - , decltype(_impl_.name_){} - , decltype(_impl_.request_type_url_){} - , decltype(_impl_.response_type_url_){} - , decltype(_impl_.request_streaming_){false} - , decltype(_impl_.response_streaming_){false} - , decltype(_impl_.syntax_){0} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.request_type_url_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.request_type_url_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.response_type_url_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.response_type_url_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -Method::~Method() { - // @@protoc_insertion_point(destructor:google.protobuf.Method) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void Method::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.options_.~RepeatedPtrField(); - _impl_.name_.Destroy(); - _impl_.request_type_url_.Destroy(); - _impl_.response_type_url_.Destroy(); -} - -void Method::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); -} - -void Method::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Method) - uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.request_type_url_.ClearToEmpty(); - _impl_.response_type_url_.ClearToEmpty(); - ::memset(&_impl_.request_streaming_, 0, static_cast( - reinterpret_cast(&_impl_.syntax_) - - reinterpret_cast(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_)); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* Method::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // string name = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { - auto str = _internal_mutable_name(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Method.name")); - } else - goto handle_unusual; - continue; - // string request_type_url = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { - auto str = _internal_mutable_request_type_url(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Method.request_type_url")); - } else - goto handle_unusual; - continue; - // bool request_streaming = 3; - case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { - _impl_.request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // string response_type_url = 4; - case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { - auto str = _internal_mutable_response_type_url(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Method.response_type_url")); - } else - goto handle_unusual; - continue; - // bool response_streaming = 5; - case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { - _impl_.response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // repeated .google.protobuf.Option options = 6; - case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { - ptr -= 1; - do { - ptr += 1; - ptr = ctx->ParseMessage(_internal_add_options(), ptr); - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else - goto handle_unusual; - continue; - // .google.protobuf.Syntax syntax = 7; - case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { - uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); - CHK_(ptr); - _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); - } else - 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* Method::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - // string name = 1; - 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, - "google.protobuf.Method.name"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_name(), target); - } - - // string request_type_url = 2; - 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, - "google.protobuf.Method.request_type_url"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_request_type_url(), target); - } - - // bool request_streaming = 3; - if (this->_internal_request_streaming() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray(3, this->_internal_request_streaming(), target); - } - - // string response_type_url = 4; - 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, - "google.protobuf.Method.response_type_url"); - target = stream->WriteStringMaybeAliased( - 4, this->_internal_response_type_url(), target); - } - - // bool response_streaming = 5; - if (this->_internal_response_streaming() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray(5, this->_internal_response_streaming(), target); - } - - // repeated .google.protobuf.Option options = 6; - for (unsigned i = 0, - n = static_cast(this->_internal_options_size()); i < n; i++) { - const auto& repfield = this->_internal_options(i); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(6, repfield, repfield.GetCachedSize(), target, stream); - } - - // .google.protobuf.Syntax syntax = 7; - if (this->_internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 7, this->_internal_syntax(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::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.Method) - return target; -} - -size_t Method::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method) - 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.Option options = 6; - total_size += 1UL * this->_internal_options_size(); - for (const auto& msg : this->_impl_.options_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - // string name = 1; - if (!this->_internal_name().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_name()); - } - - // string request_type_url = 2; - 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->_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->_internal_request_streaming() != 0) { - total_size += 1 + 1; - } - - // bool response_streaming = 5; - if (this->_internal_response_streaming() != 0) { - total_size += 1 + 1; - } - - // .google.protobuf.Syntax syntax = 7; - if (this->_internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_syntax()); - } - - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Method::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Method::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Method::GetClassData() const { return &_class_data_; } - - -void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - _this->_impl_.options_.MergeFrom(from._impl_.options_); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_request_type_url().empty()) { - _this->_internal_set_request_type_url(from._internal_request_type_url()); - } - if (!from._internal_response_type_url().empty()) { - _this->_internal_set_response_type_url(from._internal_response_type_url()); - } - if (from._internal_request_streaming() != 0) { - _this->_internal_set_request_streaming(from._internal_request_streaming()); - } - if (from._internal_response_streaming() != 0) { - _this->_internal_set_response_streaming(from._internal_response_streaming()); - } - if (from._internal_syntax() != 0) { - _this->_internal_set_syntax(from._internal_syntax()); - } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); -} - -void Method::CopyFrom(const Method& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Method) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Method::IsInitialized() const { - return true; -} - -void Method::InternalSwap(Method* other) { - using std::swap; - auto* lhs_arena = GetArenaForAllocation(); - auto* rhs_arena = other->GetArenaForAllocation(); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.options_.InternalSwap(&other->_impl_.options_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.name_, lhs_arena, - &other->_impl_.name_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.request_type_url_, lhs_arena, - &other->_impl_.request_type_url_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.response_type_url_, lhs_arena, - &other->_impl_.response_type_url_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_) - + sizeof(Method::_impl_.syntax_) - - PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_)>( - reinterpret_cast(&_impl_.request_streaming_), - reinterpret_cast(&other->_impl_.request_streaming_)); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Method::GetMetadata() const { - return ::_pbi::AssignDescriptors( - &descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, - file_level_metadata_google_2fprotobuf_2fapi_2eproto[1]); -} - -// =================================================================== - -class Mixin::_Internal { - public: -}; - -Mixin::Mixin(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Mixin) -} -Mixin::Mixin(const Mixin& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Mixin* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.name_){} - , decltype(_impl_.root_){} - , /*decltype(_impl_._cached_size_)*/{}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_name().empty()) { - _this->_impl_.name_.Set(from._internal_name(), - _this->GetArenaForAllocation()); - } - _impl_.root_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.root_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_root().empty()) { - _this->_impl_.root_.Set(from._internal_root(), - _this->GetArenaForAllocation()); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin) -} - -inline void Mixin::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.name_){} - , decltype(_impl_.root_){} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.root_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.root_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -Mixin::~Mixin() { - // @@protoc_insertion_point(destructor:google.protobuf.Mixin) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void Mixin::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.name_.Destroy(); - _impl_.root_.Destroy(); -} - -void Mixin::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); -} - -void Mixin::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin) - uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_.name_.ClearToEmpty(); - _impl_.root_.ClearToEmpty(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* Mixin::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // string name = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { - auto str = _internal_mutable_name(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Mixin.name")); - } else - goto handle_unusual; - continue; - // string root = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { - auto str = _internal_mutable_root(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Mixin.root")); - } 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* Mixin::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - // string name = 1; - 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, - "google.protobuf.Mixin.name"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_name(), target); - } - - // string root = 2; - 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, - "google.protobuf.Mixin.root"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_root(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::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.Mixin) - return target; -} - -size_t Mixin::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin) - 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 name = 1; - if (!this->_internal_name().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_name()); - } - - // string root = 2; - if (!this->_internal_root().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_root()); - } - - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mixin::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Mixin::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Mixin::GetClassData() const { return &_class_data_; } - - -void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_root().empty()) { - _this->_internal_set_root(from._internal_root()); - } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); -} - -void Mixin::CopyFrom(const Mixin& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Mixin) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Mixin::IsInitialized() const { - return true; -} - -void Mixin::InternalSwap(Mixin* 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( - &_impl_.name_, lhs_arena, - &other->_impl_.name_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.root_, lhs_arena, - &other->_impl_.root_, rhs_arena - ); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Mixin::GetMetadata() const { - return ::_pbi::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::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Api >(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::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Mixin >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/depends/protobuf/src/google/protobuf/api.pb.h b/depends/protobuf/src/google/protobuf/api.pb.h deleted file mode 100644 index b81b18e35..000000000 --- a/depends/protobuf/src/google/protobuf/api.pb.h +++ /dev/null @@ -1,1437 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/api.proto - -#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fapi_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fapi_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3021000 -#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 3021010 < 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. -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fapi_2eproto PROTOBUF_EXPORT -PROTOBUF_NAMESPACE_OPEN -namespace internal { -class AnyMetadata; -} // namespace internal -PROTOBUF_NAMESPACE_CLOSE - -// Internal implementation detail -- do not use these members. -struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto { - static const uint32_t offsets[]; -}; -PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto; -PROTOBUF_NAMESPACE_OPEN -class Api; -struct ApiDefaultTypeInternal; -PROTOBUF_EXPORT extern ApiDefaultTypeInternal _Api_default_instance_; -class Method; -struct MethodDefaultTypeInternal; -PROTOBUF_EXPORT extern MethodDefaultTypeInternal _Method_default_instance_; -class Mixin; -struct MixinDefaultTypeInternal; -PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -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 final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ { - public: - inline Api() : Api(nullptr) {} - ~Api() override; - explicit PROTOBUF_CONSTEXPR Api(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Api(const Api& from); - Api(Api&& from) noexcept - : Api() { - *this = ::std::move(from); - } - - inline Api& operator=(const Api& from) { - CopyFrom(from); - return *this; - } - inline Api& operator=(Api&& from) noexcept { - 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); - } - return *this; - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Api& default_instance() { - return *internal_default_instance(); - } - static inline const Api* internal_default_instance() { - return reinterpret_cast( - &_Api_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - friend void swap(Api& a, Api& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Api& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Api& from) { - Api::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kMethodsFieldNumber = 2, - kOptionsFieldNumber = 3, - kMixinsFieldNumber = 6, - kNameFieldNumber = 1, - kVersionFieldNumber = 4, - kSourceContextFieldNumber = 5, - kSyntaxFieldNumber = 7, - }; - // repeated .google.protobuf.Method methods = 2; - int methods_size() const; - private: - 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 >* - mutable_methods(); - private: - 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 >& - methods() const; - - // repeated .google.protobuf.Option options = 3; - int options_size() const; - private: - 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 >* - mutable_options(); - private: - 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 >& - options() const; - - // repeated .google.protobuf.Mixin mixins = 6; - int mixins_size() const; - private: - 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 >* - mutable_mixins(); - private: - 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 >& - mixins() const; - - // string name = 1; - void clear_name(); - const std::string& name() const; - template - void set_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* name); - private: - const std::string& _internal_name() const; - 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; - template - void set_version(ArgT0&& arg0, ArgT... args); - std::string* mutable_version(); - PROTOBUF_NODISCARD std::string* release_version(); - void set_allocated_version(std::string* version); - private: - const std::string& _internal_version() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_version(const std::string& value); - std::string* _internal_mutable_version(); - public: - - // .google.protobuf.SourceContext source_context = 5; - bool has_source_context() const; - private: - bool _internal_has_source_context() const; - public: - void clear_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(); - 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); - private: - ::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; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::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_; - int syntax_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; -}; -// ------------------------------------------------------------------- - -class PROTOBUF_EXPORT Method final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ { - public: - inline Method() : Method(nullptr) {} - ~Method() override; - explicit PROTOBUF_CONSTEXPR Method(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Method(const Method& from); - Method(Method&& from) noexcept - : Method() { - *this = ::std::move(from); - } - - inline Method& operator=(const Method& from) { - CopyFrom(from); - return *this; - } - inline Method& operator=(Method&& from) noexcept { - 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); - } - return *this; - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Method& default_instance() { - return *internal_default_instance(); - } - static inline const Method* internal_default_instance() { - return reinterpret_cast( - &_Method_default_instance_); - } - static constexpr int kIndexInFileMessages = - 1; - - friend void swap(Method& a, Method& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Method& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Method& from) { - Method::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kOptionsFieldNumber = 6, - kNameFieldNumber = 1, - kRequestTypeUrlFieldNumber = 2, - kResponseTypeUrlFieldNumber = 4, - kRequestStreamingFieldNumber = 3, - kResponseStreamingFieldNumber = 5, - kSyntaxFieldNumber = 7, - }; - // repeated .google.protobuf.Option options = 6; - int options_size() const; - private: - 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 >* - mutable_options(); - private: - 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 >& - options() const; - - // string name = 1; - void clear_name(); - const std::string& name() const; - template - void set_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* name); - private: - const std::string& _internal_name() const; - 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; - template - void set_request_type_url(ArgT0&& arg0, ArgT... args); - std::string* mutable_request_type_url(); - PROTOBUF_NODISCARD std::string* release_request_type_url(); - void set_allocated_request_type_url(std::string* request_type_url); - private: - const std::string& _internal_request_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_type_url(const std::string& value); - 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; - template - void set_response_type_url(ArgT0&& arg0, ArgT... args); - std::string* mutable_response_type_url(); - PROTOBUF_NODISCARD std::string* release_response_type_url(); - void set_allocated_response_type_url(std::string* response_type_url); - private: - const std::string& _internal_response_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_response_type_url(const std::string& value); - std::string* _internal_mutable_response_type_url(); - public: - - // bool request_streaming = 3; - void clear_request_streaming(); - bool request_streaming() const; - void set_request_streaming(bool value); - private: - bool _internal_request_streaming() const; - void _internal_set_request_streaming(bool value); - public: - - // bool response_streaming = 5; - void clear_response_streaming(); - bool response_streaming() const; - void set_response_streaming(bool value); - private: - bool _internal_response_streaming() const; - void _internal_set_response_streaming(bool value); - public: - - // .google.protobuf.Syntax syntax = 7; - void clear_syntax(); - ::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); - public: - - // @@protoc_insertion_point(class_scope:google.protobuf.Method) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::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_; - bool request_streaming_; - bool response_streaming_; - int syntax_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; -}; -// ------------------------------------------------------------------- - -class PROTOBUF_EXPORT Mixin final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ { - public: - inline Mixin() : Mixin(nullptr) {} - ~Mixin() override; - explicit PROTOBUF_CONSTEXPR Mixin(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Mixin(const Mixin& from); - Mixin(Mixin&& from) noexcept - : Mixin() { - *this = ::std::move(from); - } - - inline Mixin& operator=(const Mixin& from) { - CopyFrom(from); - return *this; - } - inline Mixin& operator=(Mixin&& from) noexcept { - 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); - } - return *this; - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Mixin& default_instance() { - return *internal_default_instance(); - } - static inline const Mixin* internal_default_instance() { - return reinterpret_cast( - &_Mixin_default_instance_); - } - static constexpr int kIndexInFileMessages = - 2; - - friend void swap(Mixin& a, Mixin& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Mixin& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Mixin& from) { - Mixin::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kNameFieldNumber = 1, - kRootFieldNumber = 2, - }; - // string name = 1; - void clear_name(); - const std::string& name() const; - template - void set_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* name); - private: - const std::string& _internal_name() const; - 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; - template - void set_root(ArgT0&& arg0, ArgT... args); - std::string* mutable_root(); - PROTOBUF_NODISCARD std::string* release_root(); - void set_allocated_root(std::string* root); - private: - const std::string& _internal_root() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_root(const std::string& value); - std::string* _internal_mutable_root(); - public: - - // @@protoc_insertion_point(class_scope:google.protobuf.Mixin) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr root_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// Api - -// string name = 1; -inline void Api::clear_name() { - _impl_.name_.ClearToEmpty(); -} -inline const std::string& Api::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.name) - return _internal_name(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Api::set_name(ArgT0&& arg0, ArgT... args) { - - _impl_.name_.Set(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 _s; -} -inline const std::string& Api::_internal_name() const { - return _impl_.name_.Get(); -} -inline void Api::_internal_set_name(const std::string& value) { - - _impl_.name_.Set(value, GetArenaForAllocation()); -} -inline std::string* Api::_internal_mutable_name() { - - return _impl_.name_.Mutable(GetArenaForAllocation()); -} -inline std::string* Api::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Api.name) - return _impl_.name_.Release(); -} -inline void Api::set_allocated_name(std::string* name) { - if (name != nullptr) { - - } else { - - } - _impl_.name_.SetAllocated(name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name) -} - -// repeated .google.protobuf.Method methods = 2; -inline int Api::_internal_methods_size() const { - return _impl_.methods_.size(); -} -inline int Api::methods_size() const { - return _internal_methods_size(); -} -inline void Api::clear_methods() { - _impl_.methods_.Clear(); -} -inline ::PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) - return _impl_.methods_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* -Api::mutable_methods() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) - return &_impl_.methods_; -} -inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { - return _impl_.methods_.Get(index); -} -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() { - return _impl_.methods_.Add(); -} -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 _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& -Api::methods() const { - // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) - return _impl_.methods_; -} - -// repeated .google.protobuf.Option options = 3; -inline int Api::_internal_options_size() const { - return _impl_.options_.size(); -} -inline int Api::options_size() const { - return _internal_options_size(); -} -inline ::PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) - return _impl_.options_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* -Api::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) - return &_impl_.options_; -} -inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { - return _impl_.options_.Get(index); -} -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() { - return _impl_.options_.Add(); -} -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 _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& -Api::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Api.options) - return _impl_.options_; -} - -// string version = 4; -inline void Api::clear_version() { - _impl_.version_.ClearToEmpty(); -} -inline const std::string& Api::version() const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.version) - return _internal_version(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Api::set_version(ArgT0&& arg0, ArgT... args) { - - _impl_.version_.Set(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 _s; -} -inline const std::string& Api::_internal_version() const { - return _impl_.version_.Get(); -} -inline void Api::_internal_set_version(const std::string& value) { - - _impl_.version_.Set(value, GetArenaForAllocation()); -} -inline std::string* Api::_internal_mutable_version() { - - return _impl_.version_.Mutable(GetArenaForAllocation()); -} -inline std::string* Api::release_version() { - // @@protoc_insertion_point(field_release:google.protobuf.Api.version) - return _impl_.version_.Release(); -} -inline void Api::set_allocated_version(std::string* version) { - if (version != nullptr) { - - } else { - - } - _impl_.version_.SetAllocated(version, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.version_.IsDefault()) { - _impl_.version_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version) -} - -// .google.protobuf.SourceContext source_context = 5; -inline bool Api::_internal_has_source_context() const { - return this != internal_default_instance() && _impl_.source_context_ != nullptr; -} -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 = _impl_.source_context_; - return p != nullptr ? *p : reinterpret_cast( - ::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); -} -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 void Api::unsafe_arena_set_allocated_source_context( - ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.source_context_); - } - _impl_.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 = _impl_.source_context_; - _impl_.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 = _impl_.source_context_; - _impl_.source_context_ = nullptr; - return temp; -} -inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { - - if (_impl_.source_context_ == nullptr) { - auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); - _impl_.source_context_ = p; - } - return _impl_.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 _msg; -} -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*>(_impl_.source_context_); - } - if (source_context) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( - 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); - } - - } else { - - } - _impl_.source_context_ = source_context; - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context) -} - -// repeated .google.protobuf.Mixin mixins = 6; -inline int Api::_internal_mixins_size() const { - return _impl_.mixins_.size(); -} -inline int Api::mixins_size() const { - return _internal_mixins_size(); -} -inline void Api::clear_mixins() { - _impl_.mixins_.Clear(); -} -inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins) - return _impl_.mixins_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* -Api::mutable_mixins() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) - return &_impl_.mixins_; -} -inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { - return _impl_.mixins_.Get(index); -} -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() { - return _impl_.mixins_.Add(); -} -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 _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& -Api::mixins() const { - // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins) - return _impl_.mixins_; -} - -// .google.protobuf.Syntax syntax = 7; -inline void Api::clear_syntax() { - _impl_.syntax_ = 0; -} -inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { - return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(_impl_.syntax_); -} -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) { - - _impl_.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) -} - -// ------------------------------------------------------------------- - -// Method - -// string name = 1; -inline void Method::clear_name() { - _impl_.name_.ClearToEmpty(); -} -inline const std::string& Method::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.name) - return _internal_name(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Method::set_name(ArgT0&& arg0, ArgT... args) { - - _impl_.name_.Set(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 _s; -} -inline const std::string& Method::_internal_name() const { - return _impl_.name_.Get(); -} -inline void Method::_internal_set_name(const std::string& value) { - - _impl_.name_.Set(value, GetArenaForAllocation()); -} -inline std::string* Method::_internal_mutable_name() { - - return _impl_.name_.Mutable(GetArenaForAllocation()); -} -inline std::string* Method::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Method.name) - return _impl_.name_.Release(); -} -inline void Method::set_allocated_name(std::string* name) { - if (name != nullptr) { - - } else { - - } - _impl_.name_.SetAllocated(name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", 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() { - _impl_.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(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Method::set_request_type_url(ArgT0&& arg0, ArgT... args) { - - _impl_.request_type_url_.Set(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 _s; -} -inline const std::string& Method::_internal_request_type_url() const { - return _impl_.request_type_url_.Get(); -} -inline void Method::_internal_set_request_type_url(const std::string& value) { - - _impl_.request_type_url_.Set(value, GetArenaForAllocation()); -} -inline std::string* Method::_internal_mutable_request_type_url() { - - return _impl_.request_type_url_.Mutable(GetArenaForAllocation()); -} -inline std::string* Method::release_request_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url) - return _impl_.request_type_url_.Release(); -} -inline void Method::set_allocated_request_type_url(std::string* request_type_url) { - if (request_type_url != nullptr) { - - } else { - - } - _impl_.request_type_url_.SetAllocated(request_type_url, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.request_type_url_.IsDefault()) { - _impl_.request_type_url_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url) -} - -// bool request_streaming = 3; -inline void Method::clear_request_streaming() { - _impl_.request_streaming_ = false; -} -inline bool Method::_internal_request_streaming() const { - return _impl_.request_streaming_; -} -inline bool Method::request_streaming() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) - return _internal_request_streaming(); -} -inline void Method::_internal_set_request_streaming(bool value) { - - _impl_.request_streaming_ = value; -} -inline void Method::set_request_streaming(bool value) { - _internal_set_request_streaming(value); - // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) -} - -// string response_type_url = 4; -inline void Method::clear_response_type_url() { - _impl_.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(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Method::set_response_type_url(ArgT0&& arg0, ArgT... args) { - - _impl_.response_type_url_.Set(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 _s; -} -inline const std::string& Method::_internal_response_type_url() const { - return _impl_.response_type_url_.Get(); -} -inline void Method::_internal_set_response_type_url(const std::string& value) { - - _impl_.response_type_url_.Set(value, GetArenaForAllocation()); -} -inline std::string* Method::_internal_mutable_response_type_url() { - - return _impl_.response_type_url_.Mutable(GetArenaForAllocation()); -} -inline std::string* Method::release_response_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url) - return _impl_.response_type_url_.Release(); -} -inline void Method::set_allocated_response_type_url(std::string* response_type_url) { - if (response_type_url != nullptr) { - - } else { - - } - _impl_.response_type_url_.SetAllocated(response_type_url, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.response_type_url_.IsDefault()) { - _impl_.response_type_url_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url) -} - -// bool response_streaming = 5; -inline void Method::clear_response_streaming() { - _impl_.response_streaming_ = false; -} -inline bool Method::_internal_response_streaming() const { - return _impl_.response_streaming_; -} -inline bool Method::response_streaming() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) - return _internal_response_streaming(); -} -inline void Method::_internal_set_response_streaming(bool value) { - - _impl_.response_streaming_ = value; -} -inline void Method::set_response_streaming(bool value) { - _internal_set_response_streaming(value); - // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) -} - -// repeated .google.protobuf.Option options = 6; -inline int Method::_internal_options_size() const { - return _impl_.options_.size(); -} -inline int Method::options_size() const { - return _internal_options_size(); -} -inline ::PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) - return _impl_.options_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* -Method::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) - return &_impl_.options_; -} -inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { - return _impl_.options_.Get(index); -} -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() { - return _impl_.options_.Add(); -} -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 _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& -Method::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Method.options) - return _impl_.options_; -} - -// .google.protobuf.Syntax syntax = 7; -inline void Method::clear_syntax() { - _impl_.syntax_ = 0; -} -inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { - return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(_impl_.syntax_); -} -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) { - - _impl_.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) -} - -// ------------------------------------------------------------------- - -// Mixin - -// string name = 1; -inline void Mixin::clear_name() { - _impl_.name_.ClearToEmpty(); -} -inline const std::string& Mixin::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Mixin.name) - return _internal_name(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Mixin::set_name(ArgT0&& arg0, ArgT... args) { - - _impl_.name_.Set(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 _s; -} -inline const std::string& Mixin::_internal_name() const { - return _impl_.name_.Get(); -} -inline void Mixin::_internal_set_name(const std::string& value) { - - _impl_.name_.Set(value, GetArenaForAllocation()); -} -inline std::string* Mixin::_internal_mutable_name() { - - return _impl_.name_.Mutable(GetArenaForAllocation()); -} -inline std::string* Mixin::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name) - return _impl_.name_.Release(); -} -inline void Mixin::set_allocated_name(std::string* name) { - if (name != nullptr) { - - } else { - - } - _impl_.name_.SetAllocated(name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", 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() { - _impl_.root_.ClearToEmpty(); -} -inline const std::string& Mixin::root() const { - // @@protoc_insertion_point(field_get:google.protobuf.Mixin.root) - return _internal_root(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Mixin::set_root(ArgT0&& arg0, ArgT... args) { - - _impl_.root_.Set(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 _s; -} -inline const std::string& Mixin::_internal_root() const { - return _impl_.root_.Get(); -} -inline void Mixin::_internal_set_root(const std::string& value) { - - _impl_.root_.Set(value, GetArenaForAllocation()); -} -inline std::string* Mixin::_internal_mutable_root() { - - return _impl_.root_.Mutable(GetArenaForAllocation()); -} -inline std::string* Mixin::release_root() { - // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root) - return _impl_.root_.Release(); -} -inline void Mixin::set_allocated_root(std::string* root) { - if (root != nullptr) { - - } else { - - } - _impl_.root_.SetAllocated(root, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.root_.IsDefault()) { - _impl_.root_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root) -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - - -// @@protoc_insertion_point(namespace_scope) - -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) - -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fapi_2eproto diff --git a/depends/protobuf/src/google/protobuf/api.proto b/depends/protobuf/src/google/protobuf/api.proto deleted file mode 100644 index 3d598fc85..000000000 --- a/depends/protobuf/src/google/protobuf/api.proto +++ /dev/null @@ -1,208 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -import "google/protobuf/source_context.proto"; -import "google/protobuf/type.proto"; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -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/protobuf/types/known/apipb"; - -// Api is a light-weight descriptor for an API Interface. -// -// Interfaces are also described as "protocol buffer services" in some contexts, -// such as by the "service" keyword in a .proto file, but they are different -// from API Services, which represent a concrete implementation of an interface -// as opposed to simply a description of methods and bindings. They are also -// sometimes simply referred to as "APIs" in other contexts, such as the name of -// 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; - - // The methods of this interface, in unspecified order. - repeated Method methods = 2; - - // Any metadata attached to the interface. - repeated Option options = 3; - - // A version string for this interface. If specified, must have the form - // `major-version.minor-version`, as in `1.10`. If the minor version is - // omitted, it defaults to zero. If the entire version field is empty, the - // major version is derived from the package name, as outlined below. If the - // field is not empty, the version in the package name will be verified to be - // consistent with what is provided here. - // - // The versioning schema uses [semantic - // versioning](http://semver.org) where the major version number - // indicates a breaking change and the minor version an additive, - // non-breaking change. Both version numbers are signals to users - // what to expect from different versions, and should be carefully - // chosen based on the product plan. - // - // The major version is also reflected in the package name of the - // interface, which must end in `v`, as in - // `google.feature.v1`. For major versions 0 and 1, the suffix can - // be omitted. Zero major versions must only be used for - // experimental, non-GA interfaces. - // - // - string version = 4; - - // Source context for the protocol buffer service represented by this - // message. - SourceContext source_context = 5; - - // Included interfaces. See [Mixin][]. - repeated Mixin mixins = 6; - - // The source syntax of the service. - Syntax syntax = 7; -} - -// Method represents a method of an API interface. -message Method { - // The simple name of this method. - string name = 1; - - // A URL of the input message type. - string request_type_url = 2; - - // If true, the request is streamed. - bool request_streaming = 3; - - // The URL of the output message type. - string response_type_url = 4; - - // If true, the response is streamed. - bool response_streaming = 5; - - // Any metadata attached to the method. - repeated Option options = 6; - - // The source syntax of this method. - Syntax syntax = 7; -} - -// Declares an API Interface to be included in this interface. The including -// interface must redeclare all the methods from the included interface, but -// documentation and options are inherited as follows: -// -// - If after comment and whitespace stripping, the documentation -// string of the redeclared method is empty, it will be inherited -// from the original method. -// -// - Each annotation belonging to the service config (http, -// visibility) which is not set in the redeclared method will be -// inherited. -// -// - If an http annotation is inherited, the path pattern will be -// modified as follows. Any version prefix will be replaced by the -// version of the including interface plus the [root][] path if -// specified. -// -// Example of a simple mixin: -// -// package google.acl.v1; -// service AccessControl { -// // Get the underlying ACL object. -// rpc GetAcl(GetAclRequest) returns (Acl) { -// option (google.api.http).get = "/v1/{resource=**}:getAcl"; -// } -// } -// -// package google.storage.v2; -// service Storage { -// rpc GetAcl(GetAclRequest) returns (Acl); -// -// // Get a data record. -// rpc GetData(GetDataRequest) returns (Data) { -// option (google.api.http).get = "/v2/{resource=**}"; -// } -// } -// -// Example of a mixin configuration: -// -// apis: -// - name: google.storage.v2.Storage -// mixins: -// - name: google.acl.v1.AccessControl -// -// 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 inheriting -// documentation and annotations as follows: -// -// service Storage { -// // Get the underlying ACL object. -// rpc GetAcl(GetAclRequest) returns (Acl) { -// option (google.api.http).get = "/v2/{resource=**}:getAcl"; -// } -// ... -// } -// -// Note how the version in the path pattern changed from `v1` to `v2`. -// -// If the `root` field in the mixin is specified, it should be a -// relative path under which inherited HTTP paths are placed. Example: -// -// apis: -// - name: google.storage.v2.Storage -// mixins: -// - name: google.acl.v1.AccessControl -// root: acls -// -// This implies the following inherited HTTP annotation: -// -// service Storage { -// // Get the underlying ACL object. -// rpc GetAcl(GetAclRequest) returns (Acl) { -// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; -// } -// ... -// } -message Mixin { - // The fully qualified name of the interface which is included. - string name = 1; - - // If non-empty specifies a path under which inherited HTTP paths - // are rooted. - string root = 2; -} diff --git a/depends/protobuf/src/google/protobuf/arena.cc b/depends/protobuf/src/google/protobuf/arena.cc deleted file mode 100644 index 6ba508a5f..000000000 --- a/depends/protobuf/src/google/protobuf/arena.cc +++ /dev/null @@ -1,537 +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 -#include - -#include -#ifdef ADDRESS_SANITIZER -#include -#endif // ADDRESS_SANITIZER - -// Must be included last. -#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 { - internal::SizedDelete(mem.ptr, mem.size); - } - *space_allocated_ += mem.size; - } - - private: - void (*dealloc_)(void*, size_t); - size_t* space_allocated_; -}; - -SerialArena::SerialArena(Block* b, void* owner, ThreadSafeArenaStats* stats) - : space_allocated_(b->size) { - owner_ = owner; - head_ = b; - ptr_ = b->Pointer(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize); - limit_ = b->Pointer(b->size & static_cast(-8)); - arena_stats_ = stats; -} - -SerialArena* SerialArena::New(Memory mem, void* owner, - ThreadSafeArenaStats* stats) { - GOOGLE_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize, mem.size); - ThreadSafeArenaStats::RecordAllocateStats( - stats, /*requested=*/mem.size, /*allocated=*/mem.size, /*wasted=*/0); - auto b = new (mem.ptr) Block{nullptr, mem.size}; - return new (b->Pointer(kBlockHeaderSize)) SerialArena(b, owner, stats); -} - -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. - size_t used = ptr_ - head_->Pointer(kBlockHeaderSize); - size_t wasted = head_->size - used; - space_used_ += used; - - // TODO(sbenza): Evaluate if pushing unused space into the cached blocks is a - // win. In preliminary testing showed increased memory savings as expected, - // but with a CPU regression. The regression might have been an artifact of - // the microbenchmark. - - 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); - ThreadSafeArenaStats::RecordAllocateStats(arena_stats_, /*requested=*/n, - /*allocated=*/mem.size, wasted); - 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 - arena_stats_ = Sample(); -} - -void ThreadSafeArena::SetInitialBlock(void* mem, size_t size) { - SerialArena* serial = SerialArena::New({mem, size}, &thread_cache(), - arena_stats_.MutableStats()); - 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()) { -#ifdef ADDRESS_SANITIZER - // Unpoison the initial block, now that it's going back to the user. - ASAN_UNPOISON_MEMORY_REGION(mem.ptr, mem.size); -#endif // ADDRESS_SANITIZER - 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); - arena_stats_.RecordReset(); - - 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, - arena_stats_.MutableStats()); - - 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) -void* Arena::AllocateAlignedWithHookForArray(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/depends/protobuf/src/google/protobuf/arena.h b/depends/protobuf/src/google/protobuf/arena.h deleted file mode 100644 index 3b5f16c38..000000000 --- a/depends/protobuf/src/google/protobuf/arena.h +++ /dev/null @@ -1,851 +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_H__ -#define GOOGLE_PROTOBUF_ARENA_H__ - - -#include -#include -#include -#if defined(_MSC_VER) && !defined(_LIBCPP_STD_VER) && !_HAS_EXCEPTIONS -// Work around bugs in MSVC header when _HAS_EXCEPTIONS=0. -#include -#include -namespace std { -using type_info = ::type_info; -} -#else -#include -#endif - -#include -#include -#include - -// Must be included last. -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -namespace google { -namespace protobuf { - -struct ArenaOptions; // defined below -class Arena; // defined below -class Message; // defined in message.h -class MessageLite; -template -class Map; - -namespace arena_metrics { - -void EnableArenaMetrics(ArenaOptions* options); - -} // namespace arena_metrics - -namespace TestUtil { -class ReflectionTester; // defined in test_util.h -} // namespace TestUtil - -namespace internal { - -struct ArenaTestPeer; // defined in arena_test_util.h -class InternalMetadata; // defined in metadata_lite.h -class LazyField; // defined in lazy_field.h -class EpsCopyInputStream; // defined in parse_context.h -class RepeatedPtrFieldBase; // defined in repeated_ptr_field.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); -} -} // namespace internal - -// ArenaOptions provides optional additional parameters to arena construction -// that control its block-allocation behavior. -struct ArenaOptions { - // This defines the size of the first block requested from the system malloc. - // Subsequent block sizes will increase in a geometric series up to a maximum. - size_t start_block_size; - - // This defines the maximum block size requested from system malloc (unless an - // individual arena allocation request occurs with a size larger than this - // maximum). Requested block sizes increase up to this value, then remain - // here. - size_t max_block_size; - - // An initial block of memory for the arena to use, or NULL for none. If - // provided, the block must live at least as long as the arena itself. The - // creator of the Arena retains ownership of the block after the Arena is - // destroyed. - char* initial_block; - - // The size of the initial block, if provided. - size_t initial_block_size; - - // A function pointer to an alloc method that returns memory blocks of size - // requested. By default, it contains a ptr to the malloc function. - // - // NOTE: block_alloc and dealloc functions are expected to behave like - // malloc and free, including Asan poisoning. - void* (*block_alloc)(size_t); - // A function pointer to a dealloc method that takes ownership of the blocks - // from the arena. By default, it contains a ptr to a wrapper function that - // calls free. - void (*block_dealloc)(void*, size_t); - - ArenaOptions() - : start_block_size(internal::AllocationPolicy::kDefaultStartBlockSize), - max_block_size(internal::AllocationPolicy::kDefaultMaxBlockSize), - initial_block(NULL), - initial_block_size(0), - block_alloc(nullptr), - block_dealloc(nullptr), - make_metrics_collector(nullptr) {} - - private: - // 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; -}; - -// Support for non-RTTI environments. (The metrics hooks API uses type -// information.) -#if PROTOBUF_RTTI -#define RTTI_TYPE_ID(type) (&typeid(type)) -#else -#define RTTI_TYPE_ID(type) (NULL) -#endif - -// Arena allocator. Arena allocation replaces ordinary (heap-based) allocation -// with new/delete, and improves performance by aggregating allocations into -// larger blocks and freeing allocations all at once. Protocol messages are -// allocated on an arena by using Arena::CreateMessage(Arena*), below, and -// are automatically freed when the arena is destroyed. -// -// This is a thread-safe implementation: multiple threads may allocate from the -// arena concurrently. Destruction is not thread-safe and the destructing -// thread must synchronize with users of the arena first. -// -// An arena provides two allocation interfaces: CreateMessage, which works -// for arena-enabled proto2 message types as well as other types that satisfy -// the appropriate protocol (described below), and Create, which works for -// any arbitrary type T. CreateMessage is better when the type T supports it, -// because this interface (i) passes the arena pointer to the created object so -// that its sub-objects and internal allocations can use the arena too, and (ii) -// elides the object's destructor call when possible. Create does not place -// 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(Arena* arena, Args&&... args), is as follows: -// -// - 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 -// such type trait exists, then the instantiation CreateMessage will fail -// to compile. -// -// - The type T *may* have the type trait |DestructorSkippable_|. If this type -// trait is present in the type, then its destructor will not be called if and -// only if it was passed a non-NULL arena pointer. If this type trait is not -// present on the type, then its destructor is always called when the -// containing arena is destroyed. -// -// 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 PROTOBUF_ALIGNAS(8) Arena final { - public: - // 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.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. - // - // 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::ThreadSafeArena::kBlockHeaderSize + - internal::ThreadSafeArena::kSerialArenaSize; - - inline ~Arena() {} - - // 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 - // defined in a .proto file with cc_enable_arenas set to true, otherwise a - // compilation error will occur. - // - // RepeatedField and RepeatedPtrField may also be instantiated directly on an - // arena with this method. - // - // This function also accepts any type T that satisfies the arena message - // allocation protocol, documented above. - template - PROTOBUF_ALWAYS_INLINE static T* CreateMessage(Arena* arena, Args&&... args) { - static_assert( - InternalHelper::is_arena_constructable::value, - "CreateMessage can only construct types that are ArenaConstructable"); - // 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, static_cast(args)...); - } - - // API to create any objects on the arena. Note that only the object will - // be created on the arena; the underlying ptrs (in case of a proto2 message) - // will be still heap allocated. Proto messages should usually be allocated - // with CreateMessage() instead. - // - // Note that even if T satisfies the arena message construction protocol - // (InternalArenaConstructable_ trait and optional DestructorSkippable_ - // trait), as described above, this function does not follow the protocol; - // instead, it treats T as a black-box type, just as if it did not have these - // traits. Specifically, T's constructor arguments will always be only those - // passed to Create() -- no additional arena pointer is implicitly added. - // Furthermore, the destructor will always be called at arena destruction time - // (unless the destructor is trivial). Hence, from T's point of view, it is as - // if the object were allocated on the heap (except that the underlying memory - // is obtained from the arena). - template - PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { - return CreateInternal(arena, std::is_convertible(), - static_cast(args)...); - } - - // Allocates memory with the specific size and alignment. - void* AllocateAligned(size_t size, size_t align = 8) { - if (align <= 8) { - return AllocateAlignedNoHook(internal::AlignUpTo8(size)); - } else { - // We are wasting space by over allocating align - 8 bytes. Compared - // to a dedicated function that takes current alignment in consideration. - // Such a scheme would only waste (align - 8)/2 bytes on average, but - // requires a dedicated function in the outline arena allocation - // functions. Possibly re-evaluate tradeoffs later. - return internal::AlignTo(AllocateAlignedNoHook(size + align - 8), align); - } - } - - // Create an array of object type T on the arena *without* invoking the - // constructor of T. If `arena` is null, then the return value should be freed - // with `delete[] x;` (or `::operator delete[](x);`). - // To ensure safe uses, this function checks at compile time - // (when compiled as C++11) that T is trivially default-constructible and - // trivially destructible. - template - PROTOBUF_NDEBUG_INLINE static T* CreateArray(Arena* arena, - size_t num_elements) { - 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"); - GOOGLE_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) - << "Requested size is too large to fit into size_t."; - if (arena == NULL) { - return static_cast(::operator new[](num_elements * sizeof(T))); - } else { - return arena->CreateInternalRawArray(num_elements); - } - } - - // 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. - 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_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. - 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_ALWAYS_INLINE void Own(T* object) { - OwnInternal(object, std::is_convertible()); - } - - // Adds |object| to a list of objects whose destructors will be manually - // called when the arena is destroyed or reset. This differs from Own() in - // that it does not free the underlying memory with |delete|; hence, it is - // normally only used for objects that are placement-newed into - // arena-allocated memory. - template - PROTOBUF_ALWAYS_INLINE void OwnDestructor(T* object) { - if (object != NULL) { - impl_.AddCleanup(object, &internal::arena_destruct_object); - } - } - - // Adds a custom member function on an object to the list of destructors that - // 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_ALWAYS_INLINE void OwnCustomDestructor(void* object, - void (*destruct)(void*)) { - impl_.AddCleanup(object, destruct); - } - - // Retrieves the arena associated with |value| if |value| is an arena-capable - // message, or NULL otherwise. If possible, the call resolves at compile time. - // Note that we can often devirtualize calls to `value->GetArena()` so usually - // calling this method is unnecessary. - template - PROTOBUF_ALWAYS_INLINE static Arena* GetArena(const T* value) { - return GetArenaInternal(value); - } - - template - class InternalHelper { - private: - // Provides access to protected GetOwningArena to generated messages. - static Arena* GetOwningArena(const T* p) { return p->GetOwningArena(); } - - static void InternalSwap(T* a, T* b) { a->InternalSwap(b); } - - 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 - static double DestructorSkippable(...); - - typedef std::integral_constant< - bool, sizeof(DestructorSkippable(static_cast(0))) == - sizeof(char) || - std::is_trivially_destructible::value> - is_destructor_skippable; - - template - static char ArenaConstructable( - const typename U::InternalArenaConstructable_*); - template - static double ArenaConstructable(...); - - typedef std::integral_constant( - static_cast(0))) == - sizeof(char)> - is_arena_constructable; - - template () - .GetArena())>::value, - int>::type = 0> - static char HasGetArena(decltype(&U::GetArena)); - template - static double HasGetArena(...); - - typedef std::integral_constant(nullptr)) == - sizeof(char)> - has_get_arena; - - template - static T* Construct(void* ptr, Args&&... 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->GetArena(); } - - friend class Arena; - friend class TestUtil::ReflectionTester; - }; - - // Provides access to protected GetOwningArena to generated messages. For - // internal use only. - template - static Arena* InternalGetOwningArena(const T* p) { - return InternalHelper::GetOwningArena(p); - } - - // Provides access to protected GetArenaForAllocation to generated messages. - // For internal use only. - template - static Arena* InternalGetArenaForAllocation(const T* p) { - return InternalHelper::GetArenaForAllocationInternal( - p, std::is_convertible()); - } - - // Creates message-owned arena. For internal use only. - static Arena* InternalCreateMessageOwnedArena() { - return new Arena(internal::MessageOwned{}); - } - - // Checks whether this arena is message-owned. For internal use only. - bool InternalIsMessageOwnedArena() { return IsMessageOwned(); } - - // Helper typetraits that indicates support for arenas in a type T at compile - // time. This is public only to allow construction of higher-level templated - // utilities. - // - // is_arena_constructable::value is true if the message type T has arena - // support enabled, and false otherwise. - // - // is_destructor_skippable::value is true if the message type T has told - // the arena that it is safe to skip the destructor, and false otherwise. - // - // This is inside Arena because only Arena has the friend relationships - // necessary to see the underlying generated code traits. - template - struct is_arena_constructable : InternalHelper::is_arena_constructable {}; - template - struct is_destructor_skippable : InternalHelper::is_destructor_skippable { - }; - - 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(); - } - - void ReturnArrayMemory(void* p, size_t size) { - impl_.ReturnArrayMemory(p, size); - } - - template - 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, static_cast(args)...); - } else { - return arena->DoCreateMessage(static_cast(args)...); - } - } - - // This specialization for no arguments is necessary, because its behavior is - // slightly different. When the arena pointer is nullptr, it calls T() - // instead of T(nullptr). - template - 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) { - // Generated arena constructor T(Arena*) is protected. Call via - // InternalHelper. - return InternalHelper::New(); - } else { - return arena->DoCreateMessage(); - } - } - - // 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 (destructor == nullptr) { - return AllocateAlignedWithHook(size, align, type); - } else { - 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; - } - } - } - - // CreateMessage requires that T supports arenas, but this private method - // works whether or not T supports arenas. These are not exposed to user code - // as it can cause confusing API usages, and end up having double free in - // user code. These are used only internally from LazyField and Repeated - // fields, since they are designed to work in all mode combinations. - template - PROTOBUF_ALWAYS_INLINE static Msg* DoCreateMaybeMessage(Arena* arena, - std::true_type, - Args&&... args) { - return CreateMessageInternal(arena, std::forward(args)...); - } - - template - PROTOBUF_ALWAYS_INLINE static T* DoCreateMaybeMessage(Arena* arena, - std::false_type, - Args&&... args) { - return Create(arena, std::forward(args)...); - } - - template - PROTOBUF_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena, - Args&&... args) { - return DoCreateMaybeMessage(arena, is_arena_constructable(), - std::forward(args)...); - } - - // Just allocate the required size for the given type assuming the - // type has a trivial constructor. - template - 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."; - // 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( - AllocateAlignedWithHookForArray(n, alignof(T), RTTI_TYPE_ID(T))); - } - - template - PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) { - return InternalHelper::Construct( - 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, Args&&... args) { - CreateInArenaStorageInternal(ptr, arena, - typename is_arena_constructable::type(), - std::forward(args)...); - if (arena != nullptr) { - RegisterDestructorInternal( - ptr, arena, - typename InternalHelper::is_destructor_skippable::type()); - } - } - - template - static void CreateInArenaStorageInternal(T* ptr, Arena* arena, - std::true_type, Args&&... args) { - InternalHelper::Construct(ptr, arena, std::forward(args)...); - } - template - static void CreateInArenaStorageInternal(T* ptr, Arena* /* arena */, - std::false_type, Args&&... args) { - new (ptr) T(std::forward(args)...); - } - - template - static void RegisterDestructorInternal(T* /* ptr */, Arena* /* arena */, - std::true_type) {} - template - static void RegisterDestructorInternal(T* ptr, Arena* arena, - std::false_type) { - 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 - // all template instantiations to one for generic Message reduces code size, - // using the virtual destructor instead. - template - PROTOBUF_ALWAYS_INLINE void OwnInternal(T* object, std::true_type) { - if (object != NULL) { - impl_.AddCleanup(object, &internal::arena_delete_object); - } - } - template - PROTOBUF_ALWAYS_INLINE void OwnInternal(T* object, std::false_type) { - if (object != NULL) { - impl_.AddCleanup(object, &internal::arena_delete_object); - } - } - - // Implementation for GetArena(). Only message objects with - // InternalArenaConstructable_ tags can be associated with an arena, and such - // objects must implement a GetArena() method. - template ::value, int>::type = 0> - PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) { - return InternalHelper::GetArena(value); - } - template ::value && - has_get_arena::value, - int>::type = 0> - PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) { - return value->GetArena(); - } - template ::value && - !has_get_arena::value, - int>::type = 0> - PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) { - (void)value; - return nullptr; - } - - template - PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArena(const T* value) { - return GetOwningArenaInternal( - value, std::is_convertible()); - } - - // 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; - } - - void* AllocateAlignedWithHookForArray(size_t n, size_t align, - const std::type_info* type) { - if (align <= 8) { - return AllocateAlignedWithHookForArray(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 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( - AllocateAlignedWithHookForArray(n + align - 8, type), align); - } - } - - 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 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(AllocateAlignedWithHook(n + align - 8, type), - align); - } - } - - void* AllocateAlignedNoHook(size_t n); - void* AllocateAlignedWithHook(size_t n, const std::type_info* type); - void* AllocateAlignedWithHookForArray(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 class internal::InternalMetadata; // For user_arena(). - friend class internal::LazyField; // For CreateMaybeMessage. - friend class internal::EpsCopyInputStream; // For parser performance - friend class MessageLite; - template - friend class Map; - template - friend class RepeatedField; // For ReturnArrayMemory - friend class internal::RepeatedPtrFieldBase; // For ReturnArrayMemory - friend struct internal::ArenaTestPeer; -}; - -// Defined above for supporting environments without RTTI. -#undef RTTI_TYPE_ID - -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_ARENA_H__ diff --git a/depends/protobuf/src/google/protobuf/arena_impl.h b/depends/protobuf/src/google/protobuf/arena_impl.h deleted file mode 100644 index 76727688b..000000000 --- a/depends/protobuf/src/google/protobuf/arena_impl.h +++ /dev/null @@ -1,686 +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 -#include -#include - -#ifdef ADDRESS_SANITIZER -#include -#endif // ADDRESS_SANITIZER - -#include - -// Must be included last. -#include - - -namespace google { -namespace protobuf { -namespace internal { - -// To prevent sharing cache lines between threads -#ifdef __cpp_aligned_new -enum { kCacheAlignment = 64 }; -#else -enum { kCacheAlignment = alignof(max_align_t) }; // do the best we can -#endif - -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_; -}; - -enum class AllocationClient { kDefault, kArray }; - -// 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) const { - return n <= static_cast(limit_ - ptr_); - } - - // See comments on `cached_blocks_` member for details. - PROTOBUF_ALWAYS_INLINE void* TryAllocateFromCachedBlock(size_t size) { - if (PROTOBUF_PREDICT_FALSE(size < 16)) return nullptr; - // We round up to the next larger block in case the memory doesn't match - // the pattern we are looking for. - const size_t index = Bits::Log2FloorNonZero64(size - 1) - 3; - - if (index >= cached_block_length_) return nullptr; - auto& cached_head = cached_blocks_[index]; - if (cached_head == nullptr) return nullptr; - - void* ret = cached_head; -#ifdef ADDRESS_SANITIZER - ASAN_UNPOISON_MEMORY_REGION(ret, size); -#endif // ADDRESS_SANITIZER - cached_head = cached_head->next; - return ret; - } - - // In kArray mode we look through cached blocks. - // We do not do this by default because most non-array allocations will not - // have the right size and will fail to find an appropriate cached block. - // - // TODO(sbenza): Evaluate if we should use cached blocks for message types of - // the right size. We can statically know if the allocation size can benefit - // from it. - template - 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 (alloc_client == AllocationClient::kArray) { - if (void* res = TryAllocateFromCachedBlock(n)) { - return res; - } - } - - 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; - } - - // See comments on `cached_blocks_` member for details. - void ReturnArrayMemory(void* p, size_t size) { - // We only need to check for 32-bit platforms. - // In 64-bit platforms the minimum allocation size from Repeated*Field will - // be 16 guaranteed. - if (sizeof(void*) < 8) { - if (PROTOBUF_PREDICT_FALSE(size < 16)) return; - } else { - GOOGLE_DCHECK(size >= 16); - } - - // We round down to the next smaller block in case the memory doesn't match - // the pattern we are looking for. eg, someone might have called Reserve() - // on the repeated field. - const size_t index = Bits::Log2FloorNonZero64(size) - 4; - - if (PROTOBUF_PREDICT_FALSE(index >= cached_block_length_)) { - // We can't put this object on the freelist so make this object the - // freelist. It is guaranteed it is larger than the one we have, and - // large enough to hold another allocation of `size`. - CachedBlock** new_list = static_cast(p); - size_t new_size = size / sizeof(CachedBlock*); - - std::copy(cached_blocks_, cached_blocks_ + cached_block_length_, - new_list); - std::fill(new_list + cached_block_length_, new_list + new_size, nullptr); - cached_blocks_ = new_list; - // Make the size fit in uint8_t. This is the power of two, so we don't - // need anything larger. - cached_block_length_ = - static_cast(std::min(size_t{64}, new_size)); - - return; - } - - auto& cached_head = cached_blocks_[index]; - auto* new_node = static_cast(p); - new_node->next = cached_head; - cached_head = new_node; -#ifdef ADDRESS_SANITIZER - ASAN_POISON_MEMORY_REGION(p, size); -#endif // ADDRESS_SANITIZER - } - - 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, - ThreadSafeArenaStats* stats); - // 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_; - // Limiting address up to which memory can be allocated from the head block. - char* limit_; - // For holding sampling information. The pointer is owned by the - // ThreadSafeArena that holds this serial arena. - ThreadSafeArenaStats* arena_stats_; - - // Repeated*Field and Arena play together to reduce memory consumption by - // reusing blocks. Currently, natural growth of the repeated field types makes - // them allocate blocks of size `8 + 2^N, N>=3`. - // When the repeated field grows returns the previous block and we put it in - // this free list. - // `cached_blocks_[i]` points to the free list for blocks of size `8+2^(i+3)`. - // The array of freelists is grown when needed in `ReturnArrayMemory()`. - struct CachedBlock { - // Simple linked list. - CachedBlock* next; - }; - uint8_t cached_block_length_ = 0; - CachedBlock** cached_blocks_ = nullptr; - - // Constructor is private as only New() should be used. - inline SerialArena(Block* b, void* owner, ThreadSafeArenaStats* stats); - 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; - - template - 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); - } - } - - void ReturnArrayMemory(void* p, size_t size) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - arena->ReturnArrayMemory(p, size); - } - } - - // 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* arena; - if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && - GetSerialArenaFromThreadCache(&arena))) { - return arena->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. - - static_assert(std::is_trivially_destructible{}, - "SerialArena needs to be trivially destructible."); - // 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 != nullptr && 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(kCacheAlignment) 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(nullptr) {} -#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(kCacheAlignment) 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 - - ThreadSafeArenaStatsHandle arena_stats_; - - 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/depends/protobuf/src/google/protobuf/arenastring.cc b/depends/protobuf/src/google/protobuf/arenastring.cc deleted file mode 100644 index af0c9df6b..000000000 --- a/depends/protobuf/src/google/protobuf/arenastring.cc +++ /dev/null @@ -1,267 +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 -#include - -// clang-format off -#include -// clang-format on - -namespace google { -namespace protobuf { -namespace internal { - -namespace { - -// TaggedStringPtr::Flags uses the lower 2 bits as tags. -// Enforce that allocated data aligns to at least 4 bytes, and that -// the alignment of the global const string value does as well. -// The alignment guaranteed by `new std::string` depends on both: -// - new align = __STDCPP_DEFAULT_NEW_ALIGNMENT__ / max_align_t -// - alignof(std::string) -#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ -constexpr size_t kNewAlign = __STDCPP_DEFAULT_NEW_ALIGNMENT__; -#elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900 -constexpr size_t kNewAlign = alignof(::max_align_t); -#else -constexpr size_t kNewAlign = alignof(std::max_align_t); -#endif -constexpr size_t kStringAlign = alignof(std::string); - -static_assert((kStringAlign > kNewAlign ? kStringAlign : kNewAlign) >= 4, ""); -static_assert(alignof(ExplicitlyConstructedArenaString) >= 4, ""); - -} // namespace - -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; -} - -namespace { - - -#if defined(NDEBUG) || !GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL - -class ScopedCheckPtrInvariants { - public: - explicit ScopedCheckPtrInvariants(const TaggedStringPtr*) {} -}; - -#endif // NDEBUG || !GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL - -// Creates a heap allocated std::string value. -inline TaggedStringPtr CreateString(ConstStringParam value) { - TaggedStringPtr res; - res.SetAllocated(new std::string(value.data(), value.length())); - return res; -} - -#if !GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL - -// Creates an arena allocated std::string value. -TaggedStringPtr CreateArenaString(Arena& arena, ConstStringParam s) { - TaggedStringPtr res; - res.SetMutableArena(Arena::Create(&arena, s.data(), s.length())); - return res; -} - -#endif // !GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL - -} // namespace - -void ArenaStringPtr::Set(ConstStringParam value, Arena* arena) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (IsDefault()) { - // If we're not on an arena, skip straight to a true string to avoid - // possible copy cost later. - tagged_ptr_ = arena != nullptr ? CreateArenaString(*arena, value) - : CreateString(value); - } else { - UnsafeMutablePointer()->assign(value.data(), value.length()); - } -} - -void ArenaStringPtr::Set(std::string&& value, Arena* arena) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (IsDefault()) { - NewString(arena, std::move(value)); - } else if (IsFixedSizeArena()) { - std::string* current = tagged_ptr_.Get(); - auto* s = new (current) std::string(std::move(value)); - arena->OwnDestructor(s); - tagged_ptr_.SetMutableArena(s); - } else /* !IsFixedSizeArena() */ { - *UnsafeMutablePointer() = std::move(value); - } -} - -std::string* ArenaStringPtr::Mutable(Arena* arena) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (tagged_ptr_.IsMutable()) { - return tagged_ptr_.Get(); - } else { - return MutableSlow(arena); - } -} - -std::string* ArenaStringPtr::Mutable(const LazyString& default_value, - Arena* arena) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (tagged_ptr_.IsMutable()) { - return tagged_ptr_.Get(); - } else { - return MutableSlow(arena, default_value); - } -} - -std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (tagged_ptr_.IsMutable()) { - return tagged_ptr_.Get(); - } else { - GOOGLE_DCHECK(IsDefault()); - // Allocate empty. The contents are not relevant. - return NewString(arena); - } -} - -template -std::string* ArenaStringPtr::MutableSlow(::google::protobuf::Arena* arena, - const Lazy&... lazy_default) { - GOOGLE_DCHECK(IsDefault()); - - // For empty defaults, this ends up calling the default constructor which is - // more efficient than a copy construction from - // GetEmptyStringAlreadyInited(). - return NewString(arena, lazy_default.get()...); -} - -std::string* ArenaStringPtr::Release() { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (IsDefault()) return nullptr; - - std::string* released = tagged_ptr_.Get(); - if (tagged_ptr_.IsArena()) { - released = tagged_ptr_.IsMutable() ? new std::string(std::move(*released)) - : new std::string(*released); - } - InitDefault(); - return released; -} - -void ArenaStringPtr::SetAllocated(std::string* value, Arena* arena) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - // Release what we have first. - Destroy(); - - if (value == nullptr) { - InitDefault(); - } else { -#ifndef NDEBUG - // 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 = new std::string(std::move(*value)); - delete value; - value = new_value; -#endif // !NDEBUG - InitAllocated(value, arena); - } -} - -void ArenaStringPtr::Destroy() { - delete tagged_ptr_.GetIfAllocated(); -} - -void ArenaStringPtr::ClearToEmpty() { - ScopedCheckPtrInvariants check(&tagged_ptr_); - if (IsDefault()) { - // Already set to default -- do nothing. - } else { - // Unconditionally mask away the tag. - // - // UpdateArenaString 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) { - ScopedCheckPtrInvariants check(&tagged_ptr_); - (void)arena; - if (IsDefault()) { - // Already set to default -- do nothing. - } else { - UnsafeMutablePointer()->assign(default_value.get()); - } -} - -const char* EpsCopyInputStream::ReadArenaString(const char* ptr, - ArenaStringPtr* s, - Arena* arena) { - ScopedCheckPtrInvariants check(&s->tagged_ptr_); - GOOGLE_DCHECK(arena != nullptr); - - int size = ReadSize(&ptr); - if (!ptr) return nullptr; - - auto* str = s->NewString(arena); - ptr = ReadString(ptr, size, str); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - return ptr; -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/arenastring.h b/depends/protobuf/src/google/protobuf/arenastring.h deleted file mode 100644 index 6bc8395f2..000000000 --- a/depends/protobuf/src/google/protobuf/arenastring.h +++ /dev/null @@ -1,480 +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 - -// must be last: -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - - -namespace google { -namespace protobuf { -namespace internal { -class EpsCopyInputStream; - -class SwapFieldHelper; - -// Declared in message_lite.h -PROTOBUF_EXPORT extern ExplicitlyConstructedArenaString - fixed_address_empty_string; - -// 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; -}; - -class TaggedStringPtr { - public: - // Bit flags qualifying string properties. We can use 2 bits as - // ptr_ is guaranteed and enforced to be aligned on 4 byte boundaries. - enum Flags { - kArenaBit = 0x1, // ptr is arena allocated - kMutableBit = 0x2, // ptr contents are fully mutable - kMask = 0x3 // Bit mask - }; - - // Composed logical types - enum Type { - // Default strings are immutable and never owned. - kDefault = 0, - - // Allocated strings are mutable and (as the name implies) owned. - // A heap allocated string must be deleted. - kAllocated = kMutableBit, - - // Mutable arena strings are strings where the string instance is owned - // by the arena, but the string contents itself are owned by the string - // instance. Mutable arena string instances need to be destroyed which is - // typically done through a cleanup action added to the arena owning it. - kMutableArena = kArenaBit | kMutableBit, - - // Fixed size arena strings are strings where both the string instance and - // the string contents are fully owned by the arena. Fixed size arena - // strings are a platform and c++ library specific customization. Fixed - // size arena strings are immutable, with the exception of custom internal - // updates to the content that fit inside the existing capacity. - // Fixed size arena strings must never be deleted or destroyed. - kFixedSizeArena = kArenaBit, - }; - - TaggedStringPtr() = default; - explicit constexpr TaggedStringPtr(ExplicitlyConstructedArenaString* ptr) - : ptr_(ptr) {} - - // Sets the value to `p`, tagging the value as being a 'default' value. - // See documentation for kDefault for more info. - inline const std::string* SetDefault(const std::string* p) { - return TagAs(kDefault, const_cast(p)); - } - - // Sets the value to `p`, tagging the value as a heap allocated value. - // Allocated strings are mutable and (as the name implies) owned. - // `p` must not be null - inline std::string* SetAllocated(std::string* p) { - return TagAs(kAllocated, p); - } - - // Sets the value to `p`, tagging the value as a fixed size arena string. - // See documentation for kFixedSizeArena for more info. - // `p` must not be null - inline std::string* SetFixedSizeArena(std::string* p) { - return TagAs(kFixedSizeArena, p); - } - - // Sets the value to `p`, tagging the value as a mutable arena string. - // See documentation for kMutableArena for more info. - // `p` must not be null - inline std::string* SetMutableArena(std::string* p) { - return TagAs(kMutableArena, p); - } - - // Returns true if the contents of the current string are fully mutable. - inline bool IsMutable() const { return as_int() & kMutableBit; } - - // Returns true if the current string is an immutable default value. - inline bool IsDefault() const { return (as_int() & kMask) == kDefault; } - - // If the current string is a heap-allocated mutable value, returns a pointer - // to it. Returns nullptr otherwise. - inline std::string *GetIfAllocated() const { - auto allocated = as_int() ^ kAllocated; - if (allocated & kMask) return nullptr; - - auto ptr = reinterpret_cast(allocated); - PROTOBUF_ASSUME(ptr != nullptr); - return ptr; - } - - // Returns true if the current string is an arena allocated value. - // This means it's either a mutable or fixed size arena string. - inline bool IsArena() const { return as_int() & kArenaBit; } - - // Returns true if the current string is a fixed size arena allocated value. - inline bool IsFixedSizeArena() const { - return (as_int() & kMask) == kFixedSizeArena; - } - - // Returns the contained string pointer. - inline std::string* Get() const { - return reinterpret_cast(as_int() & ~kMask); - } - - // Returns true if the contained pointer is null, indicating some error. - // The Null value is only used during parsing for temporary values. - // A persisted ArenaStringPtr value is never null. - inline bool IsNull() { return ptr_ == nullptr; } - - private: - static inline void assert_aligned(const void* p) { - GOOGLE_DCHECK_EQ(reinterpret_cast(p) & kMask, 0UL); - } - - inline std::string* TagAs(Type type, std::string* p) { - GOOGLE_DCHECK(p != nullptr); - assert_aligned(p); - ptr_ = reinterpret_cast(reinterpret_cast(p) | type); - return p; - } - - uintptr_t as_int() const { return reinterpret_cast(ptr_); } - void* ptr_; -}; - -static_assert(std::is_trivial::value, - "TaggedStringPtr must be trivial"); - -// This class encapsulates a pointer to a std::string with or without arena -// owned contents, tagged by the bottom bits of the string pointer. 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 string pointer is tagged to be either a default, externally owned value, -// a mutable heap allocated value, or an arena allocated value. The object uses -// a single global instance of an empty string that is used as the initial -// default value. Fields that have empty default values directly use this global -// default. Fields that have non empty default values are supported through -// lazily initialized default values managed by the LazyString class. -// -// Generated code and reflection code both ensure that ptr_ is never null. -// Because ArenaStringPtr is used in oneof unions, its constructor is a NOP and -// the field is always manually initialized via method calls. -// -// See TaggedStringPtr for more information about the types of string values -// being held, and the mutable and ownership invariants for each type. -struct PROTOBUF_EXPORT ArenaStringPtr { - ArenaStringPtr() = default; - constexpr ArenaStringPtr(ExplicitlyConstructedArenaString* default_value, - ConstantInitialized) - : tagged_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 InitDefault(); - - // Similar to `InitDefault` except that it allows the default value to be - // initialized to an externally owned string. This method is called from - // parsing code. `str` must not be null and outlive this instance. - inline void InitExternal(const std::string* str); - - // Called from generated code / reflection runtime only. Resets the value of - // this instances to the heap allocated value in `str`. `str` must not be - // null. Invokes `arena->Own(str)` to transfer ownership into the arena if - // `arena` is not null, else, `str` will be owned by ArenaStringPtr. This - // function should only be used to initialize a ArenaStringPtr or on an - // instance known to not carry any heap allocated value. - inline void InitAllocated(std::string* str, Arena* arena); - - void Set(ConstStringParam value, Arena* arena); - void Set(std::string&& value, Arena* arena); - void Set(const char* s, Arena* arena); - void Set(const char* s, size_t n, Arena* arena); - - void SetBytes(ConstStringParam value, Arena* arena); - void SetBytes(std::string&& value, Arena* arena); - void SetBytes(const char* s, Arena* arena); - void SetBytes(const void* p, size_t n, Arena* arena); - - template - void Set(std::reference_wrapper const_string_ref, - ::google::protobuf::Arena* arena) { - Set(const_string_ref.get(), arena); - } - - // Returns a mutable std::string reference. - // The version accepting a `LazyString` value is used in the generated code to - // initialize mutable copies for fields with a non-empty default where the - // default value is lazily initialized. - std::string* Mutable(Arena* arena); - std::string* Mutable(const LazyString& default_value, Arena* arena); - - // Gets a mutable pointer with unspecified contents. - // This function is identical to Mutable(), except it is optimized for the - // case where the caller is not interested in the current contents. For - // example, if the current field is not mutable, it will re-initialize the - // value with an empty string rather than a (non-empty) default value. - // Likewise, if the current value is a fixed size arena string with contents, - // it will be initialized into an empty mutable arena string. - std::string* MutableNoCopy(Arena* arena); - - // Basic accessors. - PROTOBUF_NDEBUG_INLINE const std::string& Get() const { - // Unconditionally mask away the tag. - return *tagged_ptr_.Get(); - } - - // Returns a pointer to the stored contents for this instance. - // This method is for internal debugging and tracking purposes only. - PROTOBUF_NDEBUG_INLINE const std::string* UnsafeGetPointer() const - PROTOBUF_RETURNS_NONNULL { - return tagged_ptr_.Get(); - } - - // 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 the default state. - // Used to implement release_() methods on generated classes. - PROTOBUF_NODISCARD std::string* Release(); - - // 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(std::string* value, Arena* arena); - - // Frees storage (if not on an arena). - void Destroy(); - - // 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); - - // 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(ArenaStringPtr* rhs, - Arena* rhs_arena, - ArenaStringPtr* lhs, - Arena* lhs_arena); - - // Internal setter used only at parse time to directly set a donated string - // value. - void UnsafeSetTaggedPointer(TaggedStringPtr 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; - - // Returns true if this instances holds an immutable default value. - inline bool IsDefault() const { return tagged_ptr_.IsDefault(); } - - private: - template - inline std::string* NewString(Arena* arena, Args&&... args) { - if (arena == nullptr) { - auto* s = new std::string(std::forward(args)...); - return tagged_ptr_.SetAllocated(s); - } else { - auto* s = Arena::Create(arena, std::forward(args)...); - return tagged_ptr_.SetMutableArena(s); - } - } - - TaggedStringPtr tagged_ptr_; - - bool IsFixedSizeArena() 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; - friend class TcParser; - - // Slow paths. - - // MutableSlow requires that !IsString() || IsDefault - // Variadic to support 0 args for empty default and 1 arg for LazyString. - template - std::string* MutableSlow(::google::protobuf::Arena* arena, const Lazy&... lazy_default); - - friend class EpsCopyInputStream; -}; - -inline void ArenaStringPtr::InitDefault() { - tagged_ptr_ = TaggedStringPtr(&fixed_address_empty_string); -} - -inline void ArenaStringPtr::InitExternal(const std::string* str) { - tagged_ptr_.SetDefault(str); -} - -inline void ArenaStringPtr::InitAllocated(std::string* str, Arena* arena) { - if (arena != nullptr) { - tagged_ptr_.SetMutableArena(str); - arena->Own(str); - } else { - tagged_ptr_.SetAllocated(str); - } -} - -inline void ArenaStringPtr::Set(const char* s, Arena* arena) { - Set(ConstStringParam{s}, arena); -} - -inline void ArenaStringPtr::Set(const char* s, size_t n, Arena* arena) { - Set(ConstStringParam{s, n}, arena); -} - -inline void ArenaStringPtr::SetBytes(ConstStringParam value, Arena* arena) { - Set(value, arena); -} - -inline void ArenaStringPtr::SetBytes(std::string&& value, Arena* arena) { - Set(std::move(value), arena); -} - -inline void ArenaStringPtr::SetBytes(const char* s, Arena* arena) { - Set(s, arena); -} - -inline void ArenaStringPtr::SetBytes(const void* p, size_t n, Arena* arena) { - Set(ConstStringParam{static_cast(p), n}, arena); -} - -// Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs. -inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // - ArenaStringPtr* rhs, Arena* rhs_arena, // - ArenaStringPtr* lhs, Arena* lhs_arena) { - // Silence unused variable warnings in release buildls. - (void)rhs_arena; - (void)lhs_arena; - std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); -#ifdef PROTOBUF_FORCE_COPY_IN_SWAP - auto force_realloc = [](ArenaStringPtr* p, Arena* arena) { - if (p->IsDefault()) return; - std::string* old_value = p->tagged_ptr_.Get(); - std::string* new_value = - p->IsFixedSizeArena() - ? Arena::Create(arena, *old_value) - : Arena::Create(arena, std::move(*old_value)); - if (arena == nullptr) { - delete old_value; - p->tagged_ptr_.SetAllocated(new_value); - } else { - p->tagged_ptr_.SetMutableArena(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::UnsafeMutablePointer() { - GOOGLE_DCHECK(tagged_ptr_.IsMutable()); - GOOGLE_DCHECK(tagged_ptr_.Get() != nullptr); - return tagged_ptr_.Get(); -} - - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_ARENASTRING_H__ diff --git a/depends/protobuf/src/google/protobuf/arenaz_sampler.cc b/depends/protobuf/src/google/protobuf/arenaz_sampler.cc deleted file mode 100644 index 0eac693d9..000000000 --- a/depends/protobuf/src/google/protobuf/arenaz_sampler.cc +++ /dev/null @@ -1,177 +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 - - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace internal { - -ThreadSafeArenazSampler& GlobalThreadSafeArenazSampler() { - static auto* sampler = new ThreadSafeArenazSampler(); - return *sampler; -} - -void UnsampleSlow(ThreadSafeArenaStats* info) { - GlobalThreadSafeArenazSampler().Unregister(info); -} - -#if defined(PROTOBUF_ARENAZ_SAMPLE) -namespace { - -PROTOBUF_CONSTINIT std::atomic g_arenaz_enabled{true}; -PROTOBUF_CONSTINIT std::atomic g_arenaz_sample_parameter{1 << 10}; -PROTOBUF_THREAD_LOCAL absl::profiling_internal::ExponentialBiased - g_exponential_biased_generator; - -} // namespace - -PROTOBUF_THREAD_LOCAL int64_t global_next_sample = 1LL << 10; - -ThreadSafeArenaStats::ThreadSafeArenaStats() { PrepareForSampling(); } -ThreadSafeArenaStats::~ThreadSafeArenaStats() = default; - -void ThreadSafeArenaStats::PrepareForSampling() { - num_allocations.store(0, std::memory_order_relaxed); - num_resets.store(0, std::memory_order_relaxed); - bytes_requested.store(0, std::memory_order_relaxed); - bytes_allocated.store(0, std::memory_order_relaxed); - bytes_wasted.store(0, std::memory_order_relaxed); - max_bytes_allocated.store(0, std::memory_order_relaxed); - thread_ids.store(0, std::memory_order_relaxed); - // The inliner makes hardcoded skip_count difficult (especially when combined - // with LTO). We use the ability to exclude stacks by regex when encoding - // instead. - depth = absl::GetStackTrace(stack, kMaxStackDepth, /* skip_count= */ 0); -} - -void RecordResetSlow(ThreadSafeArenaStats* info) { - const size_t max_bytes = - info->max_bytes_allocated.load(std::memory_order_relaxed); - const size_t allocated_bytes = - info->bytes_allocated.load(std::memory_order_relaxed); - if (max_bytes < allocated_bytes) { - info->max_bytes_allocated.store(allocated_bytes); - } - info->bytes_requested.store(0, std::memory_order_relaxed); - info->bytes_allocated.store(0, std::memory_order_relaxed); - info->bytes_wasted.fetch_add(0, std::memory_order_relaxed); - info->num_allocations.fetch_add(0, std::memory_order_relaxed); - info->num_resets.fetch_add(1, std::memory_order_relaxed); -} - -void RecordAllocateSlow(ThreadSafeArenaStats* info, size_t requested, - size_t allocated, size_t wasted) { - info->bytes_requested.fetch_add(requested, std::memory_order_relaxed); - info->bytes_allocated.fetch_add(allocated, std::memory_order_relaxed); - info->bytes_wasted.fetch_add(wasted, std::memory_order_relaxed); - info->num_allocations.fetch_add(1, std::memory_order_relaxed); - const uint64_t tid = (1ULL << (GetCachedTID() % 63)); - const uint64_t thread_ids = info->thread_ids.load(std::memory_order_relaxed); - if (!(thread_ids & tid)) { - info->thread_ids.store(thread_ids | tid, std::memory_order_relaxed); - } -} - -ThreadSafeArenaStats* SampleSlow(int64_t* next_sample) { - bool first = *next_sample < 0; - *next_sample = g_exponential_biased_generator.GetStride( - g_arenaz_sample_parameter.load(std::memory_order_relaxed)); - // Small values of interval are equivalent to just sampling next time. - ABSL_ASSERT(*next_sample >= 1); - - // g_arenaz_enabled can be dynamically flipped, we need to set a threshold low - // enough that we will start sampling in a reasonable time, so we just use the - // default sampling rate. - if (!g_arenaz_enabled.load(std::memory_order_relaxed)) return nullptr; - // We will only be negative on our first count, so we should just retry in - // that case. - if (first) { - if (PROTOBUF_PREDICT_TRUE(--*next_sample > 0)) return nullptr; - return SampleSlow(next_sample); - } - - return GlobalThreadSafeArenazSampler().Register(); -} - -void SetThreadSafeArenazEnabled(bool enabled) { - g_arenaz_enabled.store(enabled, std::memory_order_release); -} - -void SetThreadSafeArenazSampleParameter(int32_t rate) { - if (rate > 0) { - g_arenaz_sample_parameter.store(rate, std::memory_order_release); - } else { - ABSL_RAW_LOG(ERROR, "Invalid thread safe arenaz sample rate: %lld", - static_cast(rate)); // NOLINT(runtime/int) - } -} - -void SetThreadSafeArenazMaxSamples(int32_t max) { - if (max > 0) { - GlobalThreadSafeArenazSampler().SetMaxSamples(max); - } else { - ABSL_RAW_LOG(ERROR, "Invalid thread safe arenaz max samples: %lld", - static_cast(max)); // NOLINT(runtime/int) - } -} - -void SetThreadSafeArenazGlobalNextSample(int64_t next_sample) { - if (next_sample >= 0) { - global_next_sample = next_sample; - } else { - ABSL_RAW_LOG(ERROR, "Invalid thread safe arenaz next sample: %lld", - static_cast(next_sample)); // NOLINT(runtime/int) - } -} - -#else -ThreadSafeArenaStats* SampleSlow(int64_t* next_sample) { - *next_sample = std::numeric_limits::max(); - return nullptr; -} - -void SetThreadSafeArenazEnabled(bool enabled) {} -void SetThreadSafeArenazSampleParameter(int32_t rate) {} -void SetThreadSafeArenazMaxSamples(int32_t max) {} -void SetThreadSafeArenazGlobalNextSample(int64_t next_sample) {} -#endif // defined(PROTOBUF_ARENAZ_SAMPLE) - -} // namespace internal -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/arenaz_sampler.h b/depends/protobuf/src/google/protobuf/arenaz_sampler.h deleted file mode 100644 index b04b0cc67..000000000 --- a/depends/protobuf/src/google/protobuf/arenaz_sampler.h +++ /dev/null @@ -1,207 +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_SRC_GOOGLE_PROTOBUF_ARENAZ_SAMPLER_H__ -#define GOOGLE_PROTOBUF_SRC_GOOGLE_PROTOBUF_ARENAZ_SAMPLER_H__ - -#include -#include -#include - - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace internal { - -#if defined(PROTOBUF_ARENAZ_SAMPLE) -struct ThreadSafeArenaStats; -void RecordResetSlow(ThreadSafeArenaStats* info); -void RecordAllocateSlow(ThreadSafeArenaStats* info, size_t requested, - size_t allocated, size_t wasted); -// Stores information about a sampled thread safe arena. All mutations to this -// *must* be made through `Record*` functions below. All reads from this *must* -// only occur in the callback to `ThreadSafeArenazSampler::Iterate`. -struct ThreadSafeArenaStats - : public absl::profiling_internal::Sample { - // Constructs the object but does not fill in any fields. - ThreadSafeArenaStats(); - ~ThreadSafeArenaStats(); - - // Puts the object into a clean state, fills in the logically `const` members, - // blocking for any readers that are currently sampling the object. - void PrepareForSampling() ABSL_EXCLUSIVE_LOCKS_REQUIRED(init_mu); - - // These fields are mutated by the various Record* APIs and need to be - // thread-safe. - std::atomic num_allocations; - std::atomic num_resets; - std::atomic bytes_requested; - std::atomic bytes_allocated; - std::atomic bytes_wasted; - // Records the largest size an arena ever had. Maintained across resets. - std::atomic max_bytes_allocated; - // Bit i when set to 1 indicates that a thread with tid % 63 = i accessed the - // underlying arena. The field is maintained across resets. - std::atomic thread_ids; - - // All of the fields below are set by `PrepareForSampling`, they must not - // be mutated in `Record*` functions. They are logically `const` in that - // sense. These are guarded by init_mu, but that is not externalized to - // clients, who can only read them during - // `ThreadSafeArenazSampler::Iterate` which will hold the lock. - static constexpr int kMaxStackDepth = 64; - int32_t depth; - void* stack[kMaxStackDepth]; - static void RecordAllocateStats(ThreadSafeArenaStats* info, size_t requested, - size_t allocated, size_t wasted) { - if (PROTOBUF_PREDICT_TRUE(info == nullptr)) return; - RecordAllocateSlow(info, requested, allocated, wasted); - } -}; - -ThreadSafeArenaStats* SampleSlow(int64_t* next_sample); -void UnsampleSlow(ThreadSafeArenaStats* info); - -class ThreadSafeArenaStatsHandle { - public: - explicit ThreadSafeArenaStatsHandle() = default; - explicit ThreadSafeArenaStatsHandle(ThreadSafeArenaStats* info) - : info_(info) {} - - ~ThreadSafeArenaStatsHandle() { - if (PROTOBUF_PREDICT_TRUE(info_ == nullptr)) return; - UnsampleSlow(info_); - } - - ThreadSafeArenaStatsHandle(ThreadSafeArenaStatsHandle&& other) noexcept - : info_(absl::exchange(other.info_, nullptr)) {} - - ThreadSafeArenaStatsHandle& operator=( - ThreadSafeArenaStatsHandle&& other) noexcept { - if (PROTOBUF_PREDICT_FALSE(info_ != nullptr)) { - UnsampleSlow(info_); - } - info_ = absl::exchange(other.info_, nullptr); - return *this; - } - - void RecordReset() { - if (PROTOBUF_PREDICT_TRUE(info_ == nullptr)) return; - RecordResetSlow(info_); - } - - ThreadSafeArenaStats* MutableStats() { return info_; } - - friend void swap(ThreadSafeArenaStatsHandle& lhs, - ThreadSafeArenaStatsHandle& rhs) { - std::swap(lhs.info_, rhs.info_); - } - - friend class ThreadSafeArenaStatsHandlePeer; - - private: - ThreadSafeArenaStats* info_ = nullptr; -}; - -using ThreadSafeArenazSampler = - ::absl::profiling_internal::SampleRecorder; - -extern PROTOBUF_THREAD_LOCAL int64_t global_next_sample; - -// Returns an RAII sampling handle that manages registration and unregistation -// with the global sampler. -inline ThreadSafeArenaStatsHandle Sample() { - if (PROTOBUF_PREDICT_TRUE(--global_next_sample > 0)) { - return ThreadSafeArenaStatsHandle(nullptr); - } - return ThreadSafeArenaStatsHandle(SampleSlow(&global_next_sample)); -} - -#else -struct ThreadSafeArenaStats { - static void RecordAllocateStats(ThreadSafeArenaStats*, size_t /*requested*/, - size_t /*allocated*/, size_t /*wasted*/) {} -}; - -ThreadSafeArenaStats* SampleSlow(int64_t* next_sample); -void UnsampleSlow(ThreadSafeArenaStats* info); - -class ThreadSafeArenaStatsHandle { - public: - explicit ThreadSafeArenaStatsHandle() = default; - explicit ThreadSafeArenaStatsHandle(ThreadSafeArenaStats*) {} - - void RecordReset() {} - - ThreadSafeArenaStats* MutableStats() { return nullptr; } - - friend void swap(ThreadSafeArenaStatsHandle&, ThreadSafeArenaStatsHandle&) {} - - private: - friend class ThreadSafeArenaStatsHandlePeer; -}; - -class ThreadSafeArenazSampler { - public: - void Unregister(ThreadSafeArenaStats*) {} - void SetMaxSamples(int32_t) {} -}; - -// Returns an RAII sampling handle that manages registration and unregistation -// with the global sampler. -inline ThreadSafeArenaStatsHandle Sample() { - return ThreadSafeArenaStatsHandle(nullptr); -} -#endif // defined(PROTOBUF_ARENAZ_SAMPLE) - -// Returns a global Sampler. -ThreadSafeArenazSampler& GlobalThreadSafeArenazSampler(); - -// Enables or disables sampling for thread safe arenas. -void SetThreadSafeArenazEnabled(bool enabled); - -// Sets the rate at which thread safe arena will be sampled. -void SetThreadSafeArenazSampleParameter(int32_t rate); - -// Sets a soft max for the number of samples that will be kept. -void SetThreadSafeArenazMaxSamples(int32_t max); - -// Sets the current value for when arenas should be next sampled. -void SetThreadSafeArenazGlobalNextSample(int64_t next_sample); - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include -#endif // GOOGLE_PROTOBUF_SRC_PROTOBUF_ARENAZ_SAMPLER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/code_generator.cc b/depends/protobuf/src/google/protobuf/compiler/code_generator.cc deleted file mode 100644 index dc9d450a4..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/code_generator.cc +++ /dev/null @@ -1,137 +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 - -namespace google { -namespace protobuf { -namespace compiler { - -CodeGenerator::~CodeGenerator() {} - -bool CodeGenerator::GenerateAll(const std::vector& files, - const std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const { - // 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++) { - const FileDescriptor* file = files[i]; - succeeded = Generate(file, parameter, generator_context, error); - if (!succeeded && error && error->empty()) { - *error = - "Code generator returned false but provided no error " - "description."; - } - if (error && !error->empty()) { - *error = file->name() + ": " + *error; - break; - } - if (!succeeded) { - break; - } - } - return succeeded; -} - -GeneratorContext::~GeneratorContext() {} - -io::ZeroCopyOutputStream* GeneratorContext::OpenForAppend( - const std::string& filename) { - return nullptr; -} - -io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert( - const std::string& filename, const std::string& insertion_point) { - GOOGLE_LOG(FATAL) << "This GeneratorContext does not support insertion."; - return nullptr; // 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"; -} - -void GeneratorContext::GetCompilerVersion(Version* version) const { - version->set_major(GOOGLE_PROTOBUF_VERSION / 1000000); - version->set_minor(GOOGLE_PROTOBUF_VERSION / 1000 % 1000); - version->set_patch(GOOGLE_PROTOBUF_VERSION % 1000); - version->set_suffix(GOOGLE_PROTOBUF_VERSION_SUFFIX); -} - -// Parses a set of comma-delimited name/value pairs. -void ParseGeneratorParameter( - const std::string& text, - std::vector >* output) { - std::vector parts = Split(text, ",", true); - - for (int i = 0; i < parts.size(); i++) { - std::string::size_type equals_pos = parts[i].find_first_of('='); - std::pair value; - if (equals_pos == std::string::npos) { - value.first = parts[i]; - value.second = ""; - } else { - value.first = parts[i].substr(0, equals_pos); - value.second = parts[i].substr(equals_pos + 1); - } - output->push_back(value); - } -} - -// 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/depends/protobuf/src/google/protobuf/compiler/command_line_interface.cc b/depends/protobuf/src/google/protobuf/compiler/command_line_interface.cc deleted file mode 100644 index 5e9a2c418..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/command_line_interface.cc +++ /dev/null @@ -1,2622 +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 -#ifdef major -#undef major -#endif -#ifdef minor -#undef minor -#endif -#include -#include -#ifndef _MSC_VER -#include -#endif -#include -#include - -#include -#include - -#include // For PATH_MAX - -#include - -#if defined(__APPLE__) -#include -#elif defined(__FreeBSD__) -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace compiler { - -#ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 // If this isn't defined, the platform doesn't need it. -#endif -#endif - -namespace { -#if defined(_WIN32) -// DO NOT include , instead create functions in io_win32.{h,cc} and import -// them like we do below. -using google::protobuf::io::win32::access; -using google::protobuf::io::win32::close; -using google::protobuf::io::win32::mkdir; -using google::protobuf::io::win32::open; -using google::protobuf::io::win32::setmode; -using google::protobuf::io::win32::write; -#endif - -static const char* kDefaultDirectDependenciesViolationMsg = - "File is imported but not declared in --direct_dependencies: %s"; - -// Returns true if the text looks like a Windows-style absolute path, starting -// with a drive letter. Example: "C:\foo". TODO(kenton): Share this with -// copy in importer.cc? -static bool IsWindowsAbsolutePath(const std::string& text) { -#if defined(_WIN32) || defined(__CYGWIN__) - return text.size() >= 3 && text[1] == ':' && isalpha(text[0]) && - (text[2] == '/' || text[2] == '\\') && text.find_last_of(':') == 1; -#else - return false; -#endif -} - -void SetFdToTextMode(int fd) { -#ifdef _WIN32 - if (setmode(fd, _O_TEXT) == -1) { - // This should never happen, I think. - GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno); - } -#endif - // (Text and binary are the same on non-Windows platforms.) -} - -void SetFdToBinaryMode(int fd) { -#ifdef _WIN32 - if (setmode(fd, _O_BINARY) == -1) { - // This should never happen, I think. - GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_BINARY): " << strerror(errno); - } -#endif - // (Text and binary are the same on non-Windows platforms.) -} - -void AddTrailingSlash(std::string* path) { - if (!path->empty() && path->at(path->size() - 1) != '/') { - path->push_back('/'); - } -} - -bool VerifyDirectoryExists(const std::string& path) { - if (path.empty()) return true; - - if (access(path.c_str(), F_OK) == -1) { - std::cerr << path << ": " << strerror(errno) << std::endl; - return false; - } else { - return true; - } -} - -// Try to create the parent directory of the given file, creating the parent's -// parent if necessary, and so on. The full file name is actually -// (prefix + filename), but we assume |prefix| already exists and only create -// directories listed in |filename|. -bool TryCreateParentDirectory(const std::string& prefix, - const std::string& filename) { - // Recursively create parent directories to the output file. - // On Windows, both '/' and '\' are valid path separators. - std::vector parts = - Split(filename, "/\\", true); - std::string path_so_far = prefix; - for (int i = 0; i < parts.size() - 1; i++) { - path_so_far += parts[i]; - if (mkdir(path_so_far.c_str(), 0777) != 0) { - if (errno != EEXIST) { - std::cerr << filename << ": while trying to create directory " - << path_so_far << ": " << strerror(errno) << std::endl; - return false; - } - } - path_so_far += '/'; - } - - return true; -} - -// Get the absolute path of this protoc binary. -bool GetProtocAbsolutePath(std::string* path) { -#ifdef _WIN32 - char buffer[MAX_PATH]; - int len = GetModuleFileNameA(nullptr, buffer, MAX_PATH); -#elif defined(__APPLE__) - char buffer[PATH_MAX]; - int len = 0; - - char dirtybuffer[PATH_MAX]; - uint32_t size = sizeof(dirtybuffer); - if (_NSGetExecutablePath(dirtybuffer, &size) == 0) { - 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, nullptr, 0) != 0) { - len = 0; - } -#else - char buffer[PATH_MAX]; - int len = readlink("/proc/self/exe", buffer, PATH_MAX); -#endif - if (len > 0) { - path->assign(buffer, len); - return true; - } else { - return false; - } -} - -// Whether a path is where google/protobuf/descriptor.proto and other well-known -// type protos are installed. -bool IsInstalledProtoPath(const std::string& path) { - // Checking the descriptor.proto file should be good enough. - std::string file_path = path + "/google/protobuf/descriptor.proto"; - return access(file_path.c_str(), F_OK) != -1; -} - -// Add the paths where google/protobuf/descriptor.proto and other well-known -// type protos are installed. -void AddDefaultProtoPaths( - 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. - std::string path; - if (!GetProtocAbsolutePath(&path)) { - return; - } - // Strip the binary name. - size_t pos = path.find_last_of("/\\"); - if (pos == std::string::npos || pos == 0) { - return; - } - path = path.substr(0, pos); - // Check the binary's directory. - if (IsInstalledProtoPath(path)) { - paths->push_back(std::pair("", path)); - return; - } - // Check if there is an include subdirectory. - if (IsInstalledProtoPath(path + "/include")) { - paths->push_back( - std::pair("", path + "/include")); - return; - } - // Check if the upper level directory has an "include" subdirectory. - pos = path.find_last_of("/\\"); - if (pos == std::string::npos || pos == 0) { - return; - } - path = path.substr(0, pos); - if (IsInstalledProtoPath(path + "/include")) { - paths->push_back( - std::pair("", path + "/include")); - return; - } -} - -std::string PluginName(const std::string& plugin_prefix, - const std::string& directive) { - // Assuming the directive starts with "--" and ends with "_out" or "_opt", - // strip the "--" and "_out/_opt" and add the plugin prefix. - return plugin_prefix + "gen-" + directive.substr(2, directive.size() - 6); -} - -} // namespace - -// A MultiFileErrorCollector that prints errors to stderr. -class CommandLineInterface::ErrorPrinter - : public MultiFileErrorCollector, - public io::ErrorCollector, - public DescriptorPool::ErrorCollector { - public: - ErrorPrinter(ErrorFormat format, DiskSourceTree* tree = nullptr) - : format_(format), - tree_(tree), - found_errors_(false), - found_warnings_(false) {} - ~ErrorPrinter() override {} - - // implements MultiFileErrorCollector ------------------------------ - void AddError(const std::string& filename, int line, int column, - 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) 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) override { - AddError("input", line, column, 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) 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) 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, - std::ostream& out) { - // Print full path when running under MSVS - std::string dfile; - if (format_ == CommandLineInterface::ERROR_FORMAT_MSVS && - tree_ != nullptr && tree_->VirtualFileToDiskFile(filename, &dfile)) { - out << dfile; - } else { - out << filename; - } - - // Users typically expect 1-based line/column numbers, so we add 1 - // to each here. - if (line != -1) { - // Allow for both GCC- and Visual-Studio-compatible output. - switch (format_) { - case CommandLineInterface::ERROR_FORMAT_GCC: - out << ":" << (line + 1) << ":" << (column + 1); - break; - case CommandLineInterface::ERROR_FORMAT_MSVS: - out << "(" << (line + 1) << ") : " << type - << " in column=" << (column + 1); - break; - } - } - - if (type == "warning") { - out << ": warning: " << message << std::endl; - } else { - out << ": " << message << std::endl; - } - } - - const ErrorFormat format_; - DiskSourceTree* tree_; - bool found_errors_; - bool found_warnings_; -}; - -// ------------------------------------------------------------------- - -// A GeneratorContext implementation that buffers files in memory, then dumps -// them all to disk on demand. -class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { - public: - GeneratorContextImpl(const std::vector& parsed_files); - - // Write all files in the directory to disk at the given output location, - // which must end in a '/'. - bool WriteAllToDisk(const std::string& prefix); - - // Write the contents of this directory to a ZIP-format archive with the - // given name. - bool WriteAllToZip(const std::string& filename); - - // Add a boilerplate META-INF/MANIFEST.MF file as required by the Java JAR - // format, unless one has already been written. - void AddJarManifest(); - - // Get name of all output files. - void GetOutputFilenames(std::vector* output_filenames); - - // implements GeneratorContext -------------------------------------- - 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; - - // 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_; - bool had_error_; -}; - -class CommandLineInterface::MemoryOutputStream - : public io::ZeroCopyOutputStream { - public: - MemoryOutputStream(GeneratorContextImpl* directory, - const std::string& filename, bool append_mode); - 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); - ~MemoryOutputStream() override; - - // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size) override { - return inner_->Next(data, size); - } - void BackUp(int count) override { inner_->BackUp(count); } - int64_t ByteCount() const override { return inner_->ByteCount(); } - - private: - // 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. - // 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_; - std::string filename_; - std::string insertion_point_; - - // The string we're building. - std::string data_; - - // Whether we should append the output stream to the existing file. - bool append_mode_; - - // StringOutputStream writing to data_. - std::unique_ptr inner_; - - // The GeneratedCodeInfo to insert at the insertion point. - google::protobuf::GeneratedCodeInfo info_to_insert_; -}; - -// ------------------------------------------------------------------- - -CommandLineInterface::GeneratorContextImpl::GeneratorContextImpl( - const std::vector& parsed_files) - : parsed_files_(parsed_files), had_error_(false) {} - -bool CommandLineInterface::GeneratorContextImpl::WriteAllToDisk( - const std::string& prefix) { - if (had_error_) { - return false; - } - - if (!VerifyDirectoryExists(prefix)) { - return false; - } - - for (const auto& pair : files_) { - const std::string& relative_filename = pair.first; - const char* data = pair.second.data(); - int size = pair.second.size(); - - if (!TryCreateParentDirectory(prefix, relative_filename)) { - return false; - } - std::string filename = prefix + relative_filename; - - // Create the output file. - int file_descriptor; - do { - file_descriptor = - open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - } while (file_descriptor < 0 && errno == EINTR); - - if (file_descriptor < 0) { - int error = errno; - std::cerr << filename << ": " << strerror(error); - return false; - } - - // Write the file. - while (size > 0) { - int write_result; - do { - write_result = write(file_descriptor, data, size); - } while (write_result < 0 && errno == EINTR); - - if (write_result <= 0) { - // Write error. - - // FIXME(kenton): According to the man page, if write() returns zero, - // there was no error; write() simply did not write anything. It's - // unclear under what circumstances this might happen, but presumably - // errno won't be set in this case. I am confused as to how such an - // event should be handled. For now I'm treating it as an error, - // since retrying seems like it could lead to an infinite loop. I - // suspect this never actually happens anyway. - - if (write_result < 0) { - int error = errno; - std::cerr << filename << ": write: " << strerror(error); - } else { - std::cerr << filename << ": write() returned zero?" << std::endl; - } - return false; - } - - data += write_result; - size -= write_result; - } - - if (close(file_descriptor) != 0) { - int error = errno; - std::cerr << filename << ": close: " << strerror(error); - return false; - } - } - - return true; -} - -bool CommandLineInterface::GeneratorContextImpl::WriteAllToZip( - const std::string& filename) { - if (had_error_) { - return false; - } - - // Create the output file. - int file_descriptor; - do { - file_descriptor = - open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - } while (file_descriptor < 0 && errno == EINTR); - - if (file_descriptor < 0) { - int error = errno; - std::cerr << filename << ": " << strerror(error); - return false; - } - - // Create the ZipWriter - io::FileOutputStream stream(file_descriptor); - ZipWriter zip_writer(&stream); - - for (const auto& pair : files_) { - zip_writer.Write(pair.first, pair.second); - } - - zip_writer.WriteDirectory(); - - 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; -} - -void CommandLineInterface::GeneratorContextImpl::AddJarManifest() { - auto pair = files_.insert({"META-INF/MANIFEST.MF", ""}); - if (pair.second) { - pair.first->second = - "Manifest-Version: 1.0\n" - "Created-By: 1.6.0 (protoc)\n" - "\n"; - } -} - -void CommandLineInterface::GeneratorContextImpl::GetOutputFilenames( - std::vector* output_filenames) { - for (const auto& pair : files_) { - output_filenames->push_back(pair.first); - } -} - -io::ZeroCopyOutputStream* CommandLineInterface::GeneratorContextImpl::Open( - const std::string& filename) { - return new MemoryOutputStream(this, filename, false); -} - -io::ZeroCopyOutputStream* -CommandLineInterface::GeneratorContextImpl::OpenForAppend( - const std::string& filename) { - return new MemoryOutputStream(this, filename, true); -} - -io::ZeroCopyOutputStream* -CommandLineInterface::GeneratorContextImpl::OpenForInsert( - const std::string& filename, const std::string& insertion_point) { - 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( - GeneratorContextImpl* directory, const std::string& filename, - bool append_mode) - : directory_(directory), - filename_(filename), - append_mode_(append_mode), - inner_(new io::StringOutputStream(&data_)) {} - -CommandLineInterface::MemoryOutputStream::MemoryOutputStream( - GeneratorContextImpl* directory, const std::string& filename, - const std::string& insertion_point) - : directory_(directory), - filename_(filename), - 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( - 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; - } - GeneratedCodeInfo metadata; - bool is_text_format = false; - 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(new_metadata, encoded_data); - } else { - new_metadata.SerializeToString(encoded_data); - } -} - -CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { - // Make sure all data has been written. - inner_.reset(); - - // Insert into the directory. - auto pair = directory_->files_.insert({filename_, ""}); - auto it = pair.first; - bool already_present = !pair.second; - - if (insertion_point_.empty()) { - // This was just a regular Open(). - if (already_present) { - if (append_mode_) { - it->second.append(data_); - } else { - std::cerr << filename_ << ": Tried to write the same file twice." - << std::endl; - directory_->had_error_ = true; - } - return; - } - - it->second.swap(data_); - } else { - // This was an OpenForInsert(). - - // If the data doesn't end with a clean line break, add one. - if (!data_.empty() && data_[data_.size() - 1] != '\n') { - data_.push_back('\n'); - } - - // Find the file we are going to insert into. - if (!already_present) { - std::cerr << filename_ - << ": Tried to insert into file that doesn't exist." - << std::endl; - directory_->had_error_ = true; - return; - } - std::string* target = &it->second; - - // Find the insertion point. - std::string magic_string = - strings::Substitute("@@protoc_insertion_point($0)", insertion_point_); - std::string::size_type pos = target->find(magic_string); - - if (pos == std::string::npos) { - std::cerr << filename_ << ": insertion point \"" << insertion_point_ - << "\" not found." << std::endl; - directory_->had_error_ = true; - return; - } - - if ((pos > 3) && (target->substr(pos - 3, 2) == "/*")) { - // Support for inline "/* @@protoc_insertion_point() */" - pos = pos - 3; - } else { - // Seek backwards to the beginning of the line, which is where we will - // insert the data. Note that this has the effect of pushing the - // insertion point down, so the data is inserted before it. This is - // intentional because it means that multiple insertions at the same point - // will end up in the expected order in the final output. - pos = target->find_last_of('\n', pos); - if (pos == std::string::npos) { - // Insertion point is on the first line. - pos = 0; - } else { - // Advance to character after '\n'. - ++pos; - } - } - - // Extract indent. - std::string indent_(*target, pos, - target->find_first_not_of(" \t", pos) - pos); - - if (indent_.empty()) { - // No indent. This makes things easier. - target->insert(pos, data_); - UpdateMetadata(data_, pos, data_.size(), 0); - } else { - // Calculate how much space we need. - int indent_size = 0; - for (int i = 0; i < data_.size(); i++) { - if (data_[i] == '\n') indent_size += indent_.size(); - } - - // Make a hole for it. - target->insert(pos, data_.size() + indent_size, '\0'); - - // Now copy in the data. - std::string::size_type data_pos = 0; - char* target_ptr = ::google::protobuf::string_as_array(target) + pos; - while (data_pos < data_.size()) { - // Copy indent. - memcpy(target_ptr, indent_.data(), indent_.size()); - target_ptr += indent_.size(); - - // Copy line from data_. - // We already guaranteed that data_ ends with a newline (above), so this - // search can't fail. - std::string::size_type line_length = - data_.find_first_of('\n', data_pos) + 1 - data_pos; - memcpy(target_ptr, data_.data() + data_pos, line_length); - 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); - } - } -} - -// =================================================================== - -#if defined(_WIN32) && !defined(__CYGWIN__) -const char* const CommandLineInterface::kPathSeparator = ";"; -#else -const char* const CommandLineInterface::kPathSeparator = ":"; -#endif - -CommandLineInterface::CommandLineInterface() - : direct_dependencies_violation_msg_( - kDefaultDirectDependenciesViolationMsg) {} - -CommandLineInterface::~CommandLineInterface() {} - -void CommandLineInterface::RegisterGenerator(const std::string& flag_name, - CodeGenerator* generator, - const std::string& help_text) { - GeneratorInfo info; - info.flag_name = flag_name; - info.generator = generator; - info.help_text = help_text; - generators_by_flag_name_[flag_name] = info; -} - -void CommandLineInterface::RegisterGenerator( - const std::string& flag_name, const std::string& option_flag_name, - CodeGenerator* generator, const std::string& help_text) { - GeneratorInfo info; - info.flag_name = flag_name; - info.option_flag_name = option_flag_name; - info.generator = generator; - info.help_text = help_text; - generators_by_flag_name_[flag_name] = info; - generators_by_option_name_[option_flag_name] = info; -} - -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(); - switch (ParseArguments(argc, argv)) { - case PARSE_ARGUMENT_DONE_AND_EXIT: - return 0; - case PARSE_ARGUMENT_FAIL: - return 1; - case PARSE_ARGUMENT_DONE_AND_CONTINUE: - break; - } - - std::vector parsed_files; - std::unique_ptr disk_source_tree; - std::unique_ptr error_collector; - std::unique_ptr descriptor_pool; - - // 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()) { - 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()) { - // If there are no --proto_path flags, then just look in the specified - // --descriptor_set_in files. But first, verify that the input files are - // there. - if (!VerifyInputFilesInDescriptors(descriptor_set_in_database.get())) { - return 1; - } - - error_collector.reset(new ErrorPrinter(error_format_)); - descriptor_pool.reset(new DescriptorPool(descriptor_set_in_database.get(), - error_collector.get())); - } else { - disk_source_tree.reset(new DiskSourceTree()); - if (!InitializeDiskSourceTree(disk_source_tree.get(), - descriptor_set_in_database.get())) { - return 1; - } - - error_collector.reset( - new ErrorPrinter(error_format_, disk_source_tree.get())); - - source_tree_database.reset(new SourceTreeDescriptorDatabase( - disk_source_tree.get(), descriptor_set_in_database.get())); - source_tree_database->RecordErrorsTo(error_collector.get()); - - descriptor_pool.reset(new DescriptorPool( - source_tree_database.get(), - source_tree_database->GetValidationErrorCollector())); - } - - descriptor_pool->EnforceWeakDependencies(true); - if (!ParseInputFiles(descriptor_pool.get(), disk_source_tree.get(), - &parsed_files)) { - return 1; - } - - - // We construct a separate GeneratorContext for each output location. Note - // that two code generators may output to the same location, in which case - // they should share a single GeneratorContext so that OpenForInsert() works. - GeneratorContextMap output_directories; - - // Generate output. - if (mode_ == MODE_COMPILE) { - 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, ".srcjar")) { - AddTrailingSlash(&output_location); - } - - auto& generator = output_directories[output_location]; - - if (!generator) { - // First time we've seen this output location. - generator.reset(new GeneratorContextImpl(parsed_files)); - } - - if (!GenerateOutput(parsed_files, output_directives_[i], - generator.get())) { - return 1; - } - } - } - - // Write all output to disk. - for (const auto& pair : output_directories) { - const std::string& location = pair.first; - GeneratorContextImpl* directory = pair.second.get(); - if (HasSuffixString(location, "/")) { - if (!directory->WriteAllToDisk(location)) { - return 1; - } - } else { - if (HasSuffixString(location, ".jar")) { - directory->AddJarManifest(); - } - - if (!directory->WriteAllToZip(location)) { - return 1; - } - } - } - - if (!dependency_out_name_.empty()) { - GOOGLE_DCHECK(disk_source_tree.get()); - if (!GenerateDependencyManifestFile(parsed_files, output_directories, - disk_source_tree.get())) { - return 1; - } - } - - if (!descriptor_set_out_name_.empty()) { - if (!WriteDescriptorSet(parsed_files)) { - return 1; - } - } - - if (mode_ == MODE_ENCODE || mode_ == MODE_DECODE) { - if (codec_type_.empty()) { - // HACK: Define an EmptyMessage type to use for decoding. - DescriptorPool pool; - FileDescriptorProto file; - file.set_name("empty_message.proto"); - file.add_message_type()->set_name("EmptyMessage"); - GOOGLE_CHECK(pool.BuildFile(file) != nullptr); - codec_type_ = "EmptyMessage"; - if (!EncodeOrDecode(&pool)) { - return 1; - } - } else { - if (!EncodeOrDecode(descriptor_pool.get())) { - return 1; - } - } - } - - if (error_collector->FoundErrors() || - (fatal_warnings_ && error_collector->FoundWarnings())) { - return 1; - } - - if (mode_ == MODE_PRINT) { - switch (print_mode_) { - case PRINT_FREE_FIELDS: - for (int i = 0; i < parsed_files.size(); ++i) { - const FileDescriptor* fd = parsed_files[i]; - for (int j = 0; j < fd->message_type_count(); ++j) { - PrintFreeFieldNumbers(fd->message_type(j)); - } - } - break; - case PRINT_NONE: - GOOGLE_LOG(ERROR) << "If the code reaches here, it usually means a bug of " - "flag parsing in the CommandLineInterface."; - return 1; - - // Do not add a default case. - } - } - - return 0; -} - -bool CommandLineInterface::InitializeDiskSourceTree( - DiskSourceTree* source_tree, DescriptorDatabase* fallback_database) { - AddDefaultProtoPaths(&proto_path_); - - // Set up the source tree. - for (int i = 0; i < proto_path_.size(); i++) { - source_tree->MapPath(proto_path_[i].first, proto_path_[i].second); - } - - // Map input files to virtual paths if possible. - if (!MakeInputsBeProtoPathRelative(source_tree, fallback_database)) { - return false; - } - - return true; -} - -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_name << ": close: " << strerror(errno) - << std::endl; - return nullptr; - } - - if (!parsed) { - std::cerr << descriptor_set_name << ": Unable to parse." << std::endl; - return nullptr; - } - - 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 database; -} - -} // namespace - - -bool CommandLineInterface::VerifyInputFilesInDescriptors( - DescriptorDatabase* database) { - for (const auto& input_file : input_files_) { - FileDescriptorProto file_descriptor; - if (!database->FindFileByName(input_file, &file_descriptor)) { - std::cerr << "Could not find file in descriptor database: " << input_file - << ": " << strerror(ENOENT) << std::endl; - return false; - } - - // Enforce --disallow_services. - if (disallow_services_ && file_descriptor.service_size() > 0) { - std::cerr << file_descriptor.name() - << ": This file contains services, but " - "--disallow_services was used." - << std::endl; - return false; - } - - } - return true; -} - -bool CommandLineInterface::ParseInputFiles( - DescriptorPool* descriptor_pool, DiskSourceTree* source_tree, - std::vector* parsed_files) { - - 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_) { - // Import the file. - const FileDescriptor* parsed_file = - descriptor_pool->FindFileByName(input_file); - if (parsed_file == nullptr) { - result = false; - break; - } - parsed_files->push_back(parsed_file); - - // Enforce --disallow_services. - if (disallow_services_ && parsed_file->service_count() > 0) { - std::cerr << parsed_file->name() - << ": This file contains services, but " - "--disallow_services was used." - << std::endl; - result = false; - break; - } - - - // Enforce --direct_dependencies - if (direct_dependencies_explicitly_set_) { - bool indirect_imports = false; - for (int i = 0; i < parsed_file->dependency_count(); i++) { - if (direct_dependencies_.find(parsed_file->dependency(i)->name()) == - direct_dependencies_.end()) { - indirect_imports = true; - std::cerr << parsed_file->name() << ": " - << StringReplace(direct_dependencies_violation_msg_, "%s", - parsed_file->dependency(i)->name(), - true /* replace_all */) - << std::endl; - } - } - if (indirect_imports) { - result = false; - break; - } - } - } - descriptor_pool->ClearUnusedImportTrackFiles(); - return result; -} - -void CommandLineInterface::Clear() { - // Clear all members that are set by Run(). Note that we must not clear - // members which are set by other methods before Run() is called. - executable_name_.clear(); - proto_path_.clear(); - input_files_.clear(); - direct_dependencies_.clear(); - direct_dependencies_violation_msg_ = kDefaultDirectDependenciesViolationMsg; - output_directives_.clear(); - codec_type_.clear(); - descriptor_set_in_names_.clear(); - descriptor_set_out_name_.clear(); - dependency_out_name_.clear(); - - - mode_ = MODE_COMPILE; - print_mode_ = PRINT_NONE; - imports_in_descriptor_set_ = false; - source_info_in_descriptor_set_ = false; - disallow_services_ = false; - direct_dependencies_explicitly_set_ = false; - deterministic_output_ = false; -} - -bool CommandLineInterface::MakeProtoProtoPathRelative( - DiskSourceTree* source_tree, std::string* proto, - DescriptorDatabase* fallback_database) { - // If it's in the fallback db, don't report non-existent file errors. - FileDescriptorProto fallback_file; - bool in_fallback_database = - fallback_database != nullptr && - fallback_database->FindFileByName(*proto, &fallback_file); - - // If the input file path is not a physical file path, it must be a virtual - // path. - if (access(proto->c_str(), F_OK) < 0) { - std::string disk_file; - if (source_tree->VirtualFileToDiskFile(*proto, &disk_file) || - in_fallback_database) { - return true; - } else { - std::cerr << "Could not make proto path relative: " << *proto << ": " - << strerror(ENOENT) << std::endl; - return false; - } - } - - std::string virtual_file, shadowing_disk_file; - switch (source_tree->DiskFileToVirtualFile(*proto, &virtual_file, - &shadowing_disk_file)) { - case DiskSourceTree::SUCCESS: - *proto = virtual_file; - break; - case DiskSourceTree::SHADOWED: - std::cerr << *proto << ": Input is shadowed in the --proto_path by \"" - << shadowing_disk_file - << "\". Either use the latter file as your input or reorder " - "the --proto_path so that the former file's location " - "comes first." - << std::endl; - return false; - 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 << ": " - << error_str << std::endl; - return false; - } - case DiskSourceTree::NO_MAPPING: { - // Try to interpret the path as a virtual path. - std::string disk_file; - if (source_tree->VirtualFileToDiskFile(*proto, &disk_file) || - in_fallback_database) { - return true; - } else { - // The input file path can't be mapped to any --proto_path and it also - // can't be interpreted as a virtual path. - std::cerr - << *proto - << ": File does not reside within any path " - "specified using --proto_path (or -I). You must specify a " - "--proto_path which encompasses this file. Note that the " - "proto_path must be an exact prefix of the .proto file " - "names -- protoc is too dumb to figure out when two paths " - "(e.g. absolute and relative) are equivalent (it's harder " - "than you think)." - << std::endl; - return false; - } - } - } - return true; -} - -bool CommandLineInterface::MakeInputsBeProtoPathRelative( - DiskSourceTree* source_tree, DescriptorDatabase* fallback_database) { - for (auto& input_file : input_files_) { - if (!MakeProtoProtoPathRelative(source_tree, &input_file, - fallback_database)) { - return false; - } - } - - return true; -} - - -bool CommandLineInterface::ExpandArgumentFile( - const std::string& file, std::vector* arguments) { - // The argument file is searched in the working directory only. We don't - // use the proto import path here. - std::ifstream file_stream(file.c_str()); - if (!file_stream.is_open()) { - return false; - } - std::string argument; - // We don't support any kind of shell expansion right now. - while (std::getline(file_stream, argument)) { - arguments->push_back(argument); - } - return true; -} - -CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments( - int argc, const char* const argv[]) { - executable_name_ = argv[0]; - - std::vector arguments; - for (int i = 1; i < argc; ++i) { - if (argv[i][0] == '@') { - if (!ExpandArgumentFile(argv[i] + 1, &arguments)) { - std::cerr << "Failed to open argument file: " << (argv[i] + 1) - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - continue; - } - arguments.push_back(argv[i]); - } - - // if no arguments are given, show help - if (arguments.empty()) { - PrintHelpText(); - return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler. - } - - // Iterate through all arguments and parse them. - for (int i = 0; i < arguments.size(); ++i) { - std::string name, value; - - if (ParseArgument(arguments[i].c_str(), &name, &value)) { - // Returned true => Use the next argument as the flag value. - if (i + 1 == arguments.size() || arguments[i + 1][0] == '-') { - std::cerr << "Missing value for flag: " << name << std::endl; - if (name == "--decode") { - std::cerr << "To decode an unknown message, use --decode_raw." - << std::endl; - } - return PARSE_ARGUMENT_FAIL; - } else { - ++i; - value = arguments[i]; - } - } - - ParseArgumentStatus status = InterpretArgument(name, value); - if (status != PARSE_ARGUMENT_DONE_AND_CONTINUE) return status; - } - - // Make sure each plugin option has a matching plugin output. - bool foundUnknownPluginOption = false; - for (std::map::const_iterator i = - plugin_parameters_.begin(); - i != plugin_parameters_.end(); ++i) { - if (plugins_.find(i->first) != plugins_.end()) { - continue; - } - bool foundImplicitPlugin = false; - for (std::vector::const_iterator j = - output_directives_.begin(); - j != output_directives_.end(); ++j) { - if (j->generator == nullptr) { - std::string plugin_name = PluginName(plugin_prefix_, j->name); - if (plugin_name == i->first) { - foundImplicitPlugin = true; - break; - } - } - } - if (!foundImplicitPlugin) { - std::cerr << "Unknown flag: " - // strip prefix + "gen-" and add back "_opt" - << "--" + i->first.substr(plugin_prefix_.size() + 4) + "_opt" - << std::endl; - foundUnknownPluginOption = true; - } - } - if (foundUnknownPluginOption) { - return PARSE_ARGUMENT_FAIL; - } - - // The --proto_path & --descriptor_set_in flags both specify places to look - // for proto files. If neither were given, use the current working directory. - if (proto_path_.empty() && descriptor_set_in_names_.empty()) { - // Don't use make_pair as the old/default standard library on Solaris - // doesn't support it without explicit template parameters, which are - // incompatible with C++0x's make_pair. - proto_path_.push_back(std::pair("", ".")); - } - - // 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; - } - 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; - } - if (mode_ == MODE_COMPILE && output_directives_.empty() && - descriptor_set_out_name_.empty()) { - std::cerr << "Missing output directives." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (mode_ != MODE_COMPILE && !dependency_out_name_.empty()) { - std::cerr << "Can only use --dependency_out=FILE when generating code." - << 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." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (imports_in_descriptor_set_ && descriptor_set_out_name_.empty()) { - std::cerr << "--include_imports only makes sense when combined with " - "--descriptor_set_out." - << std::endl; - } - if (source_info_in_descriptor_set_ && descriptor_set_out_name_.empty()) { - std::cerr << "--include_source_info only makes sense when combined with " - "--descriptor_set_out." - << std::endl; - } - - return PARSE_ARGUMENT_DONE_AND_CONTINUE; -} - -bool CommandLineInterface::ParseArgument(const char* arg, std::string* name, - std::string* value) { - bool parsed_value = false; - - if (arg[0] != '-') { - // Not a flag. - name->clear(); - parsed_value = true; - *value = arg; - } else if (arg[1] == '-') { - // Two dashes: Multi-character name, with '=' separating name and - // value. - const char* equals_pos = strchr(arg, '='); - if (equals_pos != nullptr) { - *name = std::string(arg, equals_pos - arg); - *value = equals_pos + 1; - parsed_value = true; - } else { - *name = arg; - } - } else { - // One dash: One-character name, all subsequent characters are the - // value. - if (arg[1] == '\0') { - // arg is just "-". We treat this as an input file, except that at - // present this will just lead to a "file not found" error. - name->clear(); - *value = arg; - parsed_value = true; - } else { - *name = std::string(arg, 2); - *value = arg + 2; - parsed_value = !value->empty(); - } - } - - // Need to return true iff the next arg should be used as the value for this - // one, false otherwise. - - if (parsed_value) { - // We already parsed a value for this flag. - return false; - } - - 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 == "--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. - return false; - } - - // Next argument is the flag value. - return true; -} - -CommandLineInterface::ParseArgumentStatus -CommandLineInterface::InterpretArgument(const std::string& name, - const std::string& value) { - if (name.empty()) { - // Not a flag. Just a filename. - if (value.empty()) { - std::cerr - << "You seem to have passed an empty string as one of the " - "arguments to " - << executable_name_ - << ". This is actually " - "sort of hard to do. Congrats. Unfortunately it is not valid " - "input so the program is going to die now." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - -#if defined(_WIN32) - // On Windows, the shell (typically cmd.exe) does not expand wildcards in - // file names (e.g. foo\*.proto), so we do it ourselves. - switch (google::protobuf::io::win32::ExpandWildcards( - value, [this](const std::string& path) { - this->input_files_.push_back(path); - })) { - case google::protobuf::io::win32::ExpandWildcardsResult::kSuccess: - break; - case google::protobuf::io::win32::ExpandWildcardsResult:: - kErrorNoMatchingFile: - // Path does not exist, is not a file, or it's longer than MAX_PATH and - // long path handling is disabled. - std::cerr << "Invalid file name pattern or missing input file \"" - << value << "\"" << std::endl; - return PARSE_ARGUMENT_FAIL; - default: - std::cerr << "Cannot convert path \"" << value - << "\" to or from Windows style" << std::endl; - return PARSE_ARGUMENT_FAIL; - } -#else // not _WIN32 - // On other platforms than Windows (e.g. Linux, Mac OS) the shell (typically - // Bash) expands wildcards. - input_files_.push_back(value); -#endif // _WIN32 - - } else if (name == "-I" || name == "--proto_path") { - // Java's -classpath (and some other languages) delimits path components - // with colons. Let's accept that syntax too just to make things more - // intuitive. - std::vector parts = Split( - value, CommandLineInterface::kPathSeparator, - true); - - for (int i = 0; i < parts.size(); i++) { - std::string virtual_path; - std::string disk_path; - - std::string::size_type equals_pos = parts[i].find_first_of('='); - if (equals_pos == std::string::npos) { - virtual_path = ""; - disk_path = parts[i]; - } else { - virtual_path = parts[i].substr(0, equals_pos); - disk_path = parts[i].substr(equals_pos + 1); - } - - if (disk_path.empty()) { - std::cerr - << "--proto_path passed empty directory name. (Use \".\" for " - "current directory.)" - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - // Make sure disk path exists, warn otherwise. - if (access(disk_path.c_str(), F_OK) < 0) { - // Try the original path; it may have just happened to have a '=' in it. - if (access(parts[i].c_str(), F_OK) < 0) { - std::cerr << disk_path << ": warning: directory does not exist." - << std::endl; - } else { - virtual_path = ""; - disk_path = parts[i]; - } - } - - // Don't use make_pair as the old/default standard library on Solaris - // doesn't support it without explicit template parameters, which are - // incompatible with C++0x's make_pair. - proto_path_.push_back( - std::pair(virtual_path, disk_path)); - } - - } else if (name == "--direct_dependencies") { - if (direct_dependencies_explicitly_set_) { - std::cerr << name - << " may only be passed once. To specify multiple " - "direct dependencies, pass them all as a single " - "parameter separated by ':'." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - direct_dependencies_explicitly_set_ = true; - std::vector direct = - Split(value, ":", true); - GOOGLE_DCHECK(direct_dependencies_.empty()); - direct_dependencies_.insert(direct.begin(), direct.end()); - - } else if (name == "--direct_dependencies_violation_msg") { - direct_dependencies_violation_msg_ = value; - - } else if (name == "--descriptor_set_in") { - if (!descriptor_set_in_names_.empty()) { - std::cerr << name - << " may only be passed once. To specify multiple " - "descriptor sets, pass them all as a single " - "parameter separated by '" - << CommandLineInterface::kPathSeparator << "'." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (value.empty()) { - std::cerr << name << " requires a non-empty value." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (!dependency_out_name_.empty()) { - std::cerr << name << " cannot be used with --dependency_out." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - descriptor_set_in_names_ = Split( - value, CommandLineInterface::kPathSeparator, - true); - - } else if (name == "-o" || name == "--descriptor_set_out") { - if (!descriptor_set_out_name_.empty()) { - std::cerr << name << " may only be passed once." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (value.empty()) { - std::cerr << name << " requires a non-empty value." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (mode_ != MODE_COMPILE) { - std::cerr - << "Cannot use --encode or --decode and generate descriptors at the " - "same time." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - descriptor_set_out_name_ = value; - - } else if (name == "--dependency_out") { - if (!dependency_out_name_.empty()) { - std::cerr << name << " may only be passed once." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (value.empty()) { - std::cerr << name << " requires a non-empty value." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (!descriptor_set_in_names_.empty()) { - std::cerr << name << " cannot be used with --descriptor_set_in." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - dependency_out_name_ = value; - - } else if (name == "--include_imports") { - if (imports_in_descriptor_set_) { - std::cerr << name << " may only be passed once." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - imports_in_descriptor_set_ = true; - - } else if (name == "--include_source_info") { - if (source_info_in_descriptor_set_) { - std::cerr << name << " may only be passed once." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - source_info_in_descriptor_set_ = true; - - } else if (name == "-h" || name == "--help") { - PrintHelpText(); - return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler. - - } else if (name == "--version") { - if (!version_info_.empty()) { - std::cout << version_info_ << std::endl; - } - std::cout << "libprotoc " << internal::VersionString(PROTOBUF_VERSION) - << 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) { - std::cerr << "Only one of --encode and --decode can be specified." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (!output_directives_.empty() || !descriptor_set_out_name_.empty()) { - std::cerr << "Cannot use " << name - << " and generate code or descriptors at the same time." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - mode_ = (name == "--encode") ? MODE_ENCODE : MODE_DECODE; - - if (value.empty() && name != "--decode_raw") { - std::cerr << "Type name for " << name << " cannot be blank." << std::endl; - if (name == "--decode") { - std::cerr << "To decode an unknown message, use --decode_raw." - << std::endl; - } - return PARSE_ARGUMENT_FAIL; - } else if (!value.empty() && name == "--decode_raw") { - std::cerr << "--decode_raw does not take a parameter." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - codec_type_ = value; - - } else if (name == "--deterministic_output") { - deterministic_output_ = true; - - } else if (name == "--error_format") { - if (value == "gcc") { - error_format_ = ERROR_FORMAT_GCC; - } else if (value == "msvs") { - error_format_ = ERROR_FORMAT_MSVS; - } else { - std::cerr << "Unknown error format: " << value << std::endl; - 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; - return PARSE_ARGUMENT_FAIL; - } - - std::string plugin_name; - std::string path; - - std::string::size_type equals_pos = value.find_first_of('='); - if (equals_pos == std::string::npos) { - // Use the basename of the file. - std::string::size_type slash_pos = value.find_last_of('/'); - if (slash_pos == std::string::npos) { - plugin_name = value; - } else { - plugin_name = value.substr(slash_pos + 1); - } - path = value; - } else { - plugin_name = value.substr(0, equals_pos); - path = value.substr(equals_pos + 1); - } - - plugins_[plugin_name] = path; - - } else if (name == "--print_free_field_numbers") { - if (mode_ != MODE_COMPILE) { - std::cerr << "Cannot use " << name - << " and use --encode, --decode or print " - << "other info at the same time." << std::endl; - return PARSE_ARGUMENT_FAIL; - } - if (!output_directives_.empty() || !descriptor_set_out_name_.empty()) { - std::cerr << "Cannot use " << name - << " and generate code or descriptors at the same time." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - mode_ = MODE_PRINT; - print_mode_ = PRINT_FREE_FIELDS; - } else { - // Some other flag. Look it up in the generators list. - const GeneratorInfo* generator_info = - FindOrNull(generators_by_flag_name_, name); - if (generator_info == nullptr && - (plugin_prefix_.empty() || !HasSuffixString(name, "_out"))) { - // Check if it's a generator option flag. - generator_info = FindOrNull(generators_by_option_name_, name); - if (generator_info != nullptr) { - std::string* parameters = - &generator_parameters_[generator_info->flag_name]; - if (!parameters->empty()) { - parameters->append(","); - } - parameters->append(value); - } else if (HasPrefixString(name, "--") && HasSuffixString(name, "_opt")) { - std::string* parameters = - &plugin_parameters_[PluginName(plugin_prefix_, name)]; - if (!parameters->empty()) { - parameters->append(","); - } - parameters->append(value); - } else { - std::cerr << "Unknown flag: " << name << std::endl; - return PARSE_ARGUMENT_FAIL; - } - } else { - // It's an output flag. Add it to the output directives. - if (mode_ != MODE_COMPILE) { - std::cerr << "Cannot use --encode, --decode or print .proto info and " - "generate code at the same time." - << std::endl; - return PARSE_ARGUMENT_FAIL; - } - - OutputDirective directive; - directive.name = name; - if (generator_info == nullptr) { - directive.generator = nullptr; - } else { - directive.generator = generator_info->generator; - } - - // Split value at ':' to separate the generator parameter from the - // filename. However, avoid doing this if the colon is part of a valid - // Windows-style absolute path. - std::string::size_type colon_pos = value.find_first_of(':'); - if (colon_pos == std::string::npos || IsWindowsAbsolutePath(value)) { - directive.output_location = value; - } else { - directive.parameter = value.substr(0, colon_pos); - directive.output_location = value.substr(colon_pos + 1); - } - - output_directives_.push_back(directive); - } - } - - return PARSE_ARGUMENT_DONE_AND_CONTINUE; -} - -void CommandLineInterface::PrintHelpText() { - // Sorry for indentation here; line wrapping would be uglier. - 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 << 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(); - iter != generators_by_flag_name_.end(); ++iter) { - // 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 << std::endl - << " " << iter->first << "=OUT_DIR " - << std::string(19 - iter->first.size(), - ' ') // Spaces for alignment. - << 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( - const std::vector& parsed_files, - const OutputDirective& output_directive, - GeneratorContext* generator_context) { - // Call the generator. - std::string error; - if (output_directive.generator == nullptr) { - // This is a plugin. - GOOGLE_CHECK(HasPrefixString(output_directive.name, "--") && - HasSuffixString(output_directive.name, "_out")) - << "Bad name for plugin generator: " << output_directive.name; - - std::string plugin_name = PluginName(plugin_prefix_, output_directive.name); - std::string parameters = output_directive.parameter; - if (!plugin_parameters_[plugin_name].empty()) { - if (!parameters.empty()) { - parameters.append(","); - } - parameters.append(plugin_parameters_[plugin_name]); - } - if (!GeneratePluginOutput(parsed_files, plugin_name, parameters, - generator_context, &error)) { - std::cerr << output_directive.name << ": " << error << std::endl; - return false; - } - } else { - // Regular generator. - std::string parameters = output_directive.parameter; - if (!generator_parameters_[output_directive.name].empty()) { - if (!parameters.empty()) { - parameters.append(","); - } - 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. - std::cerr << output_directive.name << ": " << error << std::endl; - return false; - } - } - - return true; -} - -bool CommandLineInterface::GenerateDependencyManifestFile( - const std::vector& parsed_files, - const GeneratorContextMap& output_directories, - DiskSourceTree* source_tree) { - FileDescriptorSet file_set; - - std::set already_seen; - for (int i = 0; i < parsed_files.size(); i++) { - GetTransitiveDependencies(parsed_files[i], false, false, &already_seen, - file_set.mutable_file()); - } - - std::vector output_filenames; - for (const auto& pair : output_directories) { - const std::string& location = pair.first; - GeneratorContextImpl* directory = pair.second.get(); - std::vector relative_output_filenames; - directory->GetOutputFilenames(&relative_output_filenames); - for (int i = 0; i < relative_output_filenames.size(); i++) { - std::string output_filename = location + relative_output_filenames[i]; - if (output_filename.compare(0, 2, "./") == 0) { - output_filename = output_filename.substr(2); - } - output_filenames.push_back(output_filename); - } - } - - if (!descriptor_set_out_name_.empty()) { - output_filenames.push_back(descriptor_set_out_name_); - } - - int fd; - do { - fd = open(dependency_out_name_.c_str(), - O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - } while (fd < 0 && errno == EINTR); - - if (fd < 0) { - perror(dependency_out_name_.c_str()); - return false; - } - - io::FileOutputStream out(fd); - io::Printer printer(&out, '$'); - - for (int i = 0; i < output_filenames.size(); i++) { - printer.Print(output_filenames[i].c_str()); - if (i == output_filenames.size() - 1) { - printer.Print(":"); - } else { - printer.Print(" \\\n"); - } - } - - for (int i = 0; i < file_set.file_size(); i++) { - const FileDescriptorProto& file = file_set.file(i); - const std::string& virtual_file = file.name(); - std::string disk_file; - if (source_tree && - source_tree->VirtualFileToDiskFile(virtual_file, &disk_file)) { - printer.Print(" $disk_file$", "disk_file", disk_file); - if (i < file_set.file_size() - 1) printer.Print("\\\n"); - } else { - std::cerr << "Unable to identify path for file " << virtual_file - << std::endl; - return false; - } - } - - return true; -} - -bool CommandLineInterface::GeneratePluginOutput( - const std::vector& parsed_files, - const std::string& plugin_name, const std::string& parameter, - GeneratorContext* generator_context, std::string* error) { - CodeGeneratorRequest request; - CodeGeneratorResponse response; - std::string processed_parameter = parameter; - - - // Build the request. - if (!processed_parameter.empty()) { - request.set_parameter(processed_parameter); - } - - - std::set already_seen; - for (int i = 0; i < parsed_files.size(); i++) { - request.add_file_to_generate(parsed_files[i]->name()); - GetTransitiveDependencies(parsed_files[i], - true, // Include json_name for plugins. - true, // Include source code info. - &already_seen, request.mutable_proto_file()); - } - - google::protobuf::compiler::Version* version = - request.mutable_compiler_version(); - version->set_major(PROTOBUF_VERSION / 1000000); - version->set_minor(PROTOBUF_VERSION / 1000 % 1000); - version->set_patch(PROTOBUF_VERSION % 1000); - version->set_suffix(PROTOBUF_VERSION_SUFFIX); - - // Invoke the plugin. - Subprocess subprocess; - - if (plugins_.count(plugin_name) > 0) { - subprocess.Start(plugins_[plugin_name], Subprocess::EXACT_NAME); - } else { - subprocess.Start(plugin_name, Subprocess::SEARCH_PATH); - } - - std::string communicate_error; - if (!subprocess.Communicate(request, &response, &communicate_error)) { - *error = strings::Substitute("$0: $1", plugin_name, communicate_error); - return false; - } - - // Write the files. We do this even if there was a generator error in order - // to match the behavior of a compiled-in generator. - std::unique_ptr current_output; - for (int i = 0; i < response.file_size(); i++) { - const CodeGeneratorResponse::File& output_file = response.file(i); - - if (!output_file.insertion_point().empty()) { - std::string filename = output_file.name(); - // Open a file for insert. - // We reset current_output to nullptr first so that the old file is closed - // before the new one is opened. - current_output.reset(); - 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 nullptr first so that the old file is closed - // before the new one is opened. - current_output.reset(); - current_output.reset(generator_context->Open(output_file.name())); - } else if (current_output == nullptr) { - *error = strings::Substitute( - "$0: First file chunk returned by plugin did not specify a file " - "name.", - plugin_name); - return false; - } - - // Use CodedOutputStream for convenience; otherwise we'd need to provide - // our own buffer-copying loop. - io::CodedOutputStream writer(current_output.get()); - writer.WriteString(output_file.content()); - } - - // Check for errors. - if (!response.error().empty()) { - // Generator returned an error. - *error = response.error(); - return false; - } else if (!EnforceProto3OptionalSupport( - plugin_name, response.supported_features(), parsed_files)) { - return false; - } - - return true; -} - -bool CommandLineInterface::EncodeOrDecode(const DescriptorPool* pool) { - // Look up the type. - const Descriptor* type = pool->FindMessageTypeByName(codec_type_); - if (type == nullptr) { - std::cerr << "Type not defined: " << codec_type_ << std::endl; - return false; - } - - DynamicMessageFactory dynamic_factory(pool); - std::unique_ptr message(dynamic_factory.GetPrototype(type)->New()); - - if (mode_ == MODE_ENCODE) { - SetFdToTextMode(STDIN_FILENO); - SetFdToBinaryMode(STDOUT_FILENO); - } else { - SetFdToBinaryMode(STDIN_FILENO); - SetFdToTextMode(STDOUT_FILENO); - } - - io::FileInputStream in(STDIN_FILENO); - io::FileOutputStream out(STDOUT_FILENO); - - if (mode_ == MODE_ENCODE) { - // Input is text. - ErrorPrinter error_collector(error_format_); - TextFormat::Parser parser; - parser.RecordErrorsTo(&error_collector); - parser.AllowPartialMessage(true); - - if (!parser.Parse(&in, message.get())) { - std::cerr << "Failed to parse input." << std::endl; - return false; - } - } else { - // Input is binary. - if (!message->ParsePartialFromZeroCopyStream(&in)) { - std::cerr << "Failed to parse input." << std::endl; - return false; - } - } - - if (!message->IsInitialized()) { - std::cerr << "warning: Input message is missing required fields: " - << message->InitializationErrorString() << std::endl; - } - - if (mode_ == MODE_ENCODE) { - // Output is binary. - 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; - } - } else { - // Output is text. - if (!TextFormat::Print(*message, &out)) { - std::cerr << "output: I/O error." << std::endl; - return false; - } - } - - return true; -} - -bool CommandLineInterface::WriteDescriptorSet( - const std::vector& parsed_files) { - FileDescriptorSet file_set; - - std::set already_seen; - if (!imports_in_descriptor_set_) { - // Since we don't want to output transitive dependencies, but we do want - // things to be in dependency order, add all dependencies that aren't in - // parsed_files to already_seen. This will short circuit the recursion - // in GetTransitiveDependencies. - std::set to_output; - 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 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); - } - } - } - } - for (int i = 0; i < parsed_files.size(); i++) { - GetTransitiveDependencies(parsed_files[i], - true, // Include json_name - source_info_in_descriptor_set_, &already_seen, - file_set.mutable_file()); - } - - int fd; - do { - fd = open(descriptor_set_out_name_.c_str(), - O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - } while (fd < 0 && errno == EINTR); - - if (fd < 0) { - perror(descriptor_set_out_name_.c_str()); - return false; - } - - io::FileOutputStream out(fd); - - { - 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; - return false; - } - - return true; -} - -void CommandLineInterface::GetTransitiveDependencies( - const FileDescriptor* file, bool include_json_name, - bool include_source_code_info, - std::set* already_seen, - RepeatedPtrField* output) { - if (!already_seen->insert(file).second) { - // Already saw this file. Skip. - return; - } - - // Add all dependencies. - for (int i = 0; i < file->dependency_count(); i++) { - GetTransitiveDependencies(file->dependency(i), include_json_name, - include_source_code_info, already_seen, output); - } - - // Add this file. - FileDescriptorProto* new_descriptor = output->Add(); - file->CopyTo(new_descriptor); - if (include_json_name) { - file->CopyJsonNameTo(new_descriptor); - } - if (include_source_code_info) { - file->CopySourceCodeInfoTo(new_descriptor); - } -} - -namespace { - -// Utility function for PrintFreeFieldNumbers. -// Stores occupied ranges into the ranges parameter, and next level of sub -// message types into the nested_messages parameter. The FieldRange is left -// inclusive, right exclusive. i.e. [a, b). -// -// 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 -// descendant of the given descriptor and all the nodes between the -// nested type and the given descriptor are group types. e.g. -// -// message Foo { -// message Bar { -// message NestedBar {} -// } -// group Baz = 1 { -// group NestedBazGroup = 2 { -// message Quz { -// message NestedQuz {} -// } -// } -// message NestedBaz {} -// } -// } -// -// In this case, Bar, Quz and NestedBaz will be added into the nested types. -// Since free field numbers of group types will not be printed, this makes sure -// the nested message types in groups will not be dropped. The nested_messages -// parameter will contain the direct children (when groups are ignored in the -// tree) of the given descriptor for the caller to traverse. The declaration -// order of the nested messages is also preserved. -typedef std::pair FieldRange; -void GatherOccupiedFieldRanges( - const Descriptor* descriptor, std::set* ranges, - std::vector* nested_messages) { - std::set groups; - for (int i = 0; i < descriptor->field_count(); ++i) { - const FieldDescriptor* fd = descriptor->field(i); - ranges->insert(FieldRange(fd->number(), fd->number() + 1)); - if (fd->type() == FieldDescriptor::TYPE_GROUP) { - groups.insert(fd->message_type()); - } - } - for (int i = 0; i < descriptor->extension_range_count(); ++i) { - ranges->insert(FieldRange(descriptor->extension_range(i)->start, - descriptor->extension_range(i)->end)); - } - for (int i = 0; i < descriptor->reserved_range_count(); ++i) { - ranges->insert(FieldRange(descriptor->reserved_range(i)->start, - descriptor->reserved_range(i)->end)); - } - // Handle the nested messages/groups in declaration order to make it - // post-order strict. - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - const Descriptor* nested_desc = descriptor->nested_type(i); - if (groups.find(nested_desc) != groups.end()) { - GatherOccupiedFieldRanges(nested_desc, ranges, nested_messages); - } else { - nested_messages->push_back(nested_desc); - } - } -} - -// Utility function for PrintFreeFieldNumbers. -// Actually prints the formatted free field numbers for given message name and -// occupied ranges. -void FormatFreeFieldNumbers(const std::string& name, - const std::set& ranges) { - std::string output; - StringAppendF(&output, "%-35s free:", name.c_str()); - int next_free_number = 1; - for (std::set::const_iterator i = ranges.begin(); - i != ranges.end(); ++i) { - // This happens when groups re-use parent field numbers, in which - // case we skip the FieldRange entirely. - if (next_free_number >= i->second) continue; - - if (next_free_number < i->first) { - if (next_free_number + 1 == i->first) { - // Singleton - StringAppendF(&output, " %d", next_free_number); - } else { - // Range - StringAppendF(&output, " %d-%d", next_free_number, - i->first - 1); - } - } - next_free_number = i->second; - } - if (next_free_number <= FieldDescriptor::kMaxNumber) { - StringAppendF(&output, " %d-INF", next_free_number); - } - std::cout << output << std::endl; -} - -} // namespace - -void CommandLineInterface::PrintFreeFieldNumbers(const Descriptor* descriptor) { - std::set ranges; - std::vector nested_messages; - GatherOccupiedFieldRanges(descriptor, &ranges, &nested_messages); - - for (int i = 0; i < nested_messages.size(); ++i) { - PrintFreeFieldNumbers(nested_messages[i]); - } - FormatFreeFieldNumbers(descriptor->full_name(), ranges); -} - - -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/command_line_interface.h b/depends/protobuf/src/google/protobuf/compiler/command_line_interface.h deleted file mode 100644 index e8425508b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/command_line_interface.h +++ /dev/null @@ -1,464 +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. -// -// Implements the Protocol Compiler front-end such that it may be reused by -// custom compilers written to support other languages. - -#ifndef GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ -#define GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { - -class Descriptor; // descriptor.h -class DescriptorDatabase; // descriptor_database.h -class DescriptorPool; // descriptor.h -class FileDescriptor; // descriptor.h -class FileDescriptorSet; // descriptor.h -class FileDescriptorProto; // descriptor.pb.h -template -class RepeatedPtrField; // repeated_field.h -class SimpleDescriptorDatabase; // descriptor_database.h - -namespace compiler { - -class CodeGenerator; // code_generator.h -class GeneratorContext; // code_generator.h -class DiskSourceTree; // importer.h - -// This class implements the command-line interface to the protocol compiler. -// It is designed to make it very easy to create a custom protocol compiler -// supporting the languages of your choice. For example, if you wanted to -// create a custom protocol compiler binary which includes both the regular -// C++ support plus support for your own custom output "Foo", you would -// write a class "FooGenerator" which implements the CodeGenerator interface, -// then write a main() procedure like this: -// -// int main(int argc, char* argv[]) { -// google::protobuf::compiler::CommandLineInterface cli; -// -// // Support generation of C++ source and headers. -// google::protobuf::compiler::cpp::CppGenerator cpp_generator; -// cli.RegisterGenerator("--cpp_out", &cpp_generator, -// "Generate C++ source and header."); -// -// // Support generation of Foo code. -// FooGenerator foo_generator; -// cli.RegisterGenerator("--foo_out", &foo_generator, -// "Generate Foo file."); -// -// return cli.Run(argc, argv); -// } -// -// The compiler is invoked with syntax like: -// 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 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 precedence. -// -// For a full description of the command-line syntax, invoke it with --help. -class PROTOC_EXPORT CommandLineInterface { - public: - static const char* const kPathSeparator; - - CommandLineInterface(); - ~CommandLineInterface(); - - // Register a code generator for a language. - // - // Parameters: - // * flag_name: The command-line flag used to specify an output file of - // this type. The name must start with a '-'. If the name is longer - // than one letter, it must start with two '-'s. - // * generator: The CodeGenerator which will be called to generate files - // of this type. - // * help_text: Text describing this flag in the --help output. - // - // Some generators accept extra parameters. You can specify this parameter - // on the command-line by placing it before the output directory, separated - // by a colon: - // protoc --foo_out=enable_bar:outdir - // The text before the colon is passed to CodeGenerator::Generate() as the - // "parameter". - void RegisterGenerator(const std::string& flag_name, CodeGenerator* generator, - const std::string& help_text); - - // Register a code generator for a language. - // Besides flag_name you can specify another option_flag_name that could be - // used to pass extra parameters to the registered code generator. - // Suppose you have registered a generator by calling: - // command_line_interface.RegisterGenerator("--foo_out", "--foo_opt", ...) - // Then you could invoke the compiler with a command like: - // protoc --foo_out=enable_bar:outdir --foo_opt=enable_baz - // This will pass "enable_bar,enable_baz" as the parameter to the generator. - void RegisterGenerator(const std::string& flag_name, - const std::string& option_flag_name, - CodeGenerator* generator, - const std::string& help_text); - - // Enables "plugins". In this mode, if a command-line flag ends with "_out" - // but does not match any registered generator, the compiler will attempt to - // find a "plugin" to implement the generator. Plugins are just executables. - // They should live somewhere in the PATH. - // - // The compiler determines the executable name to search for by concatenating - // exe_name_prefix with the unrecognized flag name, removing "_out". So, for - // example, if exe_name_prefix is "protoc-" and you pass the flag --foo_out, - // the compiler will try to run the program "protoc-gen-foo". - // - // The plugin program should implement the following usage: - // plugin [--out=OUTDIR] [--parameter=PARAMETER] PROTO_FILES < DESCRIPTORS - // --out indicates the output directory (as passed to the --foo_out - // parameter); if omitted, the current directory should be used. --parameter - // gives the generator parameter, if any was provided (see below). The - // PROTO_FILES list the .proto files which were given on the compiler - // command-line; these are the files for which the plugin is expected to - // generate output code. Finally, DESCRIPTORS is an encoded FileDescriptorSet - // (as defined in descriptor.proto). This is piped to the plugin's stdin. - // The set will include descriptors for all the files listed in PROTO_FILES as - // well as all files that they import. The plugin MUST NOT attempt to read - // the PROTO_FILES directly -- it must use the FileDescriptorSet. - // - // The plugin should generate whatever files are necessary, as code generators - // normally do. It should write the names of all files it generates to - // stdout. The names should be relative to the output directory, NOT absolute - // names or relative to the current directory. If any errors occur, error - // messages should be written to stderr. If an error is fatal, the plugin - // should exit with a non-zero exit code. - // - // Plugins can have generator parameters similar to normal built-in - // generators. Extra generator parameters can be passed in via a matching - // "_opt" parameter. For example: - // protoc --plug_out=enable_bar:outdir --plug_opt=enable_baz - // This will pass "enable_bar,enable_baz" as the parameter to the plugin. - // - void AllowPlugins(const std::string& exe_name_prefix); - - // Run the Protocol Compiler with the given command-line parameters. - // Returns the error code which should be returned by main(). - // - // It may not be safe to call Run() in a multi-threaded environment because - // it calls strerror(). I'm not sure why you'd want to do this anyway. - int Run(int argc, const char* const argv[]); - - // 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 virtual path. - void SetInputsAreProtoPathRelative(bool /* enable */) {} - - // Provides some text which will be printed when the --version flag is - // used. The version of libprotoc will also be printed on the next line - // after this text. - void SetVersionInfo(const std::string& text) { version_info_ = text; } - - - private: - // ----------------------------------------------------------------- - - class ErrorPrinter; - class GeneratorContextImpl; - class MemoryOutputStream; - typedef std::unordered_map> - GeneratorContextMap; - - // Clear state from previous Run(). - void Clear(); - - // Remaps the proto file so that it is relative to one of the directories - // in proto_path_. Returns false if an error occurred. - bool MakeProtoProtoPathRelative(DiskSourceTree* source_tree, - std::string* proto, - DescriptorDatabase* fallback_database); - - // Remaps each file in input_files_ so that it is relative to one of the - // directories in proto_path_. Returns false if an error occurred. - 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 { - PARSE_ARGUMENT_DONE_AND_CONTINUE, - PARSE_ARGUMENT_DONE_AND_EXIT, - PARSE_ARGUMENT_FAIL - }; - - // Parse all command-line arguments. - ParseArgumentStatus ParseArguments(int argc, const char* const argv[]); - - // Read an argument file and append the file's content to the list of - // arguments. Return false if the file cannot be read. - bool ExpandArgumentFile(const std::string& file, - std::vector* arguments); - - // Parses a command-line argument into a name/value pair. Returns - // true if the next argument in the argv should be used as the value, - // false otherwise. - // - // Examples: - // "-Isrc/protos" -> - // name = "-I", value = "src/protos" - // "--cpp_out=src/foo.pb2.cc" -> - // name = "--cpp_out", value = "src/foo.pb2.cc" - // "foo.proto" -> - // name = "", value = "foo.proto" - bool ParseArgument(const char* arg, std::string* name, std::string* value); - - // Interprets arguments parsed with ParseArgument. - ParseArgumentStatus InterpretArgument(const std::string& name, - const std::string& value); - - // Print the --help text to stderr. - void PrintHelpText(); - - // Loads proto_path_ into the provided source_tree. - bool InitializeDiskSourceTree(DiskSourceTree* source_tree, - DescriptorDatabase* fallback_database); - - // Verify that all the input files exist in the given database. - bool VerifyInputFilesInDescriptors(DescriptorDatabase* fallback_database); - - // Parses input_files_ into parsed_files - bool ParseInputFiles(DescriptorPool* descriptor_pool, - DiskSourceTree* source_tree, - std::vector* parsed_files); - - // Generate the given output file from the given input. - struct OutputDirective; // see below - bool GenerateOutput(const std::vector& parsed_files, - const OutputDirective& output_directive, - GeneratorContext* generator_context); - bool GeneratePluginOutput( - const std::vector& parsed_files, - const std::string& plugin_name, const std::string& parameter, - GeneratorContext* generator_context, std::string* error); - - // Implements --encode and --decode. - bool EncodeOrDecode(const DescriptorPool* pool); - - // Implements the --descriptor_set_out option. - bool WriteDescriptorSet( - const std::vector& parsed_files); - - // Implements the --dependency_out option - bool GenerateDependencyManifestFile( - const std::vector& parsed_files, - const GeneratorContextMap& output_directories, - DiskSourceTree* source_tree); - - // Get all transitive dependencies of the given file (including the file - // itself), adding them to the given list of FileDescriptorProtos. The - // protos will be ordered such that every file is listed before any file that - // depends on it, so that you can call DescriptorPool::BuildFile() on them - // in order. Any files in *already_seen will not be added, and each file - // added will be inserted into *already_seen. If include_source_code_info is - // true then include the source code information in the FileDescriptorProtos. - // If include_json_name is true, populate the json_name field of - // FieldDescriptorProto for all fields. - static void GetTransitiveDependencies( - const FileDescriptor* file, bool include_json_name, - bool include_source_code_info, - std::set* already_seen, - RepeatedPtrField* output); - - // Implements the --print_free_field_numbers. This function prints free field - // numbers into stdout for the message and it's nested message types in - // post-order, i.e. nested types first. Printed range are left-right - // inclusive, i.e. [a, b]. - // - // Groups: - // For historical reasons, groups are considered to share the same - // field number space with the parent message, thus it will not print free - // field numbers for groups. The field numbers used in the groups are - // excluded in the free field numbers of the parent message. - // - // Extension Ranges: - // Extension ranges are considered ocuppied field numbers and they will not be - // listed as free numbers in the output. - void PrintFreeFieldNumbers(const Descriptor* descriptor); - - // ----------------------------------------------------------------- - - // The name of the executable as invoked (i.e. argv[0]). - std::string executable_name_; - - // Version info set with SetVersionInfo(). - std::string version_info_; - - // Registered generators. - struct GeneratorInfo { - std::string flag_name; - std::string option_flag_name; - CodeGenerator* generator; - std::string help_text; - }; - typedef std::map GeneratorMap; - GeneratorMap generators_by_flag_name_; - GeneratorMap generators_by_option_name_; - // A map from generator names to the parameters specified using the option - // flag. For example, if the user invokes the compiler with: - // protoc --foo_out=outputdir --foo_opt=enable_bar ... - // Then there will be an entry ("--foo_out", "enable_bar") in this map. - std::map generator_parameters_; - // Similar to generator_parameters_, but stores the parameters for plugins. - std::map plugin_parameters_; - - // See AllowPlugins(). If this is empty, plugins aren't allowed. - std::string plugin_prefix_; - - // Maps specific plugin names to files. When executing a plugin, this map - // is searched first to find the plugin executable. If not found here, the - // PATH (or other OS-specific search strategy) is searched. - std::map plugins_; - - // Stuff parsed from command line. - enum Mode { - MODE_COMPILE, // Normal mode: parse .proto files and compile them. - MODE_ENCODE, // --encode: read text from stdin, write binary to stdout. - MODE_DECODE, // --decode: read binary from stdin, write text to stdout. - MODE_PRINT, // Print mode: print info of the given .proto files and exit. - }; - - Mode mode_ = MODE_COMPILE; - - enum PrintMode { - PRINT_NONE, // Not in MODE_PRINT - PRINT_FREE_FIELDS, // --print_free_fields - }; - - 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_ = 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. - std::vector input_files_; // Names of the input proto files. - - // 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_ = 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. - std::string direct_dependencies_violation_msg_; - - // output_directives_ lists all the files we are supposed to output and what - // generator to use for each. - struct OutputDirective { - std::string name; // E.g. "--foo_out" - CodeGenerator* generator; // NULL for plugins - std::string parameter; - std::string output_location; - }; - std::vector output_directives_; - - // When using --encode or --decode, this names the type we are encoding or - // decoding. (Empty string indicates --decode_raw.) - std::string codec_type_; - - // If --descriptor_set_in was given, these are filenames containing - // parsed FileDescriptorSets to be used for loading protos. Otherwise, empty. - std::vector descriptor_set_in_names_; - - // If --descriptor_set_out was given, this is the filename to which the - // FileDescriptorSet should be written. Otherwise, empty. - std::string descriptor_set_out_name_; - - // If --dependency_out was given, this is the path to the file where the - // dependency file will be written. Otherwise, empty. - std::string dependency_out_name_; - - // True if --include_imports was given, meaning that we should - // write all transitive dependencies to the DescriptorSet. Otherwise, only - // the .proto files listed on the command-line are added. - bool imports_in_descriptor_set_; - - // True if --include_source_info was given, meaning that we should not strip - // SourceCodeInfo from the DescriptorSet. - bool source_info_in_descriptor_set_ = false; - - // Was the --disallow_services flag used? - bool disallow_services_ = false; - - // When using --encode, this will be passed to SetSerializationDeterministic. - bool deterministic_output_ = false; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CommandLineInterface); -}; - -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h b/depends/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h deleted file mode 100644 index 1716ab20d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_CPP_GENERATOR_H_ -#define GOOGLE_PROTOBUF_COMPILER_CPP_CPP_GENERATOR_H_ - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_CPP_GENERATOR_H_ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/enum.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/enum.cc deleted file mode 100644 index 8124369c2..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/enum.cc +++ /dev/null @@ -1,438 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { -// The GOOGLE_ARRAYSIZE constant is the max enum value plus 1. If the max enum value -// 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_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 != std::numeric_limits::max(); -} - -// Returns the number of unique numeric enum values. This is less than -// descriptor->value_count() when there are aliased values. -int CountUniqueValues(const EnumDescriptor* descriptor) { - std::set values; - for (int i = 0; i < descriptor->value_count(); ++i) { - values.insert(descriptor->value(i)->number()); - } - return values.size(); -} - -} // namespace - -EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, - const std::map& vars, - const Options& options) - : descriptor_(descriptor), - classname_(ClassName(descriptor, false)), - options_(options), - generate_array_size_(ShouldGenerateArraySize(descriptor)), - variables_(vars) { - variables_["classname"] = classname_; - variables_["classtype"] = QualifiedClassName(descriptor_, options); - variables_["short_name"] = descriptor_->name(); - variables_["nested_name"] = descriptor_->name(); - variables_["resolved_name"] = ResolveKeyword(descriptor_->name()); - variables_["prefix"] = - (descriptor_->containing_type() == nullptr) ? "" : classname_ + "_"; -} - -EnumGenerator::~EnumGenerator() {} - -void EnumGenerator::GenerateDefinition(io::Printer* printer) { - Formatter format(printer, variables_); - format("enum ${1$$classname$$}$ : int {\n", descriptor_); - format.Indent(); - - const EnumValueDescriptor* min_value = descriptor_->value(0); - const EnumValueDescriptor* max_value = descriptor_->value(0); - - for (int i = 0; i < descriptor_->value_count(); i++) { - auto format_value = format; - format_value.Set("name", EnumValueName(descriptor_->value(i))); - // In C++, an value of -2147483648 gets interpreted as the negative of - // 2147483648, and since 2147483648 can't fit in an integer, this produces a - // compiler warning. This works around that issue. - format_value.Set("number", Int32ToString(descriptor_->value(i)->number())); - format_value.Set("deprecation", - DeprecatedAttribute(options_, descriptor_->value(i))); - - if (i > 0) format_value(",\n"); - format_value("${1$$prefix$$name$$}$ $deprecation$= $number$", - descriptor_->value(i)); - - if (descriptor_->value(i)->number() < min_value->number()) { - min_value = descriptor_->value(i); - } - if (descriptor_->value(i)->number() > max_value->number()) { - max_value = descriptor_->value(i); - } - } - - if (descriptor_->file()->syntax() == FileDescriptor::SYNTAX_PROTO3) { - // For new enum semantics: generate min and max sentinel values equal to - // INT32_MIN and INT32_MAX - if (descriptor_->value_count() > 0) format(",\n"); - format( - "$classname$_$prefix$INT_MIN_SENTINEL_DO_NOT_USE_ = " - "std::numeric_limits<$int32$>::min(),\n" - "$classname$_$prefix$INT_MAX_SENTINEL_DO_NOT_USE_ = " - "std::numeric_limits<$int32$>::max()"); - } - - format.Outdent(); - format("\n};\n"); - - format( - "$dllexport_decl $bool $classname$_IsValid(int value);\n" - "constexpr $classname$ ${1$$prefix$$short_name$_MIN$}$ = " - "$prefix$$2$;\n" - "constexpr $classname$ ${1$$prefix$$short_name$_MAX$}$ = " - "$prefix$$3$;\n", - descriptor_, EnumValueName(min_value), EnumValueName(max_value)); - - if (generate_array_size_) { - format( - "constexpr int ${1$$prefix$$short_name$_ARRAYSIZE$}$ = " - "$prefix$$short_name$_MAX + 1;\n\n", - descriptor_); - } - - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "$dllexport_decl $const ::$proto_ns$::EnumDescriptor* " - "$classname$_descriptor();\n"); - } - - // The _Name and _Parse functions. The lite implementation is table-based, so - // we make sure to keep the tables hidden in the .cc file. - if (!HasDescriptorMethods(descriptor_->file(), options_)) { - format("const std::string& $classname$_Name($classname$ value);\n"); - } - // The _Name() function accepts the enum type itself but also any integral - // type. - format( - "template\n" - "inline const std::string& $classname$_Name(T enum_t_value) {\n" - " static_assert(::std::is_same::value ||\n" - " ::std::is_integral::value,\n" - " \"Incorrect type passed to function $classname$_Name.\");\n"); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - " return ::$proto_ns$::internal::NameOfEnum(\n" - " $classname$_descriptor(), enum_t_value);\n"); - } else { - format( - " return $classname$_Name(static_cast<$classname$>(enum_t_value));\n"); - } - format("}\n"); - - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "inline bool $classname$_Parse(\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" - " ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, $classname$* " - "value);\n"); - } -} - -void EnumGenerator::GenerateGetEnumDescriptorSpecializations( - io::Printer* printer) { - Formatter format(printer, variables_); - format( - "template <> struct is_proto_enum< $classtype$> : ::std::true_type " - "{};\n"); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "template <>\n" - "inline const EnumDescriptor* GetEnumDescriptor< $classtype$>() {\n" - " return $classtype$_descriptor();\n" - "}\n"); - } -} - -void EnumGenerator::GenerateSymbolImports(io::Printer* printer) const { - Formatter format(printer, variables_); - format("typedef $classname$ $resolved_name$;\n"); - - for (int j = 0; j < descriptor_->value_count(); j++) { - std::string deprecated_attr = - DeprecatedAttribute(options_, descriptor_->value(j)); - format( - "$1$static constexpr $resolved_name$ ${2$$3$$}$ =\n" - " $classname$_$3$;\n", - deprecated_attr, descriptor_->value(j), - EnumValueName(descriptor_->value(j))); - } - - format( - "static inline bool $nested_name$_IsValid(int value) {\n" - " return $classname$_IsValid(value);\n" - "}\n" - "static constexpr $resolved_name$ ${1$$nested_name$_MIN$}$ =\n" - " $classname$_$nested_name$_MIN;\n" - "static constexpr $resolved_name$ ${1$$nested_name$_MAX$}$ =\n" - " $classname$_$nested_name$_MAX;\n", - descriptor_); - if (generate_array_size_) { - format( - "static constexpr int ${1$$nested_name$_ARRAYSIZE$}$ =\n" - " $classname$_$nested_name$_ARRAYSIZE;\n", - descriptor_); - } - - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "static inline const ::$proto_ns$::EnumDescriptor*\n" - "$nested_name$_descriptor() {\n" - " return $classname$_descriptor();\n" - "}\n"); - } - - format( - "template\n" - "static inline const std::string& $nested_name$_Name(T enum_t_value) {\n" - " static_assert(::std::is_same::value ||\n" - " ::std::is_integral::value,\n" - " \"Incorrect type passed to function $nested_name$_Name.\");\n" - " return $classname$_Name(enum_t_value);\n" - "}\n"); - format( - "static inline bool " - "$nested_name$_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,\n" - " $resolved_name$* value) {\n" - " return $classname$_Parse(name, value);\n" - "}\n"); -} - -void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { - Formatter format(printer, variables_); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "const ::$proto_ns$::EnumDescriptor* $classname$_descriptor() {\n" - " ::$proto_ns$::internal::AssignDescriptors(&$desc_table$);\n" - " return $file_level_enum_descriptors$[$1$];\n" - "}\n", - idx); - } - - format( - "bool $classname$_IsValid(int value) {\n" - " switch (value) {\n"); - - // Multiple values may have the same number. Make sure we only cover - // each number once by first constructing a set containing all valid - // numbers, then printing a case statement for each element. - - std::set numbers; - for (int j = 0; j < descriptor_->value_count(); j++) { - const EnumValueDescriptor* value = descriptor_->value(j); - numbers.insert(value->number()); - } - - for (std::set::iterator iter = numbers.begin(); iter != numbers.end(); - ++iter) { - format(" case $1$:\n", Int32ToString(*iter)); - } - - format( - " return true;\n" - " default:\n" - " return false;\n" - " }\n" - "}\n" - "\n"); - - if (!HasDescriptorMethods(descriptor_->file(), options_)) { - // In lite mode (where descriptors are unavailable), we generate separate - // tables for mapping between enum names and numbers. The _entries table - // contains the bulk of the data and is sorted by name, while - // _entries_by_number is sorted by number and just contains pointers into - // _entries. The two tables allow mapping from name to number and number to - // name, both in time logarithmic in the number of enum entries. This could - // probably be made faster, but for now the tables are intended to be simple - // and compact. - // - // Enums with allow_alias = true support multiple entries with the same - // numerical value. In cases where there are multiple names for the same - // number, we treat the first name appearing in the .proto file as the - // canonical one. - std::map name_to_number; - std::map number_to_canonical_name; - for (int i = 0; i < descriptor_->value_count(); i++) { - const EnumValueDescriptor* value = descriptor_->value(i); - name_to_number.emplace(value->name(), value->number()); - // The same number may appear with multiple names, so we use emplace() to - // let the first name win. - number_to_canonical_name.emplace(value->number(), value->name()); - } - - format( - "static ::$proto_ns$::internal::ExplicitlyConstructed " - "$classname$_strings[$1$] = {};\n\n", - CountUniqueValues(descriptor_)); - - // We concatenate all the names for a given enum into one big string - // literal. If instead we store an array of string literals, the linker - // seems to put all enum strings for a given .proto file in the same - // section, which hinders its ability to strip out unused strings. - format("static const char $classname$_names[] ="); - for (const auto& p : name_to_number) { - format("\n \"$1$\"", p.first); - } - format(";\n\n"); - - format( - "static const ::$proto_ns$::internal::EnumEntry $classname$_entries[] " - "= {\n"); - int i = 0; - std::map number_to_index; - int data_index = 0; - for (const auto& p : name_to_number) { - format(" { {$classname$_names + $1$, $2$}, $3$ },\n", data_index, - p.first.size(), p.second); - if (number_to_canonical_name[p.second] == p.first) { - number_to_index.emplace(p.second, i); - } - ++i; - data_index += p.first.size(); - } - - format( - "};\n" - "\n" - "static const int $classname$_entries_by_number[] = {\n"); - for (const auto& p : number_to_index) { - format(" $1$, // $2$ -> $3$\n", p.second, p.first, - number_to_canonical_name[p.first]); - } - format( - "};\n" - "\n"); - - format( - "const std::string& $classname$_Name(\n" - " $classname$ value) {\n" - " static const bool dummy =\n" - " ::$proto_ns$::internal::InitializeEnumStrings(\n" - " $classname$_entries,\n" - " $classname$_entries_by_number,\n" - " $1$, $classname$_strings);\n" - " (void) dummy;\n" - " int idx = ::$proto_ns$::internal::LookUpEnumName(\n" - " $classname$_entries,\n" - " $classname$_entries_by_number,\n" - " $1$, value);\n" - " return idx == -1 ? ::$proto_ns$::internal::GetEmptyString() :\n" - " $classname$_strings[idx].get();\n" - "}\n", - CountUniqueValues(descriptor_)); - format( - "bool $classname$_Parse(\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" - " if (success) {\n" - " *value = static_cast<$classname$>(int_value);\n" - " }\n" - " return success;\n" - "}\n", - descriptor_->value_count()); - } - - if (descriptor_->containing_type() != nullptr) { - 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 MSVC++ pre-2015 and post-2017 (version 15.5+) insists that we not. - format( - "#if (__cplusplus < 201703) && " - "(!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, - EnumValueName(descriptor_->value(i))); - } - format( - "constexpr $classname$ $1$::$nested_name$_MIN;\n" - "constexpr $classname$ $1$::$nested_name$_MAX;\n", - parent); - if (generate_array_size_) { - format("constexpr int $1$::$nested_name$_ARRAYSIZE;\n", parent); - } - - format( - "#endif // (__cplusplus < 201703) && " - "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n"); - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/enum_field.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/enum_field.cc deleted file mode 100644 index 8ffb699e8..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/enum_field.cc +++ /dev/null @@ -1,451 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { - -void SetEnumVariables(const FieldDescriptor* descriptor, - std::map* variables, - const Options& options) { - SetCommonFieldVariables(descriptor, variables, options); - const EnumValueDescriptor* default_value = descriptor->default_value_enum(); - (*variables)["type"] = QualifiedClassName(descriptor->enum_type(), options); - (*variables)["default"] = Int32ToString(default_value->number()); - (*variables)["full_name"] = descriptor->full_name(); - (*variables)["cached_byte_size_name"] = MakeVarintCachedSizeName(descriptor); - bool cold = ShouldSplit(descriptor, options); - (*variables)["cached_byte_size_field"] = - MakeVarintCachedSizeFieldName(descriptor, cold); -} - -} // namespace - -// =================================================================== - -EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : FieldGenerator(descriptor, options) { - SetEnumVariables(descriptor, &variables_, options); -} - -EnumFieldGenerator::~EnumFieldGenerator() {} - -void EnumFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { - Formatter format(printer, variables_); - format("int $name$_;\n"); -} - -void EnumFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "$deprecated_attr$$type$ ${1$$name$$}$() const;\n" - "$deprecated_attr$void ${1$set_$name$$}$($type$ value);\n" - "private:\n" - "$type$ ${1$_internal_$name$$}$() const;\n" - "void ${1$_internal_set_$name$$}$($type$ value);\n" - "public:\n", - descriptor_); -} - -void EnumFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$ $classname$::_internal_$name$() const {\n" - " return static_cast< $type$ >($field$);\n" - "}\n" - "inline $type$ $classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline void $classname$::_internal_set_$name$($type$ value) {\n"); - if (!HasPreservingUnknownEnumSemantics(descriptor_)) { - format(" assert($type$_IsValid(value));\n"); - } - format( - " $set_hasbit$\n" - " $field$ = value;\n" - "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - "$maybe_prepare_split_message$" - " _internal_set_$name$(value);\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n"); -} - -void EnumFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$ = $default$;\n"); -} - -void EnumFieldGenerator::GenerateMergingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->_internal_set_$name$(from._internal_$name$());\n"); -} - -void EnumFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("swap($field$, other->$field$);\n"); -} - -void EnumFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->$field$ = from.$field$;\n"); -} - -void EnumFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "target = stream->EnsureSpace(target);\n" - "target = ::_pbi::WireFormatLite::WriteEnumToArray(\n" - " $number$, this->_internal_$name$(), target);\n"); -} - -void EnumFieldGenerator::GenerateByteSize(io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "total_size += $tag_size$ +\n" - " ::_pbi::WireFormatLite::EnumSize(this->_internal_$name$());\n"); -} - -void EnumFieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("/*decltype($field$)*/$default$"); -} - -void EnumFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - format("decltype(Impl_::Split::$name$_){$default$}"); - return; - } - format("decltype($field$){$default$}"); -} - -void EnumFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){}"); -} - -// =================================================================== - -EnumOneofFieldGenerator::EnumOneofFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : EnumFieldGenerator(descriptor, options) { - SetCommonOneofFieldVariables(descriptor, &variables_); -} - -EnumOneofFieldGenerator::~EnumOneofFieldGenerator() {} - -void EnumOneofFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$ $classname$::_internal_$name$() const {\n" - " if (_internal_has_$name$()) {\n" - " return static_cast< $type$ >($field$);\n" - " }\n" - " return static_cast< $type$ >($default$);\n" - "}\n" - "inline $type$ $classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline void $classname$::_internal_set_$name$($type$ value) {\n"); - if (!HasPreservingUnknownEnumSemantics(descriptor_)) { - format(" assert($type$_IsValid(value));\n"); - } - format( - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " }\n" - " $field$ = value;\n" - "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - " _internal_set_$name$(value);\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n"); -} - -void EnumOneofFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$ = $default$;\n"); -} - -void EnumOneofFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { - // Don't print any swapping code. Swapping the union will swap this field. -} - -void EnumOneofFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$ns$::_$classname$_default_instance_.$field$ = $default$;\n"); -} - -// =================================================================== - -RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : FieldGenerator(descriptor, options) { - SetEnumVariables(descriptor, &variables_, options); -} - -RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() {} - -void RepeatedEnumFieldGenerator::GeneratePrivateMembers( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("::$proto_ns$::RepeatedField $name$_;\n"); - if (descriptor_->is_packed() && - HasGeneratedMethods(descriptor_->file(), options_)) { - format("mutable std::atomic $cached_byte_size_name$;\n"); - } -} - -void RepeatedEnumFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "private:\n" - "$type$ ${1$_internal_$name$$}$(int index) const;\n" - "void ${1$_internal_add_$name$$}$($type$ value);\n" - "::$proto_ns$::RepeatedField* " - "${1$_internal_mutable_$name$$}$();\n" - "public:\n" - "$deprecated_attr$$type$ ${1$$name$$}$(int index) const;\n" - "$deprecated_attr$void ${1$set_$name$$}$(int index, $type$ value);\n" - "$deprecated_attr$void ${1$add_$name$$}$($type$ value);\n" - "$deprecated_attr$const ::$proto_ns$::RepeatedField& " - "${1$$name$$}$() const;\n" - "$deprecated_attr$::$proto_ns$::RepeatedField* " - "${1$mutable_$name$$}$();\n", - descriptor_); -} - -void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$ $classname$::_internal_$name$(int index) const {\n" - " return static_cast< $type$ >($field$.Get(index));\n" - "}\n" - "inline $type$ $classname$::$name$(int index) const {\n" - "$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"); - if (!HasPreservingUnknownEnumSemantics(descriptor_)) { - format(" assert($type$_IsValid(value));\n"); - } - format( - " $field$.Set(index, value);\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n" - "inline void $classname$::_internal_add_$name$($type$ value) {\n"); - if (!HasPreservingUnknownEnumSemantics(descriptor_)) { - format(" assert($type$_IsValid(value));\n"); - } - format( - " $field$.Add(value);\n" - "}\n" - "inline void $classname$::add_$name$($type$ value) {\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_list$" - " // @@protoc_insertion_point(field_list:$full_name$)\n" - " return $field$;\n" - "}\n" - "inline ::$proto_ns$::RepeatedField*\n" - "$classname$::_internal_mutable_$name$() {\n" - " return &$field$;\n" - "}\n" - "inline ::$proto_ns$::RepeatedField*\n" - "$classname$::mutable_$name$() {\n" - "$annotate_mutable_list$" - " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - " return _internal_mutable_$name$();\n" - "}\n"); -} - -void RepeatedEnumFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.Clear();\n"); -} - -void RepeatedEnumFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->$field$.MergeFrom(from.$field$);\n"); -} - -void RepeatedEnumFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.InternalSwap(&other->$field$);\n"); -} - -void RepeatedEnumFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - // Not needed for repeated fields. -} - -void RepeatedEnumFieldGenerator::GenerateDestructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.~RepeatedField();\n"); -} - -void RepeatedEnumFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (descriptor_->is_packed()) { - // Write the tag and the size. - format( - "{\n" - " int byte_size = " - "$cached_byte_size_field$.load(std::memory_order_relaxed);\n" - " if (byte_size > 0) {\n" - " target = stream->WriteEnumPacked(\n" - " $number$, $field$, byte_size, target);\n" - " }\n" - "}\n"); - } else { - format( - "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" - " target = stream->EnsureSpace(target);\n" - " target = ::_pbi::WireFormatLite::WriteEnumToArray(\n" - " $number$, this->_internal_$name$(i), target);\n" - "}\n"); - } -} - -void RepeatedEnumFieldGenerator::GenerateByteSize(io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "{\n" - " size_t data_size = 0;\n" - " unsigned int count = static_cast(this->_internal_$name$_size());"); - format.Indent(); - format( - "for (unsigned int i = 0; i < count; i++) {\n" - " data_size += ::_pbi::WireFormatLite::EnumSize(\n" - " this->_internal_$name$(static_cast(i)));\n" - "}\n"); - - if (descriptor_->is_packed()) { - format( - "if (data_size > 0) {\n" - " total_size += $tag_size$ +\n" - " " - "::_pbi::WireFormatLite::Int32Size(static_cast<$int32$>(data_size));\n" - "}\n" - "int cached_size = ::_pbi::ToCachedSize(data_size);\n" - "$cached_byte_size_field$.store(cached_size,\n" - " std::memory_order_relaxed);\n" - "total_size += data_size;\n"); - } else { - format("total_size += ($tag_size$UL * count) + data_size;\n"); - } - format.Outdent(); - format("}\n"); -} - -void RepeatedEnumFieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("/*decltype($field$)*/{}"); - if (descriptor_->is_packed() && - HasGeneratedMethods(descriptor_->file(), options_)) { - format("\n, /*decltype($cached_byte_size_field$)*/{0}"); - } -} - -void RepeatedEnumFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){arena}"); - if (descriptor_->is_packed() && - HasGeneratedMethods(descriptor_->file(), options_)) { - // std::atomic has no copy constructor, which prevents explicit aggregate - // initialization pre-C++17. - format("\n, /*decltype($cached_byte_size_field$)*/{0}"); - } -} - -void RepeatedEnumFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){from.$field$}"); - if (descriptor_->is_packed() && - HasGeneratedMethods(descriptor_->file(), options_)) { - // std::atomic has no copy constructor. - format("\n, /*decltype($cached_byte_size_field$)*/{0}"); - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/enum_field.h b/depends/protobuf/src/google/protobuf/compiler/cpp/enum_field.h deleted file mode 100644 index 61bae855c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/enum_field.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. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class EnumFieldGenerator : public FieldGenerator { - public: - EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); - ~EnumFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); -}; - -class EnumOneofFieldGenerator : public EnumFieldGenerator { - public: - EnumOneofFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~EnumOneofFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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); -}; - -class RepeatedEnumFieldGenerator : public FieldGenerator { - public: - RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~RepeatedEnumFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 { - GOOGLE_CHECK(!ShouldSplit(descriptor_, options_)); - } - void GenerateDestructorCode(io::Printer* printer) const override; - void GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const override; - void GenerateByteSize(io::Printer* printer) const override; - void GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/extension.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/extension.cc deleted file mode 100644 index 950ed9e70..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/extension.cc +++ /dev/null @@ -1,193 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) - : descriptor_(descriptor), options_(options), scc_analyzer_(scc_analyzer) { - // Construct type_traits_. - if (descriptor_->is_repeated()) { - type_traits_ = "Repeated"; - } - - switch (descriptor_->cpp_type()) { - case FieldDescriptor::CPPTYPE_ENUM: - type_traits_.append("EnumTypeTraits< "); - type_traits_.append(ClassName(descriptor_->enum_type(), true)); - type_traits_.append(", "); - type_traits_.append(ClassName(descriptor_->enum_type(), true)); - type_traits_.append("_IsValid>"); - break; - case FieldDescriptor::CPPTYPE_STRING: - type_traits_.append("StringTypeTraits"); - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - type_traits_.append("MessageTypeTraits< "); - type_traits_.append(ClassName(descriptor_->message_type(), true)); - type_traits_.append(" >"); - break; - default: - type_traits_.append("PrimitiveTypeTraits< "); - type_traits_.append(PrimitiveTypeName(options_, descriptor_->cpp_type())); - type_traits_.append(" >"); - break; - } - SetCommonVars(options, &variables_); - SetCommonMessageDataVariables(descriptor_->containing_type(), &variables_); - 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_->is_packed() ? "true" : "false"; - - std::string scope = - IsScoped() ? ClassName(descriptor_->extension_scope(), false) + "::" : ""; - variables_["scope"] = scope; - variables_["scoped_name"] = ExtensionName(descriptor_); - variables_["number"] = StrCat(descriptor_->number()); - - bool add_verify_fn = - // Only verify msgs. - descriptor_->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - // Options say to verify. - ShouldVerify(descriptor_->message_type(), options_, scc_analyzer_) && - ShouldVerify(descriptor_->containing_type(), options_, scc_analyzer_); - - variables_["verify_fn"] = - add_verify_fn - ? StrCat("&", FieldMessageTypeName(descriptor_, options_), - "::InternalVerify") - : "nullptr"; -} - -ExtensionGenerator::~ExtensionGenerator() {} - -bool ExtensionGenerator::IsScoped() const { - return descriptor_->extension_scope() != nullptr; -} - -void ExtensionGenerator::GenerateDeclaration(io::Printer* printer) const { - Formatter format(printer, variables_); - - // If this is a class member, it needs to be declared "static". Otherwise, - // it needs to be "extern". In the latter case, it also needs the DLL - // export/import specifier. - std::string qualifier; - if (!IsScoped()) { - qualifier = "extern"; - if (!options_.dllexport_decl.empty()) { - qualifier = options_.dllexport_decl + " " + qualifier; - } - } else { - qualifier = "static"; - } - - format( - "static const int $constant_name$ = $number$;\n" - "$1$ ::$proto_ns$::internal::ExtensionIdentifier< $extendee$,\n" - " ::$proto_ns$::internal::$type_traits$, $field_type$, $packed$ >\n" - " ${2$$name$$}$;\n", - qualifier, descriptor_); -} - -void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { - // If we are building for lite with implicit weak fields, we want to skip over - // any custom options (i.e. extensions of messages from descriptor.proto). - // This prevents the creation of any unnecessary linker references to the - // descriptor messages. - if (options_.lite_implicit_weak_fields && - descriptor_->containing_type()->file()->name() == - "net/proto2/proto/descriptor.proto") { - return; - } - - Formatter format(printer, variables_); - std::string default_str; - // If this is a class member, it needs to be declared in its class scope. - if (descriptor_->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { - // We need to declare a global string which will contain the default value. - // We cannot declare it at class scope because that would require exposing - // it in the header which would be annoying for other reasons. So we - // replace :: with _ in the name and declare it as a global. - default_str = - 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_); - } - - // Likewise, class members need to declare the field constant variable. - if (IsScoped()) { - format( - "#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)\n" - "const int $scope$$constant_name$;\n" - "#endif\n"); - } - - format( - "PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 " - "::$proto_ns$::internal::ExtensionIdentifier< $extendee$,\n" - " ::$proto_ns$::internal::$type_traits$, $field_type$, $packed$>\n" - " $scoped_name$($constant_name$, $1$, $verify_fn$);\n", - default_str); -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/field.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/field.cc deleted file mode 100644 index 90d20848b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/field.cc +++ /dev/null @@ -1,421 +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 - -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.UnsafeGetPointer()" - : "$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, MakeDefaultFieldName(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() ? &$1.get() : $0.UnsafeGetPointer()", field_member, - MakeDefaultFieldName(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"]; - const google::protobuf::OneofDescriptor* oneof_member = - descriptor->real_containing_oneof(); - const std::string proto_ns = (*variables)["proto_ns"]; - const std::string substitute_template_prefix = - StrCat(" ", (*variables)["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 && - !IsExplicitLazy(descriptor)) { - 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); - SetCommonMessageDataVariables(descriptor->containing_type(), 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()); - bool split = ShouldSplit(descriptor, options); - (*variables)["field"] = FieldMemberName(descriptor, split); - - (*variables)["tag_size"] = StrCat( - WireFormat::TagSize(descriptor->number(), descriptor->type())); - (*variables)["deprecated_attr"] = DeprecatedAttribute(options, descriptor); - - (*variables)["set_hasbit"] = ""; - (*variables)["clear_hasbit"] = ""; - (*variables)["maybe_prepare_split_message"] = - split ? " PrepareSplitMessageForWrite();\n" : ""; - - 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( - variables_["has_bits"], "[", has_bit_index / 32, "] |= 0x", - strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8), "u;"); - variables_["clear_hasbit"] = StrCat( - variables_["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; - } - // The first bit is the tracking bit for on demand registering ArenaDtor. - GOOGLE_CHECK_GT(inlined_string_index, 0) - << "_inlined_string_donated_'s bit 0 is reserved for arena dtor tracking"; - variables_["inlined_string_donated"] = StrCat( - "(", variables_["inlined_string_donated_array"], "[", - inlined_string_index / 32, "] & 0x", - strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8), - "u) != 0;"); - variables_["donating_states_word"] = - StrCat(variables_["inlined_string_donated_array"], "[", - inlined_string_index / 32, "]"); - variables_["mask_for_undonate"] = StrCat( - "~0x", strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8), - "u"); -} - -void FieldGenerator::GenerateAggregateInitializer(io::Printer* printer) const { - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - format("decltype(Impl_::Split::$name$_){arena}"); - return; - } - format("decltype($field$){arena}"); -} - -void FieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("/*decltype($field$)*/{}"); -} - -void FieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){from.$field$}"); -} - -void FieldGenerator::GenerateCopyConstructorCode(io::Printer* printer) const { - if (ShouldSplit(descriptor_, options_)) { - // There is no copy constructor for the `Split` struct, so we need to copy - // the value here. - Formatter format(printer, variables_); - format("$field$ = from.$field$;\n"); - } -} - -void SetCommonOneofFieldVariables( - const FieldDescriptor* descriptor, - std::map* variables) { - const std::string prefix = descriptor->containing_oneof()->name() + "_."; - (*variables)["oneof_name"] = descriptor->containing_oneof()->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/depends/protobuf/src/google/protobuf/compiler/cpp/field.h b/depends/protobuf/src/google/protobuf/compiler/cpp/field.h deleted file mode 100644 index dd2a51a2f..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/field.h +++ /dev/null @@ -1,270 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ - -#include -#include -#include -#include - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -// Helper function: set variables in the map that are the same for all -// field code generators. -// ['name', 'index', 'number', 'classname', 'declared_type', 'tag_size', -// 'deprecation']. -void SetCommonFieldVariables(const FieldDescriptor* descriptor, - std::map* variables, - const Options& options); - -void SetCommonOneofFieldVariables( - const FieldDescriptor* descriptor, - std::map* variables); - -class FieldGenerator { - public: - explicit FieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : descriptor_(descriptor), options_(options) {} - virtual ~FieldGenerator(); - virtual void GenerateSerializeWithCachedSizes( - io::Printer* printer) const final{}; - // Generate lines of code declaring members fields of the message class - // needed to represent this field. These are placed inside the message - // class. - virtual void GeneratePrivateMembers(io::Printer* printer) const = 0; - - // Generate static default variable for this field. These are placed inside - // the message class. Most field types don't need this, so the default - // implementation is empty. - virtual void GenerateStaticMembers(io::Printer* /*printer*/) const {} - - // Generate prototypes for all of the accessor functions related to this - // field. These are placed inside the class definition. - virtual void GenerateAccessorDeclarations(io::Printer* printer) const = 0; - - // Generate inline definitions of accessor functions for this field. - // These are placed inside the header after all class definitions. - virtual void GenerateInlineAccessorDefinitions( - io::Printer* printer) const = 0; - - // Generate definitions of accessors that aren't inlined. These are - // placed somewhere in the .cc file. - // Most field types don't need this, so the default implementation is empty. - virtual void GenerateNonInlineAccessorDefinitions( - io::Printer* /*printer*/) const {} - - // Generate declarations of accessors that are for internal purposes only. - // Most field types don't need this, so the default implementation is empty. - virtual void GenerateInternalAccessorDefinitions( - io::Printer* /*printer*/) const {} - - // Generate definitions of accessors that are for internal purposes only. - // Most field types don't need this, so the default implementation is empty. - virtual void GenerateInternalAccessorDeclarations( - io::Printer* /*printer*/) const {} - - // Generate lines of code (statements, not declarations) which clear the - // field. This is used to define the clear_$name$() method - virtual void GenerateClearingCode(io::Printer* printer) const = 0; - - // Generate lines of code (statements, not declarations) which clear the - // field as part of the Clear() method for the whole message. For message - // types which have field presence bits, MessageGenerator::GenerateClear - // will have already checked the presence bits. - // - // Since most field types can re-use GenerateClearingCode, this method is - // not pure virtual. - virtual void GenerateMessageClearingCode(io::Printer* printer) const { - GenerateClearingCode(printer); - } - - // Generate lines of code (statements, not declarations) which merges the - // contents of the field from the current message to the target message, - // which is stored in the generated code variable "from". - // This is used to fill in the MergeFrom method for the whole message. - // Details of this usage can be found in message.cc under the - // GenerateMergeFrom method. - virtual void GenerateMergingCode(io::Printer* printer) const = 0; - - // Generates a copy constructor - virtual void GenerateCopyConstructorCode(io::Printer* printer) const; - - // Generate lines of code (statements, not declarations) which swaps - // this field and the corresponding field of another message, which - // is stored in the generated code variable "other". This is used to - // define the Swap method. Details of usage can be found in - // message.cc under the GenerateSwap method. - virtual void GenerateSwappingCode(io::Printer* printer) const = 0; - - // Generate initialization code for private members declared by - // GeneratePrivateMembers(). These go into the message class's SharedCtor() - // method, invoked by each of the generated constructors. - virtual void GenerateConstructorCode(io::Printer* printer) const = 0; - - // Generate initialization code for private members in the cold struct. - virtual void GenerateCreateSplitMessageCode(io::Printer* printer) const {} - - // Generate any code that needs to go in the class's SharedDtor() method, - // invoked by the destructor. - // Most field types don't need this, so the default implementation is empty. - virtual void GenerateDestructorCode(io::Printer* /*printer*/) const {} - - // Generate a manual destructor invocation for use when the message is on an - // arena. The code that this method generates will be executed inside a - // shared-for-the-whole-message-class method registered with - // OwnDestructor(). - virtual void GenerateArenaDestructorCode(io::Printer* printer) const { - GOOGLE_CHECK(NeedsArenaDestructor() == ArenaDtorNeeds::kNone) - << descriptor_->cpp_type_name(); - } - - // Generate initialization code for private members declared by - // GeneratePrivateMembers(). These go into the SharedCtor's - // aggregate initialization of the _impl_ struct and must follow the syntax - // (e.g. `decltype($field$){$default$}`). Does not include `:` or `,` - // separators. Default values should be specified here when possible. - // - // Note: We use `decltype($field$)` for both explicit construction and the - // fact that it's self-documenting. Pre-C++17, copy elision isn't guaranteed - // in aggregate initialization so a valid copy/move constructor must exist - // (even though it's not used). Because of this, we need to comment out the - // decltype and fallback to implicit construction. - virtual void GenerateAggregateInitializer(io::Printer* printer) const; - - // Generate constinit initialization code for private members declared by - // GeneratePrivateMembers(). These go into the constexpr constructor's - // aggregate initialization of the _impl_ struct and must follow the syntax - // (e.g. `/*decltype($field$)*/{}`, see above). Does not - // include `:` or `,` separators. - virtual void GenerateConstexprAggregateInitializer( - io::Printer* printer) const; - - // Generate copy initialization code for private members declared by - // GeneratePrivateMembers(). These go into the copy constructor's - // aggregate initialization of the _impl_ struct and must follow the syntax - // (e.g. `decltype($field$){from.$field$}`, see above). Does not - // include `:` or `,` separators. - virtual void GenerateCopyAggregateInitializer(io::Printer* printer) const; - - // Generate lines to serialize this field directly to the array "target", - // which are placed within the message's SerializeWithCachedSizesToArray() - // method. This must also advance "target" past the written bytes. - virtual void GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const = 0; - - // Generate lines to compute the serialized size of this field, which - // are placed in the message's ByteSize() method. - virtual void GenerateByteSize(io::Printer* printer) const = 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; } - - virtual ArenaDtorNeeds NeedsArenaDestructor() const { - return ArenaDtorNeeds::kNone; - } - - void SetHasBitIndex(int32_t has_bit_index); - void SetInlinedStringIndex(int32_t inlined_string_index); - - protected: - const FieldDescriptor* descriptor_; - const Options& options_; - std::map variables_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); -}; - -// Convenience class which constructs FieldGenerators for a Descriptor. -class FieldGeneratorMap { - public: - FieldGeneratorMap(const Descriptor* descriptor, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - ~FieldGeneratorMap(); - - const FieldGenerator& get(const FieldDescriptor* field) const; - - void SetHasBitIndices(const std::vector& has_bit_indices_) { - for (int i = 0; i < descriptor_->field_count(); ++i) { - field_generators_[i]->SetHasBitIndex(has_bit_indices_[i]); - } - } - - 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_; - - static FieldGenerator* MakeGoogleInternalGenerator( - const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - static FieldGenerator* MakeGenerator(const FieldDescriptor* field, - const Options& options, - MessageSCCAnalyzer* scc_analyzer); - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/file.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/file.cc deleted file mode 100644 index 838e0ab9b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/file.cc +++ /dev/null @@ -1,1382 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { - -// When we forward-declare things, we want to create a sorted order so our -// output is deterministic and minimizes namespace changes. -template -std::string GetSortKey(const T& val) { - return val.full_name(); -} - -template <> -std::string GetSortKey(const FileDescriptor& val) { - return val.name(); -} - -template -bool CompareSortKeys(const T* a, const T* b) { - return GetSortKey(*a) < GetSortKey(*b); -} - -template -std::vector Sorted(const std::unordered_set& vals) { - std::vector sorted(vals.begin(), vals.end()); - std::sort(sorted.begin(), sorted.end(), CompareSortKeys); - return sorted; -} - -// TODO(b/203101078): remove pragmas that suppresses uninitialized warnings when -// clang bug is fixed. -inline void MuteWuninitialized(Formatter& format) { - format( - "#if defined(__llvm__)\n" - " #pragma clang diagnostic push\n" - " #pragma clang diagnostic ignored \"-Wuninitialized\"\n" - "#endif // __llvm__\n"); -} - -inline void UnmuteWuninitialized(Formatter& format) { - format( - "#if defined(__llvm__)\n" - " #pragma clang diagnostic pop\n" - "#endif // __llvm__\n"); -} - -} // namespace - -FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) - : file_(file), options_(options), scc_analyzer_(options) { - // These variables are the same on a file level - SetCommonVars(options, &variables_); - variables_["dllexport_decl"] = options.dllexport_decl; - variables_["tablename"] = UniqueName("TableStruct", file_, options_); - variables_["file_level_metadata"] = - UniqueName("file_level_metadata", file_, options_); - variables_["desc_table"] = DescriptorTableName(file_, options_); - variables_["file_level_enum_descriptors"] = - UniqueName("file_level_enum_descriptors", file_, options_); - variables_["file_level_service_descriptors"] = - UniqueName("file_level_service_descriptors", file_, options_); - variables_["filename"] = file_->name(); - variables_["package_ns"] = Namespace(file_, options); - - std::vector msgs = FlattenMessagesInFile(file); - for (int i = 0; i < msgs.size(); i++) { - // Deleted in destructor - MessageGenerator* msg_gen = - new MessageGenerator(msgs[i], variables_, i, options, &scc_analyzer_); - message_generators_.emplace_back(msg_gen); - msg_gen->AddGenerators(&enum_generators_, &extension_generators_); - } - - for (int i = 0; i < file->enum_type_count(); i++) { - enum_generators_.emplace_back( - new EnumGenerator(file->enum_type(i), variables_, options)); - } - - for (int i = 0; i < file->service_count(); i++) { - service_generators_.emplace_back( - new ServiceGenerator(file->service(i), variables_, options)); - } - if (HasGenericServices(file_, options_)) { - for (int i = 0; i < service_generators_.size(); i++) { - service_generators_[i]->index_in_metadata_ = i; - } - } - for (int i = 0; i < file->extension_count(); i++) { - extension_generators_.emplace_back( - 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)); - } -} - -FileGenerator::~FileGenerator() = default; - -void FileGenerator::GenerateMacroUndefs(io::Printer* printer) { - Formatter format(printer, variables_); - // Only do this for protobuf's own types. There are some google3 protos using - // macros as field names and the generated code compiles after the macro - // expansion. Undefing these macros actually breaks such code. - if (file_->name() != "net/proto2/compiler/proto/plugin.proto" && - file_->name() != "google/protobuf/compiler/plugin.proto") { - return; - } - std::vector names_to_undef; - std::vector fields; - ListAllFields(file_, &fields); - for (int i = 0; i < fields.size(); i++) { - const std::string& name = fields[i]->name(); - static const char* kMacroNames[] = {"major", "minor"}; - for (int j = 0; j < GOOGLE_ARRAYSIZE(kMacroNames); ++j) { - if (name == kMacroNames[j]) { - names_to_undef.push_back(name); - break; - } - } - } - for (int i = 0; i < names_to_undef.size(); ++i) { - format( - "#ifdef $1$\n" - "#undef $1$\n" - "#endif\n", - names_to_undef[i]); - } -} - -void FileGenerator::GenerateHeader(io::Printer* printer) { - Formatter format(printer, variables_); - - // port_def.inc must be included after all other includes. - IncludeFile("net/proto2/public/port_def.inc", printer); - format("#define $1$$ dllexport_decl$\n", FileDllExport(file_, options_)); - GenerateMacroUndefs(printer); - - // For Any support with lite protos, we need to friend AnyMetadata, so we - // forward-declare it here. - format( - "PROTOBUF_NAMESPACE_OPEN\n" - "namespace internal {\n" - "class AnyMetadata;\n" - "} // namespace internal\n" - "PROTOBUF_NAMESPACE_CLOSE\n"); - - GenerateGlobalStateFunctionDeclarations(printer); - - GenerateForwardDeclarations(printer); - - { - NamespaceOpener ns(Namespace(file_, options_), format); - - format("\n"); - - GenerateEnumDefinitions(printer); - - format(kThickSeparator); - format("\n"); - - GenerateMessageDefinitions(printer); - - format("\n"); - format(kThickSeparator); - format("\n"); - - GenerateServiceDefinitions(printer); - - GenerateExtensionIdentifiers(printer); - - format("\n"); - format(kThickSeparator); - format("\n"); - - GenerateInlineFunctionDefinitions(printer); - - format( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n" - "\n"); - } - - // We need to specialize some templates in the ::google::protobuf namespace: - GenerateProto2NamespaceEnumSpecializations(printer); - - format( - "\n" - "// @@protoc_insertion_point(global_scope)\n" - "\n"); - IncludeFile("net/proto2/public/port_undef.inc", printer); -} - -void FileGenerator::GenerateProtoHeader(io::Printer* printer, - const std::string& info_path) { - Formatter format(printer, variables_); - if (!options_.proto_h) { - return; - } - - GenerateTopHeaderGuard(printer, false); - - if (!options_.opensource_runtime) { - format( - "#ifdef SWIG\n" - "#error \"Do not SWIG-wrap protobufs.\"\n" - "#endif // SWIG\n" - "\n"); - } - - if (IsBootstrapProto(options_, file_)) { - format("// IWYU pragma: private, include \"$1$.proto.h\"\n\n", - StripProto(file_->name())); - } - - GenerateLibraryIncludes(printer); - - for (int i = 0; i < file_->public_dependency_count(); i++) { - const FileDescriptor* dep = file_->public_dependency(i); - format("#include \"$1$.proto.h\"\n", StripProto(dep->name())); - } - - format("// @@protoc_insertion_point(includes)\n"); - - GenerateMetadataPragma(printer, info_path); - - GenerateHeader(printer); - - GenerateBottomHeaderGuard(printer, false); -} - -void FileGenerator::GeneratePBHeader(io::Printer* printer, - const std::string& info_path) { - Formatter format(printer, variables_); - GenerateTopHeaderGuard(printer, true); - - if (options_.proto_h) { - std::string target_basename = StripProto(file_->name()); - if (!options_.opensource_runtime) { - GetBootstrapBasename(options_, target_basename, &target_basename); - } - format("#include \"$1$.proto.h\" // IWYU pragma: export\n", - target_basename); - } else { - GenerateLibraryIncludes(printer); - } - - if (options_.transitive_pb_h) { - GenerateDependencyIncludes(printer); - } - - // This is unfortunately necessary for some plugins. I don't see why we - // need two of the same insertion points. - // TODO(gerbens) remove this. - format("// @@protoc_insertion_point(includes)\n"); - - GenerateMetadataPragma(printer, info_path); - - if (!options_.proto_h) { - GenerateHeader(printer); - } else { - { - NamespaceOpener ns(Namespace(file_, options_), format); - format( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n"); - } - format( - "\n" - "// @@protoc_insertion_point(global_scope)\n" - "\n"); - } - - GenerateBottomHeaderGuard(printer, true); -} - -void FileGenerator::DoIncludeFile(const std::string& google3_name, - bool do_export, io::Printer* printer) { - Formatter format(printer, variables_); - const std::string prefix = "net/proto2/"; - GOOGLE_CHECK(google3_name.find(prefix) == 0) << google3_name; - - if (options_.opensource_runtime) { - std::string path = google3_name.substr(prefix.size()); - - path = StringReplace(path, "internal/", "", false); - path = StringReplace(path, "proto/", "", false); - path = StringReplace(path, "public/", "", false); - if (options_.runtime_include_base.empty()) { - format("#include ", path); - } else { - format("#include \"$1$google/protobuf/$2$\"", - options_.runtime_include_base, path); - } - } else { - std::string path = google3_name; - // The bootstrapped proto generated code needs to use the - // third_party/protobuf header paths to avoid circular dependencies. - if (options_.bootstrap) { - path = StringReplace(google3_name, "net/proto2/public", - "third_party/protobuf", false); - } - format("#include \"$1$\"", path); - } - - if (do_export) { - format(" // IWYU pragma: export"); - } - - format("\n"); -} - -std::string FileGenerator::CreateHeaderInclude(const std::string& basename, - const FileDescriptor* file) { - bool use_system_include = false; - std::string name = basename; - - if (options_.opensource_runtime) { - if (IsWellKnownMessage(file)) { - if (options_.runtime_include_base.empty()) { - use_system_include = true; - } else { - name = options_.runtime_include_base + basename; - } - } - } - - std::string left = "\""; - std::string right = "\""; - if (use_system_include) { - left = "<"; - right = ">"; - } - return left + name + right; -} - -void FileGenerator::GenerateSourceIncludes(io::Printer* printer) { - Formatter format(printer, variables_); - std::string target_basename = StripProto(file_->name()); - if (!options_.opensource_runtime) { - GetBootstrapBasename(options_, target_basename, &target_basename); - } - target_basename += options_.proto_h ? ".proto.h" : ".pb.h"; - format( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "// source: $filename$\n" - "\n" - "#include $1$\n" - "\n" - "#include \n" // for swap() - "\n", - CreateHeaderInclude(target_basename, file_)); - - IncludeFile("net/proto2/io/public/coded_stream.h", printer); - // TODO(gerbens) This is to include parse_context.h, we need a better way - IncludeFile("net/proto2/public/extension_set.h", printer); - IncludeFile("net/proto2/public/wire_format_lite.h", printer); - - // Unknown fields implementation in lite mode uses StringOutputStream - if (!UseUnknownFieldSet(file_, options_) && !message_generators_.empty()) { - IncludeFile("net/proto2/io/public/zero_copy_stream_impl_lite.h", printer); - } - - if (HasDescriptorMethods(file_, options_)) { - IncludeFile("net/proto2/public/descriptor.h", printer); - IncludeFile("net/proto2/public/generated_message_reflection.h", printer); - IncludeFile("net/proto2/public/reflection_ops.h", printer); - IncludeFile("net/proto2/public/wire_format.h", printer); - } - - if (HasGeneratedMethods(file_, options_) && - options_.tctable_mode != Options::kTCTableNever) { - IncludeFile("net/proto2/public/generated_message_tctable_impl.h", printer); - } - - if (options_.proto_h) { - // Use the smaller .proto.h files. - for (int i = 0; i < file_->dependency_count(); i++) { - const FileDescriptor* dep = file_->dependency(i); - // Do not import weak deps. - if (!options_.opensource_runtime && IsDepWeak(dep)) continue; - std::string basename = StripProto(dep->name()); - if (IsBootstrapProto(options_, file_)) { - GetBootstrapBasename(options_, basename, &basename); - } - 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); -} - -void FileGenerator::GenerateSourcePrelude(io::Printer* printer) { - Formatter format(printer, variables_); - - // 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"); - - // Generate convenience aliases. - format( - "\n" - "namespace _pb = ::$1$;\n" - "namespace _pbi = _pb::internal;\n", - ProtobufNamespace(options_)); - if (HasGeneratedMethods(file_, options_) && - options_.tctable_mode != Options::kTCTableNever) { - format("namespace _fl = _pbi::field_layout;\n"); - } - format("\n"); -} - -void FileGenerator::GenerateSourceDefaultInstance(int idx, - io::Printer* printer) { - Formatter format(printer, variables_); - MessageGenerator* generator = message_generators_[idx].get(); - // Generate the split instance first because it's needed in the constexpr - // constructor. - if (ShouldSplit(generator->descriptor_, options_)) { - // 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( - "struct $1$ {\n" - " PROTOBUF_CONSTEXPR $1$()\n" - " : _instance{", - DefaultInstanceType(generator->descriptor_, options_, - /*split=*/true)); - generator->GenerateInitDefaultSplitInstance(printer); - format( - "} {}\n" - " ~$1$() {}\n" - " union {\n" - " $2$ _instance;\n" - " };\n" - "};\n", - DefaultInstanceType(generator->descriptor_, options_, /*split=*/true), - StrCat(generator->classname_, "::Impl_::Split")); - // 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 " - "PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 $1$ $2$;\n", - DefaultInstanceType(generator->descriptor_, options_, /*split=*/true), - DefaultInstanceName(generator->descriptor_, options_, /*split=*/true)); - } - - generator->GenerateConstexprConstructor(printer); - format( - "struct $1$ {\n" - " PROTOBUF_CONSTEXPR $1$()\n" - " : _instance(::_pbi::ConstantInitialized{}) {}\n" - " ~$1$() {}\n" - " union {\n" - " $2$ _instance;\n" - " };\n" - "};\n", - DefaultInstanceType(generator->descriptor_, options_), - generator->classname_); - format( - "PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT " - "PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 $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_PRIORITY2 std::true_type " - "$1$::Impl_::_init_inline_$2$_ = " - "($3$._instance.$4$.Init(), std::true_type{});\n", - ClassName(generator->descriptor_), FieldName(field), - DefaultInstanceName(generator->descriptor_, options_), - FieldMemberName(field, ShouldSplit(field, options_))); - } - } - - if (options_.lite_implicit_weak_fields) { - format( - "PROTOBUF_CONSTINIT const void* $1$ =\n" - " &$2$;\n", - DefaultInstancePtr(generator->descriptor_, options_), - DefaultInstanceName(generator->descriptor_, options_)); - } -} - -// A list of things defined in one .pb.cc file that we need to reference from -// another .pb.cc file. -struct FileGenerator::CrossFileReferences { - // Populated if we are referencing from messages or files. - std::unordered_set weak_default_instances; - - // Only if we are referencing from files. - std::unordered_set strong_reflection_files; - std::unordered_set weak_reflection_files; -}; - -void FileGenerator::GetCrossFileReferencesForField(const FieldDescriptor* field, - CrossFileReferences* refs) { - const Descriptor* msg = field->message_type(); - if (msg == nullptr) return; - - if (IsImplicitWeakField(field, options_, &scc_analyzer_) || - IsWeak(field, options_)) { - refs->weak_default_instances.insert(msg); - } -} - -void FileGenerator::GetCrossFileReferencesForFile(const FileDescriptor* file, - CrossFileReferences* refs) { - ForEachField(file, [this, refs](const FieldDescriptor* field) { - GetCrossFileReferencesForField(field, refs); - }); - - if (!HasDescriptorMethods(file, options_)) return; - - for (int i = 0; i < file->dependency_count(); i++) { - const FileDescriptor* dep = file->dependency(i); - if (IsDepWeak(dep)) { - refs->weak_reflection_files.insert(dep); - } else { - refs->strong_reflection_files.insert(dep); - } - } -} - -// Generates references to variables defined in other files. -void FileGenerator::GenerateInternalForwardDeclarations( - const CrossFileReferences& refs, io::Printer* printer) { - Formatter format(printer, variables_); - - { - NamespaceOpener ns(format); - for (auto instance : Sorted(refs.weak_default_instances)) { - ns.ChangeTo(Namespace(instance, options_)); - if (options_.lite_implicit_weak_fields) { - format( - "PROTOBUF_CONSTINIT __attribute__((weak)) const void* $1$ =\n" - " &::_pbi::implicit_weak_message_default_instance;\n", - DefaultInstancePtr(instance, options_)); - } else { - format("extern __attribute__((weak)) $1$ $2$;\n", - DefaultInstanceType(instance, options_), - DefaultInstanceName(instance, options_)); - } - } - } - - for (auto file : Sorted(refs.weak_reflection_files)) { - format( - "extern __attribute__((weak)) const ::_pbi::DescriptorTable $1$;\n", - DescriptorTableName(file, options_)); - } -} - -void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) { - Formatter format(printer, variables_); - GenerateSourceIncludes(printer); - GenerateSourcePrelude(printer); - - if (IsAnyMessage(file_, options_)) MuteWuninitialized(format); - - CrossFileReferences refs; - ForEachField(message_generators_[idx]->descriptor_, - [this, &refs](const FieldDescriptor* field) { - GetCrossFileReferencesForField(field, &refs); - }); - GenerateInternalForwardDeclarations(refs, printer); - - { // package namespace - NamespaceOpener ns(Namespace(file_, options_), format); - - // Define default instances - GenerateSourceDefaultInstance(idx, printer); - - // Generate classes. - format("\n"); - message_generators_[idx]->GenerateClassMethods(printer); - - format( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n"); - } // end package namespace - - { - NamespaceOpener proto_ns(ProtobufNamespace(options_), format); - message_generators_[idx]->GenerateSourceInProto2Namespace(printer); - } - - if (IsAnyMessage(file_, options_)) UnmuteWuninitialized(format); - - format( - "\n" - "// @@protoc_insertion_point(global_scope)\n"); -} - -void FileGenerator::GenerateSourceForExtension(int idx, io::Printer* printer) { - Formatter format(printer, variables_); - GenerateSourceIncludes(printer); - GenerateSourcePrelude(printer); - NamespaceOpener ns(Namespace(file_, options_), format); - extension_generators_[idx]->GenerateDefinition(printer); -} - -void FileGenerator::GenerateGlobalSource(io::Printer* printer) { - Formatter format(printer, variables_); - GenerateSourceIncludes(printer); - GenerateSourcePrelude(printer); - - { - // Define the code to initialize reflection. This code uses a global - // constructor to register reflection data with the runtime pre-main. - if (HasDescriptorMethods(file_, options_)) { - GenerateReflectionInitializationCode(printer); - } - } - - NamespaceOpener ns(Namespace(file_, options_), format); - - // Generate enums. - for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->GenerateMethods(i, printer); - } -} - -void FileGenerator::GenerateSource(io::Printer* printer) { - Formatter format(printer, variables_); - GenerateSourceIncludes(printer); - GenerateSourcePrelude(printer); - CrossFileReferences refs; - GetCrossFileReferencesForFile(file_, &refs); - GenerateInternalForwardDeclarations(refs, printer); - - if (IsAnyMessage(file_, options_)) MuteWuninitialized(format); - - { - NamespaceOpener ns(Namespace(file_, options_), format); - - // Define default instances - for (int i = 0; i < message_generators_.size(); i++) { - GenerateSourceDefaultInstance(i, 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. - GenerateReflectionInitializationCode(printer); - } - } - - { - NamespaceOpener ns(Namespace(file_, options_), format); - - // Actually implement the protos - - // Generate enums. - for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->GenerateMethods(i, printer); - } - - // Generate classes. - for (int i = 0; i < message_generators_.size(); i++) { - format("\n"); - format(kThickSeparator); - format("\n"); - message_generators_[i]->GenerateClassMethods(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); - } - } - - // Define extensions. - for (int i = 0; i < extension_generators_.size(); i++) { - extension_generators_[i]->GenerateDefinition(printer); - } - - format( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n"); - } - - { - NamespaceOpener proto_ns(ProtobufNamespace(options_), format); - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->GenerateSourceInProto2Namespace(printer); - } - } - - format( - "\n" - "// @@protoc_insertion_point(global_scope)\n"); - - if (IsAnyMessage(file_, options_)) UnmuteWuninitialized(format); - - IncludeFile("net/proto2/public/port_undef.inc", printer); -} - -void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) { - Formatter format(printer, variables_); - - if (!message_generators_.empty()) { - format("static ::_pb::Metadata $file_level_metadata$[$1$];\n", - message_generators_.size()); - } - if (!enum_generators_.empty()) { - format( - "static const ::_pb::EnumDescriptor* " - "$file_level_enum_descriptors$[$1$];\n", - enum_generators_.size()); - } else { - format( - "static " - "constexpr ::_pb::EnumDescriptor const** " - "$file_level_enum_descriptors$ = nullptr;\n"); - } - if (HasGenericServices(file_, options_) && file_->service_count() > 0) { - format( - "static " - "const ::_pb::ServiceDescriptor* " - "$file_level_service_descriptors$[$1$];\n", - file_->service_count()); - } else { - format( - "static " - "constexpr ::_pb::ServiceDescriptor const** " - "$file_level_service_descriptors$ = nullptr;\n"); - } - - if (!message_generators_.empty()) { - format( - "\n" - "const $uint32$ $tablename$::offsets[] " - "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n"); - format.Indent(); - std::vector > pairs; - pairs.reserve(message_generators_.size()); - for (int i = 0; i < message_generators_.size(); i++) { - pairs.push_back(message_generators_[i]->GenerateOffsets(printer)); - } - format.Outdent(); - format( - "};\n" - "static const ::_pbi::MigrationSchema schemas[] " - "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n"); - format.Indent(); - { - int offset = 0; - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->GenerateSchema(printer, offset, - pairs[i].second); - offset += pairs[i].first; - } - } - format.Outdent(); - format( - "};\n" - "\nstatic const ::_pb::Message* const file_default_instances[] = {\n"); - format.Indent(); - for (int i = 0; i < message_generators_.size(); i++) { - const Descriptor* descriptor = message_generators_[i]->descriptor_; - format("&$1$::_$2$_default_instance_._instance,\n", - Namespace(descriptor, options_), // 1 - ClassName(descriptor)); // 2 - } - format.Outdent(); - format( - "};\n" - "\n"); - } else { - // we still need these symbols to exist - format( - // MSVC doesn't like empty arrays, so we add a dummy. - "const $uint32$ $tablename$::offsets[1] = {};\n" - "static constexpr ::_pbi::MigrationSchema* schemas = nullptr;\n" - "static constexpr ::_pb::Message* const* " - "file_default_instances = nullptr;\n" - "\n"); - } - - // --------------------------------------------------------------- - - // Embed the descriptor. We simply serialize the entire - // FileDescriptorProto/ and embed it as a string literal, which is parsed and - // built into real descriptors at initialization time. - const std::string protodef_name = - UniqueName("descriptor_table_protodef", file_, options_); - format("const char $1$[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =\n", - protodef_name); - format.Indent(); - FileDescriptorProto file_proto; - file_->CopyTo(&file_proto); - std::string file_data; - file_proto.SerializeToString(&file_data); - - { - if (file_data.size() > 65535) { - // Workaround for MSVC: "Error C1091: compiler limit: string exceeds - // 65535 bytes in length". Declare a static array of chars rather than - // use a string literal. Only write 25 bytes per line. - static const int kBytesPerLine = 25; - format("{ "); - for (int i = 0; i < file_data.size();) { - for (int j = 0; j < kBytesPerLine && i < file_data.size(); ++i, ++j) { - format("'$1$', ", CEscape(file_data.substr(i, 1))); - } - format("\n"); - } - format("'\\0' }"); // null-terminate - } else { - // Only write 40 bytes per line. - static const int kBytesPerLine = 40; - for (int i = 0; i < file_data.size(); i += kBytesPerLine) { - format( - "\"$1$\"\n", - EscapeTrigraphs(CEscape(file_data.substr(i, kBytesPerLine)))); - } - } - format(";\n"); - } - format.Outdent(); - - CrossFileReferences refs; - GetCrossFileReferencesForFile(file_, &refs); - int num_deps = - refs.strong_reflection_files.size() + refs.weak_reflection_files.size(); - - // Build array of DescriptorTable deps. - if (num_deps > 0) { - format( - "static const ::_pbi::DescriptorTable* const " - "$desc_table$_deps[$1$] = {\n", - num_deps); - - 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"); - } - - // 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 ::_pbi::once_flag $desc_table$_once;\n" - "const ::_pbi::DescriptorTable $desc_table$ = {\n" - " false, $1$, $2$, $3$,\n" - " \"$filename$\",\n" - " &$desc_table$_once, $4$, $5$, $6$,\n" - " schemas, file_default_instances, $tablename$::offsets,\n" - " $7$, $file_level_enum_descriptors$,\n" - " $file_level_service_descriptors$,\n" - "};\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 ::_pbi::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 - // unnecessary code that can't be stripped by --gc-sections. Descriptor - // initialization will still be performed lazily when it's needed. - if (file_->name() != "net/proto2/proto/descriptor.proto") { - format( - "// Force running AddDescriptors() at dynamic initialization time.\n" - "PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 " - "static ::_pbi::AddDescriptorsRunner $1$(&$desc_table$);\n", - UniqueName("dynamic_init_dummy", file_, options_)); - } -} - -class FileGenerator::ForwardDeclarations { - public: - void AddMessage(const Descriptor* d) { classes_[ClassName(d)] = d; } - void AddEnum(const EnumDescriptor* d) { enums_[ClassName(d)] = d; } - void AddSplit(const Descriptor* d) { splits_[ClassName(d)] = d; } - - void Print(const Formatter& format, const Options& options) const { - for (const auto& p : enums_) { - const std::string& enumname = p.first; - const EnumDescriptor* enum_desc = p.second; - format( - "enum ${1$$2$$}$ : int;\n" - "bool $2$_IsValid(int value);\n", - enum_desc, enumname); - } - for (const auto& p : classes_) { - const std::string& classname = p.first; - const Descriptor* class_desc = p.second; - format( - "class ${1$$2$$}$;\n" - "struct $3$;\n" - "$dllexport_decl $extern $3$ $4$;\n", - class_desc, classname, DefaultInstanceType(class_desc, options), - DefaultInstanceName(class_desc, options)); - } - for (const auto& p : splits_) { - const Descriptor* class_desc = p.second; - format( - "struct $1$;\n" - "$dllexport_decl $extern $1$ $2$;\n", - DefaultInstanceType(class_desc, options, /*split=*/true), - DefaultInstanceName(class_desc, options, /*split=*/true)); - } - } - - void PrintTopLevelDecl(const Formatter& format, - const Options& options) const { - for (const auto& pair : classes_) { - format( - "template<> $dllexport_decl $" - "$1$* Arena::CreateMaybeMessage<$1$>(Arena*);\n", - QualifiedClassName(pair.second, options)); - } - } - - private: - std::map classes_; - std::map enums_; - std::map splits_; -}; - -static void PublicImportDFS(const FileDescriptor* fd, - std::unordered_set* fd_set) { - for (int i = 0; i < fd->public_dependency_count(); i++) { - const FileDescriptor* dep = fd->public_dependency(i); - if (fd_set->insert(dep).second) PublicImportDFS(dep, fd_set); - } -} - -void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) { - Formatter format(printer, variables_); - std::vector classes; - std::vector enums; - - FlattenMessagesInFile(file_, &classes); // All messages need forward decls. - - if (options_.proto_h) { // proto.h needs extra forward declarations. - // All classes / enums referred to as field members - std::vector fields; - ListAllFields(file_, &fields); - for (int i = 0; i < fields.size(); i++) { - classes.push_back(fields[i]->containing_type()); - classes.push_back(fields[i]->message_type()); - enums.push_back(fields[i]->enum_type()); - } - ListAllTypesForServices(file_, &classes); - } - - // Calculate the set of files whose definitions we get through include. - // No need to forward declare types that are defined in these. - std::unordered_set public_set; - PublicImportDFS(file_, &public_set); - - std::map decls; - for (int i = 0; i < classes.size(); i++) { - const Descriptor* d = classes[i]; - if (d && !public_set.count(d->file())) - decls[Namespace(d, options_)].AddMessage(d); - } - for (int i = 0; i < enums.size(); i++) { - const EnumDescriptor* d = enums[i]; - if (d && !public_set.count(d->file())) - decls[Namespace(d, options_)].AddEnum(d); - } - for (const auto& mg : message_generators_) { - const Descriptor* d = mg->descriptor_; - if ((d != nullptr) && (public_set.count(d->file()) == 0u) && - ShouldSplit(mg->descriptor_, options_)) - decls[Namespace(d, options_)].AddSplit(d); - } - - { - NamespaceOpener ns(format); - for (const auto& pair : decls) { - ns.ChangeTo(pair.first); - pair.second.Print(format, options_); - } - } - format("PROTOBUF_NAMESPACE_OPEN\n"); - for (const auto& pair : decls) { - pair.second.PrintTopLevelDecl(format, options_); - } - format("PROTOBUF_NAMESPACE_CLOSE\n"); -} - -void FileGenerator::GenerateTopHeaderGuard(io::Printer* printer, bool pb_h) { - Formatter format(printer, variables_); - // Generate top of header. - format( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "// source: $filename$\n" - "\n" - "#ifndef $1$\n" - "#define $1$\n" - "\n" - "#include \n" - "#include \n", - IncludeGuard(file_, pb_h, options_)); - if (!options_.opensource_runtime && !enum_generators_.empty()) { - // Add header to provide std::is_integral for safe Enum_Name() function. - format("#include \n"); - } - format("\n"); -} - -void FileGenerator::GenerateBottomHeaderGuard(io::Printer* printer, bool pb_h) { - Formatter format(printer, variables_); - format("#endif // $GOOGLE_PROTOBUF$_INCLUDED_$1$\n", - IncludeGuard(file_, pb_h, options_)); -} - -void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) { - Formatter format(printer, variables_); - if (UsingImplicitWeakFields(file_, options_)) { - IncludeFile("net/proto2/public/implicit_weak_message.h", printer); - } - if (HasWeakFields(file_, options_)) { - GOOGLE_CHECK(!options_.opensource_runtime); - IncludeFile("net/proto2/public/weak_field_map.h", printer); - } - 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 - // version before going any further. - IncludeFile("net/proto2/public/port_def.inc", printer); - format( - "#if PROTOBUF_VERSION < $1$\n" - "#error This file was generated by a newer version of protoc which is\n" - "#error incompatible with your Protocol Buffer headers. Please update\n" - "#error your headers.\n" - "#endif\n" - "#if $2$ < PROTOBUF_MIN_PROTOC_VERSION\n" - "#error This file was generated by an older version of protoc which " - "is\n" - "#error incompatible with your Protocol Buffer headers. Please\n" - "#error regenerate this file with a newer version of protoc.\n" - "#endif\n" - "\n", - PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC, // 1 - PROTOBUF_VERSION); // 2 - IncludeFile("net/proto2/public/port_undef.inc", printer); - } - - // OK, it's now safe to #include other files. - 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); - } - 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/metadata_lite.h", printer); - - if (HasDescriptorMethods(file_, options_)) { - IncludeFile("net/proto2/public/generated_message_reflection.h", printer); - } - - if (!message_generators_.empty()) { - if (HasDescriptorMethods(file_, options_)) { - IncludeFile("net/proto2/public/message.h", printer); - } else { - IncludeFile("net/proto2/public/message_lite.h", printer); - } - } - if (options_.opensource_runtime) { - // Open-source relies on unconditional includes of these. - IncludeFileAndExport("net/proto2/public/repeated_field.h", printer); - IncludeFileAndExport("net/proto2/public/extension_set.h", printer); - } else { - // Google3 includes these files only when they are necessary. - if (HasExtensionsOrExtendableMessage(file_)) { - IncludeFileAndExport("net/proto2/public/extension_set.h", printer); - } - if (HasRepeatedFields(file_)) { - IncludeFileAndExport("net/proto2/public/repeated_field.h", printer); - } - if (HasStringPieceFields(file_, options_)) { - IncludeFile("net/proto2/public/string_piece_field_support.h", printer); - } - if (HasCordFields(file_, options_)) { - format("#include \"third_party/absl/strings/cord.h\"\n"); - } - } - if (HasMapFields(file_)) { - IncludeFileAndExport("net/proto2/public/map.h", printer); - if (HasDescriptorMethods(file_, options_)) { - IncludeFile("net/proto2/public/map_entry.h", printer); - IncludeFile("net/proto2/public/map_field_inl.h", printer); - } else { - IncludeFile("net/proto2/public/map_entry_lite.h", printer); - IncludeFile("net/proto2/public/map_field_lite.h", printer); - } - } - - if (HasEnumDefinitions(file_)) { - if (HasDescriptorMethods(file_, options_)) { - IncludeFile("net/proto2/public/generated_enum_reflection.h", printer); - } else { - IncludeFile("net/proto2/public/generated_enum_util.h", printer); - } - } - - if (HasGenericServices(file_, options_)) { - IncludeFile("net/proto2/public/service.h", printer); - } - - if (UseUnknownFieldSet(file_, options_) && !message_generators_.empty()) { - IncludeFile("net/proto2/public/unknown_field_set.h", printer); - } -} - -void FileGenerator::GenerateMetadataPragma(io::Printer* printer, - const std::string& info_path) { - Formatter format(printer, variables_); - if (!info_path.empty() && !options_.annotation_pragma_name.empty() && - !options_.annotation_guard_name.empty()) { - format.Set("guard", options_.annotation_guard_name); - format.Set("pragma", options_.annotation_pragma_name); - format.Set("info_path", info_path); - format( - "#ifdef $guard$\n" - "#pragma $pragma$ \"$info_path$\"\n" - "#endif // $guard$\n"); - } -} - -void FileGenerator::GenerateDependencyIncludes(io::Printer* printer) { - Formatter format(printer, variables_); - for (int i = 0; i < file_->dependency_count(); i++) { - std::string basename = StripProto(file_->dependency(i)->name()); - - // Do not import weak deps. - if (IsDepWeak(file_->dependency(i))) continue; - - if (IsBootstrapProto(options_, file_)) { - GetBootstrapBasename(options_, basename, &basename); - } - - format("#include $1$\n", - CreateHeaderInclude(basename + ".pb.h", file_->dependency(i))); - } -} - -void FileGenerator::GenerateGlobalStateFunctionDeclarations( - io::Printer* printer) { - Formatter format(printer, variables_); - // Forward-declare the DescriptorTable because this is referenced by .pb.cc - // files depending on this file. - // - // The TableStruct is also outputted in weak_message_field.cc, because the - // weak fields must refer to table struct but cannot include the header. - // Also it annotates extra weak attributes. - // TODO(gerbens) make sure this situation is handled better. - format( - "\n" - "// Internal implementation detail -- do not use these members.\n" - "struct $dllexport_decl $$tablename$ {\n" - " static const $uint32$ offsets[];\n" - "};\n"); - if (HasDescriptorMethods(file_, options_)) { - format( - "$dllexport_decl $extern const ::$proto_ns$::internal::DescriptorTable " - "$desc_table$;\n"); - } -} - -void FileGenerator::GenerateMessageDefinitions(io::Printer* printer) { - Formatter format(printer, variables_); - // Generate class definitions. - for (int i = 0; i < message_generators_.size(); i++) { - if (i > 0) { - format("\n"); - format(kThinSeparator); - format("\n"); - } - message_generators_[i]->GenerateClassDefinition(printer); - } -} - -void FileGenerator::GenerateEnumDefinitions(io::Printer* printer) { - // Generate enum definitions. - for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->GenerateDefinition(printer); - } -} - -void FileGenerator::GenerateServiceDefinitions(io::Printer* printer) { - Formatter format(printer, variables_); - if (HasGenericServices(file_, options_)) { - // Generate service definitions. - for (int i = 0; i < service_generators_.size(); i++) { - if (i > 0) { - format("\n"); - format(kThinSeparator); - format("\n"); - } - service_generators_[i]->GenerateDeclarations(printer); - } - - format("\n"); - format(kThickSeparator); - format("\n"); - } -} - -void FileGenerator::GenerateExtensionIdentifiers(io::Printer* printer) { - // Declare extension identifiers. These are in global scope and so only - // the global scope extensions. - for (auto& extension_generator : extension_generators_) { - if (extension_generator->IsScoped()) continue; - extension_generator->GenerateDeclaration(printer); - } -} - -void FileGenerator::GenerateInlineFunctionDefinitions(io::Printer* printer) { - Formatter format(printer, variables_); - // TODO(gerbens) remove pragmas when gcc is no longer used. Current version - // of gcc fires a bogus error when compiled with strict-aliasing. - format( - "#ifdef __GNUC__\n" - " #pragma GCC diagnostic push\n" - " #pragma GCC diagnostic ignored \"-Wstrict-aliasing\"\n" - "#endif // __GNUC__\n"); - // Generate class inline methods. - for (int i = 0; i < message_generators_.size(); i++) { - if (i > 0) { - format(kThinSeparator); - format("\n"); - } - message_generators_[i]->GenerateInlineMethods(printer); - } - format( - "#ifdef __GNUC__\n" - " #pragma GCC diagnostic pop\n" - "#endif // __GNUC__\n"); - - for (int i = 0; i < message_generators_.size(); i++) { - if (i > 0) { - format(kThinSeparator); - format("\n"); - } - } -} - -void FileGenerator::GenerateProto2NamespaceEnumSpecializations( - io::Printer* printer) { - Formatter format(printer, variables_); - // Emit GetEnumDescriptor specializations into google::protobuf namespace: - if (HasEnumDefinitions(file_)) { - format("\n"); - { - NamespaceOpener proto_ns(ProtobufNamespace(options_), format); - format("\n"); - for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->GenerateGetEnumDescriptorSpecializations(printer); - } - format("\n"); - } - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/file.h b/depends/protobuf/src/google/protobuf/compiler/cpp/file.h deleted file mode 100644 index ca05361b4..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/file.h +++ /dev/null @@ -1,209 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -class FileDescriptor; // descriptor.h -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class EnumGenerator; // enum.h -class MessageGenerator; // message.h -class ServiceGenerator; // service.h -class ExtensionGenerator; // extension.h - -class FileGenerator { - public: - // See generator.cc for the meaning of dllexport_decl. - FileGenerator(const FileDescriptor* file, const Options& options); - ~FileGenerator(); - - // Shared code between the two header generators below. - void GenerateHeader(io::Printer* printer); - - // info_path, if non-empty, should be the path (relative to printer's - // output) to the metadata file describing this proto header. - void GenerateProtoHeader(io::Printer* printer, const std::string& info_path); - // info_path, if non-empty, should be the path (relative to printer's - // output) to the metadata file describing this PB header. - 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(); } - 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: - // Internal type used by GenerateForwardDeclarations (defined in file.cc). - class ForwardDeclarations; - struct CrossFileReferences; - - void IncludeFile(const std::string& google3_name, io::Printer* printer) { - DoIncludeFile(google3_name, false, printer); - } - void IncludeFileAndExport(const std::string& google3_name, - io::Printer* printer) { - DoIncludeFile(google3_name, true, printer); - } - void DoIncludeFile(const std::string& google3_name, bool do_export, - io::Printer* printer); - - std::string CreateHeaderInclude(const std::string& basename, - const FileDescriptor* file); - void GetCrossFileReferencesForField(const FieldDescriptor* field, - CrossFileReferences* refs); - void GetCrossFileReferencesForFile(const FileDescriptor* file, - CrossFileReferences* refs); - void GenerateInternalForwardDeclarations(const CrossFileReferences& refs, - io::Printer* printer); - void GenerateSourceIncludes(io::Printer* printer); - void GenerateSourcePrelude(io::Printer* printer); - void GenerateSourceDefaultInstance(int idx, io::Printer* printer); - - void GenerateInitForSCC(const SCC* scc, const CrossFileReferences& refs, - io::Printer* printer); - void GenerateReflectionInitializationCode(io::Printer* printer); - - // For other imports, generates their forward-declarations. - void GenerateForwardDeclarations(io::Printer* printer); - - // Generates top or bottom of a header file. - void GenerateTopHeaderGuard(io::Printer* printer, bool pb_h); - void GenerateBottomHeaderGuard(io::Printer* printer, bool pb_h); - - // Generates #include directives. - void GenerateLibraryIncludes(io::Printer* printer); - void GenerateDependencyIncludes(io::Printer* printer); - - // Generate a pragma to pull in metadata using the given info_path (if - // non-empty). info_path should be relative to printer's output. - void GenerateMetadataPragma(io::Printer* printer, - const std::string& info_path); - - // Generates a couple of different pieces before definitions: - void GenerateGlobalStateFunctionDeclarations(io::Printer* printer); - - // Generates types for classes. - void GenerateMessageDefinitions(io::Printer* printer); - - void GenerateEnumDefinitions(io::Printer* printer); - - // Generates generic service definitions. - void GenerateServiceDefinitions(io::Printer* printer); - - // Generates extension identifiers. - void GenerateExtensionIdentifiers(io::Printer* printer); - - // Generates inline function definitions. - void GenerateInlineFunctionDefinitions(io::Printer* printer); - - void GenerateProto2NamespaceEnumSpecializations(io::Printer* printer); - - // Sometimes the names we use in a .proto file happen to be defined as - // macros on some platforms (e.g., macro/minor used in plugin.proto are - // defined as macros in sys/types.h on FreeBSD and a few other platforms). - // To make the generated code compile on these platforms, we either have to - // undef the macro for these few platforms, or rename the field name for all - // platforms. Since these names are part of protobuf public API, renaming is - // generally a breaking change so we prefer the #undef approach. - void GenerateMacroUndefs(io::Printer* printer); - - bool IsDepWeak(const FileDescriptor* dep) const { - if (weak_deps_.count(dep) != 0) { - GOOGLE_CHECK(!options_.opensource_runtime); - return true; - } - return false; - } - - std::set weak_deps_; - - const FileDescriptor* file_; - const Options options_; - - MessageSCCAnalyzer scc_analyzer_; - - std::map variables_; - - // Contains the post-order walk of all the messages (and child messages) in - // this file. If you need a pre-order walk just reverse iterate. - std::vector> message_generators_; - std::vector> enum_generators_; - std::vector> service_generators_; - std::vector> extension_generators_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/generator.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/generator.cc deleted file mode 100644 index 63a2bcebe..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/generator.cc +++ /dev/null @@ -1,279 +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 - -namespace google { -namespace protobuf { -namespace compiler { -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, - std::string* error) const { - std::vector > options; - ParseGeneratorParameter(parameter, &options); - - // ----------------------------------------------------------------- - // parse generator options - - // If the dllexport_decl option is passed to the compiler, we need to write - // it in front of every symbol that should be exported if this .proto is - // compiled into a Windows DLL. E.g., if the user invokes the protocol - // compiler as: - // protoc --cpp_out=dllexport_decl=FOO_EXPORT:outdir foo.proto - // then we'll define classes like this: - // class FOO_EXPORT Foo { - // ... - // } - // FOO_EXPORT is a macro which should expand to __declspec(dllexport) or - // __declspec(dllimport) depending on what is being compiled. - // - // If the proto_h option is passed to the compiler, we will generate all - // classes and enums so that they can be forward-declared from files that - // need them from imports. - // - // If the lite option is passed to the compiler, we will generate the - // current files and all transitive dependencies using the LITE runtime. - Options file_options; - - file_options.opensource_runtime = opensource_runtime_; - file_options.runtime_include_base = runtime_include_base_; - - for (int i = 0; i < options.size(); i++) { - if (options[i].first == "dllexport_decl") { - file_options.dllexport_decl = options[i].second; - } else if (options[i].first == "safe_boundary_check") { - file_options.safe_boundary_check = true; - } else if (options[i].first == "annotate_headers") { - file_options.annotate_headers = true; - } else if (options[i].first == "annotation_pragma_name") { - file_options.annotation_pragma_name = options[i].second; - } else if (options[i].first == "annotation_guard_name") { - 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") { - file_options.enforce_mode = EnforceOptimizeMode::kLiteRuntime; - file_options.lite_implicit_weak_fields = true; - if (!options[i].second.empty()) { - file_options.num_cc_files = - strto32(options[i].second.c_str(), nullptr, 10); - } - } else if (options[i].first == "proto_h") { - file_options.proto_h = true; - } 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 == "verified_lazy") { - file_options.unverified_lazy = false; - } else if (options[i].first == "unverified_lazy_message_sets") { - file_options.unverified_lazy_message_sets = true; - } else if (options[i].first == "message_owned_arena_trial") { - file_options.message_owned_arena_trial = true; - } else if (options[i].first == "force_eagerly_verified_lazy") { - file_options.force_eagerly_verified_lazy = 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; - } - } - - // The safe_boundary_check option controls behavior for Google-internal - // protobuf APIs. - if (file_options.safe_boundary_check && file_options.opensource_runtime) { - *error = - "The safe_boundary_check option is not supported outside of Google."; - return false; - } - - // ----------------------------------------------------------------- - - - std::string basename = StripProto(file->name()); - - if (MaybeBootstrap(file_options, generator_context, file_options.bootstrap, - &basename)) { - return true; - } - - FileGenerator file_generator(file, file_options); - - // Generate header(s). - if (file_options.proto_h) { - std::unique_ptr output( - generator_context->Open(basename + ".proto.h")); - GeneratedCodeInfo annotations; - io::AnnotationProtoCollector annotation_collector( - &annotations); - std::string info_path = basename + ".proto.h.meta"; - io::Printer printer( - output.get(), '$', - file_options.annotate_headers ? &annotation_collector : nullptr); - file_generator.GenerateProtoHeader( - &printer, file_options.annotate_headers ? info_path : ""); - if (file_options.annotate_headers) { - std::unique_ptr info_output( - generator_context->Open(info_path)); - annotations.SerializeToZeroCopyStream(info_output.get()); - } - } - - { - std::unique_ptr output( - generator_context->Open(basename + ".pb.h")); - GeneratedCodeInfo annotations; - io::AnnotationProtoCollector annotation_collector( - &annotations); - std::string info_path = basename + ".pb.h.meta"; - io::Printer printer( - output.get(), '$', - file_options.annotate_headers ? &annotation_collector : nullptr); - file_generator.GeneratePBHeader( - &printer, file_options.annotate_headers ? info_path : ""); - if (file_options.annotate_headers) { - std::unique_ptr info_output( - generator_context->Open(info_path)); - annotations.SerializeToZeroCopyStream(info_output.get()); - } - } - - // Generate cc file(s). - if (UsingImplicitWeakFields(file, file_options)) { - { - // This is the global .cc file, containing - // enum/services/tables/reflection - std::unique_ptr output( - generator_context->Open(basename + ".pb.cc")); - io::Printer printer(output.get(), '$'); - file_generator.GenerateGlobalSource(&printer); - } - - 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(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; - } - 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(), '$'); - 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( - generator_context->Open(basename + ".pb.cc")); - io::Printer printer(output.get(), '$'); - file_generator.GenerateSource(&printer); - } - - return true; -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/generator.h b/depends/protobuf/src/google/protobuf/compiler/cpp/generator.h deleted file mode 100644 index 1a374b9f1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/generator.h +++ /dev/null @@ -1,107 +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. -// -// Generates C++ code for a given .proto file. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__ - -#include -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -// CodeGenerator implementation which generates a C++ source file and -// header. If you create your own protocol compiler binary and you want -// it to support C++ output, you can do so by registering an instance of this -// CodeGenerator with the CommandLineInterface in your main() function. -class PROTOC_EXPORT CppGenerator : public CodeGenerator { - public: - CppGenerator(); - ~CppGenerator() override; - - enum class Runtime { - kGoogle3, // Use the internal google3 runtime. - kOpensource, // Use the open-source runtime. - - // Use the open-source runtime with google3 #include paths. We make these - // absolute to avoid ambiguity, so the runtime will be #included like: - // #include "third_party/protobuf/.../google/protobuf/message.h" - kOpensourceGoogle3 - }; - - void set_opensource_runtime(bool opensource) { - opensource_runtime_ = opensource; - } - - // If set to a non-empty string, generated code will do: - // #include "/google/protobuf/message.h" - // instead of: - // #include - // This has no effect if opensource_runtime = false. - void set_runtime_include_base(const std::string& base) { - runtime_include_base_ = base; - } - - // implements CodeGenerator ---------------------------------------- - bool Generate(const FileDescriptor* file, const std::string& parameter, - 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; - std::string runtime_include_base_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CppGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/helpers.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/helpers.cc deleted file mode 100644 index 4b7c5c9d9..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/helpers.cc +++ /dev/null @@ -1,1599 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { - -static const char kAnyMessageName[] = "Any"; -static const char kAnyProtoFile[] = "google/protobuf/any.proto"; - -std::string DotsToColons(const std::string& name) { - return StringReplace(name, ".", "::", true); -} - -static const char* const kKeywordList[] = { // - "NULL", - "alignas", - "alignof", - "and", - "and_eq", - "asm", - "auto", - "bitand", - "bitor", - "bool", - "break", - "case", - "catch", - "char", - "class", - "compl", - "const", - "constexpr", - "const_cast", - "continue", - "decltype", - "default", - "delete", - "do", - "double", - "dynamic_cast", - "else", - "enum", - "explicit", - "export", - "extern", - "false", - "float", - "for", - "friend", - "goto", - "if", - "inline", - "int", - "long", - "mutable", - "namespace", - "new", - "noexcept", - "not", - "not_eq", - "nullptr", - "operator", - "or", - "or_eq", - "private", - "protected", - "public", - "register", - "reinterpret_cast", - "return", - "short", - "signed", - "sizeof", - "static", - "static_assert", - "static_cast", - "struct", - "switch", - "template", - "this", - "thread_local", - "throw", - "true", - "try", - "typedef", - "typeid", - "typename", - "union", - "unsigned", - "using", - "virtual", - "void", - "volatile", - "wchar_t", - "while", - "xor", - "xor_eq"}; - -static std::unordered_set* MakeKeywordsMap() { - auto* result = new std::unordered_set(); - for (const auto keyword : kKeywordList) { - result->emplace(keyword); - } - return result; -} - -static std::unordered_set& kKeywords = *MakeKeywordsMap(); - -std::string IntTypeName(const Options& options, const std::string& type) { - return type + "_t"; -} - -void SetIntVar(const Options& options, const std::string& type, - std::map* variables) { - (*variables)[type] = IntTypeName(options, type); -} - -// Returns true if the message can potentially allocate memory for its field. -// This is used to determine if message-owned arena will be useful. -bool AllocExpected(const Descriptor* descriptor) { - return false; -} - -// Describes different approaches to detect non-canonical int32 encoding. Only -// kNever or kAlways is eligible for *simple* verification methods. -enum class VerifyInt32Type { - kCustom, // Only check if field number matches. - kNever, // Do not check. - kAlways, // Always check. -}; - -inline VerifySimpleType VerifyInt32TypeToVerifyCustom(VerifyInt32Type t) { - static VerifySimpleType kCustomTypes[] = { - VerifySimpleType::kCustom, VerifySimpleType::kCustomInt32Never, - VerifySimpleType::kCustomInt32Always}; - return kCustomTypes[static_cast(t) - - static_cast(VerifyInt32Type::kCustom)]; -} - -} // namespace - -bool IsLazy(const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - return IsLazilyVerifiedLazy(field, options) || - IsEagerlyVerifiedLazy(field, options, scc_analyzer); -} - -// Returns true if "field" is a message field that is backed by LazyField per -// profile (go/pdlazy). -inline bool IsEagerlyVerifiedLazyByProfile(const FieldDescriptor* field, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - return false; -} - -bool IsEagerlyVerifiedLazy(const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - return false; -} - -bool IsLazilyVerifiedLazy(const FieldDescriptor* field, - const Options& options) { - return false; -} - -void SetCommonVars(const Options& options, - std::map* variables) { - (*variables)["proto_ns"] = ProtobufNamespace(options); - - // Warning: there is some clever naming/splitting here to avoid extract script - // rewrites. The names of these variables must not be things that the extract - // script will rewrite. That's why we use "CHK" (for example) instead of - // "GOOGLE_CHECK". - if (options.opensource_runtime) { - (*variables)["GOOGLE_PROTOBUF"] = "GOOGLE_PROTOBUF"; - (*variables)["CHK"] = "GOOGLE_CHECK"; - (*variables)["DCHK"] = "GOOGLE_DCHECK"; - } else { - // These values are things the extract script would rewrite if we did not - // split them. It might not strictly matter since we don't generate google3 - // code in open-source. But it's good to prevent surprising things from - // happening. - (*variables)["GOOGLE_PROTOBUF"] = - "GOOGLE3" - "_PROTOBUF"; - (*variables)["CHK"] = - "CH" - "ECK"; - (*variables)["DCHK"] = - "DCH" - "ECK"; - } - - SetIntVar(options, "int8", variables); - SetIntVar(options, "uint8", variables); - SetIntVar(options, "uint32", variables); - SetIntVar(options, "uint64", variables); - SetIntVar(options, "int32", variables); - SetIntVar(options, "int64", variables); - (*variables)["string"] = "std::string"; -} - -void SetCommonMessageDataVariables( - const Descriptor* descriptor, - std::map* variables) { - std::string prefix = IsMapEntryMessage(descriptor) ? "" : "_impl_."; - (*variables)["any_metadata"] = prefix + "_any_metadata_"; - (*variables)["cached_size"] = prefix + "_cached_size_"; - (*variables)["extensions"] = prefix + "_extensions_"; - (*variables)["has_bits"] = prefix + "_has_bits_"; - (*variables)["inlined_string_donated_array"] = - prefix + "_inlined_string_donated_"; - (*variables)["oneof_case"] = prefix + "_oneof_case_"; - (*variables)["tracker"] = "Impl_::_tracker_"; - (*variables)["weak_field_map"] = prefix + "_weak_field_map_"; - (*variables)["split"] = prefix + "_split_"; - (*variables)["cached_split_ptr"] = "cached_split_ptr"; -} - -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; - // Note: I distrust ctype.h due to locales. - for (int i = 0; i < input.size(); i++) { - if ('a' <= input[i] && input[i] <= 'z') { - if (cap_next_letter) { - result += input[i] + ('A' - 'a'); - } else { - result += input[i]; - } - cap_next_letter = false; - } else if ('A' <= input[i] && input[i] <= 'Z') { - // Capital letters are left as-is. - result += input[i]; - cap_next_letter = false; - } else if ('0' <= input[i] && input[i] <= '9') { - result += input[i]; - cap_next_letter = true; - } else { - cap_next_letter = true; - } - } - return result; -} - -const char kThickSeparator[] = - "// ===================================================================\n"; -const char kThinSeparator[] = - "// -------------------------------------------------------------------\n"; - -bool CanInitializeByZeroing(const FieldDescriptor* field) { - if (field->is_repeated() || field->is_extension()) return false; - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_ENUM: - return field->default_value_enum()->number() == 0; - case FieldDescriptor::CPPTYPE_INT32: - return field->default_value_int32() == 0; - case FieldDescriptor::CPPTYPE_INT64: - return field->default_value_int64() == 0; - case FieldDescriptor::CPPTYPE_UINT32: - return field->default_value_uint32() == 0; - case FieldDescriptor::CPPTYPE_UINT64: - return field->default_value_uint64() == 0; - case FieldDescriptor::CPPTYPE_FLOAT: - return field->default_value_float() == 0; - case FieldDescriptor::CPPTYPE_DOUBLE: - return field->default_value_double() == 0; - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool() == false; - default: - return false; - } -} - -std::string ClassName(const Descriptor* descriptor) { - const Descriptor* parent = descriptor->containing_type(); - std::string res; - if (parent) res += ClassName(parent) + "_"; - res += descriptor->name(); - if (IsMapEntryMessage(descriptor)) res += "_DoNotUse"; - return ResolveKeyword(res); -} - -std::string ClassName(const EnumDescriptor* enum_descriptor) { - if (enum_descriptor->containing_type() == nullptr) { - return ResolveKeyword(enum_descriptor->name()); - } else { - return ClassName(enum_descriptor->containing_type()) + "_" + - enum_descriptor->name(); - } -} - -std::string QualifiedClassName(const Descriptor* d, const Options& options) { - return QualifiedFileLevelSymbol(d->file(), ClassName(d), options); -} - -std::string QualifiedClassName(const EnumDescriptor* d, - const Options& options) { - return QualifiedFileLevelSymbol(d->file(), ClassName(d), options); -} - -std::string QualifiedClassName(const Descriptor* d) { - return QualifiedClassName(d, Options()); -} - -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); -} - -std::string Namespace(const FileDescriptor* d, const Options& options) { - std::string ret = Namespace(d->package()); - if (IsWellKnownMessage(d) && options.opensource_runtime) { - // Written with string concatenation to prevent rewriting of - // ::google::protobuf. - ret = StringReplace(ret, - "::google::" - "protobuf", - "::PROTOBUF_NAMESPACE_ID", false); - } - return ret; -} - -std::string Namespace(const Descriptor* d, const Options& options) { - return Namespace(d->file(), options); -} - -std::string Namespace(const FieldDescriptor* d, const Options& options) { - return Namespace(d->file(), options); -} - -std::string Namespace(const EnumDescriptor* d, const Options& options) { - return Namespace(d->file(), options); -} - -std::string DefaultInstanceType(const Descriptor* descriptor, - const Options& /*options*/, bool split) { - return ClassName(descriptor) + (split ? "__Impl_Split" : "") + - "DefaultTypeInternal"; -} - -std::string DefaultInstanceName(const Descriptor* descriptor, - const Options& /*options*/, bool split) { - return "_" + ClassName(descriptor, false) + (split ? "__Impl_Split" : "") + - "_default_instance_"; -} - -std::string DefaultInstancePtr(const Descriptor* descriptor, - const Options& options, bool split) { - return DefaultInstanceName(descriptor, options, split) + "ptr_"; -} - -std::string QualifiedDefaultInstanceName(const Descriptor* descriptor, - const Options& options, bool split) { - return QualifiedFileLevelSymbol( - descriptor->file(), DefaultInstanceName(descriptor, options, split), - options); -} - -std::string QualifiedDefaultInstancePtr(const Descriptor* descriptor, - const Options& options, bool split) { - return QualifiedDefaultInstanceName(descriptor, options, split) + "ptr_"; -} - -std::string DescriptorTableName(const FileDescriptor* file, - const Options& options) { - return UniqueName("descriptor_table", file, options); -} - -std::string FileDllExport(const FileDescriptor* file, const Options& options) { - return UniqueName("PROTOBUF_INTERNAL_EXPORT", file, options); -} - -std::string SuperClassName(const Descriptor* descriptor, - const Options& options) { - 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) { - if (kKeywords.count(name) > 0) { - return name + "_"; - } - return name; -} - -std::string FieldName(const FieldDescriptor* field) { - std::string result = field->name(); - LowerString(&result); - if (kKeywords.count(result) > 0) { - result.append("_"); - } - return result; -} - -std::string FieldMemberName(const FieldDescriptor* field, bool split) { - StringPiece prefix = - IsMapEntryMessage(field->containing_type()) ? "" : "_impl_."; - StringPiece split_prefix = split ? "_split_->" : ""; - if (field->real_containing_oneof() == nullptr) { - return StrCat(prefix, split_prefix, FieldName(field), "_"); - } - // Oneof fields are never split. - GOOGLE_CHECK(!split); - return StrCat(prefix, field->containing_oneof()->name(), "_.", - FieldName(field), "_"); -} - -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) { - result.append("_"); - } - return result; -} - -int EstimateAlignmentSize(const FieldDescriptor* field) { - if (field == nullptr) return 0; - if (field->is_repeated()) return 8; - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_BOOL: - return 1; - - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_UINT32: - case FieldDescriptor::CPPTYPE_ENUM: - case FieldDescriptor::CPPTYPE_FLOAT: - return 4; - - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT64: - case FieldDescriptor::CPPTYPE_DOUBLE: - case FieldDescriptor::CPPTYPE_STRING: - case FieldDescriptor::CPPTYPE_MESSAGE: - return 8; - } - GOOGLE_LOG(FATAL) << "Can't get here."; - return -1; // Make compiler happy. -} - -std::string FieldConstantName(const FieldDescriptor* field) { - std::string field_name = UnderscoresToCamelCase(field->name(), true); - std::string result = "k" + field_name + "FieldNumber"; - - if (!field->is_extension() && - field->containing_type()->FindFieldByCamelcaseName( - field->camelcase_name()) != field) { - // This field's camelcase name is not unique. As a hack, add the field - // number to the constant name. This makes the constant rather useless, - // but what can we do? - result += "_" + StrCat(field->number()); - } - - return result; -} - -std::string FieldMessageTypeName(const FieldDescriptor* field, - const Options& options) { - // Note: The Google-internal version of Protocol Buffers uses this function - // as a hook point for hacks to support legacy code. - return QualifiedClassName(field->message_type(), options); -} - -std::string StripProto(const std::string& filename) { - /* - * 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 "int32_t"; - case FieldDescriptor::CPPTYPE_INT64: - return "int64_t"; - case FieldDescriptor::CPPTYPE_UINT32: - return "uint32_t"; - case FieldDescriptor::CPPTYPE_UINT64: - return "uint64_t"; - case FieldDescriptor::CPPTYPE_DOUBLE: - return "double"; - case FieldDescriptor::CPPTYPE_FLOAT: - return "float"; - case FieldDescriptor::CPPTYPE_BOOL: - return "bool"; - case FieldDescriptor::CPPTYPE_ENUM: - return "int"; - case FieldDescriptor::CPPTYPE_STRING: - return "std::string"; - case FieldDescriptor::CPPTYPE_MESSAGE: - return nullptr; - - // No default because we want the compiler to complain if any new - // CppTypes are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return nullptr; -} - -std::string PrimitiveTypeName(const Options& options, - FieldDescriptor::CppType type) { - switch (type) { - case FieldDescriptor::CPPTYPE_INT32: - return IntTypeName(options, "int32"); - case FieldDescriptor::CPPTYPE_INT64: - return IntTypeName(options, "int64"); - case FieldDescriptor::CPPTYPE_UINT32: - return IntTypeName(options, "uint32"); - case FieldDescriptor::CPPTYPE_UINT64: - return IntTypeName(options, "uint64"); - case FieldDescriptor::CPPTYPE_DOUBLE: - return "double"; - case FieldDescriptor::CPPTYPE_FLOAT: - return "float"; - case FieldDescriptor::CPPTYPE_BOOL: - return "bool"; - case FieldDescriptor::CPPTYPE_ENUM: - return "int"; - case FieldDescriptor::CPPTYPE_STRING: - return "std::string"; - case FieldDescriptor::CPPTYPE_MESSAGE: - return ""; - - // No default because we want the compiler to complain if any new - // CppTypes are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return ""; -} - -const char* DeclaredTypeMethodName(FieldDescriptor::Type type) { - switch (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_FLOAT: - return "Float"; - case FieldDescriptor::TYPE_DOUBLE: - return "Double"; - - 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_GROUP: - return "Group"; - case FieldDescriptor::TYPE_MESSAGE: - return "Message"; - - // No default because we want the compiler to complain if any new - // types are added. - } - GOOGLE_LOG(FATAL) << "Can't get here."; - return ""; -} - -std::string Int32ToString(int 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(number + 1, " - 1"); - } else { - return StrCat(number); - } -} - -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("int64_t{", number + 1, "} - 1"); - } - return StrCat("int64_t{", number, "}"); -} - -static std::string UInt64ToString(uint64_t number) { - return StrCat("uint64_t{", number, "u}"); -} - -std::string DefaultValue(const FieldDescriptor* field) { - return DefaultValue(Options(), field); -} - -std::string DefaultValue(const Options& options, const FieldDescriptor* field) { - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return Int32ToString(field->default_value_int32()); - case FieldDescriptor::CPPTYPE_UINT32: - return StrCat(field->default_value_uint32()) + "u"; - case FieldDescriptor::CPPTYPE_INT64: - return Int64ToString(field->default_value_int64()); - case FieldDescriptor::CPPTYPE_UINT64: - return UInt64ToString(field->default_value_uint64()); - case FieldDescriptor::CPPTYPE_DOUBLE: { - double value = field->default_value_double(); - if (value == std::numeric_limits::infinity()) { - return "std::numeric_limits::infinity()"; - } else if (value == -std::numeric_limits::infinity()) { - return "-std::numeric_limits::infinity()"; - } else if (value != value) { - return "std::numeric_limits::quiet_NaN()"; - } else { - return SimpleDtoa(value); - } - } - case FieldDescriptor::CPPTYPE_FLOAT: { - float value = field->default_value_float(); - if (value == std::numeric_limits::infinity()) { - return "std::numeric_limits::infinity()"; - } else if (value == -std::numeric_limits::infinity()) { - return "-std::numeric_limits::infinity()"; - } else if (value != value) { - return "std::numeric_limits::quiet_NaN()"; - } else { - std::string float_value = SimpleFtoa(value); - // If floating point value contains a period (.) or an exponent - // (either E or e), then append suffix 'f' to make it a float - // literal. - if (float_value.find_first_of(".eE") != std::string::npos) { - float_value.push_back('f'); - } - return float_value; - } - } - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool() ? "true" : "false"; - case FieldDescriptor::CPPTYPE_ENUM: - // Lazy: Generate a static_cast because we don't have a helper function - // that constructs the full name of an enum value. - return strings::Substitute( - "static_cast< $0 >($1)", ClassName(field->enum_type(), true), - Int32ToString(field->default_value_enum()->number())); - case FieldDescriptor::CPPTYPE_STRING: - return "\"" + - EscapeTrigraphs(CEscape(field->default_value_string())) + - "\""; - case FieldDescriptor::CPPTYPE_MESSAGE: - return "*" + FieldMessageTypeName(field, options) + - "::internal_default_instance()"; - } - // Can't actually get here; make compiler happy. (We could add a default - // case above but then we wouldn't get the nice compiler warning when a - // new type is added.) - GOOGLE_LOG(FATAL) << "Can't get here."; - return ""; -} - -// Convert a file name into a valid identifier. -std::string FilenameIdentifier(const std::string& filename) { - std::string result; - for (int i = 0; i < filename.size(); i++) { - if (ascii_isalnum(filename[i])) { - result.push_back(filename[i]); - } 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]))); - } - } - return result; -} - -std::string UniqueName(const std::string& name, const std::string& filename, - const Options& options) { - return name + "_" + FilenameIdentifier(filename); -} - -// Return the qualified C++ name for a file level symbol. -std::string QualifiedFileLevelSymbol(const FileDescriptor* file, - const std::string& name, - const Options& options) { - if (file->package().empty()) { - return StrCat("::", name); - } - return StrCat(Namespace(file, options), "::", name); -} - -// Escape C++ trigraphs by escaping question marks to \? -std::string EscapeTrigraphs(const std::string& to_escape) { - return StringReplace(to_escape, "?", "\\?", true); -} - -// Escaped function name to eliminate naming conflict. -std::string SafeFunctionName(const Descriptor* descriptor, - const FieldDescriptor* field, - const std::string& prefix) { - // Do not use FieldName() since it will escape keywords. - std::string name = field->name(); - LowerString(&name); - std::string function_name = prefix + name; - if (descriptor->FindFieldByName(function_name)) { - // Single underscore will also make it conflicting with the private data - // member. We use double underscore to escape function names. - function_name.append("__"); - } else if (kKeywords.count(name) > 0) { - // If the field name is a keyword, we append the underscore back to keep it - // consistent with other function names. - function_name.append("_"); - } - return function_name; -} - -bool IsStringInlined(const FieldDescriptor* descriptor, - const Options& options) { - (void)descriptor; - (void)options; - return false; -} - -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, scc_analyzer)) { - return true; - } - } - for (int idx = 0; idx < descriptor->extension_count(); idx++) { - 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, scc_analyzer)) { - return true; - } - } - return false; -} - -// Does the given FileDescriptor use lazy fields? -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, scc_analyzer)) { - return true; - } - } - for (int field_idx = 0; field_idx < file->extension_count(); field_idx++) { - if (IsLazy(file->extension(field_idx), options, scc_analyzer)) { - return true; - } - } - return false; -} - -bool ShouldSplit(const Descriptor*, const Options&) { return false; } -bool ShouldSplit(const FieldDescriptor*, const Options&) { return false; } - -static bool HasRepeatedFields(const Descriptor* descriptor) { - for (int i = 0; i < descriptor->field_count(); ++i) { - if (descriptor->field(i)->label() == FieldDescriptor::LABEL_REPEATED) { - return true; - } - } - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - if (HasRepeatedFields(descriptor->nested_type(i))) return true; - } - return false; -} - -bool HasRepeatedFields(const FileDescriptor* file) { - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasRepeatedFields(file->message_type(i))) return true; - } - return false; -} - -static bool IsStringPieceField(const FieldDescriptor* field, - const Options& options) { - return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - EffectiveStringCType(field, options) == FieldOptions::STRING_PIECE; -} - -static bool HasStringPieceFields(const Descriptor* descriptor, - const Options& options) { - for (int i = 0; i < descriptor->field_count(); ++i) { - if (IsStringPieceField(descriptor->field(i), options)) return true; - } - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - if (HasStringPieceFields(descriptor->nested_type(i), options)) return true; - } - return false; -} - -bool HasStringPieceFields(const FileDescriptor* file, const Options& options) { - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasStringPieceFields(file->message_type(i), options)) return true; - } - return false; -} - -static bool IsCordField(const FieldDescriptor* field, const Options& options) { - return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - EffectiveStringCType(field, options) == FieldOptions::CORD; -} - -static bool HasCordFields(const Descriptor* descriptor, - const Options& options) { - for (int i = 0; i < descriptor->field_count(); ++i) { - if (IsCordField(descriptor->field(i), options)) return true; - } - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - if (HasCordFields(descriptor->nested_type(i), options)) return true; - } - return false; -} - -bool HasCordFields(const FileDescriptor* file, const Options& options) { - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasCordFields(file->message_type(i), options)) return true; - } - return false; -} - -static bool HasExtensionsOrExtendableMessage(const Descriptor* descriptor) { - if (descriptor->extension_range_count() > 0) return true; - if (descriptor->extension_count() > 0) return true; - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - if (HasExtensionsOrExtendableMessage(descriptor->nested_type(i))) { - return true; - } - } - return false; -} - -bool HasExtensionsOrExtendableMessage(const FileDescriptor* file) { - if (file->extension_count() > 0) return true; - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasExtensionsOrExtendableMessage(file->message_type(i))) return true; - } - return false; -} - -static bool HasMapFields(const Descriptor* descriptor) { - for (int i = 0; i < descriptor->field_count(); ++i) { - if (descriptor->field(i)->is_map()) { - return true; - } - } - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - if (HasMapFields(descriptor->nested_type(i))) return true; - } - return false; -} - -bool HasMapFields(const FileDescriptor* file) { - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasMapFields(file->message_type(i))) return true; - } - return false; -} - -static bool HasEnumDefinitions(const Descriptor* message_type) { - if (message_type->enum_type_count() > 0) return true; - for (int i = 0; i < message_type->nested_type_count(); ++i) { - if (HasEnumDefinitions(message_type->nested_type(i))) return true; - } - return false; -} - -bool HasEnumDefinitions(const FileDescriptor* file) { - if (file->enum_type_count() > 0) return true; - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasEnumDefinitions(file->message_type(i))) return true; - } - 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 IsUtf8String(const FieldDescriptor* field) { - return IsProto3(field->file()) && - field->type() == FieldDescriptor::TYPE_STRING; -} - -VerifySimpleType ShouldVerifySimple(const Descriptor* descriptor) { - (void)descriptor; - return VerifySimpleType::kCustom; -} - -bool IsStringOrMessage(const FieldDescriptor* field) { - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT32: - case FieldDescriptor::CPPTYPE_UINT64: - case FieldDescriptor::CPPTYPE_DOUBLE: - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_BOOL: - case FieldDescriptor::CPPTYPE_ENUM: - return false; - case FieldDescriptor::CPPTYPE_STRING: - case FieldDescriptor::CPPTYPE_MESSAGE: - return true; - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return false; -} - -FieldOptions::CType EffectiveStringCType(const FieldDescriptor* field, - const Options& options) { - GOOGLE_DCHECK(field->cpp_type() == FieldDescriptor::CPPTYPE_STRING); - if (options.opensource_runtime) { - // Open-source protobuf release only supports STRING ctype. - return FieldOptions::STRING; - } else { - // Google-internal supports all ctypes. - return field->options().ctype(); - } -} - -bool IsAnyMessage(const FileDescriptor* descriptor, const Options& options) { - return descriptor->name() == kAnyProtoFile; -} - -bool IsAnyMessage(const Descriptor* descriptor, const Options& options) { - return descriptor->name() == kAnyMessageName && - IsAnyMessage(descriptor->file(), options); -} - -bool IsWellKnownMessage(const FileDescriptor* file) { - static const std::unordered_set well_known_files{ - "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", - }; - return well_known_files.find(file->name()) != well_known_files.end(); -} - -static bool FieldEnforceUtf8(const FieldDescriptor* field, - const Options& options) { - return true; -} - -static bool FileUtf8Verification(const FileDescriptor* file, - const Options& options) { - return true; -} - -// Which level of UTF-8 enforcemant is placed on this file. -Utf8CheckMode GetUtf8CheckMode(const FieldDescriptor* field, - const Options& options) { - if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 && - FieldEnforceUtf8(field, options)) { - return Utf8CheckMode::kStrict; - } else if (GetOptimizeFor(field->file(), options) != - FileOptions::LITE_RUNTIME && - FileUtf8Verification(field->file(), options)) { - return Utf8CheckMode::kVerify; - } else { - return Utf8CheckMode::kNone; - } -} - -static void GenerateUtf8CheckCode(const FieldDescriptor* field, - const Options& options, bool for_parse, - const char* parameters, - const char* strict_function, - const char* verify_function, - const Formatter& format) { - switch (GetUtf8CheckMode(field, options)) { - case Utf8CheckMode::kStrict: { - if (for_parse) { - format("DO_("); - } - format("::$proto_ns$::internal::WireFormatLite::$1$(\n", strict_function); - format.Indent(); - format(parameters); - if (for_parse) { - format("::$proto_ns$::internal::WireFormatLite::PARSE,\n"); - } else { - format("::$proto_ns$::internal::WireFormatLite::SERIALIZE,\n"); - } - format("\"$1$\")", field->full_name()); - if (for_parse) { - format(")"); - } - format(";\n"); - format.Outdent(); - break; - } - case Utf8CheckMode::kVerify: { - format("::$proto_ns$::internal::WireFormat::$1$(\n", verify_function); - format.Indent(); - format(parameters); - if (for_parse) { - format("::$proto_ns$::internal::WireFormat::PARSE,\n"); - } else { - format("::$proto_ns$::internal::WireFormat::SERIALIZE,\n"); - } - format("\"$1$\");\n", field->full_name()); - format.Outdent(); - break; - } - case Utf8CheckMode::kNone: - break; - } -} - -void GenerateUtf8CheckCodeForString(const FieldDescriptor* field, - const Options& options, bool for_parse, - const char* parameters, - const Formatter& format) { - GenerateUtf8CheckCode(field, options, for_parse, parameters, - "VerifyUtf8String", "VerifyUTF8StringNamedField", - format); -} - -void GenerateUtf8CheckCodeForCord(const FieldDescriptor* field, - const Options& options, bool for_parse, - const char* parameters, - const Formatter& format) { - GenerateUtf8CheckCode(field, options, for_parse, parameters, "VerifyUtf8Cord", - "VerifyUTF8CordNamedField", format); -} - -void FlattenMessagesInFile(const FileDescriptor* file, - std::vector* result) { - for (int i = 0; i < file->message_type_count(); i++) { - ForEachMessage(file->message_type(i), [&](const Descriptor* descriptor) { - result->push_back(descriptor); - }); - } -} - -bool HasWeakFields(const Descriptor* descriptor, const Options& options) { - for (int i = 0; i < descriptor->field_count(); i++) { - if (IsWeak(descriptor->field(i), options)) return true; - } - return false; -} - -bool HasWeakFields(const FileDescriptor* file, const Options& options) { - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasWeakFields(file->message_type(i), options)) return true; - } - return false; -} - -bool UsingImplicitWeakFields(const FileDescriptor* file, - const Options& options) { - return options.lite_implicit_weak_fields && - GetOptimizeFor(file, options) == FileOptions::LITE_RUNTIME; -} - -bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - return UsingImplicitWeakFields(field->file(), options) && - field->type() == FieldDescriptor::TYPE_MESSAGE && - !field->is_required() && !field->is_map() && !field->is_extension() && - !IsWellKnownMessage(field->message_type()->file()) && - field->message_type()->file()->name() != - "net/proto2/proto/descriptor.proto" && - // We do not support implicit weak fields between messages in the same - // strongly-connected component. - scc_analyzer->GetSCC(field->containing_type()) != - scc_analyzer->GetSCC(field->message_type()); -} - -MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) { - if (analysis_cache_.count(scc)) return analysis_cache_[scc]; - 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; - } - 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: { - if (field->options().ctype() == FieldOptions::CORD) { - result.contains_cord = true; - } - break; - } - case FieldDescriptor::TYPE_GROUP: - case FieldDescriptor::TYPE_MESSAGE: { - const SCC* child = analyzer_.GetSCC(field->message_type()); - if (child != scc) { - MessageAnalysis analysis = GetSCCAnalysis(child); - result.contains_cord |= analysis.contains_cord; - result.contains_extension |= analysis.contains_extension; - 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 - // nodes it has to be recursive, however this test also works for - // a single node that is recursive. - result.is_recursive = true; - } - break; - } - default: - break; - } - } - } - // We deliberately only insert the result here. After we contracted the SCC - // in the graph, the graph should be a DAG. Hence we shouldn't need to mark - // nodes visited as we can never return to them. By inserting them here - // we will go in an infinite loop if the SCC is not correct. - return analysis_cache_[scc] = result; -} - -void ListAllFields(const Descriptor* d, - std::vector* fields) { - // Collect sub messages - for (int i = 0; i < d->nested_type_count(); i++) { - ListAllFields(d->nested_type(i), fields); - } - // Collect message level extensions. - for (int i = 0; i < d->extension_count(); i++) { - fields->push_back(d->extension(i)); - } - // Add types of fields necessary - for (int i = 0; i < d->field_count(); i++) { - fields->push_back(d->field(i)); - } -} - -void ListAllFields(const FileDescriptor* d, - std::vector* fields) { - // Collect file level message. - for (int i = 0; i < d->message_type_count(); i++) { - ListAllFields(d->message_type(i), fields); - } - // Collect message level extensions. - for (int i = 0; i < d->extension_count(); i++) { - fields->push_back(d->extension(i)); - } -} - -void ListAllTypesForServices(const FileDescriptor* fd, - std::vector* types) { - for (int i = 0; i < fd->service_count(); i++) { - const ServiceDescriptor* sd = fd->service(i); - for (int j = 0; j < sd->method_count(); j++) { - const MethodDescriptor* method = sd->method(j); - types->push_back(method->input_type()); - types->push_back(method->output_type()); - } - } -} - -bool GetBootstrapBasename(const Options& options, const std::string& basename, - std::string* bootstrap_basename) { - if (options.opensource_runtime) { - return false; - } - - std::unordered_map bootstrap_mapping{ - {"net/proto2/proto/descriptor", - "third_party/protobuf/descriptor"}, - {"net/proto2/compiler/proto/plugin", - "net/proto2/compiler/proto/plugin"}, - {"net/proto2/compiler/proto/profile", - "net/proto2/compiler/proto/profile_bootstrap"}, - }; - auto iter = bootstrap_mapping.find(basename); - if (iter == bootstrap_mapping.end()) { - *bootstrap_basename = basename; - return false; - } else { - *bootstrap_basename = iter->second; - return true; - } -} - -bool IsBootstrapProto(const Options& options, const FileDescriptor* file) { - std::string my_name = StripProto(file->name()); - return GetBootstrapBasename(options, my_name, &my_name); -} - -bool MaybeBootstrap(const Options& options, GeneratorContext* generator_context, - bool bootstrap_flag, std::string* basename) { - std::string bootstrap_basename; - if (!GetBootstrapBasename(options, *basename, &bootstrap_basename)) { - return false; - } - - if (bootstrap_flag) { - // Adjust basename, but don't abort code generation. - *basename = bootstrap_basename; - return false; - } else { - const std::string& forward_to_basename = bootstrap_basename; - - // Generate forwarding headers and empty .pb.cc. - { - std::unique_ptr output( - generator_context->Open(*basename + ".pb.h")); - io::Printer printer(output.get(), '$', nullptr); - printer.Print( - "#ifndef PROTOBUF_INCLUDED_$filename_identifier$_FORWARD_PB_H\n" - "#define PROTOBUF_INCLUDED_$filename_identifier$_FORWARD_PB_H\n" - "#include \"$forward_to_basename$.pb.h\" // IWYU pragma: export\n" - "#endif // PROTOBUF_INCLUDED_$filename_identifier$_FORWARD_PB_H\n", - "forward_to_basename", forward_to_basename, "filename_identifier", - FilenameIdentifier(*basename)); - - if (!options.opensource_runtime) { - // HACK HACK HACK, tech debt from the deeps of proto1 and SWIG - // protocoltype is SWIG'ed and we need to forward - if (*basename == "net/proto/protocoltype") { - printer.Print( - "#ifdef SWIG\n" - "%include \"$forward_to_basename$.pb.h\"\n" - "#endif // SWIG\n", - "forward_to_basename", forward_to_basename); - } - } - } - - { - std::unique_ptr output( - generator_context->Open(*basename + ".proto.h")); - io::Printer printer(output.get(), '$', nullptr); - printer.Print( - "#ifndef PROTOBUF_INCLUDED_$filename_identifier$_FORWARD_PROTO_H\n" - "#define PROTOBUF_INCLUDED_$filename_identifier$_FORWARD_PROTO_H\n" - "#include \"$forward_to_basename$.proto.h\" // IWYU pragma: " - "export\n" - "#endif // " - "PROTOBUF_INCLUDED_$filename_identifier$_FORWARD_PROTO_H\n", - "forward_to_basename", forward_to_basename, "filename_identifier", - FilenameIdentifier(*basename)); - } - - { - std::unique_ptr output( - generator_context->Open(*basename + ".pb.cc")); - io::Printer printer(output.get(), '$', nullptr); - printer.Print("\n"); - } - - { - std::unique_ptr output( - generator_context->Open(*basename + ".pb.h.meta")); - } - - { - std::unique_ptr output( - generator_context->Open(*basename + ".proto.h.meta")); - } - - // Abort code generation. - return true; - } -} - -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; - } - // 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; - } - } - // 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; - } - } - } else { - if (HasExtensionFromFile(reflection->GetMessage(msg, field), file, - options, has_opt_codesize_extension)) { - return true; - } - } - } - return false; -} - -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; - } - if (HasBootstrapProblem(file, options, has_opt_codesize_extension)) { - return FileOptions::SPEED; - } - 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; - } - } - 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; -} - -inline bool IsMessageOwnedArenaEligible(const Descriptor* desc, - const Options& options) { - return GetOptimizeFor(desc->file(), options) != FileOptions::LITE_RUNTIME && - !options.bootstrap && !options.opensource_runtime && - AllocExpected(desc); -} - -bool EnableMessageOwnedArena(const Descriptor* desc, const Options& options) { - (void)desc; - (void)options; - return false; -} - -bool EnableMessageOwnedArenaTrial(const Descriptor* desc, - const Options& options) { - return false; -} - -bool HasMessageFieldOrExtension(const Descriptor* desc) { - if (desc->extension_range_count() > 0) return true; - for (const auto* f : FieldRange(desc)) { - if (f->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) return true; - } - return false; -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/helpers.h b/depends/protobuf/src/google/protobuf/compiler/cpp/helpers.h deleted file mode 100644 index d8dcda724..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/helpers.h +++ /dev/null @@ -1,1064 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -enum class ArenaDtorNeeds { kNone = 0, kOnDemand = 1, kRequired = 2 }; - -inline std::string ProtobufNamespace(const Options& /* options */) { - return "PROTOBUF_NAMESPACE_ID"; -} - -inline std::string MacroPrefix(const Options& /* options */) { - return "GOOGLE_PROTOBUF"; -} - -inline std::string DeprecatedAttribute(const Options& /* options */, - const FieldDescriptor* d) { - return d->options().deprecated() ? "PROTOBUF_DEPRECATED " : ""; -} - -inline std::string DeprecatedAttribute(const Options& /* options */, - const EnumValueDescriptor* d) { - return d->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM " : ""; -} - -// Commonly-used separator comments. Thick is a line of '=', thin is a line -// of '-'. -extern const char kThickSeparator[]; -extern const char kThinSeparator[]; - -void SetCommonVars(const Options& options, - std::map* variables); - -// Variables to access message data from the message scope. -void SetCommonMessageDataVariables( - const Descriptor* descriptor, - 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, - bool bootstrap_flag, std::string* basename); -bool IsBootstrapProto(const Options& options, const FileDescriptor* file); - -// Name space of the proto file. This namespace is such that the string -// "::some_name" is the correct fully qualified namespace. -// This means if the package is empty the namespace is "", and otherwise -// the namespace is "::foo::bar::...::baz" without trailing semi-colons. -std::string Namespace(const FileDescriptor* d, const Options& options); -std::string Namespace(const Descriptor* d, const Options& options); -std::string Namespace(const FieldDescriptor* d, const Options& options); -std::string Namespace(const EnumDescriptor* d, const Options& options); - -// Returns true if it's safe to reset "field" to zero. -bool CanInitializeByZeroing(const FieldDescriptor* field); - -std::string ClassName(const Descriptor* descriptor); -std::string ClassName(const EnumDescriptor* enum_descriptor); - -std::string QualifiedClassName(const Descriptor* d, const Options& options); -std::string QualifiedClassName(const EnumDescriptor* d, const Options& options); - -std::string QualifiedClassName(const Descriptor* d); -std::string QualifiedClassName(const EnumDescriptor* d); - -// DEPRECATED just use ClassName or QualifiedClassName, a boolean is very -// unreadable at the callsite. -// Returns the non-nested type name for the given type. If "qualified" is -// true, prefix the type with the full namespace. For example, if you had: -// package foo.bar; -// message Baz { message Moo {} } -// Then the qualified ClassName for Moo would be: -// ::foo::bar::Baz_Moo -// While the non-qualified version would be: -// Baz_Moo -inline std::string ClassName(const Descriptor* descriptor, bool qualified) { - return qualified ? QualifiedClassName(descriptor, Options()) - : ClassName(descriptor); -} - -inline std::string ClassName(const EnumDescriptor* descriptor, bool qualified) { - return qualified ? QualifiedClassName(descriptor, Options()) - : 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, bool split = false); - -// Non-qualified name of the default_instance of this message. -std::string DefaultInstanceName(const Descriptor* descriptor, - const Options& options, bool split = false); - -// Non-qualified name of the default instance pointer. This is used only for -// implicit weak fields, where we need an extra indirection. -std::string DefaultInstancePtr(const Descriptor* descriptor, - const Options& options, bool split = false); - -// Fully qualified name of the default_instance of this message. -std::string QualifiedDefaultInstanceName(const Descriptor* descriptor, - const Options& options, - bool split = false); - -// Fully qualified name of the default instance pointer. -std::string QualifiedDefaultInstancePtr(const Descriptor* descriptor, - const Options& options, - bool split = false); - -// DescriptorTable variable name. -std::string DescriptorTableName(const FileDescriptor* file, - const Options& options); - -// When declaring symbol externs from another file, this macro will supply the -// dllexport needed for the target file, if any. -std::string FileDllExport(const FileDescriptor* file, const Options& options); - -// Name of the base class: google::protobuf::Message or google::protobuf::MessageLite. -std::string SuperClassName(const Descriptor* descriptor, - const Options& options); - -// Adds an underscore if necessary to prevent conflicting with a keyword. -std::string ResolveKeyword(const std::string& name); - -// 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); - -// Returns the (unqualified) private member name for this field in C++ code. -std::string FieldMemberName(const FieldDescriptor* field, bool split); - -// 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 -// 64-bit pointers. -int EstimateAlignmentSize(const FieldDescriptor* field); - -// Get the unqualified name that should be used for a field's field -// number constant. -std::string FieldConstantName(const FieldDescriptor* field); - -// Returns the scope where the field was defined (for extensions, this is -// different from the message type to which the field applies). -inline const Descriptor* FieldScope(const FieldDescriptor* field) { - return field->is_extension() ? field->extension_scope() - : field->containing_type(); -} - -// Returns the fully-qualified type name field->message_type(). Usually this -// is just ClassName(field->message_type(), true); -std::string FieldMessageTypeName(const FieldDescriptor* field, - const Options& options); - -// 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, - FieldDescriptor::CppType type); - -// Get the declared type name in CamelCase format, as is used e.g. for the -// methods of WireFormat. For example, TYPE_INT32 becomes "Int32". -const char* DeclaredTypeMethodName(FieldDescriptor::Type type); - -// Return the code that evaluates to the number when compiled. -std::string Int32ToString(int number); - -// Get code that evaluates to the field's default value. -std::string DefaultValue(const Options& options, const FieldDescriptor* field); - -// Compatibility function for callers outside proto2. -std::string DefaultValue(const FieldDescriptor* field); - -// Convert a file name into a valid identifier. -std::string FilenameIdentifier(const std::string& filename); - -// For each .proto file generates a unique name. To prevent collisions of -// symbols in the global namespace -std::string UniqueName(const std::string& name, const std::string& filename, - const Options& options); -inline std::string UniqueName(const std::string& name, const FileDescriptor* d, - const Options& options) { - return UniqueName(name, d->name(), options); -} -inline std::string UniqueName(const std::string& name, const Descriptor* d, - const Options& options) { - return UniqueName(name, d->file(), options); -} -inline std::string UniqueName(const std::string& name, const EnumDescriptor* d, - const Options& options) { - return UniqueName(name, d->file(), options); -} -inline std::string UniqueName(const std::string& name, - const ServiceDescriptor* d, - const Options& options) { - return UniqueName(name, d->file(), options); -} - -// Versions for call sites that only support the internal runtime (like proto1 -// support). -inline Options InternalRuntimeOptions() { - Options options; - options.opensource_runtime = false; - return options; -} -inline std::string UniqueName(const std::string& name, - const std::string& filename) { - return UniqueName(name, filename, InternalRuntimeOptions()); -} -inline std::string UniqueName(const std::string& name, - const FileDescriptor* d) { - return UniqueName(name, d->name(), InternalRuntimeOptions()); -} -inline std::string UniqueName(const std::string& name, const Descriptor* d) { - return UniqueName(name, d->file(), InternalRuntimeOptions()); -} -inline std::string UniqueName(const std::string& name, - const EnumDescriptor* d) { - return UniqueName(name, d->file(), InternalRuntimeOptions()); -} -inline std::string UniqueName(const std::string& name, - const ServiceDescriptor* d) { - return UniqueName(name, d->file(), InternalRuntimeOptions()); -} - -// Return the qualified C++ name for a file level symbol. -std::string QualifiedFileLevelSymbol(const FileDescriptor* file, - const std::string& name, - const Options& options); - -// Escape C++ trigraphs by escaping question marks to \? -std::string EscapeTrigraphs(const std::string& to_escape); - -// Escaped function name to eliminate naming conflict. -std::string SafeFunctionName(const Descriptor* descriptor, - const FieldDescriptor* field, - const std::string& prefix); - -// Returns true if generated messages have public unknown fields accessors -inline bool PublicUnknownFieldsAccessors(const Descriptor* message) { - return message->file()->syntax() != FileDescriptor::SYNTAX_PROTO3; -} - -// Returns the optimize mode for , respecting . -FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file, - const Options& options); - -// Determines whether unknown fields will be stored in an UnknownFieldSet or -// a string. -inline bool UseUnknownFieldSet(const FileDescriptor* file, - const Options& options) { - return GetOptimizeFor(file, options) != FileOptions::LITE_RUNTIME; -} - -inline bool IsWeak(const FieldDescriptor* field, const Options& options) { - if (field->options().weak()) { - GOOGLE_CHECK(!options.opensource_runtime); - return true; - } - return false; -} - -bool IsStringInlined(const FieldDescriptor* descriptor, const Options& options); - -// For a string field, returns the effective ctype. If the actual ctype is -// not supported, returns the default of STRING. -FieldOptions::CType EffectiveStringCType(const FieldDescriptor* field, - const Options& options); - -inline bool IsCord(const FieldDescriptor* field, const Options& options) { - return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - 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, - MessageSCCAnalyzer* scc_analyzer); - -// Is the given field a supported lazy field? -bool IsLazy(const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - -// Is this an explicit (non-profile driven) lazy field, as denoted by -// lazy/unverified_lazy in the descriptor? -inline bool IsExplicitLazy(const FieldDescriptor* field) { - return field->options().lazy() || field->options().unverified_lazy(); -} - -bool IsEagerlyVerifiedLazy(const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - -bool IsLazilyVerifiedLazy(const FieldDescriptor* field, const Options& options); - -// Is the given message being split (go/pdsplit)? -bool ShouldSplit(const Descriptor* desc, const Options& options); - -// Is the given field being split out? -bool ShouldSplit(const FieldDescriptor* field, const Options& options); - -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); - -// Does the file have any repeated fields, necessitating the file to include -// repeated_field.h? This does not include repeated extensions, since those are -// all stored internally in an ExtensionSet, not a separate RepeatedField*. -bool HasRepeatedFields(const FileDescriptor* file); - -// Does the file have any string/bytes fields with ctype=STRING_PIECE? This -// does not include extensions, since ctype is ignored for extensions. -bool HasStringPieceFields(const FileDescriptor* file, const Options& options); - -// Does the file have any string/bytes fields with ctype=CORD? This does not -// include extensions, since ctype is ignored for extensions. -bool HasCordFields(const FileDescriptor* file, const Options& options); - -// Does the file have any map fields, necessitating the file to include -// map_field_inl.h and map.h. -bool HasMapFields(const FileDescriptor* file); - -// Does this file have any enum type definitions? -bool HasEnumDefinitions(const FileDescriptor* file); - -// Does this file have generated parsing, serialization, and other -// standard methods for which reflection-based fallback implementations exist? -inline bool HasGeneratedMethods(const FileDescriptor* file, - const Options& options) { - return GetOptimizeFor(file, options) != FileOptions::CODE_SIZE; -} - -// Do message classes in this file have descriptor and reflection methods? -inline bool HasDescriptorMethods(const FileDescriptor* file, - const Options& options) { - return GetOptimizeFor(file, options) != FileOptions::LITE_RUNTIME; -} - -// Should we generate generic services for this file? -inline bool HasGenericServices(const FileDescriptor* file, - const Options& options) { - return file->service_count() > 0 && - GetOptimizeFor(file, options) != FileOptions::LITE_RUNTIME && - file->options().cc_generic_services(); -} - -inline bool IsProto2MessageSet(const Descriptor* descriptor, - const Options& options) { - return !options.opensource_runtime && - options.enforce_mode != EnforceOptimizeMode::kLiteRuntime && - !options.lite_implicit_weak_fields && - descriptor->options().message_set_wire_format() && - descriptor->full_name() == "google.protobuf.bridge.MessageSet"; -} - -inline bool IsMapEntryMessage(const Descriptor* descriptor) { - return descriptor->options().map_entry(); -} - -// Returns true if the field's CPPTYPE is string or message. -bool IsStringOrMessage(const FieldDescriptor* field); - -std::string UnderscoresToCamelCase(const std::string& input, - bool cap_next_letter); - -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 -// in the enum field itself, rather than going to the UnknownFieldSet. -inline bool HasPreservingUnknownEnumSemantics(const FieldDescriptor* field) { - return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3; -} - -inline bool IsCrossFileMessage(const FieldDescriptor* field) { - return field->type() == FieldDescriptor::TYPE_MESSAGE && - field->message_type()->file() != field->file(); -} - -inline std::string MakeDefaultName(const FieldDescriptor* field) { - return StrCat("_i_give_permission_to_break_this_code_default_", - FieldName(field), "_"); -} - -// Semantically distinct from MakeDefaultName in that it gives the C++ code -// referencing a default field from the message scope, rather than just the -// variable name. -// For example, declarations of default variables should always use just -// MakeDefaultName to produce code like: -// Type _i_give_permission_to_break_this_code_default_field_; -// -// Code that references these should use MakeDefaultFieldName, in case the field -// exists at some nested level like: -// internal_container_._i_give_permission_to_break_this_code_default_field_; -inline std::string MakeDefaultFieldName(const FieldDescriptor* field) { - return StrCat("Impl_::", MakeDefaultName(field)); -} - -inline std::string MakeVarintCachedSizeName(const FieldDescriptor* field) { - return StrCat("_", FieldName(field), "_cached_byte_size_"); -} - -// Semantically distinct from MakeVarintCachedSizeName in that it gives the C++ -// code referencing the object from the message scope, rather than just the -// variable name. -// For example, declarations of default variables should always use just -// MakeVarintCachedSizeName to produce code like: -// Type _field_cached_byte_size_; -// -// Code that references these variables should use -// MakeVarintCachedSizeFieldName, in case the field exists at some nested level -// like: -// internal_container_._field_cached_byte_size_; -inline std::string MakeVarintCachedSizeFieldName(const FieldDescriptor* field, - bool split) { - return StrCat("_impl_.", split ? "_split_->" : "", "_", - FieldName(field), "_cached_byte_size_"); -} - -// Note: A lot of libraries detect Any protos based on Descriptor::full_name() -// while the two functions below use FileDescriptor::name(). In a sane world the -// two approaches should be equivalent. But if you are dealing with descriptors -// from untrusted sources, you might need to match semantics across libraries. -bool IsAnyMessage(const FileDescriptor* descriptor, const Options& options); -bool IsAnyMessage(const Descriptor* descriptor, const Options& options); - -bool IsWellKnownMessage(const FileDescriptor* descriptor); - -inline std::string IncludeGuard(const FileDescriptor* file, bool pb_h, - const Options& options) { - // If we are generating a .pb.h file and the proto_h option is enabled, then - // the .pb.h gets an extra suffix. - std::string filename_identifier = FilenameIdentifier( - file->name() + (pb_h && options.proto_h ? ".pb.h" : "")); - - if (IsWellKnownMessage(file)) { - // For well-known messages we need third_party/protobuf and net/proto2 to - // have distinct include guards, because some source files include both and - // both need to be defined (the third_party copies will be in the - // google::protobuf_opensource namespace). - return MacroPrefix(options) + "_INCLUDED_" + filename_identifier; - } else { - // Ideally this case would use distinct include guards for opensource and - // google3 protos also. (The behavior of "first #included wins" is not - // ideal). But unfortunately some legacy code includes both and depends on - // the identical include guards to avoid compile errors. - // - // We should clean this up so that this case can be removed. - return "GOOGLE_PROTOBUF_INCLUDED_" + filename_identifier; - } -} - -// 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) { - 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; - } -} - -// This orders the messages in a .pb.cc as it's outputted by file.cc -void FlattenMessagesInFile(const FileDescriptor* file, - std::vector* result); -inline std::vector FlattenMessagesInFile( - const FileDescriptor* file) { - std::vector result; - FlattenMessagesInFile(file, &result); - 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); - -// Returns true if the "required" restriction check should be ignored for the -// given field. -inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field, - const Options& options) { - // Do not check "required" for lazily verified lazy fields. - return IsLazilyVerifiedLazy(field, options); -} - -struct MessageAnalysis { - 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 -// quadratic performance, if we do this per message we would get O(V*(V+E)). -// Logically this is just only used in message.cc, but in the header for -// FileGenerator to help share it. -class PROTOC_EXPORT MessageSCCAnalyzer { - public: - explicit MessageSCCAnalyzer(const Options& options) : options_(options) {} - - MessageAnalysis GetSCCAnalysis(const SCC* scc); - - bool HasRequiredFields(const Descriptor* descriptor) { - 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); - } - - private: - struct DepsGenerator { - std::vector operator()(const Descriptor* desc) const { - std::vector deps; - for (int i = 0; i < desc->field_count(); i++) { - if (desc->field(i)->message_type()) { - deps.push_back(desc->field(i)->message_type()); - } - } - return deps; - } - }; - SCCAnalyzer analyzer_; - Options options_; - std::map analysis_cache_; -}; - -void ListAllFields(const Descriptor* d, - std::vector* fields); -void ListAllFields(const FileDescriptor* d, - std::vector* fields); - -template -void ForEachField(const Descriptor* d, T&& func) { - for (int i = 0; i < d->nested_type_count(); i++) { - ForEachField(d->nested_type(i), std::forward(func)); - } - for (int i = 0; i < d->extension_count(); i++) { - func(d->extension(i)); - } - for (int i = 0; i < d->field_count(); i++) { - func(d->field(i)); - } -} - -template -void ForEachField(const FileDescriptor* d, T&& func) { - for (int i = 0; i < d->message_type_count(); i++) { - ForEachField(d->message_type(i), std::forward(func)); - } - for (int i = 0; i < d->extension_count(); i++) { - func(d->extension(i)); - } -} - -void ListAllTypesForServices(const FileDescriptor* fd, - std::vector* types); - -// Indicates whether we should use implicit weak fields for this file. -bool UsingImplicitWeakFields(const FileDescriptor* file, - const Options& options); - -// Indicates whether to treat this field as implicitly weak. -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 ""; -} - -// Returns true if this message has a _tracker_ field. -inline bool HasTracker(const Descriptor* desc, const Options& options) { - return options.field_listener_options.inject_field_listener_events && - desc->file()->options().optimize_for() != - google::protobuf::FileOptions::LITE_RUNTIME; -} - -// Returns true if this message needs an Impl_ struct for it's data. -inline bool HasImplData(const Descriptor* desc, const Options& options) { - return !HasSimpleBaseClass(desc, options); -} - -// 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 -// the format string $1$, $2$, etc... are substituted for the first, second, ... -// direct argument respectively in the format call, it accepts both strings and -// integers. The implementation verifies all arguments are used and are "first" -// used in order of appearance in the argument list. For example, -// -// Format("return array[$1$];", 3) -> "return array[3];" -// Format("array[$2$] = $1$;", "Bla", 3) -> FATAL error (wrong order) -// Format("array[$1$] = $2$;", 3, "Bla") -> "array[3] = Bla;" -// -// The arguments can be used more than once like -// -// Format("array[$1$] = $2$; // Index = $1$", 3, "Bla") -> -// "array[3] = Bla; // Index = 3" -// -// If you use more arguments use the following style to help the reader, -// -// Format("int $1$() {\n" -// " array[$2$] = $3$;\n" -// " return $4$;" -// "}\n", -// funname, // 1 -// idx, // 2 -// varname, // 3 -// retval); // 4 -// -// but consider using named variables. Named variables like $foo$, with some -// identifier foo, are looked up in the map. One additional feature is that -// spaces are accepted between the '$' delimiters, $ foo$ will -// substitute to " bar" if foo stands for "bar", but in case it's empty -// will substitute to "". Hence, for example, -// -// Format(vars, "$dllexport $void fun();") -> "void fun();" -// "__declspec(export) void fun();" -// -// which is convenient to prevent double, leading or trailing spaces. -class PROTOC_EXPORT Formatter { - public: - explicit Formatter(io::Printer* printer) : printer_(printer) {} - Formatter(io::Printer* printer, - const std::map& vars) - : printer_(printer), vars_(vars) {} - - template - void Set(const std::string& key, const T& value) { - vars_[key] = ToString(value); - } - - void AddMap(const std::map& vars) { - for (const auto& keyval : vars) vars_[keyval.first] = keyval.second; - } - - template - void operator()(const char* format, const Args&... args) const { - printer_->FormatInternal({ToString(args)...}, vars_, format); - } - - void Indent() const { printer_->Indent(); } - 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) - : format_(format), vars_(format->vars_) {} - ~SaveState() { format_->vars_.swap(vars_); } - - private: - Formatter* format_; - std::map vars_; - }; - - private: - io::Printer* printer_; - std::map vars_; - - // Convenience overloads to accept different types as arguments. - static std::string ToString(const std::string& s) { return s; } - template ::value>::type> - static std::string ToString(I x) { - return StrCat(x); - } - static std::string ToString(strings::Hex x) { return StrCat(x); } - static std::string ToString(const FieldDescriptor* d) { return Payload(d); } - static std::string ToString(const Descriptor* d) { return Payload(d); } - static std::string ToString(const EnumDescriptor* d) { return Payload(d); } - static std::string ToString(const EnumValueDescriptor* d) { - return Payload(d); - } - static std::string ToString(const OneofDescriptor* d) { return Payload(d); } - - template - static std::string Payload(const Descriptor* descriptor) { - std::vector path; - descriptor->GetLocationPath(&path); - GeneratedCodeInfo::Annotation annotation; - for (int index : path) { - annotation.add_path(index); - } - annotation.set_source_file(descriptor->file()->name()); - return annotation.SerializeAsString(); - } -}; - -template -void PrintFieldComment(const Formatter& format, const T* field) { - // Print the field's (or oneof's) proto-syntax definition as a comment. - // We don't want to print group bodies so we cut off after the first - // line. - DebugStringOptions options; - options.elide_group_body = true; - options.elide_oneof_body = true; - std::string def = field->DebugStringWithOptions(options); - format("// $1$\n", def.substr(0, def.find_first_of('\n'))); -} - -class PROTOC_EXPORT NamespaceOpener { - public: - explicit NamespaceOpener(const Formatter& format) - : printer_(format.printer()) {} - NamespaceOpener(const std::string& name, const Formatter& format) - : NamespaceOpener(format) { - ChangeTo(name); - } - ~NamespaceOpener() { ChangeTo(""); } - - void ChangeTo(const std::string& name) { - std::vector new_stack_ = - Split(name, "::", true); - 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 (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", *it); - } - } - name_stack_.swap(new_stack_); - 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 { - printer_->Print("namespace $ns$ {\n", "ns", name_stack_[i]); - } - } - } - - private: - io::Printer* printer_; - std::vector name_stack_; -}; - -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, - const Options& options); - -void GenerateUtf8CheckCodeForString(const FieldDescriptor* field, - const Options& options, bool for_parse, - const char* parameters, - const Formatter& format); - -void GenerateUtf8CheckCodeForCord(const FieldDescriptor* field, - const Options& options, bool for_parse, - const char* parameters, - const Formatter& format); - -template -struct FieldRangeImpl { - struct Iterator { - using iterator_category = std::forward_iterator_tag; - using value_type = const FieldDescriptor*; - using difference_type = int; - - value_type operator*() { return descriptor->field(idx); } - - friend bool operator==(const Iterator& a, const Iterator& b) { - GOOGLE_DCHECK(a.descriptor == b.descriptor); - return a.idx == b.idx; - } - friend bool operator!=(const Iterator& a, const Iterator& b) { - return !(a == b); - } - - Iterator& operator++() { - idx++; - return *this; - } - - int idx; - const T* descriptor; - }; - - Iterator begin() const { return {0, descriptor}; } - Iterator end() const { return {descriptor->field_count(), descriptor}; } - - const T* descriptor; -}; - -template -FieldRangeImpl FieldRange(const T* desc) { - return {desc}; -} - -struct OneOfRangeImpl { - struct Iterator { - using iterator_category = std::forward_iterator_tag; - using value_type = const OneofDescriptor*; - using difference_type = int; - - value_type operator*() { return descriptor->oneof_decl(idx); } - - friend bool operator==(const Iterator& a, const Iterator& b) { - GOOGLE_DCHECK(a.descriptor == b.descriptor); - return a.idx == b.idx; - } - friend bool operator!=(const Iterator& a, const Iterator& b) { - return !(a == b); - } - - Iterator& operator++() { - idx++; - return *this; - } - - int idx; - const Descriptor* descriptor; - }; - - Iterator begin() const { return {0, descriptor}; } - Iterator end() const { - return {descriptor->real_oneof_decl_count(), descriptor}; - } - - const Descriptor* descriptor; -}; - -inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; } - -PROTOC_EXPORT std::string StripProto(const std::string& filename); - -bool EnableMessageOwnedArena(const Descriptor* desc, const Options& options); - -bool EnableMessageOwnedArenaTrial(const Descriptor* desc, - const Options& options); - -bool ShouldVerify(const Descriptor* descriptor, const Options& options, - MessageSCCAnalyzer* scc_analyzer); -bool ShouldVerify(const FileDescriptor* file, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - -// Indicates whether to use predefined verify methods for a given message. If a -// message is "simple" and needs no special verification per field (e.g. message -// field, repeated packed, UTF8 string, etc.), we can use either VerifySimple or -// VerifySimpleAlwaysCheckInt32 methods as all verification can be done based on -// the wire type. -// -// Otherwise, we need "custom" verify methods tailored to a message to pass -// which field needs a special verification; i.e. InternalVerify. -enum class VerifySimpleType { - kSimpleInt32Never, // Use VerifySimple - kSimpleInt32Always, // Use VerifySimpleAlwaysCheckInt32 - kCustom, // Use InternalVerify and check only for int32 - kCustomInt32Never, // Use InternalVerify but never check for int32 - kCustomInt32Always, // Use InternalVerify and always check for int32 -}; - -// Returns VerifySimpleType if messages can be verified by predefined methods. -VerifySimpleType ShouldVerifySimple(const Descriptor* descriptor); - -bool IsUtf8String(const FieldDescriptor* field); - -bool HasMessageFieldOrExtension(const Descriptor* desc); - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/map_field.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/map_field.cc deleted file mode 100644 index 3a55ef535..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/map_field.cc +++ /dev/null @@ -1,338 +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 compiler { -namespace cpp { - -bool IsProto3Field(const FieldDescriptor* field_descriptor) { - const FileDescriptor* file_descriptor = field_descriptor->file(); - return file_descriptor->syntax() == FileDescriptor::SYNTAX_PROTO3; -} - -void SetMessageVariables(const FieldDescriptor* descriptor, - std::map* variables, - const Options& options) { - SetCommonFieldVariables(descriptor, variables, options); - (*variables)["type"] = ClassName(descriptor->message_type(), false); - (*variables)["full_name"] = descriptor->full_name(); - - const FieldDescriptor* key = descriptor->message_type()->map_key(); - const FieldDescriptor* val = descriptor->message_type()->map_value(); - (*variables)["key_cpp"] = PrimitiveTypeName(options, key->cpp_type()); - switch (val->cpp_type()) { - case FieldDescriptor::CPPTYPE_MESSAGE: - (*variables)["val_cpp"] = FieldMessageTypeName(val, options); - break; - case FieldDescriptor::CPPTYPE_ENUM: - (*variables)["val_cpp"] = ClassName(val->enum_type(), true); - break; - default: - (*variables)["val_cpp"] = PrimitiveTypeName(options, val->cpp_type()); - } - (*variables)["key_wire_type"] = - "TYPE_" + ToUpper(DeclaredTypeMethodName(key->type())); - (*variables)["val_wire_type"] = - "TYPE_" + ToUpper(DeclaredTypeMethodName(val->type())); - (*variables)["map_classname"] = ClassName(descriptor->message_type(), false); - (*variables)["number"] = StrCat(descriptor->number()); - (*variables)["tag"] = StrCat(internal::WireFormat::MakeTag(descriptor)); - - if (HasDescriptorMethods(descriptor->file(), options)) { - (*variables)["lite"] = ""; - } else { - (*variables)["lite"] = "Lite"; - } -} - -MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) - : FieldGenerator(descriptor, options), - has_required_fields_( - scc_analyzer->HasRequiredFields(descriptor->message_type())) { - SetMessageVariables(descriptor, &variables_, options); -} - -MapFieldGenerator::~MapFieldGenerator() {} - -void MapFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "::$proto_ns$::internal::MapField$lite$<\n" - " $map_classname$,\n" - " $key_cpp$, $val_cpp$,\n" - " ::$proto_ns$::internal::WireFormatLite::$key_wire_type$,\n" - " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$> " - "$name$_;\n"); -} - -void MapFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "private:\n" - "const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" - " ${1$_internal_$name$$}$() const;\n" - "::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" - " ${1$_internal_mutable_$name$$}$();\n" - "public:\n" - "$deprecated_attr$const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" - " ${1$$name$$}$() const;\n" - "$deprecated_attr$::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" - " ${1$mutable_$name$$}$();\n", - descriptor_); -} - -void MapFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" - "$classname$::_internal_$name$() const {\n" - " return $field$.GetMap();\n" - "}\n" - "inline const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" - "$classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_map:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" - "$classname$::_internal_mutable_$name$() {\n" - "$maybe_prepare_split_message$" - " return $field$.MutableMap();\n" - "}\n" - "inline ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" - "$classname$::mutable_$name$() {\n" - "$annotate_mutable$" - " // @@protoc_insertion_point(field_mutable_map:$full_name$)\n" - " return _internal_mutable_$name$();\n" - "}\n"); -} - -void MapFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.Clear();\n"); -} - -void MapFieldGenerator::GenerateMergingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->$field$.MergeFrom(from.$field$);\n"); -} - -void MapFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.InternalSwap(&other->$field$);\n"); -} - -void MapFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - GenerateConstructorCode(printer); - GenerateMergingCode(printer); -} - -static void GenerateSerializationLoop(Formatter& format, bool string_key, - bool string_value, - bool is_deterministic) { - if (is_deterministic) { - format( - "for (const auto& entry : " - "::_pbi::MapSorter$1$(map_field)) {\n", - (string_key ? "Ptr" : "Flat")); - } else { - format("for (const auto& entry : map_field) {\n"); - } - { - auto loop_scope = format.ScopedIndent(); - format( - "target = WireHelper::InternalSerialize($number$, " - "entry.first, entry.second, target, stream);\n"); - - if (string_key || string_value) { - format("check_utf8(entry);\n"); - } - } - format("}\n"); -} - -void MapFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("if (!this->_internal_$name$().empty()) {\n"); - format.Indent(); - const FieldDescriptor* key_field = descriptor_->message_type()->map_key(); - const FieldDescriptor* value_field = descriptor_->message_type()->map_value(); - const bool string_key = key_field->type() == FieldDescriptor::TYPE_STRING; - const bool string_value = value_field->type() == FieldDescriptor::TYPE_STRING; - - format( - "using MapType = ::_pb::Map<$key_cpp$, $val_cpp$>;\n" - "using WireHelper = $map_classname$::Funcs;\n" - "const auto& map_field = this->_internal_$name$();\n"); - bool utf8_check = string_key || string_value; - if (utf8_check) { - format("auto check_utf8 = [](const MapType::value_type& entry) {\n"); - { - auto check_scope = format.ScopedIndent(); - // p may be unused when GetUtf8CheckMode evaluates to kNone, - // thus disabling the validation. - format("(void)entry;\n"); - if (string_key) { - GenerateUtf8CheckCodeForString( - key_field, options_, false, - "entry.first.data(), static_cast(entry.first.length()),\n", - format); - } - if (string_value) { - GenerateUtf8CheckCodeForString( - value_field, options_, false, - "entry.second.data(), static_cast(entry.second.length()),\n", - format); - } - } - format("};\n"); - } - - format( - "\n" - "if (stream->IsSerializationDeterministic() && " - "map_field.size() > 1) {\n"); - { - auto deterministic_scope = format.ScopedIndent(); - GenerateSerializationLoop(format, string_key, string_value, true); - } - format("} else {\n"); - { - auto map_order_scope = format.ScopedIndent(); - GenerateSerializationLoop(format, string_key, string_value, false); - } - format("}\n"); - format.Outdent(); - format("}\n"); -} - -void MapFieldGenerator::GenerateByteSize(io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "total_size += $tag_size$ *\n" - " " - "::$proto_ns$::internal::FromIntSize(this->_internal_$name$_size());\n" - "for (::$proto_ns$::Map< $key_cpp$, $val_cpp$ >::const_iterator\n" - " it = this->_internal_$name$().begin();\n" - " it != this->_internal_$name$().end(); ++it) {\n" - " total_size += $map_classname$::Funcs::ByteSizeLong(it->first, " - "it->second);\n" - "}\n"); -} - -void MapFieldGenerator::GenerateIsInitialized(io::Printer* printer) const { - if (!has_required_fields_) return; - - Formatter format(printer, variables_); - format( - "if (!::$proto_ns$::internal::AllAreInitialized($field$)) return " - "false;\n"); -} - -void MapFieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format("/*decltype($field$)*/{::_pbi::ConstantInitialized()}"); - } else { - format("/*decltype($field$)*/{}"); - } -} - -void MapFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - // MapField has no move constructor, which prevents explicit aggregate - // initialization pre-C++17. - format("/*decltype($field$)*/{}"); -} - -void MapFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - format( - "/*decltype($classname$::Split::$name$_)*/" - "{::_pbi::ArenaInitialized(), arena}"); - return; - } - // MapField has no move constructor. - format("/*decltype($field$)*/{::_pbi::ArenaInitialized(), arena}"); -} - -void MapFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - format("$cached_split_ptr$->$name$_.Destruct();\n"); - format("$cached_split_ptr$->$name$_.~MapField$lite$();\n"); - return; - } - format("$field$.Destruct();\n"); - format("$field$.~MapField$lite$();\n"); -} - -void MapFieldGenerator::GenerateArenaDestructorCode( - io::Printer* printer) const { - if (NeedsArenaDestructor() == ArenaDtorNeeds::kNone) { - return; - } - - Formatter format(printer, variables_); - // _this is the object being destructed (we are inside a static method here). - format("_this->$field$.Destruct();\n"); -} - -ArenaDtorNeeds MapFieldGenerator::NeedsArenaDestructor() const { - return HasDescriptorMethods(descriptor_->file(), options_) - ? ArenaDtorNeeds::kRequired - : ArenaDtorNeeds::kNone; -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/map_field.h b/depends/protobuf/src/google/protobuf/compiler/cpp/map_field.h deleted file mode 100644 index 678a128bd..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/map_field.h +++ /dev/null @@ -1,83 +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_COMPILER_CPP_MAP_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_MAP_FIELD_H__ - -#include -#include - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class MapFieldGenerator : public FieldGenerator { - public: - MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - ~MapFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateDestructorCode(io::Printer* printer) const override; - void GenerateArenaDestructorCode(io::Printer* printer) const override; - ArenaDtorNeeds NeedsArenaDestructor() const override; - - private: - const bool has_required_fields_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MAP_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/message.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/message.cc deleted file mode 100644 index 69069dacd..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/message.cc +++ /dev/null @@ -1,4446 +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 -#include - - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -using internal::WireFormat; -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 = "_impl_._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_word_index) { - if (!field->options().weak()) { - int has_bit_index = has_bit_indices[field->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)); - format("if (cached_has_bits & 0x$1$u) {\n", mask); - } else { - format("if (has_$1$()) {\n", FieldName(field)); - } - format.Indent(); -} - -struct FieldOrderingByNumber { - inline bool operator()(const FieldDescriptor* a, - const FieldDescriptor* b) const { - return a->number() < b->number(); - } -}; - -// Sort the fields of the given Descriptor by number into a new[]'d array -// and return it. -std::vector SortFieldsByNumber( - const Descriptor* descriptor) { - std::vector fields(descriptor->field_count()); - for (int i = 0; i < descriptor->field_count(); i++) { - fields[i] = descriptor->field(i); - } - std::sort(fields.begin(), fields.end(), FieldOrderingByNumber()); - return fields; -} - -// Functor for sorting extension ranges by their "start" field number. -struct ExtensionRangeSorter { - bool operator()(const Descriptor::ExtensionRange* left, - const Descriptor::ExtensionRange* right) const { - return left->start < right->start; - } -}; - -bool IsPOD(const FieldDescriptor* field) { - if (field->is_repeated() || field->is_extension()) return false; - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_ENUM: - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT32: - case FieldDescriptor::CPPTYPE_UINT64: - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - case FieldDescriptor::CPPTYPE_BOOL: - return true; - case FieldDescriptor::CPPTYPE_STRING: - return false; - default: - return false; - } -} - -// 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 - // 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 -// !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)); - // Merge and serialize semantics: primitive fields are merged/serialized only - // 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$_internal_$name$().empty()) {\n"); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - // Message fields still have has_$name$() methods. - 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$_internal_$name$() != 0) {\n"); - } - format.Indent(); - return true; - } else if (field->real_containing_oneof()) { - format("if (_internal_has_$name$()) {\n"); - format.Indent(); - return true; - } - return false; -} - -// Does the given field have a has_$name$() method? -bool HasHasMethod(const FieldDescriptor* field) { - 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 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. -void CollectMapInfo(const Options& options, const Descriptor* descriptor, - std::map* variables) { - GOOGLE_CHECK(IsMapEntryMessage(descriptor)); - std::map& vars = *variables; - const FieldDescriptor* key = descriptor->map_key(); - const FieldDescriptor* val = descriptor->map_value(); - vars["key_cpp"] = PrimitiveTypeName(options, key->cpp_type()); - switch (val->cpp_type()) { - case FieldDescriptor::CPPTYPE_MESSAGE: - vars["val_cpp"] = FieldMessageTypeName(val, options); - break; - case FieldDescriptor::CPPTYPE_ENUM: - vars["val_cpp"] = ClassName(val->enum_type(), true); - break; - default: - vars["val_cpp"] = PrimitiveTypeName(options, val->cpp_type()); - } - vars["key_wire_type"] = - "TYPE_" + ToUpper(DeclaredTypeMethodName(key->type())); - vars["val_wire_type"] = - "TYPE_" + ToUpper(DeclaredTypeMethodName(val->type())); -} - -// Does the given field have a private (internal helper only) has_$name$() -// method? -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 IsProto3(field->file()) && field->real_containing_oneof(); -} - -// TODO(ckennelly): Cull these exclusions if/when these protos do not have -// their methods overridden by subclasses. - -bool ShouldMarkClassAsFinal(const Descriptor* descriptor, - const Options& options) { - return true; -} - - -// 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 IsCrossFileMapField(const FieldDescriptor* field) { - if (!field->is_map()) { - return false; - } - - const Descriptor* d = field->message_type(); - const FieldDescriptor* value = d->FindFieldByNumber(2); - - return IsCrossFileMessage(value); -} - -bool IsCrossFileMaybeMap(const FieldDescriptor* field) { - if (IsCrossFileMapField(field)) { - return true; - } - - return IsCrossFileMessage(field); -} - -bool IsRequired(const std::vector& v) { - return v.front()->is_required(); -} - -bool HasNonSplitOptionalString(const Descriptor* desc, const Options& options) { - for (const auto* field : FieldRange(desc)) { - if (IsString(field, options) && !field->is_repeated() && - !field->real_containing_oneof() && !ShouldSplit(field, options)) { - return true; - } - } - return false; -} - -// Collects neighboring fields based on a given criteria (equivalent predicate). -template -std::vector> CollectFields( - const std::vector& fields, - const Predicate& equivalent) { - std::vector> chunks; - for (auto field : fields) { - if (chunks.empty() || !equivalent(chunks.back().back(), field)) { - chunks.emplace_back(); - } - chunks.back().push_back(field); - } - return chunks; -} - -// 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_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_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); - } - 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_t n) { - int result = 0; - while (n != 0) { - result += (n & 1); - n = n / 2; - } - return result; -} - -// For a run of cold chunks, opens and closes an external if statement that -// checks multiple has_bits words to skip bulk of cold fields. -class ColdChunkSkipper { - public: - ColdChunkSkipper( - const Descriptor* descriptor, const Options& options, - const std::vector>& chunks, - 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) { - SetCommonVars(options, &variables_); - SetCommonMessageDataVariables(descriptor, &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_word_index, - const std::string& from, io::Printer* printer); - bool OnEndChunk(int chunk, io::Printer* printer); - - private: - bool IsColdChunk(int chunk); - - int HasbitWord(int chunk, int offset) { - return has_bit_indices_[chunks_[chunk][offset]->index()] / 32; - } - - const std::vector>& chunks_; - const std::vector& has_bit_indices_; - const AccessInfoMap* access_info_map_; - const double cold_threshold_; - std::map variables_; - int limit_chunk_ = -1; -}; - -// Tuning parameters for ColdChunkSkipper. -const double kColdRatio = 0.005; - -bool ColdChunkSkipper::IsColdChunk(int chunk) { - // Mark this variable as used until it is actually used - (void)cold_threshold_; - return false; -} - - -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_) { - return; - } else if (chunk < limit_chunk_) { - // We are already inside a run of cold chunks. - return; - } else if (!IsColdChunk(chunk)) { - // We can't start a run of cold chunks. - return; - } - - // Find the end of consecutive cold chunks. - limit_chunk_ = chunk; - while (limit_chunk_ < chunks_.size() && IsColdChunk(limit_chunk_)) { - limit_chunk_++; - } - - if (limit_chunk_ <= chunk + 1) { - // Require at least two chunks to emit external has_bit checks. - limit_chunk_ = -1; - return; - } - - // Emit has_bit check for each has_bit_dword index. - format("if (PROTOBUF_PREDICT_FALSE("); - int first_word = HasbitWord(chunk, 0); - while (chunk < limit_chunk_) { - 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++) { - for (auto field : chunks_[chunk]) { - int hasbit_index = has_bit_indices_[field->index()]; - // Fields on a chunk must be in the same word. - GOOGLE_CHECK_EQ(this_word, hasbit_index / 32); - mask |= 1 << (hasbit_index % 32); - } - } - - if (this_word != first_word) { - format(" ||\n "); - } - format.Set("mask", strings::Hex(mask, strings::ZERO_PAD_8)); - if (this_word == cached_has_word_index) { - format("(cached_has_bits & 0x$mask$u) != 0"); - } else { - format("($1$_impl_._has_bits_[$2$] & 0x$mask$u) != 0", from, this_word); - } - } - format(")) {\n"); - format.Indent(); -} - -bool ColdChunkSkipper::OnEndChunk(int chunk, io::Printer* printer) { - Formatter format(printer, variables_); - if (chunk != limit_chunk_ - 1) { - return false; - } - format.Outdent(); - format("}\n"); - 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 (!HasTracker(descriptor, options)) { - return; - } - StringPiece tracker = (*variables)["tracker"]; - StringPiece extensions = (*variables)["extensions"]; - 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 = StrCat(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 - -// =================================================================== - -MessageGenerator::MessageGenerator( - const Descriptor* descriptor, - const std::map& vars, int index_in_file_messages, - const Options& options, MessageSCCAnalyzer* scc_analyzer) - : descriptor_(descriptor), - index_in_file_messages_(index_in_file_messages), - classname_(ClassName(descriptor, false)), - 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) { - if (!message_layout_helper_) { - message_layout_helper_.reset(new PaddingOptimizer()); - } - SetCommonMessageDataVariables(descriptor, &variables_); - - // Variables that apply to this class - variables_["classname"] = classname_; - variables_["classtype"] = QualifiedClassName(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 (HasTracker(descriptor_, options_)) { - const std::string injector_template = - StrCat(" ", variables_["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->real_containing_oneof()) { - optimized_order_.push_back(field); - } - } - - message_layout_helper_->OptimizeLayout(&optimized_order_, options_, - scc_analyzer_); - - // 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); - // The bitset[0] is for arena dtor tracking. Donating states start from - // bitset[1]; - max_inlined_string_index_++; - } - 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()) { - ++num_required_fields_; - } - } - - 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 { - 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; -} - -int MessageGenerator::HasWordIndex(const FieldDescriptor* field) const { - int hasbit = HasBitIndex(field); - return hasbit == kNoHasbit ? kNoHasbit : hasbit / 32; -} - -void MessageGenerator::AddGenerators( - std::vector>* enum_generators, - std::vector>* extension_generators) { - for (int i = 0; i < descriptor_->enum_type_count(); i++) { - enum_generators->emplace_back( - new EnumGenerator(descriptor_->enum_type(i), variables_, options_)); - 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_, scc_analyzer_)); - extension_generators_.push_back(extension_generators->back().get()); - } -} - -void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { - Formatter format(printer, variables_); - // optimized_fields_ does not contain fields where - // 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 - // order of the _has_bits_ entries and we want GDB's pretty printers to be - // able to infer these indices from the k[FIELDNAME]FieldNumber order. - std::vector ordered_fields; - ordered_fields.reserve(descriptor_->field_count()); - - ordered_fields.insert(ordered_fields.begin(), optimized_order_.begin(), - optimized_order_.end()); - for (auto field : FieldRange(descriptor_)) { - if (!field->real_containing_oneof() && !field->options().weak() && - !IsFieldStripped(field, options_)) { - continue; - } - ordered_fields.push_back(field); - } - - if (!ordered_fields.empty()) { - format("enum : int {\n"); - for (auto field : ordered_fields) { - Formatter::SaveState save(&format); - - std::map vars; - SetCommonFieldVariables(field, &vars, options_); - format.AddMap(vars); - format(" ${1$$2$$}$ = $number$,\n", field, FieldConstantName(field)); - } - format("};\n"); - } - for (auto field : ordered_fields) { - PrintFieldComment(format, field); - - Formatter::SaveState save(&format); - - std::map vars; - SetCommonFieldVariables(field, &vars, options_); - format.AddMap(vars); - - if (field->is_repeated()) { - 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$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)) { - if (!IsFieldStripped(field, options_)) { - format( - "private:\n" - "bool ${1$_internal_has_$name$$}$() const;\n" - "public:\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); - - format("\n"); - } - - if (descriptor_->extension_range_count() > 0) { - // 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 - if (descriptor_->options().message_set_wire_format() && - !options_.opensource_runtime && !options_.lite_implicit_weak_fields) { - // Special-case MessageSet - format("GOOGLE_PROTOBUF_EXTENSION_MESSAGE_SET_ACCESSORS($classname$)\n"); - } - } - - for (auto oneof : OneOfRange(descriptor_)) { - Formatter::SaveState saver(&format); - format.Set("oneof_name", oneof->name()); - format.Set("camel_oneof_name", UnderscoresToCamelCase(oneof->name(), true)); - format( - "void ${1$clear_$oneof_name$$}$();\n" - "$camel_oneof_name$Case $oneof_name$_case() const;\n", - oneof); - } -} - -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_has$" - " return $weak_field_map$.Has($number$);\n" - "}\n"); - return; - } - 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", - strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " bool value = " - "($has_bits$[$has_array_index$] & 0x$has_mask$u) != 0;\n"); - - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !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. - format(" PROTOBUF_ASSUME(!value || $field$ != nullptr);\n"); - } - - format( - " return value;\n" - "}\n" - "inline bool $classname$::has_$name$() const {\n" - "$annotate_has$" - " return _internal_has_$name$();\n" - "}\n"); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - // Message fields have a has_$name$() method. - if (IsLazy(field, options_, scc_analyzer_)) { - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " return !$field$.IsCleared();\n" - "}\n"); - } else { - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " return this != internal_default_instance() " - "&& $field$ != nullptr;\n" - "}\n"); - } - format( - "inline bool $classname$::has_$name$() const {\n" - "$annotate_has$" - " return _internal_has_$name$();\n" - "}\n"); - } -} - -void MessageGenerator::GenerateOneofHasBits(io::Printer* printer) { - Formatter format(printer, variables_); - for (auto oneof : OneOfRange(descriptor_)) { - format.Set("oneof_name", oneof->name()); - format.Set("oneof_index", oneof->index()); - format.Set("cap_oneof_name", ToUpper(oneof->name())); - format( - "inline bool $classname$::has_$oneof_name$() const {\n" - " return $oneof_name$_case() != $cap_oneof_name$_NOT_SET;\n" - "}\n" - "inline void $classname$::clear_has_$oneof_name$() {\n" - " $oneof_case$[$oneof_index$] = $cap_oneof_name$_NOT_SET;\n" - "}\n"); - } -} - -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$(). - // Oneofs also have has_$name$() but only as a private helper - // method, so that generated code is slightly cleaner (vs. comparing - // _oneof_case_[index] against a constant everywhere). - // - // If has_$name$() is private, there is no need to add an internal accessor. - // Only annotate public accessors. - if (HasHasMethod(field)) { - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " return $oneof_name$_case() == k$field_name$;\n" - "}\n" - "inline bool $classname$::has_$name$() const {\n" - "$annotate_has$" - " return _internal_has_$name$();\n" - "}\n"); - } else if (HasPrivateHasMethod(field)) { - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " return $oneof_name$_case() == k$field_name$;\n" - "}\n"); - } - // set_has_$name$() for oneof fields is always private; hence should not be - // annotated. - format( - "inline void $classname$::set_has_$name$() {\n" - " $oneof_case$[$oneof_index$] = k$field_name$;\n" - "}\n"); -} - -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"); - - format.Indent(); - - 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"); - format.Indent(); - field_generators_.get(field).GenerateClearingCode(format.printer()); - format("clear_has_$oneof_name$();\n"); - format.Outdent(); - format("}\n"); - } else { - if (ShouldSplit(field, options_)) { - format("if (IsSplitMessageDefault()) return;\n"); - } - field_generators_.get(field).GenerateClearingCode(format.printer()); - 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"); -} - -void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* printer) { - Formatter format(printer, variables_); - format("// $classname$\n\n"); - - for (auto field : FieldRange(descriptor_)) { - PrintFieldComment(format, field); - - if (IsFieldStripped(field, options_)) { - continue; - } - - std::map vars; - SetCommonFieldVariables(field, &vars, options_); - - Formatter::SaveState saver(&format); - format.AddMap(vars); - - // Generate has_$name$() or $name$_size(). - if (field->is_repeated()) { - 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 $field$$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", - StrCat(field->containing_oneof()->index())); - GenerateOneofMemberHasBits(field, format); - } else { - // Singular field. - GenerateSingularFieldHasBits(field, format); - } - - if (!IsCrossFileMaybeMap(field)) { - GenerateFieldClear(field, true, format); - } - - // Generate type-specific accessors. - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GenerateInlineAccessorDefinitions(printer); - } - - format("\n"); - } - - // Generate has_$name$() and clear_has_$name$() functions for oneofs. - GenerateOneofHasBits(printer); -} - -void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { - Formatter format(printer, variables_); - format.Set("class_final", - ShouldMarkClassAsFinal(descriptor_, options_) ? "final" : ""); - - if (IsMapEntryMessage(descriptor_)) { - std::map vars; - CollectMapInfo(options_, descriptor_, &vars); - vars["lite"] = - HasDescriptorMethods(descriptor_->file(), options_) ? "" : "Lite"; - format.AddMap(vars); - format( - "class $classname$ : public " - "::$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" - "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$> " - "SuperType;\n" - " $classname$();\n" - " explicit PROTOBUF_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 != Utf8CheckMode::kNone) { - if (utf8_check == Utf8CheckMode::kStrict) { - format( - " static bool ValidateKey(std::string* s) {\n" - " return ::$proto_ns$::internal::WireFormatLite::" - "VerifyUtf8String(s->data(), static_cast(s->size()), " - "::$proto_ns$::internal::WireFormatLite::PARSE, \"$1$\");\n" - " }\n", - descriptor_->field(0)->full_name()); - } else { - GOOGLE_CHECK(utf8_check == Utf8CheckMode::kVerify); - format( - " static bool ValidateKey(std::string* s) {\n" - "#ifndef NDEBUG\n" - " ::$proto_ns$::internal::WireFormatLite::VerifyUtf8String(\n" - " s->data(), static_cast(s->size()), " - "::$proto_ns$::internal::" - "WireFormatLite::PARSE, \"$1$\");\n" - "#else\n" - " (void) s;\n" - "#endif\n" - " return true;\n" - " }\n", - descriptor_->field(0)->full_name()); - } - } else { - format(" static bool ValidateKey(void*) { return true; }\n"); - } - if (descriptor_->field(1)->type() == FieldDescriptor::TYPE_STRING && - utf8_check != Utf8CheckMode::kNone) { - if (utf8_check == Utf8CheckMode::kStrict) { - format( - " static bool ValidateValue(std::string* s) {\n" - " return ::$proto_ns$::internal::WireFormatLite::" - "VerifyUtf8String(s->data(), static_cast(s->size()), " - "::$proto_ns$::internal::WireFormatLite::PARSE, \"$1$\");\n" - " }\n", - descriptor_->field(1)->full_name()); - } else { - GOOGLE_CHECK(utf8_check == Utf8CheckMode::kVerify); - format( - " static bool ValidateValue(std::string* s) {\n" - "#ifndef NDEBUG\n" - " ::$proto_ns$::internal::WireFormatLite::VerifyUtf8String(\n" - " s->data(), static_cast(s->size()), " - "::$proto_ns$::internal::" - "WireFormatLite::PARSE, \"$1$\");\n" - "#else\n" - " (void) s;\n" - "#endif\n" - " return true;\n" - " }\n", - descriptor_->field(1)->full_name()); - } - } else { - format(" static bool ValidateValue(void*) { return true; }\n"); - } - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - " using ::$proto_ns$::Message::MergeFrom;\n" - "" - " ::$proto_ns$::Metadata GetMetadata() const final;\n"); - } - format( - " friend struct ::$tablename$;\n" - "};\n"); - return; - } - - format( - "class $dllexport_decl $${1$$classname$$}$$ class_final$ :\n" - " public $superclass$ /* @@protoc_insertion_point(" - "class_definition:$full_name$) */ {\n", - descriptor_); - format(" public:\n"); - format.Indent(); - - if (EnableMessageOwnedArena(descriptor_, options_)) { - format( - "inline $classname$() : $classname$(" - "::$proto_ns$::Arena::InternalCreateMessageOwnedArena(), true) {}\n"); - } else if (EnableMessageOwnedArenaTrial(descriptor_, options_)) { - format( - "inline $classname$() : $classname$(InMoaTrial() ? " - "::$proto_ns$::Arena::InternalCreateMessageOwnedArena() : nullptr, " - "InMoaTrial()) {}\n"); - } else { - format("inline $classname$() : $classname$(nullptr) {}\n"); - } - if (!HasSimpleBaseClass(descriptor_, options_)) { - format("~$classname$() override;\n"); - } - format( - "explicit PROTOBUF_CONSTEXPR " - "$classname$(::$proto_ns$::internal::ConstantInitialized);\n" - "\n" - "$classname$(const $classname$& from);\n" - "$classname$($classname$&& from) noexcept\n" - " : $classname$() {\n" - " *this = ::std::move(from);\n" - "}\n" - "\n" - "inline $classname$& operator=(const $classname$& from) {\n" - " CopyFrom(from);\n" - " return *this;\n" - "}\n" - "inline $classname$& operator=($classname$&& from) noexcept {\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" - " return *this;\n" - "}\n" - "\n"); - - if (PublicUnknownFieldsAccessors(descriptor_)) { - format( - "inline const $unknown_fields_type$& unknown_fields() const {\n" - " return $unknown_fields$;\n" - "}\n" - "inline $unknown_fields_type$* mutable_unknown_fields() {\n" - " return $mutable_unknown_fields$;\n" - "}\n" - "\n"); - } - - // Only generate this member if it's not disabled. - if (HasDescriptorMethods(descriptor_->file(), options_) && - !descriptor_->options().no_standard_descriptor_accessor()) { - format( - "static const ::$proto_ns$::Descriptor* descriptor() {\n" - " return GetDescriptor();\n" - "}\n"); - } - - if (HasDescriptorMethods(descriptor_->file(), options_)) { - // These shadow non-static methods of the same names in Message. We - // redefine them here because calls directly on the generated class can be - // statically analyzed -- we know what descriptor types are being requested. - // It also avoids a vtable dispatch. - // - // We would eventually like to eliminate the methods in Message, and having - // this separate also lets us track calls to the base class methods - // separately. - format( - "static const ::$proto_ns$::Descriptor* GetDescriptor() {\n" - " return default_instance().GetMetadata().descriptor;\n" - "}\n" - "static const ::$proto_ns$::Reflection* GetReflection() {\n" - " return default_instance().GetMetadata().reflection;\n" - "}\n"); - } - - format( - "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. - for (auto oneof : OneOfRange(descriptor_)) { - format("enum $1$Case {\n", UnderscoresToCamelCase(oneof->name(), true)); - format.Indent(); - for (auto field : FieldRange(oneof)) { - format("$1$ = $2$,\n", OneofCaseConstantName(field), // 1 - field->number()); // 2 - } - format("$1$_NOT_SET = 0,\n", ToUpper(oneof->name())); - format.Outdent(); - format( - "};\n" - "\n"); - } - - // TODO(gerbens) make this private, while still granting other protos access. - format( - "static inline const $classname$* internal_default_instance() {\n" - " return reinterpret_cast(\n" - " &_$classname$_default_instance_);\n" - "}\n" - "static constexpr int kIndexInFileMessages =\n" - " $1$;\n" - "\n", - index_in_file_messages_); - - if (IsAnyMessage(descriptor_, options_)) { - format( - "// implements Any -----------------------------------------------\n" - "\n"); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "bool PackFrom(const ::$proto_ns$::Message& message) {\n" - " $DCHK$_NE(&message, this);\n" - " return $any_metadata$.PackFrom(GetArena(), message);\n" - "}\n" - "bool PackFrom(const ::$proto_ns$::Message& message,\n" - " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " - "type_url_prefix) {\n" - " $DCHK$_NE(&message, this);\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" - "}\n" - "static bool GetAnyFieldDescriptors(\n" - " const ::$proto_ns$::Message& message,\n" - " const ::$proto_ns$::FieldDescriptor** type_url_field,\n" - " const ::$proto_ns$::FieldDescriptor** value_field);\n" - "template " - "::value>::type>\n" - "bool PackFrom(const T& message) {\n" - " return $any_metadata$.PackFrom(GetArena(), message);\n" - "}\n" - "template " - "::value>::type>\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" - "template " - "::value>::type>\n" - "bool UnpackTo(T* message) const {\n" - " return $any_metadata$.UnpackTo(message);\n" - "}\n"); - } else { - format( - "template \n" - "bool PackFrom(const T& message) {\n" - " return $any_metadata$.PackFrom(GetArena(), message);\n" - "}\n" - "template \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" - " return $any_metadata$.UnpackTo(message);\n" - "}\n"); - } - format( - "template bool Is() const {\n" - " return $any_metadata$.Is();\n" - "}\n" - "static bool ParseAnyTypeUrl(::PROTOBUF_NAMESPACE_ID::ConstStringParam " - "type_url,\n" - " std::string* full_type_name);\n"); - } - - 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"); - - format( - "\n" - "// implements Message ----------------------------------------------\n" - "\n" - "$classname$* New(::$proto_ns$::Arena* arena = nullptr) const final {\n" - " return CreateMaybeMessage<$classname$>(arena);\n" - "}\n"); - - // For instances that derive from Message (rather than MessageLite), some - // methods are virtual and should be marked as final. - format.Set("full_final", HasDescriptorMethods(descriptor_->file(), options_) - ? "final" - : ""); - - if (HasGeneratedMethods(descriptor_->file(), options_)) { - if (HasDescriptorMethods(descriptor_->file(), options_)) { - 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. - "using $superclass$::CopyFrom;\n" - "void CopyFrom(const $classname$& from);\n" - "" - "using $superclass$::MergeFrom;\n" - "void MergeFrom(" - " const $classname$& from) {\n" - " $classname$::MergeImpl(*this, from);\n" - "}\n" - "private:\n" - "static void MergeImpl(::$proto_ns$::Message& to_msg, const " - "::$proto_ns$::Message& from_msg);\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)" - " final;\n" - "void CopyFrom(const $classname$& from);\n" - "void MergeFrom(const $classname$& from);\n"); - } - - if (!HasSimpleBaseClass(descriptor_, options_)) { - format( - "PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;\n" - "bool IsInitialized() const final;\n" - "\n" - "size_t ByteSizeLong() const final;\n"); - - parse_function_generator_->GenerateMethodDecls(printer); - - format( - "$uint8$* _InternalSerialize(\n" - " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " - "const final;\n"); - } - } - - if (options_.field_listener_options.inject_field_listener_events) { - format("static constexpr int _kInternalFieldNumber = $1$;\n", - descriptor_->field_count()); - } - - if (!HasSimpleBaseClass(descriptor_, options_)) { - format( - "int GetCachedSize() const final { return " - "$cached_size$.Get(); }" - "\n\nprivate:\n" - "void SharedCtor(::$proto_ns$::Arena* arena, bool is_message_owned);\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" - "}\n", - options_.opensource_runtime ? "::PROTOBUF_NAMESPACE_ID::StringPiece" - : "::StringPiece"); - - 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"); - - switch (NeedsArenaDestructor()) { - case ArenaDtorNeeds::kOnDemand: - format( - "private:\n" - "static void ArenaDtor(void* object);\n" - "inline void OnDemandRegisterArenaDtor(::$proto_ns$::Arena* arena) " - "override {\n" - " if (arena == nullptr || ($inlined_string_donated_array$[0] & " - "0x1u) " - "== " - "0) {\n" - " return;\n" - " }\n" - " $inlined_string_donated_array$[0] &= 0xFFFFFFFEu;\n" - " arena->OwnCustomDestructor(this, &$classname$::ArenaDtor);\n" - "}\n"); - break; - case ArenaDtorNeeds::kRequired: - format( - "private:\n" - "static void ArenaDtor(void* object);\n"); - break; - case ArenaDtorNeeds::kNone: - break; - } - - 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" - "\n"); - } else { - format( - "std::string GetTypeName() const final;\n" - "\n"); - } - - if (ShouldSplit(descriptor_, options_)) { - format( - "private:\n" - "inline bool IsSplitMessageDefault() const {\n" - " return $split$ == reinterpret_cast(&$1$);\n" - "}\n" - "PROTOBUF_NOINLINE void PrepareSplitMessageForWrite();\n" - "public:\n", - DefaultInstanceName(descriptor_, options_, /*split=*/true)); - } - - format( - "// nested types ----------------------------------------------------\n" - "\n"); - - // Import all nested message classes into this class's scope with typedefs. - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - const Descriptor* nested_type = descriptor_->nested_type(i); - if (!IsMapEntryMessage(nested_type)) { - format.Set("nested_full_name", ClassName(nested_type, false)); - format.Set("nested_name", ResolveKeyword(nested_type->name())); - format("typedef ${1$$nested_full_name$$}$ ${1$$nested_name$$}$;\n", - nested_type); - } - } - - if (descriptor_->nested_type_count() > 0) { - format("\n"); - } - - // Import all nested enums and their values into this class's scope with - // typedefs and constants. - for (int i = 0; i < descriptor_->enum_type_count(); i++) { - enum_generators_[i]->GenerateSymbolImports(printer); - format("\n"); - } - - format( - "// accessors -------------------------------------------------------\n" - "\n"); - - // Generate accessor methods for all fields. - GenerateFieldAccessorDeclarations(printer); - - // Declare extension identifiers. - for (int i = 0; i < descriptor_->extension_count(); i++) { - extension_generators_[i]->GenerateDeclaration(printer); - } - - - format("// @@protoc_insertion_point(class_scope:$full_name$)\n"); - - // Generate private members. - format.Outdent(); - format(" private:\n"); - format.Indent(); - // 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->real_containing_oneof()) { - format("void set_has_$1$();\n", FieldName(field)); - } - } - format("\n"); - - // Generate oneof function declarations - for (auto oneof : OneOfRange(descriptor_)) { - format( - "inline bool has_$1$() const;\n" - "inline void clear_has_$1$();\n\n", - oneof->name()); - } - - if (HasGeneratedMethods(descriptor_->file(), options_) && - !descriptor_->options().message_set_wire_format() && - num_required_fields_ > 1) { - format( - "// helper for ByteSizeLong()\n" - "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. - - bool need_to_emit_cached_size = !HasSimpleBaseClass(descriptor_, options_); - const std::string cached_size_decl = - "mutable ::$proto_ns$::internal::CachedSize _cached_size_;\n"; - - 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, "> _has_bits_;\n"); - - format( - "template friend class " - "::$proto_ns$::Arena::InternalHelper;\n" - "typedef void InternalArenaConstructable_;\n" - "typedef void DestructorSkippable_;\n"); - - // To minimize padding, data members are divided into three sections: - // (1) members assumed to align to 8 bytes - // (2) members corresponding to message fields, re-ordered to optimize - // alignment. - // (3) members assumed to align to 4 bytes. - - format("struct Impl_ {\n"); - format.Indent(); - - // Members assumed to align to 8 bytes: - - if (descriptor_->extension_range_count() > 0) { - format( - "::$proto_ns$::internal::ExtensionSet _extensions_;\n" - "\n"); - } - - if (HasTracker(descriptor_, options_)) { - format("static ::$proto_ns$::AccessListener<$1$> _tracker_;\n", - ClassName(descriptor_)); - } - - // 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 (!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 - // potential alignment padding. - format(has_bits_decl.c_str()); - if (need_to_emit_cached_size) { - format(cached_size_decl.c_str()); - need_to_emit_cached_size = false; - } - } - - // Field members: - - // Emit some private and static members - for (auto field : optimized_order_) { - const FieldGenerator& generator = field_generators_.get(field); - generator.GenerateStaticMembers(printer); - if (!ShouldSplit(field, options_)) { - generator.GeneratePrivateMembers(printer); - } - } - if (ShouldSplit(descriptor_, options_)) { - format("struct Split {\n"); - format.Indent(); - for (auto field : optimized_order_) { - if (!ShouldSplit(field, options_)) continue; - const FieldGenerator& generator = field_generators_.get(field); - generator.GeneratePrivateMembers(printer); - } - format.Outdent(); - format( - " typedef void InternalArenaConstructable_;\n" - " typedef void DestructorSkippable_;\n" - "};\n" - "Split* _split_;\n"); - } - - // 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( - // explicit empty constructor is needed when union contains - // ArenaStringPtr members for string fields. - "constexpr $1$Union() : _constinit_{} {}\n" - " ::$proto_ns$::internal::ConstantInitialized _constinit_;\n", - camel_oneof_name); - for (auto field : FieldRange(oneof)) { - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GeneratePrivateMembers(printer); - } - } - format.Outdent(); - format("} $1$_;\n", oneof->name()); - for (auto field : FieldRange(oneof)) { - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GenerateStaticMembers(printer); - } - } - } - - // Members assumed to align to 4 bytes: - - if (need_to_emit_cached_size) { - format(cached_size_decl.c_str()); - need_to_emit_cached_size = false; - } - - // Generate _oneof_case_. - if (descriptor_->real_oneof_decl_count() > 0) { - format( - "$uint32$ _oneof_case_[$1$];\n" - "\n", - descriptor_->real_oneof_decl_count()); - } - - if (num_weak_fields_) { - format("::$proto_ns$::internal::WeakFieldMap _weak_field_map_;\n"); - } - // Generate _any_metadata_ for the Any type. - if (IsAnyMessage(descriptor_, options_)) { - format("::$proto_ns$::internal::AnyMetadata _any_metadata_;\n"); - } - - format.Outdent(); - format("};\n"); - - // Only create the _impl_ field if it contains data. - if (HasImplData(descriptor_, options_)) { - format("union { Impl_ _impl_; };\n"); - } - - if (ShouldSplit(descriptor_, options_)) { - format( - "static Impl_::Split* CreateSplitMessage(" - "::$proto_ns$::Arena* arena);\n"); - format("friend struct $1$;\n", - DefaultInstanceType(descriptor_, options_, /*split=*/true)); - } - - // The TableStruct struct needs access to the private parts, in order to - // construct the offsets of all members. - format("friend struct ::$tablename$;\n"); - - format.Outdent(); - format("};"); - GOOGLE_DCHECK(!need_to_emit_cached_size); -} // NOLINT(readability/fn_size) - -void MessageGenerator::GenerateInlineMethods(io::Printer* printer) { - if (IsMapEntryMessage(descriptor_)) return; - GenerateFieldAccessorDefinitions(printer); - - // Generate oneof_case() functions. - for (auto oneof : OneOfRange(descriptor_)) { - Formatter format(printer, variables_); - format.Set("camel_oneof_name", UnderscoresToCamelCase(oneof->name(), true)); - format.Set("oneof_name", oneof->name()); - format.Set("oneof_index", oneof->index()); - format( - "inline $classname$::$camel_oneof_name$Case $classname$::" - "${1$$oneof_name$_case$}$() const {\n" - " return $classname$::$camel_oneof_name$Case(" - "$oneof_case$[$oneof_index$]);\n" - "}\n", - oneof); - } -} - -void MessageGenerator::GenerateSchema(io::Printer* printer, int offset, - int has_offset) { - Formatter format(printer, variables_); - 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$, $3$, sizeof($classtype$)},\n", offset, has_offset, - inlined_string_indices_offset); -} - -void MessageGenerator::GenerateClassMethods(io::Printer* printer) { - Formatter format(printer, variables_); - if (IsMapEntryMessage(descriptor_)) { - format( - "$classname$::$classname$() {}\n" - "$classname$::$classname$(::$proto_ns$::Arena* arena)\n" - " : SuperType(arena) {}\n" - "void $classname$::MergeFrom(const $classname$& other) {\n" - " MergeFromInternal(other);\n" - "}\n"); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - if (!descriptor_->options().map_entry()) { - format( - "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" - "$annotate_reflection$" - " return ::_pbi::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 ::_pbi::AssignDescriptors(\n" - " &$desc_table$_getter, &$desc_table$_once,\n" - " $file_level_metadata$[$1$]);\n" - "}\n", - index_in_file_messages_); - } - } - return; - } - - if (IsAnyMessage(descriptor_, options_)) { - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "bool $classname$::GetAnyFieldDescriptors(\n" - " const ::$proto_ns$::Message& message,\n" - " const ::$proto_ns$::FieldDescriptor** type_url_field,\n" - " const ::$proto_ns$::FieldDescriptor** value_field) {\n" - " return ::_pbi::GetAnyFieldDescriptors(\n" - " message, type_url_field, value_field);\n" - "}\n"); - } - format( - "bool $classname$::ParseAnyTypeUrl(\n" - " ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url,\n" - " std::string* full_type_name) {\n" - " return ::_pbi::ParseAnyTypeUrl(type_url, full_type_name);\n" - "}\n" - "\n"); - } - - format( - "class $classname$::_Internal {\n" - " public:\n"); - format.Indent(); - 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 (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" - "}\n", - 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_)) { - 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->real_containing_oneof()) { - SetCommonOneofFieldVariables(field, &vars); - } - format.AddMap(vars); - GenerateFieldClear(field, false, format); - } - } - - GenerateStructors(printer); - format("\n"); - - if (descriptor_->real_oneof_decl_count() > 0) { - GenerateOneofClear(printer); - format("\n"); - } - - if (HasGeneratedMethods(descriptor_->file(), options_)) { - GenerateClear(printer); - format("\n"); - - if (!HasSimpleBaseClass(descriptor_, options_)) { - parse_function_generator_->GenerateMethodImpls(printer); - format("\n"); - - parse_function_generator_->GenerateDataDefinitions(printer); - } - - GenerateSerializeWithCachedSizesToArray(printer); - format("\n"); - - GenerateByteSize(printer); - format("\n"); - - GenerateMergeFrom(printer); - format("\n"); - - GenerateClassSpecificMergeImpl(printer); - format("\n"); - - GenerateCopyFrom(printer); - format("\n"); - - GenerateIsInitialized(printer); - format("\n"); - } - - if (ShouldSplit(descriptor_, options_)) { - format( - "void $classname$::PrepareSplitMessageForWrite() {\n" - " if (IsSplitMessageDefault()) {\n" - " $split$ = CreateSplitMessage(GetArenaForAllocation());\n" - " }\n" - "}\n"); - } - - GenerateVerify(printer); - - GenerateSwap(printer); - format("\n"); - - if (HasDescriptorMethods(descriptor_->file(), options_)) { - if (!descriptor_->options().map_entry()) { - format( - "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" - "$annotate_reflection$" - " return ::_pbi::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 ::_pbi::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" - " return \"$full_name$\";\n" - "}\n" - "\n"); - } - - if (HasTracker(descriptor_, options_)) { - format( - "::$proto_ns$::AccessListener<$classtype$> " - "$1$::$tracker$(&FullMessageName);\n", - ClassName(descriptor_)); - } -} - -std::pair MessageGenerator::GenerateOffsets( - io::Printer* printer) { - Formatter format(printer, variables_); - - if (!has_bit_indices_.empty() || IsMapEntryMessage(descriptor_)) { - format("PROTOBUF_FIELD_OFFSET($classtype$, $has_bits$),\n"); - } else { - format("~0u, // no _has_bits_\n"); - } - format("PROTOBUF_FIELD_OFFSET($classtype$, _internal_metadata_),\n"); - if (descriptor_->extension_range_count() > 0) { - format("PROTOBUF_FIELD_OFFSET($classtype$, $extensions$),\n"); - } else { - format("~0u, // no _extensions_\n"); - } - if (descriptor_->real_oneof_decl_count() > 0) { - format("PROTOBUF_FIELD_OFFSET($classtype$, $oneof_case$[0]),\n"); - } else { - format("~0u, // no _oneof_case_\n"); - } - if (num_weak_fields_ > 0) { - format("PROTOBUF_FIELD_OFFSET($classtype$, $weak_field_map$),\n"); - } else { - format("~0u, // no _weak_field_map_\n"); - } - if (!inlined_string_indices_.empty()) { - format( - "PROTOBUF_FIELD_OFFSET($classtype$, " - "$inlined_string_donated_array$),\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_->real_oneof_decl_count(); - size_t entries = offsets; - for (auto field : FieldRange(descriptor_)) { - 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("::_pbi::kInvalidFieldOffsetTag"); - } else { - format("PROTOBUF_FIELD_OFFSET($classtype$$1$, $2$)", - ShouldSplit(field, options_) ? "::Impl_::Split" : "", - ShouldSplit(field, options_) - ? FieldName(field) + "_" - : FieldMemberName(field, /*cold=*/false)); - } - - // 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 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$, _impl_.$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 (!has_bit_indices_.empty()) { - entries += has_bit_indices_.size(); - for (int i = 0; i < has_bit_indices_.size(); i++) { - const std::string index = - has_bit_indices_[i] >= 0 ? StrCat(has_bit_indices_[i]) : "~0u"; - format("$1$,\n", index); - } - } - if (!inlined_string_indices_.empty()) { - entries += inlined_string_indices_.size(); - for (int inlined_string_index : inlined_string_indices_) { - const std::string index = - inlined_string_index >= 0 - ? StrCat(inlined_string_index, ", // inlined_string_index") - : "~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( - "inline void $classname$::SharedCtor(\n" - " ::_pb::Arena* arena, bool is_message_owned) {\n" - " (void)arena;\n" - " (void)is_message_owned;\n"); - - format.Indent(); - // Impl_ _impl_. - format("new (&_impl_) Impl_{"); - format.Indent(); - const char* field_sep = " "; - const auto put_sep = [&] { - format("\n$1$ ", field_sep); - field_sep = ","; - }; - - // Note: any fields without move/copy constructors can't be explicitly - // aggregate initialized pre-C++17. - if (descriptor_->extension_range_count() > 0) { - put_sep(); - format("/*decltype($extensions$)*/{::_pbi::ArenaInitialized(), arena}"); - } - if (!inlined_string_indices_.empty()) { - put_sep(); - format("decltype($inlined_string_donated_array$){}"); - } - bool need_to_emit_cached_size = !HasSimpleBaseClass(descriptor_, options_); - if (!has_bit_indices_.empty()) { - put_sep(); - format("decltype($has_bits$){}"); - if (need_to_emit_cached_size) { - put_sep(); - format("/*decltype($cached_size$)*/{}"); - need_to_emit_cached_size = false; - } - } - - // Initialize member variables with arena constructor. - for (auto field : optimized_order_) { - GOOGLE_DCHECK(!IsFieldStripped(field, options_)); - if (ShouldSplit(field, options_)) { - continue; - } - put_sep(); - field_generators_.get(field).GenerateAggregateInitializer(printer); - } - if (ShouldSplit(descriptor_, options_)) { - put_sep(); - format("decltype($split$){reinterpret_cast(&$1$)}", - DefaultInstanceName(descriptor_, options_, /*split=*/true)); - } - for (auto oneof : OneOfRange(descriptor_)) { - put_sep(); - format("decltype(_impl_.$1$_){}", oneof->name()); - } - - if (need_to_emit_cached_size) { - put_sep(); - format("/*decltype($cached_size$)*/{}"); - } - - if (descriptor_->real_oneof_decl_count() != 0) { - put_sep(); - format("/*decltype($oneof_case$)*/{}"); - } - if (num_weak_fields_ > 0) { - put_sep(); - format("decltype($weak_field_map$){arena}"); - } - if (IsAnyMessage(descriptor_, options_)) { - put_sep(); - // AnyMetadata has no move constructor. - format("/*decltype($any_metadata$)*/{&_impl_.type_url_, &_impl_.value_}"); - } - - format.Outdent(); - format("\n};\n"); - - if (!inlined_string_indices_.empty()) { - // Donate inline string fields. - format.Indent(); - // The last bit is the tracking bit for registering ArenaDtor. The bit is 1 - // means ArenaDtor is not registered on construction, and on demand register - // is needed. - format("if (arena != nullptr) {\n"); - if (NeedsArenaDestructor() == ArenaDtorNeeds::kOnDemand) { - format( - " if (!is_message_owned) {\n" - " $inlined_string_donated_array$[0] = ~0u;\n" - " } else {\n" - // We should not register ArenaDtor for MOA. - " $inlined_string_donated_array$[0] = 0xFFFFFFFEu;\n" - " }\n"); - } else { - format(" $inlined_string_donated_array$[0] = 0xFFFFFFFEu;\n"); - } - for (size_t i = 1; i < InlinedStringDonatedSize(); ++i) { - format(" $inlined_string_donated_array$[$1$] = ~0u;\n", i); - } - format("}\n"); - format.Outdent(); - } - - for (const FieldDescriptor* field : optimized_order_) { - if (ShouldSplit(field, options_)) { - continue; - } - field_generators_.get(field).GenerateConstructorCode(printer); - } - - for (auto oneof : OneOfRange(descriptor_)) { - format("clear_has_$1$();\n", oneof->name()); - } - - format.Outdent(); - format("}\n\n"); -} - -void MessageGenerator::GenerateCreateSplitMessage(io::Printer* printer) { - Formatter format(printer, variables_); - format( - "$classname$::Impl_::Split* " - "$classname$::CreateSplitMessage(::$proto_ns$::Arena* arena) {\n"); - format.Indent(); - const char* field_sep = " "; - const auto put_sep = [&] { - format("\n$1$ ", field_sep); - field_sep = ","; - }; - format( - "const size_t size = sizeof(Impl_::Split);\n" - "void* chunk = (arena == nullptr) ?\n" - " ::operator new(size) :\n" - " arena->AllocateAligned(size, alignof(Impl_::Split));\n" - "Impl_::Split* ptr = reinterpret_cast(chunk);\n" - "new (ptr) Impl_::Split{"); - format.Indent(); - for (const FieldDescriptor* field : optimized_order_) { - GOOGLE_DCHECK(!IsFieldStripped(field, options_)); - if (ShouldSplit(field, options_)) { - put_sep(); - field_generators_.get(field).GenerateAggregateInitializer(printer); - } - } - format.Outdent(); - format("};\n"); - for (const FieldDescriptor* field : optimized_order_) { - GOOGLE_DCHECK(!IsFieldStripped(field, options_)); - if (ShouldSplit(field, options_)) { - field_generators_.get(field).GenerateCreateSplitMessageCode(printer); - } - } - format("return ptr;\n"); - format.Outdent(); - format("}\n"); -} - -void MessageGenerator::GenerateInitDefaultSplitInstance(io::Printer* printer) { - if (!ShouldSplit(descriptor_, options_)) return; - - Formatter format(printer, variables_); - const char* field_sep = " "; - const auto put_sep = [&] { - format("\n$1$ ", field_sep); - field_sep = ","; - }; - for (const auto* field : optimized_order_) { - if (ShouldSplit(field, options_)) { - put_sep(); - field_generators_.get(field).GenerateConstexprAggregateInitializer( - printer); - } - } -} - -void MessageGenerator::GenerateSharedDestructorCode(io::Printer* printer) { - if (HasSimpleBaseClass(descriptor_, options_)) return; - Formatter format(printer, variables_); - - format("inline void $classname$::SharedDtor() {\n"); - format.Indent(); - format("$DCHK$(GetArenaForAllocation() == nullptr);\n"); - - if (descriptor_->extension_range_count() > 0) { - format("$extensions$.~ExtensionSet();\n"); - } - - // Write the destructors for each field except oneof members. - // optimized_order_ does not contain oneof fields. - for (auto field : optimized_order_) { - if (ShouldSplit(field, options_)) { - continue; - } - field_generators_.get(field).GenerateDestructorCode(printer); - } - if (ShouldSplit(descriptor_, options_)) { - format("if (!IsSplitMessageDefault()) {\n"); - format.Indent(); - format("auto* $cached_split_ptr$ = $split$;\n"); - for (auto field : optimized_order_) { - if (ShouldSplit(field, options_)) { - field_generators_.get(field).GenerateDestructorCode(printer); - } - } - format("delete $cached_split_ptr$;\n"); - format.Outdent(); - format("}\n"); - } - - // Generate code to destruct oneofs. Clearing should do the work. - for (auto oneof : OneOfRange(descriptor_)) { - format( - "if (has_$1$()) {\n" - " clear_$1$();\n" - "}\n", - oneof->name()); - } - - if (num_weak_fields_) { - format("$weak_field_map$.ClearAll();\n"); - } - - if (IsAnyMessage(descriptor_, options_)) { - format("$any_metadata$.~AnyMetadata();\n"); - } - - format.Outdent(); - format( - "}\n" - "\n"); -} - -ArenaDtorNeeds MessageGenerator::NeedsArenaDestructor() const { - if (HasSimpleBaseClass(descriptor_, options_)) return ArenaDtorNeeds::kNone; - ArenaDtorNeeds needs = ArenaDtorNeeds::kNone; - for (const auto* field : FieldRange(descriptor_)) { - if (IsFieldStripped(field, options_)) continue; - needs = - std::max(needs, field_generators_.get(field).NeedsArenaDestructor()); - } - return needs; -} - -void MessageGenerator::GenerateArenaDestructorCode(io::Printer* printer) { - GOOGLE_CHECK(NeedsArenaDestructor() > ArenaDtorNeeds::kNone); - - Formatter format(printer, variables_); - - // Generate the ArenaDtor() method. Track whether any fields actually produced - // code that needs to be called. - format("void $classname$::ArenaDtor(void* object) {\n"); - format.Indent(); - - // This code is placed inside a static method, rather than an ordinary one, - // since that simplifies Arena's destructor list (ordinary function pointers - // rather than member function pointers). _this is the object being - // destructed. - format("$classname$* _this = reinterpret_cast< $classname$* >(object);\n"); - - // Process non-oneof fields first. - for (auto field : optimized_order_) { - if (IsFieldStripped(field, options_) || ShouldSplit(field, options_)) - continue; - const FieldGenerator& fg = field_generators_.get(field); - fg.GenerateArenaDestructorCode(printer); - } - if (ShouldSplit(descriptor_, options_)) { - format("if (!_this->IsSplitMessageDefault()) {\n"); - format.Indent(); - for (auto field : optimized_order_) { - if (IsFieldStripped(field, options_) || !ShouldSplit(field, options_)) - continue; - const FieldGenerator& fg = field_generators_.get(field); - fg.GenerateArenaDestructorCode(printer); - } - format.Outdent(); - format("}\n"); - } - - // Process oneof fields. - for (auto oneof : OneOfRange(descriptor_)) { - for (auto field : FieldRange(oneof)) { - if (IsFieldStripped(field, options_)) continue; - field_generators_.get(field).GenerateArenaDestructorCode(printer); - } - } - - format.Outdent(); - format("}\n"); -} - -void MessageGenerator::GenerateConstexprConstructor(io::Printer* printer) { - Formatter format(printer, variables_); - - if (IsMapEntryMessage(descriptor_) || !HasImplData(descriptor_, options_)) { - format( - "PROTOBUF_CONSTEXPR $classname$::$classname$(\n" - " ::_pbi::ConstantInitialized) {}\n"); - return; - } - - format( - "PROTOBUF_CONSTEXPR $classname$::$classname$(\n" - " ::_pbi::ConstantInitialized)"); - - bool need_to_emit_cached_size = !HasSimpleBaseClass(descriptor_, options_); - format(": _impl_{"); - format.Indent(); - const char* field_sep = " "; - const auto put_sep = [&] { - format("\n$1$ ", field_sep); - field_sep = ","; - }; - if (descriptor_->extension_range_count() > 0) { - put_sep(); - format("/*decltype($extensions$)*/{}"); - } - if (!inlined_string_indices_.empty()) { - put_sep(); - format("/*decltype($inlined_string_donated_array$)*/{}"); - } - if (!has_bit_indices_.empty()) { - put_sep(); - format("/*decltype($has_bits$)*/{}"); - if (need_to_emit_cached_size) { - put_sep(); - format("/*decltype($cached_size$)*/{}"); - need_to_emit_cached_size = false; - } - } - for (auto field : optimized_order_) { - if (ShouldSplit(field, options_)) { - continue; - } - put_sep(); - field_generators_.get(field).GenerateConstexprAggregateInitializer( - printer); - } - if (ShouldSplit(descriptor_, options_)) { - put_sep(); - format("/*decltype($split$)*/&$1$._instance", - DefaultInstanceName(descriptor_, options_, /*split=*/true)); - } - - for (auto oneof : OneOfRange(descriptor_)) { - put_sep(); - format("/*decltype(_impl_.$1$_)*/{}", oneof->name()); - } - - if (need_to_emit_cached_size) { - put_sep(); - format("/*decltype($cached_size$)*/{}"); - } - - if (descriptor_->real_oneof_decl_count() != 0) { - put_sep(); - format("/*decltype($oneof_case$)*/{}"); - } - - if (num_weak_fields_) { - put_sep(); - format("/*decltype($weak_field_map$)*/{}"); - } - - if (IsAnyMessage(descriptor_, options_)) { - put_sep(); - format( - "/*decltype($any_metadata$)*/{&_impl_.type_url_, " - "&_impl_.value_}"); - } - - format.Outdent(); - format("} {}\n"); -} - -void MessageGenerator::GenerateCopyConstructorBody(io::Printer* printer) const { - Formatter format(printer, variables_); - - const RunMap runs = - FindRuns(optimized_order_, [this](const FieldDescriptor* field) { - return IsPOD(field) && !ShouldSplit(field, options_); - }); - - std::string pod_template = - "::memcpy(&$first$, &from.$first$,\n" - " static_cast(reinterpret_cast(&$last$) -\n" - " reinterpret_cast(&$first$)) + sizeof($last$));\n"; - - if (ShouldSplit(descriptor_, options_)) { - format("if (!from.IsSplitMessageDefault()) {\n"); - format.Indent(); - format("_this->PrepareSplitMessageForWrite();\n"); - for (auto field : optimized_order_) { - if (ShouldSplit(field, options_)) { - field_generators_.get(field).GenerateCopyConstructorCode(printer); - } - } - format.Outdent(); - format("}\n"); - } - - for (size_t i = 0; i < optimized_order_.size(); ++i) { - const FieldDescriptor* field = optimized_order_[i]; - if (ShouldSplit(field, options_)) { - continue; - } - 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. - if (it != runs.end() && it->second > 1) { - // Use a memset, then skip run_length fields. - const size_t run_length = it->second; - const std::string first_field_name = - FieldMemberName(field, /*cold=*/false); - const std::string last_field_name = - FieldMemberName(optimized_order_[i + run_length - 1], /*cold=*/false); - - format.Set("first", first_field_name); - format.Set("last", last_field_name); - - format(pod_template.c_str()); - - i += run_length - 1; - // ++i at the top of the loop. - } else { - field_generators_.get(field).GenerateCopyConstructorCode(printer); - } - } -} - -void MessageGenerator::GenerateStructors(io::Printer* printer) { - Formatter format(printer, variables_); - - format( - "$classname$::$classname$(::$proto_ns$::Arena* arena,\n" - " bool is_message_owned)\n" - " : $1$(arena, is_message_owned) {\n", - SuperClassName(descriptor_, options_)); - - if (!HasSimpleBaseClass(descriptor_, options_)) { - format(" SharedCtor(arena, is_message_owned);\n"); - if (NeedsArenaDestructor() == ArenaDtorNeeds::kRequired) { - format( - " if (arena != nullptr && !is_message_owned) {\n" - " arena->OwnCustomDestructor(this, &$classname$::ArenaDtor);\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_)) { - // If we are in lite mode and using implicit weak fields, we generate a - // one-liner copy constructor that delegates to MergeFrom. This saves some - // code size and also cuts down on the complexity of implicit weak fields. - // We might eventually want to do this for all lite protos. - format( - "$classname$::$classname$(const $classname$& from)\n" - " : $classname$() {\n" - " MergeFrom(from);\n" - "}\n"); - } else { - format( - "$classname$::$classname$(const $classname$& from)\n" - " : $superclass$() {\n"); - format.Indent(); - format("$classname$* const _this = this; (void)_this;\n"); - - if (HasImplData(descriptor_, options_)) { - const char* field_sep = " "; - const auto put_sep = [&] { - format("\n$1$ ", field_sep); - field_sep = ","; - }; - - format("new (&_impl_) Impl_{"); - format.Indent(); - - if (descriptor_->extension_range_count() > 0) { - put_sep(); - format("/*decltype($extensions$)*/{}"); - } - if (!inlined_string_indices_.empty()) { - // Do not copy inlined_string_donated_, because this is not an arena - // constructor. - put_sep(); - format("decltype($inlined_string_donated_array$){}"); - } - bool need_to_emit_cached_size = - !HasSimpleBaseClass(descriptor_, options_); - if (!has_bit_indices_.empty()) { - put_sep(); - format("decltype($has_bits$){from.$has_bits$}"); - if (need_to_emit_cached_size) { - put_sep(); - format("/*decltype($cached_size$)*/{}"); - need_to_emit_cached_size = false; - } - } - - // Initialize member variables with arena constructor. - for (auto field : optimized_order_) { - if (ShouldSplit(field, options_)) { - continue; - } - put_sep(); - field_generators_.get(field).GenerateCopyAggregateInitializer(printer); - } - if (ShouldSplit(descriptor_, options_)) { - put_sep(); - format("decltype($split$){reinterpret_cast(&$1$)}", - DefaultInstanceName(descriptor_, options_, /*split=*/true)); - } - for (auto oneof : OneOfRange(descriptor_)) { - put_sep(); - format("decltype(_impl_.$1$_){}", oneof->name()); - } - - if (need_to_emit_cached_size) { - put_sep(); - format("/*decltype($cached_size$)*/{}"); - } - - if (descriptor_->real_oneof_decl_count() != 0) { - put_sep(); - format("/*decltype($oneof_case$)*/{}"); - } - if (num_weak_fields_ > 0) { - put_sep(); - format("decltype($weak_field_map$){from.$weak_field_map$}"); - } - if (IsAnyMessage(descriptor_, options_)) { - put_sep(); - format( - "/*decltype($any_metadata$)*/{&_impl_.type_url_, &_impl_.value_}"); - } - format.Outdent(); - format("};\n\n"); - } - - format( - "_internal_metadata_.MergeFrom<$unknown_fields_type$>(from._internal_" - "metadata_);\n"); - - if (descriptor_->extension_range_count() > 0) { - format( - "$extensions$.MergeFrom(internal_default_instance(), " - "from.$extensions$);\n"); - } - - GenerateCopyConstructorBody(printer); - - // Copy oneof fields. Oneof field requires oneof case check. - for (auto oneof : OneOfRange(descriptor_)) { - format( - "clear_has_$1$();\n" - "switch (from.$1$_case()) {\n", - oneof->name()); - format.Indent(); - for (auto field : FieldRange(oneof)) { - format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); - format.Indent(); - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GenerateMergingCode(printer); - } - format("break;\n"); - format.Outdent(); - format("}\n"); - } - format( - "case $1$_NOT_SET: {\n" - " break;\n" - "}\n", - ToUpper(oneof->name())); - format.Outdent(); - format("}\n"); - } - - format.Outdent(); - format( - " // @@protoc_insertion_point(copy_constructor:$full_name$)\n" - "}\n" - "\n"); - } - - // Generate the shared constructor code. - GenerateSharedConstructorCode(printer); - - if (ShouldSplit(descriptor_, options_)) { - GenerateCreateSplitMessage(printer); - } - - // Generate the destructor. - if (!HasSimpleBaseClass(descriptor_, options_)) { - format( - "$classname$::~$classname$() {\n" - " // @@protoc_insertion_point(destructor:$full_name$)\n"); - format( - " if (auto *arena = " - "_internal_metadata_.DeleteReturnArena<$unknown_fields_type$>()) {\n" - " (void)arena;\n"); - if (NeedsArenaDestructor() > ArenaDtorNeeds::kNone) { - format(" ArenaDtor(this);\n"); - } - format( - " return;\n" - " }\n"); - format( - " SharedDtor();\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 (NeedsArenaDestructor() > ArenaDtorNeeds::kNone) { - GenerateArenaDestructorCode(printer); - } - - 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) { - Formatter format(printer, variables_); - format( - "template<> " - "PROTOBUF_NOINLINE $classtype$*\n" - "Arena::CreateMaybeMessage< $classtype$ >(Arena* arena) {\n" - " return Arena::CreateMessageInternal< $classtype$ >(arena);\n" - "}\n"); -} - -void MessageGenerator::GenerateClear(io::Printer* printer) { - if (HasSimpleBaseClass(descriptor_, options_)) return; - Formatter format(printer, variables_); - - // 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( - "void $classname$::Clear() {\n" - "// @@protoc_insertion_point(message_clear_start:$full_name$)\n"); - format.Indent(); - - format( - // TODO(jwb): It would be better to avoid emitting this if it is not used, - // rather than emitting a workaround for the resulting warning. - "$uint32$ cached_has_bits = 0;\n" - "// Prevent compiler warnings about cached_has_bits being unused\n" - "(void) cached_has_bits;\n\n"); - - if (descriptor_->extension_range_count() > 0) { - format("$extensions$.Clear();\n"); - } - - // 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); - } - } - bool merge_zero_init = zero_init_bytes > kMaxUnconditionalPrimitiveBytesClear; - int chunk_count = 0; - - std::vector> chunks = CollectFields( - optimized_order_, - [&](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() && - ShouldSplit(a, options_) == ShouldSplit(b, options_) && - (CanInitializeByZeroing(a) == CanInitializeByZeroing(b) || - (CanInitializeByZeroing(a) && - (chunk_count == 1 || merge_zero_init))); - if (!same) chunk_count = 0; - return same; - }); - - ColdChunkSkipper cold_skipper(descriptor_, options_, chunks, has_bit_indices_, - kColdRatio); - int cached_has_word_index = -1; - - for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) { - std::vector& chunk = chunks[chunk_index]; - cold_skipper.OnStartChunk(chunk_index, cached_has_word_index, "", printer); - - const FieldDescriptor* memset_start = nullptr; - const FieldDescriptor* memset_end = nullptr; - bool saw_non_zero_init = false; - bool chunk_is_cold = !chunk.empty() && ShouldSplit(chunk.front(), options_); - for (const auto& field : chunk) { - if (CanInitializeByZeroing(field)) { - GOOGLE_CHECK(!saw_non_zero_init); - if (!memset_start) memset_start = field; - memset_end = field; - } else { - saw_non_zero_init = true; - } - } - - // Whether we wrap this chunk in: - // if (cached_has_bits & 1 && - (memset_end != chunk.back() || merge_zero_init); - - 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)); - - // 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)); - - 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", chunk_mask_str); - format.Indent(); - } - - if (chunk_is_cold) { - format("if (!IsSplitMessageDefault()) {\n"); - format.Indent(); - } - - if (memset_start) { - if (memset_start == memset_end) { - // For clarity, do not memset a single field. - field_generators_.get(memset_start) - .GenerateMessageClearingCode(printer); - } else { - GOOGLE_CHECK_EQ(chunk_is_cold, ShouldSplit(memset_start, options_)); - GOOGLE_CHECK_EQ(chunk_is_cold, ShouldSplit(memset_end, options_)); - format( - "::memset(&$1$, 0, static_cast(\n" - " reinterpret_cast(&$2$) -\n" - " reinterpret_cast(&$1$)) + sizeof($2$));\n", - FieldMemberName(memset_start, chunk_is_cold), - FieldMemberName(memset_end, chunk_is_cold)); - } - } - - // 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 have_enclosing_if = - HasBitIndex(field) != kNoHasbit && - (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || - field->cpp_type() == FieldDescriptor::CPPTYPE_STRING); - - if (have_enclosing_if) { - PrintPresenceCheck(format, field, has_bit_indices_, printer, - &cached_has_word_index); - } - - field_generators_.get(field).GenerateMessageClearingCode(printer); - - if (have_enclosing_if) { - format.Outdent(); - format("}\n"); - } - } - - if (chunk_is_cold) { - format.Outdent(); - format("}\n"); - } - - if (have_outer_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; - } - } - - // Step 4: Unions. - for (auto oneof : OneOfRange(descriptor_)) { - format("clear_$1$();\n", oneof->name()); - } - - if (num_weak_fields_) { - format("$weak_field_map$.ClearAll();\n"); - } - - // We don't clear donated status. - - if (!has_bit_indices_.empty()) { - // Step 5: Everything else. - format("$has_bits$.Clear();\n"); - } - - std::map vars; - SetUnknownFieldsVariable(descriptor_, options_, &vars); - format.AddMap(vars); - format("_internal_metadata_.Clear<$unknown_fields_type$>();\n"); - - format.Outdent(); - format("}\n"); -} - -void MessageGenerator::GenerateOneofClear(io::Printer* printer) { - // Generated function clears the active field and union case (e.g. foo_case_). - int i = 0; - for (auto oneof : OneOfRange(descriptor_)) { - Formatter format(printer, variables_); - format.Set("oneofname", oneof->name()); - - format( - "void $classname$::clear_$oneofname$() {\n" - "// @@protoc_insertion_point(one_of_clear_start:$full_name$)\n"); - format.Indent(); - format("switch ($oneofname$_case()) {\n"); - format.Indent(); - for (auto field : FieldRange(oneof)) { - format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); - format.Indent(); - // We clear only allocated objects in oneofs - if (!IsStringOrMessage(field) || IsFieldStripped(field, options_)) { - format("// No need to clear\n"); - } else { - field_generators_.get(field).GenerateClearingCode(printer); - } - format("break;\n"); - format.Outdent(); - format("}\n"); - } - format( - "case $1$_NOT_SET: {\n" - " break;\n" - "}\n", - ToUpper(oneof->name())); - format.Outdent(); - format( - "}\n" - "$oneof_case$[$1$] = $2$_NOT_SET;\n", - i, ToUpper(oneof->name())); - format.Outdent(); - 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"); - format.Indent(); - format("using std::swap;\n"); - - if (HasGeneratedMethods(descriptor_->file(), options_)) { - if (descriptor_->extension_range_count() > 0) { - format( - "$extensions$.InternalSwap(&other->$extensions$);" - "\n"); - } - - std::map vars; - SetUnknownFieldsVariable(descriptor_, options_, &vars); - format.AddMap(vars); - if (HasNonSplitOptionalString(descriptor_, options_)) { - format( - "auto* lhs_arena = GetArenaForAllocation();\n" - "auto* rhs_arena = other->GetArenaForAllocation();\n"); - } - format("_internal_metadata_.InternalSwap(&other->_internal_metadata_);\n"); - - if (!has_bit_indices_.empty()) { - for (int i = 0; i < HasBitsSize(); ++i) { - format("swap($has_bits$[$1$], other->$has_bits$[$1$]);\n", i); - } - } - - // If possible, we swap several fields at once, including padding. - const RunMap runs = - FindRuns(optimized_order_, [this](const FieldDescriptor* field) { - return !ShouldSplit(field, options_) && - CanBeManipulatedAsRawBytes(field, options_, scc_analyzer_); - }); - - for (size_t i = 0; i < optimized_order_.size(); ++i) { - const FieldDescriptor* field = optimized_order_[i]; - if (ShouldSplit(field, options_)) { - continue; - } - 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 = - FieldMemberName(field, /*cold=*/false); - const std::string last_field_name = FieldMemberName( - optimized_order_[i + run_length - 1], /*cold=*/false); - - 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); - } - } - if (ShouldSplit(descriptor_, options_)) { - format("swap($split$, other->$split$);\n"); - } - - for (auto oneof : OneOfRange(descriptor_)) { - format("swap(_impl_.$1$_, other->_impl_.$1$_);\n", oneof->name()); - } - - for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { - format("swap($oneof_case$[$1$], other->$oneof_case$[$1$]);\n", i); - } - - if (num_weak_fields_) { - format( - "$weak_field_map$.UnsafeArenaSwap(&other->$weak_field_map$)" - ";\n"); - } - - if (!inlined_string_indices_.empty()) { - for (size_t i = 0; i < InlinedStringDonatedSize(); ++i) { - format( - "swap($inlined_string_donated_array$[$1$], " - "other->$inlined_string_donated_array$[$1$]);\n", - i); - } - } - } else { - format("GetReflection()->Swap(this, other);"); - } - - format.Outdent(); - format("}\n"); -} - -void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { - Formatter format(printer, variables_); - 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( - "const ::$proto_ns$::Message::ClassData " - "$classname$::_class_data_ = {\n" - " ::$proto_ns$::Message::CopyWithSourceCheck,\n" - " $classname$::MergeImpl\n" - "};\n" - "const ::$proto_ns$::Message::ClassData*" - "$classname$::GetClassData() const { return &_class_data_; }\n" - "\n"); - } else { - // Generate CheckTypeAndMergeFrom(). - format( - "void $classname$::CheckTypeAndMergeFrom(\n" - " const ::$proto_ns$::MessageLite& from) {\n" - " MergeFrom(*::_pbi::DownCast(\n" - " &from));\n" - "}\n"); - } - } else { - // In the simple case, we just define ClassData that vectors back to the - // simple implementation of Copy and Merge. - format( - "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::GenerateClassSpecificMergeImpl(io::Printer* printer) { - if (HasSimpleBaseClass(descriptor_, options_)) return; - // Generate the class-specific MergeFrom, which avoids the GOOGLE_CHECK and cast. - Formatter format(printer, variables_); - if (!HasDescriptorMethods(descriptor_->file(), options_)) { - // For messages that don't inherit from Message, just implement MergeFrom - // directly. - format( - "void $classname$::MergeFrom(const $classname$& from) {\n" - " $classname$* const _this = this;\n"); - } else { - format( - "void $classname$::MergeImpl(::$proto_ns$::Message& to_msg, const " - "::$proto_ns$::Message& from_msg) {\n" - " auto* const _this = static_cast<$classname$*>(&to_msg);\n" - " auto& from = static_cast(from_msg);\n"); - } - format.Indent(); - format( - "$annotate_mergefrom$" - "// @@protoc_insertion_point(class_specific_merge_from_start:" - "$full_name$)\n"); - format("$DCHK$_NE(&from, _this);\n"); - - format( - "$uint32$ cached_has_bits = 0;\n" - "(void) cached_has_bits;\n\n"); - - if (ShouldSplit(descriptor_, options_)) { - format( - "if (!from.IsSplitMessageDefault()) {\n" - " _this->PrepareSplitMessageForWrite();\n" - "}\n"); - } - - std::vector> chunks = CollectFields( - optimized_order_, - [&](const FieldDescriptor* a, const FieldDescriptor* b) -> bool { - return HasByteIndex(a) == HasByteIndex(b) && - ShouldSplit(a, options_) == ShouldSplit(b, options_); - }); - - ColdChunkSkipper cold_skipper(descriptor_, options_, chunks, has_bit_indices_, - kColdRatio); - - // 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; - - 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); - - 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)); - - // 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)); - - 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); - } - - format("if (cached_has_bits & 0x$1$u) {\n", chunk_mask_str); - 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); - - 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"); - } - } 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(); - 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()]; - 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)) { - // 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); - } else { - generator.GenerateMergingCode(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_word_index); - format("_this->$has_bits$[$1$] |= cached_has_bits;\n", - cached_has_word_index); - } - - 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; - } - } - - // Merge oneof fields. Oneof field requires oneof case check. - for (auto oneof : OneOfRange(descriptor_)) { - format("switch (from.$1$_case()) {\n", oneof->name()); - format.Indent(); - for (auto field : FieldRange(oneof)) { - format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); - format.Indent(); - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GenerateMergingCode(printer); - } - format("break;\n"); - format.Outdent(); - format("}\n"); - } - format( - "case $1$_NOT_SET: {\n" - " break;\n" - "}\n", - ToUpper(oneof->name())); - format.Outdent(); - format("}\n"); - } - if (num_weak_fields_) { - format( - "_this->$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( - "_this->$extensions$.MergeFrom(internal_default_instance(), " - "from.$extensions$);\n"); - } - - format( - "_this->_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_)) { - // 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::CopyWithSourceCheck, - // which calls Clear() and then MergeFrom(), as well as making sure that - // clearing the destination message doesn't alter 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. - format( - "void $classname$::CopyFrom(const $classname$& from) {\n" - "// @@protoc_insertion_point(class_specific_copy_from_start:" - "$full_name$)\n"); - format.Indent(); - - format("if (&from == this) return;\n"); - - if (!options_.opensource_runtime && HasMessageFieldOrExtension(descriptor_)) { - // This check is disabled in the opensource release because we're - // concerned that many users do not define NDEBUG in their release builds. - // It is also disabled if a message has neither message fields nor - // extensions, as it's impossible to copy from its descendant. - // - // Note that FailIfCopyFromDescendant is implemented by reflection and not - // available for lite runtime. In that case, check if the size of the source - // has changed after Clear. - format("#ifndef NDEBUG\n"); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format("FailIfCopyFromDescendant(*this, from);\n"); - } else { - format("size_t from_size = from.ByteSizeLong();\n"); - } - format( - "#endif\n" - "Clear();\n"); - if (!HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "#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"); -} - -void MessageGenerator::GenerateVerify(io::Printer* printer) { -} - -void MessageGenerator::GenerateSerializeOneofFields( - io::Printer* printer, const std::vector& fields) { - Formatter format(printer, variables_); - GOOGLE_CHECK(!fields.empty()); - if (fields.size() == 1) { - GenerateSerializeOneField(printer, fields[0], -1); - return; - } - // We have multiple mutually exclusive choices. Emit a switch statement. - const OneofDescriptor* oneof = fields[0]->containing_oneof(); - format("switch ($1$_case()) {\n", oneof->name()); - format.Indent(); - for (auto field : fields) { - format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); - format.Indent(); - field_generators_.get(field).GenerateSerializeWithCachedSizesToArray( - printer); - format("break;\n"); - format.Outdent(); - format("}\n"); - } - format.Outdent(); - // Doing nothing is an option. - format( - " default: ;\n" - "}\n"); -} - -void MessageGenerator::GenerateSerializeOneField(io::Printer* printer, - const FieldDescriptor* field, - int cached_has_bits_index) { - Formatter format(printer, variables_); - if (!field->options().weak()) { - // For weakfields, PrintFieldComment is called during iteration. - PrintFieldComment(format, field); - } - - bool have_enclosing_if = false; - if (field->options().weak()) { - } else if (HasHasbit(field)) { - // Attempt to use the state of cached_has_bits, if possible. - 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)); - - format("if (cached_has_bits & 0x$1$u) {\n", mask); - } else { - format("if (_internal_has_$1$()) {\n", FieldName(field)); - } - - format.Indent(); - have_enclosing_if = true; - } else if (field->is_optional() && !HasHasbit(field)) { - have_enclosing_if = EmitFieldNonDefaultCondition(printer, "this->", field); - } - - field_generators_.get(field).GenerateSerializeWithCachedSizesToArray(printer); - - if (have_enclosing_if) { - format.Outdent(); - format("}\n"); - } - format("\n"); -} - -void MessageGenerator::GenerateSerializeOneExtensionRange( - io::Printer* printer, const Descriptor::ExtensionRange* range) { - std::map vars = variables_; - vars["start"] = StrCat(range->start); - vars["end"] = StrCat(range->end); - Formatter format(printer, vars); - format("// Extension range [$start$, $end$)\n"); - format( - "target = $extensions$._InternalSerialize(\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. - format( - "$uint8$* $classname$::_InternalSerialize(\n" - " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " - "const {\n" - "$annotate_serialize$" - " target = $extensions$." - "InternalSerializeMessageSetWithCachedSizesToArray(\n" // - "internal_default_instance(), target, stream);\n"); - std::map vars; - SetUnknownFieldsVariable(descriptor_, options_, &vars); - format.AddMap(vars); - format( - " target = ::_pbi::" - "InternalSerializeUnknownMessageSetItemsToArray(\n" - " $unknown_fields$, target, stream);\n"); - format( - " return target;\n" - "}\n"); - return; - } - - format( - "$uint8$* $classname$::_InternalSerialize(\n" - " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " - "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(); - format( - " return target;\n" - "}\n"); -} - -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 - // because it lets the C++ compiler know this is a "at most one can happen" - // situation. If we emitted "if (has_x()) ...; if (has_y()) ..." the C++ - // compiler's emitted code might check has_y() even when has_x() is true. - class LazySerializerEmitter { - public: - LazySerializerEmitter(MessageGenerator* mg, io::Printer* printer) - : mg_(mg), - format_(printer), - eager_(IsProto3(mg->descriptor_->file())), - cached_has_bit_index_(kNoHasbit) {} - - ~LazySerializerEmitter() { Flush(); } - - // If conditions allow, try to accumulate a run of fields from the same - // oneof, and handle them at the next Flush(). - void Emit(const FieldDescriptor* field) { - if (eager_ || MustFlush(field)) { - Flush(); - } - if (!field->real_containing_oneof()) { - // TODO(ckennelly): Defer non-oneof fields similarly to oneof fields. - - if (!field->options().weak() && !field->is_repeated() && !eager_) { - // We speculatively load the entire _has_bits_[index] contents, even - // if it is for only one field. Deferring non-oneof emitting would - // allow us to determine whether this is going to be useful. - int has_bit_index = mg_->has_bit_indices_[field->index()]; - if (cached_has_bit_index_ != has_bit_index / 32) { - // Reload. - int new_index = has_bit_index / 32; - - format_("cached_has_bits = _impl_._has_bits_[$1$];\n", new_index); - - cached_has_bit_index_ = new_index; - } - } - - mg_->GenerateSerializeOneField(format_.printer(), field, - cached_has_bit_index_); - } else { - v_.push_back(field); - } - } - - void EmitIfNotNull(const FieldDescriptor* field) { - if (field != nullptr) { - Emit(field); - } - } - - void Flush() { - if (!v_.empty()) { - mg_->GenerateSerializeOneofFields(format_.printer(), v_); - v_.clear(); - } - } - - private: - // If we have multiple fields in v_ then they all must be from the same - // oneof. Would adding field to v_ break that invariant? - bool MustFlush(const FieldDescriptor* field) { - return !v_.empty() && - v_[0]->containing_oneof() != field->containing_oneof(); - } - - MessageGenerator* mg_; - Formatter format_; - const bool eager_; - std::vector v_; - - // 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_; - }; - - 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_); - - 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()); - if (num_weak_fields_) { - format( - "::_pbi::WeakFieldMap::FieldWriter field_writer(" - "$weak_field_map$);\n"); - } - - format( - "$uint32$ cached_has_bits = 0;\n" - "(void) cached_has_bits;\n\n"); - - // Merge the fields and the extension ranges, both sorted by field number. - { - LazySerializerEmitter e(this, printer); - LazyExtensionRangeEmitter re(this, printer); - LargestWeakFieldHolder largest_weak_field; - int i, j; - for (i = 0, j = 0; - i < ordered_fields.size() || j < sorted_extensions.size();) { - if ((j == sorted_extensions.size()) || - (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()) { - largest_weak_field.ReplaceIfLarger(field); - PrintFieldComment(format, field); - } else { - e.EmitIfNotNull(largest_weak_field.Release()); - e.Emit(field); - } - } else { - e.EmitIfNotNull(largest_weak_field.Release()); - e.Flush(); - re.AddToRange(sorted_extensions[j++]); - } - } - re.Flush(); - e.EmitIfNotNull(largest_weak_field.Release()); - } - - 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 = " - "::_pbi::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"); -} - -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( - "::_pbi::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 = " - "::_pbi::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); - - for (auto field : FieldRange(descriptor_)) { - if (!field->is_required()) { - continue; - } - - const int has_bit_index = has_bit_indices_[field->index()]; - masks[has_bit_index / 32] |= static_cast(1) - << (has_bit_index % 32); - } - return masks; -} - -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; - 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" - " total_size += ::_pbi::\n" - " ComputeUnknownMessageSetItemsSize($unknown_fields$);\n" - " }\n" - " int cached_size = " - "::_pbi::ToCachedSize(total_size);\n" - " SetCachedSize(cached_size);\n" - " return total_size;\n" - "}\n"); - return; - } - - if (num_required_fields_ > 1) { - // Emit a function (rarely used, we hope) that handles the required fields - // by checking for each one individually. - format( - "size_t $classname$::RequiredFieldsByteSizeFallback() const {\n" - "// @@protoc_insertion_point(required_fields_byte_size_fallback_start:" - "$full_name$)\n"); - format.Indent(); - format("size_t total_size = 0;\n"); - for (auto field : optimized_order_) { - if (field->is_required()) { - format( - "\n" - "if (_internal_has_$1$()) {\n", - FieldName(field)); - format.Indent(); - PrintFieldComment(format, field); - field_generators_.get(field).GenerateByteSize(printer); - format.Outdent(); - format("}\n"); - } - } - format( - "\n" - "return total_size;\n"); - format.Outdent(); - format("}\n"); - } - - format( - "size_t $classname$::ByteSizeLong() const {\n" - "$annotate_bytesize$" - "// @@protoc_insertion_point(message_byte_size_start:$full_name$)\n"); - format.Indent(); - format( - "size_t total_size = 0;\n" - "\n"); - - if (descriptor_->extension_range_count() > 0) { - format( - "total_size += $extensions$.ByteSize();\n" - "\n"); - } - - std::map 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) { - // The fast path works if all required fields are present. - const std::vector masks_for_has_bits = RequiredFieldsBitMask(); - format("if ($1$) { // All required fields are present.\n", - ConditionalToCheckBitmasks(masks_for_has_bits)); - format.Indent(); - // Oneof fields cannot be required, so optimized_order_ contains all of the - // fields that we need to potentially emit. - for (auto field : optimized_order_) { - if (!field->is_required()) continue; - PrintFieldComment(format, field); - field_generators_.get(field).GenerateByteSize(printer); - format("\n"); - } - format.Outdent(); - format( - "} else {\n" // the slow path - " total_size += RequiredFieldsByteSizeFallback();\n" - "}\n"); - } else { - // num_required_fields_ <= 1: no need to be tricky - for (auto field : optimized_order_) { - if (!field->is_required()) continue; - PrintFieldComment(format, field); - format("if (_internal_has_$1$()) {\n", FieldName(field)); - format.Indent(); - field_generators_.get(field).GenerateByteSize(printer); - format.Outdent(); - format("}\n"); - } - } - - std::vector> chunks = CollectFields( - optimized_order_, - [&](const FieldDescriptor* a, const FieldDescriptor* b) -> bool { - return a->label() == b->label() && HasByteIndex(a) == HasByteIndex(b) && - ShouldSplit(a, options_) == ShouldSplit(b, options_); - }); - - // Remove chunks with required fields. - chunks.erase(std::remove_if(chunks.begin(), chunks.end(), IsRequired), - chunks.end()); - - ColdChunkSkipper cold_skipper(descriptor_, 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"); - - for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) { - const std::vector& chunk = chunks[chunk_index]; - const bool have_outer_if = - chunk.size() > 1 && HasWordIndex(chunk[0]) != kNoHasbit; - cold_skipper.OnStartChunk(chunk_index, cached_has_word_index, "", printer); - - 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)); - - // 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)); - - 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", chunk_mask_str); - format.Indent(); - } - - // Go back and emit checks for each of the fields we processed. - 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); - - 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_word_index); - have_enclosing_if = true; - } else { - // Without field presence: field is serialized only if it has a - // non-default value. - have_enclosing_if = - EmitFieldNonDefaultCondition(printer, "this->", field); - } - - generator.GenerateByteSize(printer); - - if (have_enclosing_if) { - format.Outdent(); - format( - "}\n" - "\n"); - } - if (need_extra_newline) { - format("\n"); - } - } - - if (have_outer_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; - } - } - - // Fields inside a oneof don't use _has_bits_ so we count them in a separate - // pass. - for (auto oneof : OneOfRange(descriptor_)) { - format("switch ($1$_case()) {\n", oneof->name()); - format.Indent(); - for (auto field : FieldRange(oneof)) { - PrintFieldComment(format, field); - format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); - format.Indent(); - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GenerateByteSize(printer); - } - format("break;\n"); - format.Outdent(); - format("}\n"); - } - format( - "case $1$_NOT_SET: {\n" - " break;\n" - "}\n", - ToUpper(oneof->name())); - format.Outdent(); - format("}\n"); - } - - if (num_weak_fields_) { - // TagSize + MessageSize - format("total_size += $weak_field_map$.ByteSizeLong();\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 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"); - - // 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 = ::_pbi::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(); - - if (descriptor_->extension_range_count() > 0) { - format( - "if (!$extensions$.IsInitialized()) {\n" - " return false;\n" - "}\n\n"); - } - - 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_) { - field_generators_.get(field).GenerateIsInitialized(printer); - } - if (num_weak_fields_) { - // For Weak fields. - format("if (!$weak_field_map$.IsInitialized()) return false;\n"); - } - // Go through the oneof fields, emitting a switch if any might have required - // fields. - for (auto oneof : OneOfRange(descriptor_)) { - bool has_required_fields = false; - for (auto field : FieldRange(oneof)) { - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !ShouldIgnoreRequiredFieldCheck(field, options_) && - scc_analyzer_->HasRequiredFields(field->message_type())) { - has_required_fields = true; - break; - } - } - - if (!has_required_fields) { - continue; - } - - format("switch ($1$_case()) {\n", oneof->name()); - format.Indent(); - for (auto field : FieldRange(oneof)) { - format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); - format.Indent(); - if (!IsFieldStripped(field, options_)) { - field_generators_.get(field).GenerateIsInitialized(printer); - } - format("break;\n"); - format.Outdent(); - format("}\n"); - } - format( - "case $1$_NOT_SET: {\n" - " break;\n" - "}\n", - ToUpper(oneof->name())); - format.Outdent(); - format("}\n"); - } - - format.Outdent(); - format( - " return true;\n" - "}\n"); -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/message.h b/depends/protobuf/src/google/protobuf/compiler/cpp/message.h deleted file mode 100644 index 5bdfcb35e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/message.h +++ /dev/null @@ -1,232 +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. - -#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 { -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class EnumGenerator; // enum.h -class ExtensionGenerator; // extension.h - -class MessageGenerator { - public: - // See generator.cc for the meaning of dllexport_decl. - MessageGenerator(const Descriptor* descriptor, - const std::map& vars, - int index_in_file_messages, const Options& options, - MessageSCCAnalyzer* scc_analyzer); - ~MessageGenerator(); - - // Append the two types of nested generators to the corresponding vector. - void AddGenerators( - std::vector>* enum_generators, - std::vector>* extension_generators); - - // Generate definitions for this class and all its nested types. - void GenerateClassDefinition(io::Printer* printer); - - // Generate definitions of inline methods (placed at the end of the header - // file). - void GenerateInlineMethods(io::Printer* printer); - - // Source file stuff. - - // Generate all non-inline methods for this class. - void GenerateClassMethods(io::Printer* printer); - - // Generate source file code that should go outside any namespace. - void GenerateSourceInProto2Namespace(io::Printer* printer); - - private: - // Generate declarations and definitions of accessors for fields. - void GenerateFieldAccessorDeclarations(io::Printer* printer); - void GenerateFieldAccessorDefinitions(io::Printer* printer); - - // 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); - - // Generate constructors and destructor. - void GenerateStructors(io::Printer* printer); - - // The compiler typically generates multiple copies of each constructor and - // destructor: http://gcc.gnu.org/bugs.html#nonbugs_cxx - // Placing common code in a separate method reduces the generated code size. - // - // Generate the shared constructor code. - void GenerateSharedConstructorCode(io::Printer* printer); - // Generate the shared destructor code. - void GenerateSharedDestructorCode(io::Printer* printer); - // 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); - - void GenerateCreateSplitMessage(io::Printer* printer); - void GenerateInitDefaultSplitInstance(io::Printer* printer); - - // Generate standard Message methods. - void GenerateClear(io::Printer* printer); - void GenerateOneofClear(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 GenerateClassSpecificMergeImpl(io::Printer* printer); - void GenerateCopyFrom(io::Printer* printer); - void GenerateSwap(io::Printer* printer); - void GenerateIsInitialized(io::Printer* printer); - - // Helpers for GenerateSerializeWithCachedSizes(). - // - // cached_has_bit_index maintains that: - // cached_has_bits = _has_bits_[cached_has_bit_index] - // for cached_has_bit_index >= 0 - void GenerateSerializeOneField(io::Printer* printer, - const FieldDescriptor* field, - int cached_has_bits_index); - // Generate a switch statement to serialize 2+ fields from the same oneof. - // Or, if fields.size() == 1, just call GenerateSerializeOneField(). - void GenerateSerializeOneofFields( - io::Printer* printer, const std::vector& fields); - void GenerateSerializeOneExtensionRange( - io::Printer* printer, const Descriptor::ExtensionRange* range); - - // Generates has_foo() functions and variables for singular field has-bits. - void GenerateSingularFieldHasBits(const FieldDescriptor* field, - Formatter format); - // Generates has_foo() functions and variables for oneof field has-bits. - void GenerateOneofHasBits(io::Printer* printer); - // Generates has_foo_bar() functions for oneof members. - void GenerateOneofMemberHasBits(const FieldDescriptor* field, - const Formatter& format); - // Generates the clear_foo() method for a field. - void GenerateFieldClear(const FieldDescriptor* field, bool is_inline, - Formatter format); - - // Generates the body of the message's copy constructor. - void GenerateCopyConstructorBody(io::Printer* printer) const; - - // Returns the level that this message needs ArenaDtor. If the message has - // a field that is not arena-exclusive, it needs an ArenaDtor - // (go/proto-destructor). - // - // - Returning kNone means we don't need to generate ArenaDtor. - // - Returning kOnDemand means we need to generate ArenaDtor, but don't need - // to register ArenaDtor at construction. Such as when the message's - // ArenaDtor code is only for destructing inlined string. - // - Returning kRequired means we meed to generate ArenaDtor and register it - // at construction. - ArenaDtorNeeds NeedsArenaDestructor() const; - - size_t HasBitsSize() 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_; - std::string classname_; - Options options_; - FieldGeneratorMap field_generators_; - // optimized_order_ is the order we layout the message's fields in the - // class. This is reused to initialize the fields in-order for cache - // efficiency. - // - // optimized_order_ excludes oneof fields and weak fields. - 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. If there is no inlined string in the message, - // this is empty. - 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_; - int num_weak_fields_; - - std::unique_ptr message_layout_helper_; - std::unique_ptr parse_function_generator_; - - MessageSCCAnalyzer* scc_analyzer_; - - std::map variables_; - - friend class FileGenerator; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/message_field.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/message_field.cc deleted file mode 100644 index 7e87a0799..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/message_field.cc +++ /dev/null @@ -1,958 +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 { -std::string ReinterpretCast(const std::string& type, - const std::string& expression, - bool implicit_weak_field) { - if (implicit_weak_field) { - return "reinterpret_cast< " + type + " >(" + expression + ")"; - } else { - return expression; - } -} - -void SetMessageVariables(const FieldDescriptor* descriptor, - const Options& options, bool implicit_weak, - std::map* variables) { - SetCommonFieldVariables(descriptor, variables, options); - (*variables)["type"] = FieldMessageTypeName(descriptor, options); - (*variables)["casted_member"] = ReinterpretCast( - (*variables)["type"] + "*", (*variables)["field"], implicit_weak); - (*variables)["casted_member_const"] = - ReinterpretCast("const " + (*variables)["type"] + "&", - "*" + (*variables)["field"], implicit_weak); - (*variables)["type_default_instance"] = - QualifiedDefaultInstanceName(descriptor->message_type(), options); - (*variables)["type_default_instance_ptr"] = ReinterpretCast( - "const ::PROTOBUF_NAMESPACE_ID::MessageLite*", - QualifiedDefaultInstancePtr(descriptor->message_type(), options), - implicit_weak); - (*variables)["type_reference_function"] = - 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"] = - SafeFunctionName(descriptor->containing_type(), descriptor, "release_"); - (*variables)["full_name"] = descriptor->full_name(); -} - -} // namespace - -// =================================================================== - -MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) - : FieldGenerator(descriptor, options), - implicit_weak_field_( - IsImplicitWeakField(descriptor, options, scc_analyzer)), - has_required_fields_( - scc_analyzer->HasRequiredFields(descriptor->message_type())) { - SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_); -} - -MessageFieldGenerator::~MessageFieldGenerator() {} - -void MessageFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format("::$proto_ns$::MessageLite* $name$_;\n"); - } else { - format("$type$* $name$_;\n"); - } -} - -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" - "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", - descriptor_); - if (!IsFieldStripped(descriptor_, options_)) { - format( - "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 {} - -void MessageFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "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" - "}\n" - "inline const $type$& $classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n"); - - format( - "inline void $classname$::unsafe_arena_set_allocated_$name$(\n" - " $type$* $name$) {\n" - "$maybe_prepare_split_message$" - // 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*>($field$);\n" - " }\n"); - if (implicit_weak_field_) { - format( - " $field$ = reinterpret_cast<::$proto_ns$::MessageLite*>($name$);\n"); - } else { - format(" $field$ = $name$;\n"); - } - format( - " 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$" - "$maybe_prepare_split_message$" - " $clear_hasbit$\n" - " $type$* temp = $casted_member$;\n" - " $field$ = 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$" - "$maybe_prepare_split_message$" - " $clear_hasbit$\n" - " $type$* temp = $casted_member$;\n" - " $field$ = nullptr;\n" - " return temp;\n" - "}\n"); - - format( - "inline $type$* $classname$::_internal_mutable_$name$() {\n" - "$type_reference_function$" - " $set_hasbit$\n" - " if ($field$ == nullptr) {\n" - " auto* p = CreateMaybeMessage<$type$>(GetArenaForAllocation());\n"); - if (implicit_weak_field_) { - format(" $field$ = reinterpret_cast<::$proto_ns$::MessageLite*>(p);\n"); - } else { - format(" $field$ = p;\n"); - } - format( - " }\n" - " return $casted_member$;\n" - "}\n" - "inline $type$* $classname$::mutable_$name$() {\n" - // TODO(b/122856539): add tests to make sure all write accessors are able - // to prepare split message allocation. - "$maybe_prepare_split_message$" - " $type$* _msg = _internal_mutable_$name$();\n" - "$annotate_mutable$" - " // @@protoc_insertion_point(field_mutable:$full_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" - " ::$proto_ns$::Arena* message_arena = GetArenaForAllocation();\n"); - format( - "$maybe_prepare_split_message$" - " if (message_arena == nullptr) {\n"); - if (IsCrossFileMessage(descriptor_)) { - format( - " delete reinterpret_cast< ::$proto_ns$::MessageLite*>($field$);\n"); - } else { - format(" delete $field$;\n"); - } - format( - " }\n" - " if ($name$) {\n"); - 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" - " ::$proto_ns$::Arena::InternalGetOwningArena(\n" - " reinterpret_cast<::$proto_ns$::MessageLite*>(" - "$name$));\n"); - } else { - format( - " ::$proto_ns$::Arena* submessage_arena =\n" - " ::$proto_ns$::Arena::InternalGetOwningArena(" - "$name$);\n"); - } - format( - " if (message_arena != submessage_arena) {\n" - " $name$ = ::$proto_ns$::internal::GetOwnedMessage(\n" - " message_arena, $name$, submessage_arena);\n" - " }\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n"); - if (implicit_weak_field_) { - format(" $field$ = reinterpret_cast($name$);\n"); - } else { - format(" $field$ = $name$;\n"); - } - format( - "$annotate_set$" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); -} - -void MessageFieldGenerator::GenerateInternalAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format( - "static const ::$proto_ns$::MessageLite& $name$(" - "const $classname$* msg);\n" - "static ::$proto_ns$::MessageLite* mutable_$name$(" - "$classname$* msg);\n"); - } else { - format("static const $type$& $name$(const $classname$* msg);\n"); - } -} - -void MessageFieldGenerator::GenerateInternalAccessorDefinitions( - io::Printer* printer) const { - // In theory, these accessors could be inline in _Internal. However, in - // practice, the linker is then not able to throw them out making implicit - // weak dependencies not work at all. - Formatter format(printer, variables_); - if (implicit_weak_field_) { - // These private accessors are used by MergeFrom and - // MergePartialFromCodedStream, and their purpose is to provide access to - // the field without creating a strong dependency on the message type. - format( - "const ::$proto_ns$::MessageLite& $classname$::_Internal::$name$(\n" - " const $classname$* msg) {\n" - " if (msg->$field$ != nullptr) {\n" - " return *msg->$field$;\n" - " } else {\n" - " return *$type_default_instance_ptr$;\n" - " }\n" - "}\n"); - format( - "::$proto_ns$::MessageLite*\n" - "$classname$::_Internal::mutable_$name$($classname$* msg) {\n"); - if (HasHasbit(descriptor_)) { - format(" msg->$set_hasbit$\n"); - } - if (descriptor_->real_containing_oneof() == nullptr) { - format(" if (msg->$field$ == nullptr) {\n"); - } else { - format( - " if (!msg->_internal_has_$name$()) {\n" - " msg->clear_$oneof_name$();\n" - " msg->set_has_$name$();\n"); - } - format( - " msg->$field$ = $type_default_instance_ptr$->New(\n" - " msg->GetArenaForAllocation());\n" - " }\n" - " return msg->$field$;\n" - "}\n"); - } else { - // This inline accessor directly returns member field and is used in - // Serialize such that AFDO profile correctly captures access information to - // message fields under serialize. - format( - "const $type$&\n" - "$classname$::_Internal::$name$(const $classname$* msg) {\n" - " return *msg->$field$;\n" - "}\n"); - } -} - -void MessageFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (!HasHasbit(descriptor_)) { - // If we don't have has-bits, message presence is indicated only by ptr != - // nullptr. Thus on clear, we need to delete the object. - format( - "if (GetArenaForAllocation() == nullptr && $field$ != nullptr) {\n" - " delete $field$;\n" - "}\n" - "$field$ = nullptr;\n"); - } else { - format("if ($field$ != nullptr) $field$->Clear();\n"); - } -} - -void MessageFieldGenerator::GenerateMessageClearingCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (!HasHasbit(descriptor_)) { - // If we don't have has-bits, message presence is indicated only by ptr != - // nullptr. Thus on clear, we need to delete the object. - format( - "if (GetArenaForAllocation() == nullptr && $field$ != nullptr) {\n" - " delete $field$;\n" - "}\n" - "$field$ = nullptr;\n"); - } else { - format( - "$DCHK$($field$ != nullptr);\n" - "$field$->Clear();\n"); - } -} - -void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format( - "_Internal::mutable_$name$(_this)->CheckTypeAndMergeFrom(\n" - " _Internal::$name$(&from));\n"); - } else { - format( - "_this->_internal_mutable_$name$()->$type$::MergeFrom(\n" - " from._internal_$name$());\n"); - } -} - -void MessageFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format("swap($field$, other->$field$);\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 - // instances. In google3 a default instance will never get deleted so we - // don't need to worry about that but in opensource protobuf default - // instances are deleted in shutdown process and we need to take special - // care when handling them. - format("if (this != internal_default_instance()) "); - } - if (ShouldSplit(descriptor_, options_)) { - format("delete $cached_split_ptr$->$name$_;\n"); - return; - } - format("delete $field$;\n"); -} - -void MessageFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format( - "if (from._internal_has_$name$()) {\n" - " _this->$field$ = new $type$(*from.$field$);\n" - "}\n"); -} - -void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { - format( - "target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$($number$, _Internal::$name$(this),\n" - " _Internal::$name$(this).GetCachedSize(), target, stream);\n"); - } else { - format( - "target = stream->EnsureSpace(target);\n" - "target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$(\n" - " $number$, _Internal::$name$(this), target, stream);\n"); - } -} - -void MessageFieldGenerator::GenerateByteSize(io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format( - "total_size += $tag_size$ +\n" - " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " *$field$);\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 (!$field$->IsInitialized()) return false;\n" - "}\n"); -} - -void MessageFieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("/*decltype($field$)*/nullptr"); -} - -void MessageFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){nullptr}"); -} - -void MessageFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - format("decltype(Impl_::Split::$name$_){nullptr}"); - return; - } - format("decltype($field$){nullptr}"); -} - -// =================================================================== - -MessageOneofFieldGenerator::MessageOneofFieldGenerator( - const FieldDescriptor* descriptor, const Options& options, - MessageSCCAnalyzer* scc_analyzer) - : MessageFieldGenerator(descriptor, options, scc_analyzer) { - SetCommonOneofFieldVariables(descriptor, &variables_); -} - -MessageOneofFieldGenerator::~MessageOneofFieldGenerator() {} - -void MessageOneofFieldGenerator::GenerateNonInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "void $classname$::set_allocated_$name$($type$* $name$) {\n" - " ::$proto_ns$::Arena* message_arena = GetArenaForAllocation();\n" - " clear_$oneof_name$();\n" - " if ($name$) {\n"); - 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" - " ::$proto_ns$::Arena::InternalGetOwningArena(\n" - " reinterpret_cast<::$proto_ns$::MessageLite*>(" - "$name$));\n"); - } else { - format( - " ::$proto_ns$::Arena* submessage_arena =\n" - " ::$proto_ns$::Arena::InternalGetOwningArena($name$);\n"); - } - format( - " if (message_arena != submessage_arena) {\n" - " $name$ = ::$proto_ns$::internal::GetOwnedMessage(\n" - " message_arena, $name$, submessage_arena);\n" - " }\n" - " set_has_$name$();\n" - " $field$ = $name$;\n" - " }\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); -} - -void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$* $classname$::$release_name$() {\n" - "$annotate_release$" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - "$type_reference_function$" - " if (_internal_has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " $type$* temp = $casted_member$;\n" - " if (GetArenaForAllocation() != nullptr) {\n" - " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n" - " }\n" - " $field$ = nullptr;\n" - " return temp;\n" - " } else {\n" - " return nullptr;\n" - " }\n" - "}\n"); - - format( - "inline const $type$& $classname$::_internal_$name$() const {\n" - "$type_reference_function$" - " return _internal_has_$name$()\n" - " ? $casted_member_const$\n" - " : reinterpret_cast< $type$&>($type_default_instance$);\n" - "}\n" - "inline const $type$& $classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline $type$* $classname$::unsafe_arena_release_$name$() {\n" - "$annotate_release$" - " // @@protoc_insertion_point(field_unsafe_arena_release" - ":$full_name$)\n" - "$type_reference_function$" - " if (_internal_has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " $type$* temp = $casted_member$;\n" - " $field$ = 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"); - if (implicit_weak_field_) { - format( - " $field$ = " - "reinterpret_cast<::$proto_ns$::MessageLite*>($name$);\n"); - } else { - format(" $field$ = $name$;\n"); - } - format( - " }\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" - "$full_name$)\n" - "}\n" - "inline $type$* $classname$::_internal_mutable_$name$() {\n" - "$type_reference_function$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n"); - if (implicit_weak_field_) { - format( - " $field$ = " - "reinterpret_cast<::$proto_ns$::MessageLite*>(CreateMaybeMessage< " - "$type$ >(GetArenaForAllocation()));\n"); - } else { - format( - " $field$ = CreateMaybeMessage< $type$ " - ">(GetArenaForAllocation());\n"); - } - format( - " }\n" - " return $casted_member$;\n" - "}\n" - "inline $type$* $classname$::mutable_$name$() {\n" - " $type$* _msg = _internal_mutable_$name$();\n" - "$annotate_mutable$" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return _msg;\n" - "}\n"); -} - -void MessageOneofFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format( - "if (GetArenaForAllocation() == nullptr) {\n" - " delete $field$;\n" - "}\n"); -} - -void MessageOneofFieldGenerator::GenerateMessageClearingCode( - io::Printer* printer) const { - GenerateClearingCode(printer); -} - -void MessageOneofFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - // Don't print any swapping code. Swapping the union will swap this field. -} - -void MessageOneofFieldGenerator::GenerateDestructorCode( - io::Printer* printer) const { - // We inherit from MessageFieldGenerator, so we need to override the default - // behavior. -} - -void MessageOneofFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - // Don't print any constructor code. The field is in a union. We allocate - // 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$->IsInitialized()) return false;\n" - "}\n"); -} - -// =================================================================== - -RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( - const FieldDescriptor* descriptor, const Options& options, - MessageSCCAnalyzer* scc_analyzer) - : FieldGenerator(descriptor, options), - implicit_weak_field_( - IsImplicitWeakField(descriptor, options, scc_analyzer)), - has_required_fields_( - scc_analyzer->HasRequiredFields(descriptor->message_type())) { - SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_); -} - -RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} - -void RepeatedMessageFieldGenerator::GeneratePrivateMembers( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format("::$proto_ns$::WeakRepeatedPtrField< $type$ > $name$_;\n"); - } else { - format("::$proto_ns$::RepeatedPtrField< $type$ > $name$_;\n"); - } -} - -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", - 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" - " ${1$$name$$}$() const;\n", - descriptor_); -} - -void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format.Set("weak", implicit_weak_field_ ? ".weak" : ""); - - format( - "inline $type$* $classname$::mutable_$name$(int index) {\n" - "$annotate_mutable$" - // TODO(dlj): move insertion points - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - "$type_reference_function$" - " return $field$$weak$.Mutable(index);\n" - "}\n" - "inline ::$proto_ns$::RepeatedPtrField< $type$ >*\n" - "$classname$::mutable_$name$() {\n" - "$annotate_mutable_list$" - " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - "$type_reference_function$" - " return &$field$$weak$;\n" - "}\n"); - - if (options_.safe_boundary_check) { - format( - "inline const $type$& $classname$::_internal_$name$(int index) const " - "{\n" - " return $field$$weak$.InternalCheckedGet(index,\n" - " reinterpret_cast($type_default_instance$));\n" - "}\n"); - } else { - format( - "inline const $type$& $classname$::_internal_$name$(int index) const " - "{\n" - "$type_reference_function$" - " return $field$$weak$.Get(index);\n" - "}\n"); - } - - format( - "inline const $type$& $classname$::$name$(int index) const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$(index);\n" - "}\n" - "inline $type$* $classname$::_internal_add_$name$() {\n" - " return $field$$weak$.Add();\n" - "}\n" - "inline $type$* $classname$::add_$name$() {\n" - " $type$* _add = _internal_add_$name$();\n" - "$annotate_add_mutable$" - " // @@protoc_insertion_point(field_add:$full_name$)\n" - " return _add;\n" - "}\n"); - - format( - "inline const ::$proto_ns$::RepeatedPtrField< $type$ >&\n" - "$classname$::$name$() const {\n" - "$annotate_list$" - " // @@protoc_insertion_point(field_list:$full_name$)\n" - "$type_reference_function$" - " return $field$$weak$;\n" - "}\n"); -} - -void RepeatedMessageFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format("$field$.Clear();\n"); -} - -void RepeatedMessageFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format("_this->$field$.MergeFrom(from.$field$);\n"); -} - -void RepeatedMessageFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - format("$field$.InternalSwap(&other->$field$);\n"); -} - -void RepeatedMessageFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - // Not needed for repeated fields. -} - -void RepeatedMessageFieldGenerator::GenerateDestructorCode( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format("$field$.~WeakRepeatedPtrField();\n"); - } else { - format("$field$.~RepeatedPtrField();\n"); - } -} - -void RepeatedMessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); - - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format( - "for (auto it = this->$field$.pointer_begin(),\n" - " end = this->$field$.pointer_end(); it < end; ++it) {\n"); - if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { - format( - " target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$($number$, " - "**it, (**it).GetCachedSize(), target, stream);\n"); - } else { - format( - " target = stream->EnsureSpace(target);\n" - " target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$($number$, **it, target, " - "stream);\n"); - } - format("}\n"); - } else { - format( - "for (unsigned i = 0,\n" - " n = static_cast(this->_internal_$name$_size());" - " i < n; i++) {\n"); - if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { - format( - " const auto& repfield = this->_internal_$name$(i);\n" - " target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$($number$, " - "repfield, repfield.GetCachedSize(), target, stream);\n" - "}\n"); - } else { - format( - " target = stream->EnsureSpace(target);\n" - " target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$($number$, " - "this->_internal_$name$(i), target, stream);\n" - "}\n"); - } - } -} - -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" - "for (const auto& msg : this->$field$) {\n" - " total_size +=\n" - " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(msg);\n" - "}\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($field$.weak))\n" - " return false;\n"); - } else { - format( - "if (!::$proto_ns$::internal::AllAreInitialized($field$))\n" - " return false;\n"); - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/message_field.h b/depends/protobuf/src/google/protobuf/compiler/cpp/message_field.h deleted file mode 100644 index 70c42c0ea..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/message_field.h +++ /dev/null @@ -1,148 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ - -#include -#include - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class MessageFieldGenerator : public FieldGenerator { - public: - MessageFieldGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer); - ~MessageFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - - protected: - const bool implicit_weak_field_; - const bool has_required_fields_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); -}; - -class MessageOneofFieldGenerator : public MessageFieldGenerator { - public: - MessageOneofFieldGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer); - ~MessageOneofFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 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); -}; - -class RepeatedMessageFieldGenerator : public FieldGenerator { - public: - RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer); - ~RepeatedMessageFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 GenerateDestructorCode(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; - - private: - const bool implicit_weak_field_; - const bool has_required_fields_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/message_layout_helper.h b/depends/protobuf/src/google/protobuf/compiler/cpp/message_layout_helper.h deleted file mode 100644 index a8813a1f2..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/message_layout_helper.h +++ /dev/null @@ -1,64 +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: seongkim@google.com (Seong Beom Kim) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__ - -#include -#include - -namespace google { -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 { - public: - virtual ~MessageLayoutHelper() {} - - virtual void OptimizeLayout(std::vector* fields, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) = 0; -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/names.h b/depends/protobuf/src/google/protobuf/compiler/cpp/names.h deleted file mode 100644 index 7404ac530..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/names.h +++ /dev/null @@ -1,97 +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_COMPILER_CPP_NAMES_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__ - -#include - -// Must be included last. -#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 Moo {} } -// Then the non-qualified version would be: -// Baz_Moo -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 Moo {} } -// Then the qualified ClassName for Moo would be: -// ::foo::bar::Baz_Moo -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/depends/protobuf/src/google/protobuf/compiler/cpp/options.h b/depends/protobuf/src/google/protobuf/compiler/cpp/options.h deleted file mode 100644 index 5d935e9e6..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/options.h +++ /dev/null @@ -1,101 +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: rennie@google.com (Jeffrey Rennie) - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -class AccessInfoMap; - -namespace cpp { - -enum class EnforceOptimizeMode { - kNoEnforcement, // Use the runtime specified by the file specific options. - 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 { - const AccessInfoMap* access_info_map = nullptr; - std::string dllexport_decl; - std::string runtime_include_base; - std::string annotation_pragma_name; - std::string annotation_guard_name; - FieldListenerOptions field_listener_options; - EnforceOptimizeMode enforce_mode = EnforceOptimizeMode::kNoEnforcement; - enum { - kTCTableNever, - kTCTableGuarded, - kTCTableAlways - } tctable_mode = kTCTableNever; - int num_cc_files = 0; - bool safe_boundary_check = false; - bool proto_h = false; - bool transitive_pb_h = true; - bool annotate_headers = false; - bool lite_implicit_weak_fields = false; - bool bootstrap = false; - bool opensource_runtime = false; - bool annotate_accessor = false; - bool unused_field_stripping = false; - bool unverified_lazy_message_sets = false; - bool unverified_lazy = false; - bool profile_driven_inline_string = true; - bool message_owned_arena_trial = false; - bool force_split = false; -#ifdef PROTOBUF_STABLE_EXPERIMENTS - bool force_eagerly_verified_lazy = true; - bool force_inline_string = true; -#else // PROTOBUF_STABLE_EXPERIMENTS - bool force_eagerly_verified_lazy = false; - bool force_inline_string = false; -#endif // !PROTOBUF_STABLE_EXPERIMENTS -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.cc deleted file mode 100644 index 20910520d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.cc +++ /dev/null @@ -1,228 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { - -// FieldGroup is just a helper for PaddingOptimizer below. It holds a vector of -// fields that are grouped together because they have compatible alignment, and -// a preferred location in the final field ordering. -class FieldGroup { - public: - FieldGroup() : preferred_location_(0) {} - - // A group with a single field. - FieldGroup(double preferred_location, const FieldDescriptor* field) - : preferred_location_(preferred_location), fields_(1, field) {} - - // Append the fields in 'other' to this group. - void Append(const FieldGroup& other) { - if (other.fields_.empty()) { - return; - } - // Preferred location is the average among all the fields, so we weight by - // the number of fields on each FieldGroup object. - preferred_location_ = (preferred_location_ * fields_.size() + - (other.preferred_location_ * other.fields_.size())) / - (fields_.size() + other.fields_.size()); - fields_.insert(fields_.end(), other.fields_.begin(), other.fields_.end()); - } - - void SetPreferredLocation(double location) { preferred_location_ = location; } - const std::vector& fields() const { return fields_; } - - // FieldGroup objects sort by their preferred location. - bool operator<(const FieldGroup& other) const { - return preferred_location_ < other.preferred_location_; - } - - private: - // "preferred_location_" is an estimate of where this group should go in the - // final list of fields. We compute this by taking the average index of each - // field in this group in the original ordering of fields. This is very - // approximate, but should put this group close to where its member fields - // originally went. - double preferred_location_; - std::vector fields_; - // We rely on the default copy constructor and operator= so this type can be - // used in a vector. -}; - -} // namespace - -// Reorder 'fields' so that if the fields are output into a c++ class in the new -// order, fields of similar family (see below) are together and within each -// family, alignment padding is minimized. -// -// We try to do this while keeping each field as close as possible to its field -// number order so that we don't reduce cache locality much for function that -// access each field in order. Originally, OptimizePadding used declaration -// order for its decisions, but generated code minus the serializer/parsers uses -// the output of OptimizePadding as well (stored in -// MessageGenerator::optimized_order_). Since the serializers use field number -// order, we use that as a tie-breaker. -// -// We classify each field into a particular "family" of fields, that we perform -// the same operation on in our generated functions. -// -// REPEATED is placed first, as the C++ compiler automatically initializes -// these fields in layout order. -// -// STRING is grouped next, as our Clear/SharedCtor/SharedDtor walks it and -// calls ArenaStringPtr::Destroy on each. -// -// LAZY_MESSAGE is grouped next, as it interferes with the ability to memset -// non-repeated fields otherwise. -// -// MESSAGE is grouped next, as our Clear/SharedDtor code walks it and calls -// delete on each. We initialize these fields with a NULL pointer (see -// MessageFieldGenerator::GenerateConstructorCode), which allows them to be -// memset. -// -// ZERO_INITIALIZABLE is memset in Clear/SharedCtor -// -// OTHER these fields are initialized one-by-one. -void PaddingOptimizer::OptimizeLayout( - 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 { - REPEATED = 0, - STRING = 1, - // Laying out LAZY_MESSAGE before MESSAGE allows a single memset to zero - // MESSAGE and ZERO_INITIALIZABLE fields together. - LAZY_MESSAGE = 2, - MESSAGE = 3, - ZERO_INITIALIZABLE = 4, - OTHER = 5, - kMaxFamily - }; - - // First divide fields into those that align to 1 byte, 4 bytes or 8 bytes. - std::vector aligned_to_1[kMaxFamily]; - std::vector aligned_to_4[kMaxFamily]; - std::vector aligned_to_8[kMaxFamily]; - for (int i = 0; i < fields->size(); ++i) { - const FieldDescriptor* field = (*fields)[i]; - - Family f = OTHER; - if (field->is_repeated()) { - f = REPEATED; - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { - f = STRING; - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - f = MESSAGE; - if (IsLazy(field, options, scc_analyzer)) { - f = LAZY_MESSAGE; - } - } else if (CanInitializeByZeroing(field)) { - f = ZERO_INITIALIZABLE; - } - - const int j = field->number(); - switch (EstimateAlignmentSize(field)) { - case 1: - aligned_to_1[f].push_back(FieldGroup(j, field)); - break; - case 4: - aligned_to_4[f].push_back(FieldGroup(j, field)); - break; - case 8: - aligned_to_8[f].push_back(FieldGroup(j, field)); - break; - default: - GOOGLE_LOG(FATAL) << "Unknown alignment size " << EstimateAlignmentSize(field) - << "for a field " << field->full_name() << "."; - } - } - - // For each family, group fields to optimize padding. - for (int f = 0; f < kMaxFamily; f++) { - // Now group fields aligned to 1 byte into sets of 4, and treat those like a - // single field aligned to 4 bytes. - for (int i = 0; i < aligned_to_1[f].size(); i += 4) { - FieldGroup field_group; - for (int j = i; j < aligned_to_1[f].size() && j < i + 4; ++j) { - field_group.Append(aligned_to_1[f][j]); - } - aligned_to_4[f].push_back(field_group); - } - // Sort by preferred location to keep fields as close to their field number - // order as possible. Using stable_sort ensures that the output is - // consistent across runs. - std::stable_sort(aligned_to_4[f].begin(), aligned_to_4[f].end()); - - // Now group fields aligned to 4 bytes (or the 4-field groups created above) - // into pairs, and treat those like a single field aligned to 8 bytes. - for (int i = 0; i < aligned_to_4[f].size(); i += 2) { - FieldGroup field_group; - for (int j = i; j < aligned_to_4[f].size() && j < i + 2; ++j) { - field_group.Append(aligned_to_4[f][j]); - } - if (i == aligned_to_4[f].size() - 1) { - if (f == OTHER) { - // Move incomplete 4-byte block to the beginning. This is done to - // pair with the (possible) leftover blocks from the - // ZERO_INITIALIZABLE family. - field_group.SetPreferredLocation(-1); - } else { - // Move incomplete 4-byte block to the end. - field_group.SetPreferredLocation(double{FieldDescriptor::kMaxNumber}); - } - } - aligned_to_8[f].push_back(field_group); - } - // Sort by preferred location. - std::stable_sort(aligned_to_8[f].begin(), aligned_to_8[f].end()); - } - - // Now pull out all the FieldDescriptors in order. - fields->clear(); - for (int f = 0; f < kMaxFamily; ++f) { - for (int i = 0; i < aligned_to_8[f].size(); ++i) { - fields->insert(fields->end(), aligned_to_8[f][i].fields().begin(), - aligned_to_8[f][i].fields().end()); - } - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.h b/depends/protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.h deleted file mode 100644 index 9c76f38c4..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.h +++ /dev/null @@ -1,65 +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: seongkim@google.com (Seong Beom Kim) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__ - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -// Rearranges the fields of a message to minimize padding. -// Fields are grouped by the type and the size. -// For example, grouping four boolean fields and one int32 -// field results in zero padding overhead. See OptimizeLayout's -// comment for details. -class PaddingOptimizer : public MessageLayoutHelper { - public: - PaddingOptimizer() {} - ~PaddingOptimizer() override {} - - void OptimizeLayout(std::vector* fields, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) override; -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc deleted file mode 100644 index 0f1d767c8..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc +++ /dev/null @@ -1,1725 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { -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; -} - -std::string FieldParseFunctionName( - const TailCallTableInfo::FieldEntryInfo& entry, const Options& options); - -bool IsFieldEligibleForFastParsing( - const TailCallTableInfo::FieldEntryInfo& entry, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - const auto* field = entry.field; - // Map, oneof, weak, and lazy fields are not handled on the fast path. - if (field->is_map() || field->real_containing_oneof() || - field->options().weak() || - IsImplicitWeakField(field, options, scc_analyzer) || - IsLazy(field, options, scc_analyzer)) { - return false; - } - - // We will check for a valid auxiliary index range later. However, we might - // want to change the value we check for inlined string fields. - int aux_idx = entry.aux_idx; - - switch (field->type()) { - case FieldDescriptor::TYPE_ENUM: - // If enum values are not validated at parse time, then this field can be - // handled on the fast path like an int32. - if (HasPreservingUnknownEnumSemantics(field)) { - break; - } - if (field->is_repeated() && field->is_packed()) { - return false; - } - break; - - // Some bytes fields can be handled on fast path. - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: - if (field->options().ctype() != FieldOptions::STRING) { - return false; - } - if (IsStringInlined(field, options)) { - GOOGLE_CHECK(!field->is_repeated()); - // For inlined strings, the donation state index is stored in the - // `aux_idx` field of the fast parsing info. We need to check the range - // of that value instead of the auxiliary index. - aux_idx = entry.inlined_string_idx; - } - break; - - default: - break; - } - - if (HasHasbit(field)) { - // The tailcall parser can only update the first 32 hasbits. Fields with - // has-bits beyond the first 32 are handled by mini parsing/fallback. - GOOGLE_CHECK_GE(entry.hasbit_idx, 0) << field->DebugString(); - if (entry.hasbit_idx >= 32) return false; - } - - // If the field needs auxiliary data, then the aux index is needed. This - // must fit in a uint8_t. - if (aux_idx > std::numeric_limits::max()) { - return false; - } - - // 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 - // ^^^^^^^ ^^^^^^^ - if (field->number() >= 1 << 11) return false; - - return true; -} - -std::vector SplitFastFieldsForSize( - const std::vector& field_entries, - int table_size_log2, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - std::vector result(1 << table_size_log2); - const uint32_t idx_mask = result.size() - 1; - - for (const auto& entry : field_entries) { - if (!IsFieldEligibleForFastParsing(entry, options, scc_analyzer)) { - continue; - } - - const auto* field = entry.field; - uint32_t tag = WireFormat::MakeTag(field); - - // Construct the varint-coded tag. If it is more than 7 bits, we need to - // shift the high bits and add a continue bit. - if (uint32_t hibits = tag & 0xFFFFFF80) { - tag = tag + hibits + 128; // tag = lobits + 2*hibits + 128 - } - - // 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 - // tag: 1nnnnttt 0nnnnnnn - // ^^^^^ - // idx (table_size_log2=5) - // 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. - const uint32_t fast_idx = (tag >> 3) & idx_mask; - - TailCallTableInfo::FastFieldInfo& info = result[fast_idx]; - if (info.field != nullptr) { - // This field entry is already filled. - continue; - } - - // Fill in this field's entry: - GOOGLE_CHECK(info.func_name.empty()) << info.func_name; - info.func_name = FieldParseFunctionName(entry, options); - info.field = field; - info.coded_tag = tag; - // If this field does not have presence, then it can set an out-of-bounds - // bit (tailcall parsing uses a uint64_t for hasbits, but only stores 32). - info.hasbit_idx = HasHasbit(field) ? entry.hasbit_idx : 63; - if (IsStringInlined(field, options)) { - GOOGLE_CHECK(!field->is_repeated()); - info.aux_idx = static_cast(entry.inlined_string_idx); - } else { - info.aux_idx = static_cast(entry.aux_idx); - } - } - return result; -} - -// Filter out fields that will be handled by mini parsing. -std::vector FilterMiniParsedFields( - const std::vector& fields, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - std::vector generated_fallback_fields; - - for (const auto* field : fields) { - bool handled = false; - switch (field->type()) { - case FieldDescriptor::TYPE_DOUBLE: - case FieldDescriptor::TYPE_FLOAT: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_SFIXED64: - case FieldDescriptor::TYPE_BOOL: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_INT64: - // These are handled by MiniParse, so we don't need any generated - // fallback code. - handled = true; - break; - - case FieldDescriptor::TYPE_ENUM: - if (field->is_repeated() && !HasPreservingUnknownEnumSemantics(field)) { - // TODO(b/206890171): handle packed repeated closed enums - // Non-packed repeated can be handled using tables, but we still - // need to generate fallback code for all repeated enums in order to - // handle packed encoding. This is because of the lite/full split - // when handling invalid enum values in a packed field. - handled = false; - } else { - handled = true; - } - break; - - case FieldDescriptor::TYPE_BYTES: - case FieldDescriptor::TYPE_STRING: - if (IsStringInlined(field, options)) { - // TODO(b/198211897): support InilnedStringField. - handled = false; - } else { - handled = true; - } - break; - - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_GROUP: - // TODO(b/210762816): support remaining field types. - if (field->is_map() || IsWeak(field, options) || - IsImplicitWeakField(field, options, scc_analyzer) || - IsLazy(field, options, scc_analyzer)) { - handled = false; - } else { - handled = true; - } - break; - - default: - handled = false; - break; - } - if (!handled) generated_fallback_fields.push_back(field); - } - - return generated_fallback_fields; -} - -} // namespace - -TailCallTableInfo::TailCallTableInfo( - const Descriptor* descriptor, const Options& options, - const std::vector& ordered_fields, - const std::vector& has_bit_indices, - const std::vector& inlined_string_indices, - MessageSCCAnalyzer* scc_analyzer) { - int oneof_count = descriptor->real_oneof_decl_count(); - // If this message has any oneof fields, store the case offset in the first - // auxiliary entry. - if (oneof_count > 0) { - GOOGLE_LOG_IF(DFATAL, ordered_fields.empty()) - << "Invalid message: " << descriptor->full_name() << " has " - << oneof_count << " oneof declarations, but no fields"; - aux_entries.push_back(StrCat("_fl::Offset{offsetof(", - ClassName(descriptor), - ", _impl_._oneof_case_)}")); - } - - // If this message has any inlined string fields, store the donation state - // offset in the second auxiliary entry. - if (!inlined_string_indices.empty()) { - aux_entries.resize(2); // pad if necessary - aux_entries[1] = - StrCat("_fl::Offset{offsetof(", ClassName(descriptor), - ", _impl_._inlined_string_donated_)}"); - } - - // Fill in mini table entries. - for (const FieldDescriptor* field : ordered_fields) { - field_entries.push_back( - {field, (HasHasbit(field) ? has_bit_indices[field->index()] : -1)}); - auto& entry = field_entries.back(); - - if (field->type() == FieldDescriptor::TYPE_MESSAGE || - field->type() == FieldDescriptor::TYPE_GROUP) { - // Message-typed fields have a FieldAux with the default instance pointer. - if (field->is_map()) { - // TODO(b/205904770): generate aux entries for maps - } else if (IsWeak(field, options)) { - // Don't generate anything for weak fields. They are handled by the - // generated fallback. - } else if (IsImplicitWeakField(field, options, scc_analyzer)) { - // Implicit weak fields don't need to store a default instance pointer. - } else if (IsLazy(field, options, scc_analyzer)) { - // Lazy fields are handled by the generated fallback function. - } else { - field_entries.back().aux_idx = aux_entries.size(); - const Descriptor* field_type = field->message_type(); - aux_entries.push_back(StrCat( - "reinterpret_cast(&", QualifiedDefaultInstanceName(field_type, options), ")")); - } - } else if (field->type() == FieldDescriptor::TYPE_ENUM && - !HasPreservingUnknownEnumSemantics(field)) { - // Enum fields which preserve unknown values (proto3 behavior) are - // effectively int32 fields with respect to parsing -- i.e., the value - // does not need to be validated at parse time. - // - // Enum fields which do not preserve unknown values (proto2 behavior) use - // a FieldAux to store validation information. If the enum values are - // sequential (and within a range we can represent), then the FieldAux - // entry represents the range using the minimum value (which must fit in - // an int16_t) and count (a uint16_t). Otherwise, the entry holds a - // pointer to the generated Name_IsValid function. - - entry.aux_idx = aux_entries.size(); - const EnumDescriptor* enum_type = field->enum_type(); - GOOGLE_CHECK_GT(enum_type->value_count(), 0) << enum_type->DebugString(); - - // Check if the enum values are a single, contiguous range. - std::vector enum_values; - for (int i = 0, N = enum_type->value_count(); i < N; ++i) { - enum_values.push_back(enum_type->value(i)->number()); - } - auto values_begin = enum_values.begin(); - auto values_end = enum_values.end(); - std::sort(values_begin, values_end); - enum_values.erase(std::unique(values_begin, values_end), values_end); - - if (enum_values.back() - enum_values[0] == enum_values.size() - 1 && - enum_values[0] >= std::numeric_limits::min() && - enum_values[0] <= std::numeric_limits::max() && - enum_values.size() <= std::numeric_limits::max()) { - entry.is_enum_range = true; - aux_entries.push_back( - StrCat(enum_values[0], ", ", enum_values.size())); - } else { - entry.is_enum_range = false; - aux_entries.push_back( - StrCat(QualifiedClassName(enum_type, options), "_IsValid")); - } - } else if ((field->type() == FieldDescriptor::TYPE_STRING || - field->type() == FieldDescriptor::TYPE_BYTES) && - IsStringInlined(field, options)) { - GOOGLE_CHECK(!field->is_repeated()); - // Inlined strings have an extra marker to represent their donation state. - int idx = inlined_string_indices[field->index()]; - // For mini parsing, the donation state index is stored as an `offset` - // auxiliary entry. - entry.aux_idx = aux_entries.size(); - aux_entries.push_back(StrCat("_fl::Offset{", idx, "}")); - // For fast table parsing, the donation state index is stored instead of - // the aux_idx (this will limit the range to 8 bits). - entry.inlined_string_idx = idx; - } - } - - // Choose the smallest fast table that covers the maximum number of fields. - table_size_log2 = 0; // fallback value - int num_fast_fields = -1; - for (int try_size_log2 : {0, 1, 2, 3, 4, 5}) { - size_t try_size = 1 << try_size_log2; - auto split_fields = SplitFastFieldsForSize(field_entries, try_size_log2, - options, scc_analyzer); - GOOGLE_CHECK_EQ(split_fields.size(), try_size); - int try_num_fast_fields = 0; - for (const auto& info : split_fields) { - if (info.field != nullptr) ++try_num_fast_fields; - } - // Use this size if (and only if) it covers more fields. - if (try_num_fast_fields > num_fast_fields) { - fast_path_fields = std::move(split_fields); - table_size_log2 = try_size_log2; - num_fast_fields = try_num_fast_fields; - } - // The largest table we allow has the same number of entries as the message - // has fields, rounded up to the next power of 2 (e.g., a message with 5 - // fields can have a fast table of size 8). A larger table *might* cover - // more fields in certain cases, but a larger table in that case would have - // mostly empty entries; so, we cap the size to avoid pathologically sparse - // tables. - if (try_size > ordered_fields.size()) { - break; - } - } - - // Filter out fields that are handled by MiniParse. We don't need to generate - // a fallback for these, which saves code size. - fallback_fields = FilterMiniParsedFields(ordered_fields, options, - scc_analyzer); - - // 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), - ordered_fields_(GetOrderedFields(descriptor_, options_)), - num_hasbits_(max_has_bit_index) { - if (should_generate_tctable()) { - tc_table_info_.reset(new TailCallTableInfo( - descriptor_, options_, ordered_fields_, has_bit_indices, - inlined_string_indices, scc_analyzer)); - } - SetCommonVars(options_, &variables_); - SetCommonMessageDataVariables(descriptor_, &variables_); - SetUnknownFieldsVariable(descriptor_, options_, &variables_); - variables_["classname"] = ClassName(descriptor, false); -} - -void ParseFunctionGenerator::GenerateMethodDecls(io::Printer* printer) { - Formatter format(printer, variables_); - if (should_generate_tctable()) { - format.Outdent(); - if (should_generate_guarded_tctable()) { - format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); - } - format( - " private:\n" - " static const char* Tct_ParseFallback(PROTOBUF_TC_PARAM_DECL);\n" - " public:\n"); - if (should_generate_guarded_tctable()) { - 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" - " ::_pbi::ParseContext* ctx) {\n" - "$annotate_deserialize$"); - if (!options_.unverified_lazy_message_sets && - ShouldVerify(descriptor_, options_, scc_analyzer_)) { - format( - " ctx->set_lazy_eager_verify_func(&$classname$::InternalVerify);\n"); - } - format( - " 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); - } - 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, ::_pbi::ParseContext* ctx) {\n" - "$annotate_deserialize$" - " ptr = ::_pbi::TcParser::ParseLoop(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->_impl_._has_bits_[0] = hasbits;\n"); - } - format("uint32_t tag = data.tag();\n"); - - format.Set("msg", "typed_msg->"); - format.Set("this", "typed_msg"); - format.Set("has_bits", "typed_msg->_impl_._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"); -} - -struct SkipEntry16 { - uint16_t skipmap; - uint16_t field_entry_offset; -}; -struct SkipEntryBlock { - uint32_t first_fnum; - std::vector entries; -}; -struct NumToEntryTable { - uint32_t skipmap32; // for fields #1 - #32 - std::vector blocks; - // Compute the number of uint16_t required to represent this table. - int size16() const { - int size = 2; // for the termination field# - for (const auto& block : blocks) { - // 2 for the field#, 1 for a count of skip entries, 2 for each entry. - size += 3 + block.entries.size() * 2; - } - return size; - } -}; - -static NumToEntryTable MakeNumToEntryTable( - const std::vector& field_descriptors); - -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(); - } - auto field_num_to_entry_table = MakeNumToEntryTable(ordered_fields_); - format( - "static const ::$proto_ns$::internal::" - "TcParseTable<$1$, $2$, $3$, $4$, $5$> _table_;\n", - tc_table_info_->table_size_log2, ordered_fields_.size(), - tc_table_info_->aux_entries.size(), CalculateFieldNamesSize(), - field_num_to_entry_table.size16()); - 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, " - "::_pbi::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", "_impl_._has_bits_"); - } - format.Set("next_tag", "continue"); - format("while (!ctx->Done(&ptr)) {\n"); - format.Indent(); - - format( - "uint32_t tag;\n" - "ptr = ::_pbi::ReadTag(ptr, &tag);\n"); - GenerateParseIterationBody(format, descriptor_, ordered_fields_); - - format.Outdent(); - format("} // while\n"); - - format.Outdent(); - format("message_done:\n"); - if (hasbits_size) format(" _impl_._has_bits_.Or(has_bits);\n"); - - format( - " return ptr;\n" - "failure:\n" - " ptr = nullptr;\n" - " goto message_done;\n" - "#undef CHK_\n" - "}\n"); -} - -static NumToEntryTable MakeNumToEntryTable( - const std::vector& field_descriptors) { - NumToEntryTable num_to_entry_table; - num_to_entry_table.skipmap32 = static_cast(-1); - - // skip_entry_block is the current block of SkipEntries that we're - // appending to. cur_block_first_fnum is the number of the first - // field represented by the block. - uint16_t field_entry_index = 0; - uint16_t N = field_descriptors.size(); - // First, handle field numbers 1-32, which affect only the initial - // skipmap32 and don't generate additional skip-entry blocks. - for (; field_entry_index != N; ++field_entry_index) { - auto* field_descriptor = field_descriptors[field_entry_index]; - if (field_descriptor->number() > 32) break; - auto skipmap32_index = field_descriptor->number() - 1; - num_to_entry_table.skipmap32 -= 1 << skipmap32_index; - } - // If all the field numbers were less than or equal to 32, we will have - // no further entries to process, and we are already done. - if (field_entry_index == N) return num_to_entry_table; - - SkipEntryBlock* block = nullptr; - bool start_new_block = true; - // To determine sparseness, track the field number corresponding to - // the start of the most recent skip entry. - uint32_t last_skip_entry_start = 0; - for (; field_entry_index != N; ++field_entry_index) { - auto* field_descriptor = field_descriptors[field_entry_index]; - uint32_t fnum = field_descriptor->number(); - GOOGLE_CHECK_GT(fnum, last_skip_entry_start); - if (start_new_block == false) { - // If the next field number is within 15 of the last_skip_entry_start, we - // continue writing just to that entry. If it's between 16 and 31 more, - // then we just extend the current block by one. If it's more than 31 - // more, we have to add empty skip entries in order to continue using the - // existing block. Obviously it's just 32 more, it doesn't make sense to - // start a whole new block, since new blocks mean having to write out - // their starting field number, which is 32 bits, as well as the size of - // the additional block, which is 16... while an empty SkipEntry16 only - // costs 32 bits. So if it was 48 more, it's a slight space win; we save - // 16 bits, but probably at the cost of slower run time. We're choosing - // 96 for now. - if (fnum - last_skip_entry_start > 96) start_new_block = true; - } - if (start_new_block) { - num_to_entry_table.blocks.push_back(SkipEntryBlock{fnum}); - block = &num_to_entry_table.blocks.back(); - start_new_block = false; - } - - auto skip_entry_num = (fnum - block->first_fnum) / 16; - auto skip_entry_index = (fnum - block->first_fnum) % 16; - while (skip_entry_num >= block->entries.size()) - block->entries.push_back({0xFFFF, field_entry_index}); - block->entries[skip_entry_num].skipmap -= 1 << (skip_entry_index); - - last_skip_entry_start = fnum - skip_entry_index; - } - return num_to_entry_table; -} - -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 = "::_pbi::TcParser::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. - auto field_num_to_entry_table = MakeNumToEntryTable(ordered_fields_); - format( - "PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\n" - "const ::_pbi::TcParseTable<$1$, $2$, $3$, $4$, $5$> " - "$classname$::_table_ = " - "{\n", - tc_table_info_->table_size_log2, ordered_fields_.size(), - tc_table_info_->aux_entries.size(), CalculateFieldNamesSize(), - field_num_to_entry_table.size16()); - { - auto table_scope = format.ScopedIndent(); - format("{\n"); - { - auto header_scope = format.ScopedIndent(); - if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { - format("PROTOBUF_FIELD_OFFSET($classname$, _impl_._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$, $2$, // max_field_number, fast_idx_mask\n", - (ordered_fields_.empty() ? 0 : ordered_fields_.back()->number()), - (((1 << tc_table_info_->table_size_log2) - 1) << 3)); - format( - "offsetof(decltype(_table_), field_lookup_table),\n" - "$1$, // skipmap\n", - field_num_to_entry_table.skipmap32); - if (ordered_fields_.empty()) { - format( - "offsetof(decltype(_table_), field_names), // no field_entries\n"); - } else { - format("offsetof(decltype(_table_), field_entries),\n"); - } - - format( - "$1$, // num_field_entries\n" - "$2$, // num_aux_entries\n", - ordered_fields_.size(), tc_table_info_->aux_entries.size()); - if (tc_table_info_->aux_entries.empty()) { - format( - "offsetof(decltype(_table_), field_names), // no aux_entries\n"); - } else { - format("offsetof(decltype(_table_), aux_entries),\n"); - } - format( - "&$1$._instance,\n" - "$2$, // fallback\n" - "", - DefaultInstanceName(descriptor_, options_), fallback); - } - format("}, {{\n"); - { - // fast_entries[] - auto fast_scope = format.ScopedIndent(); - GenerateFastFieldEntries(format); - } - format("}}, {{\n"); - { - // field_lookup_table[] - auto field_lookup_scope = format.ScopedIndent(); - int line_entries = 0; - for (int i = 0, N = field_num_to_entry_table.blocks.size(); i < N; ++i) { - SkipEntryBlock& entry_block = field_num_to_entry_table.blocks[i]; - format("$1$, $2$, $3$,\n", entry_block.first_fnum & 65535, - entry_block.first_fnum / 65536, entry_block.entries.size()); - for (auto se16 : entry_block.entries) { - if (line_entries == 0) { - format("$1$, $2$,", se16.skipmap, se16.field_entry_offset); - ++line_entries; - } else if (line_entries < 5) { - format(" $1$, $2$,", se16.skipmap, se16.field_entry_offset); - ++line_entries; - } else { - format(" $1$, $2$,\n", se16.skipmap, se16.field_entry_offset); - line_entries = 0; - } - } - } - if (line_entries) format("\n"); - format("65535, 65535\n"); - } - if (ordered_fields_.empty()) { - GOOGLE_LOG_IF(DFATAL, !tc_table_info_->aux_entries.empty()) - << "Invalid message: " << descriptor_->full_name() << " has " - << tc_table_info_->aux_entries.size() - << " auxiliary field entries, but no fields"; - format( - "}},\n" - "// no field_entries, or aux_entries\n" - "{{\n"); - } else { - format("}}, {{\n"); - { - // field_entries[] - auto field_scope = format.ScopedIndent(); - GenerateFieldEntries(format); - } - if (tc_table_info_->aux_entries.empty()) { - format( - "}},\n" - "// no aux_entries\n" - "{{\n"); - } else { - format("}}, {{\n"); - { - // aux_entries[] - auto aux_scope = format.ScopedIndent(); - for (const std::string& aux_entry : tc_table_info_->aux_entries) { - format("{$1$},\n", aux_entry); - } - } - format("}}, {{\n"); - } - } // ordered_fields_.empty() - { - // field_names[] - auto field_name_scope = format.ScopedIndent(); - GenerateFieldNames(format); - } - format("}},\n"); - } - format("};\n\n"); // _table_ -} - -void ParseFunctionGenerator::GenerateFastFieldEntries(Formatter& format) { - for (const auto& info : tc_table_info_->fast_path_fields) { - if (info.field != nullptr) { - PrintFieldComment(format, info.field); - } - if (info.func_name.empty()) { - format("{::_pbi::TcParser::MiniParse, {}},\n"); - } else { - bool cold = ShouldSplit(info.field, options_); - format( - "{$1$,\n" - " {$2$, $3$, $4$, PROTOBUF_FIELD_OFFSET($classname$$5$, $6$)}},\n", - info.func_name, info.coded_tag, info.hasbit_idx, info.aux_idx, - cold ? "::Impl_::Split" : "", - cold ? FieldName(info.field) + "_" - : FieldMemberName(info.field, /*cold=*/false)); - } - } -} - -static void FormatFieldKind(Formatter& format, - const TailCallTableInfo::FieldEntryInfo& entry, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - const FieldDescriptor* field = entry.field; - // Spell the field kind in proto language declaration order, starting with - // cardinality: - format("(::_fl::kFc"); - if (HasHasbit(field)) { - format("Optional"); - } else if (field->is_repeated()) { - format("Repeated"); - } else if (field->real_containing_oneof()) { - format("Oneof"); - } else { - format("Singular"); - } - - // The rest of the type uses convenience aliases: - format(" | ::_fl::k"); - if (field->is_repeated() && field->is_packed()) { - format("Packed"); - } - switch (field->type()) { - case FieldDescriptor::TYPE_DOUBLE: - format("Double"); - break; - case FieldDescriptor::TYPE_FLOAT: - format("Float"); - break; - case FieldDescriptor::TYPE_FIXED32: - format("Fixed32"); - break; - case FieldDescriptor::TYPE_SFIXED32: - format("SFixed32"); - break; - case FieldDescriptor::TYPE_FIXED64: - format("Fixed64"); - break; - case FieldDescriptor::TYPE_SFIXED64: - format("SFixed64"); - break; - case FieldDescriptor::TYPE_BOOL: - format("Bool"); - break; - case FieldDescriptor::TYPE_ENUM: - if (HasPreservingUnknownEnumSemantics(field)) { - // No validation is required. - format("OpenEnum"); - } else if (entry.is_enum_range) { - // Validation is done by range check (start/length in FieldAux). - format("EnumRange"); - } else { - // Validation uses the generated _IsValid function. - format("Enum"); - } - break; - case FieldDescriptor::TYPE_UINT32: - format("UInt32"); - break; - case FieldDescriptor::TYPE_SINT32: - format("SInt32"); - break; - case FieldDescriptor::TYPE_INT32: - format("Int32"); - break; - case FieldDescriptor::TYPE_UINT64: - format("UInt64"); - break; - case FieldDescriptor::TYPE_SINT64: - format("SInt64"); - break; - case FieldDescriptor::TYPE_INT64: - format("Int64"); - break; - - case FieldDescriptor::TYPE_BYTES: - format("Bytes"); - break; - case FieldDescriptor::TYPE_STRING: { - auto mode = GetUtf8CheckMode(field, options); - switch (mode) { - case Utf8CheckMode::kStrict: - format("Utf8String"); - break; - case Utf8CheckMode::kVerify: - format("RawString"); - break; - case Utf8CheckMode::kNone: - // Treat LITE_RUNTIME strings as bytes. - format("Bytes"); - break; - default: - GOOGLE_LOG(FATAL) << "Invalid Utf8CheckMode (" << static_cast(mode) - << ") for " << field->DebugString(); - } - break; - } - - case FieldDescriptor::TYPE_GROUP: - format("Message | ::_fl::kRepGroup"); - break; - case FieldDescriptor::TYPE_MESSAGE: - if (field->is_map()) { - format("Map"); - } else { - format("Message"); - if (IsLazy(field, options, scc_analyzer)) { - format(" | ::_fl::kRepLazy"); - } else if (IsImplicitWeakField(field, options, scc_analyzer)) { - format(" | ::_fl::kRepIWeak"); - } - } - break; - } - - // Fill in extra information about string and bytes field representations. - if (field->type() == FieldDescriptor::TYPE_BYTES || - field->type() == FieldDescriptor::TYPE_STRING) { - if (field->is_repeated()) { - format(" | ::_fl::kRepSString"); - } else { - format(" | ::_fl::kRepAString"); - } - } - - format(")"); -} - -void ParseFunctionGenerator::GenerateFieldEntries(Formatter& format) { - for (const auto& entry : tc_table_info_->field_entries) { - const FieldDescriptor* field = entry.field; - PrintFieldComment(format, field); - format("{"); - if (IsWeak(field, options_)) { - // Weak fields are handled by the generated fallback function. - // (These are handled by legacy Google-internal logic.) - format("/* weak */ 0, 0, 0, 0"); - } else { - const OneofDescriptor* oneof = field->real_containing_oneof(); - bool cold = ShouldSplit(field, options_); - format("PROTOBUF_FIELD_OFFSET($classname$$1$, $2$), $3$, $4$,\n ", - cold ? "::Impl_::Split" : "", - cold ? FieldName(field) + "_" - : FieldMemberName(field, /*cold=*/false), - (oneof ? oneof->index() : entry.hasbit_idx), entry.aux_idx); - FormatFieldKind(format, entry, options_, scc_analyzer_); - } - format("},\n"); - } -} - -static constexpr int kMaxNameLength = 255; - -int ParseFunctionGenerator::CalculateFieldNamesSize() const { - // The full name of the message appears first. - int size = std::min(static_cast(descriptor_->full_name().size()), - kMaxNameLength); - int lengths_size = 1; - for (const auto& entry : tc_table_info_->field_entries) { - const FieldDescriptor* field = entry.field; - GOOGLE_CHECK_LE(field->name().size(), kMaxNameLength); - size += field->name().size(); - lengths_size += 1; - } - // align to an 8-byte boundary - lengths_size = (lengths_size + 7) & -8; - return size + lengths_size + 1; -} - -static void FormatOctal(Formatter& format, int size) { - int octal_size = ((size >> 6) & 3) * 100 + // - ((size >> 3) & 7) * 10 + // - ((size >> 0) & 7); - format("\\$1$", octal_size); -} - -void ParseFunctionGenerator::GenerateFieldNames(Formatter& format) { - // First, we output the size of each string, as an unsigned byte. The first - // string is the message name. - int count = 1; - format("\""); - FormatOctal(format, - std::min(static_cast(descriptor_->full_name().size()), 255)); - for (const auto& entry : tc_table_info_->field_entries) { - FormatOctal(format, entry.field->name().size()); - ++count; - } - while (count & 7) { // align to an 8-byte boundary - format("\\0"); - ++count; - } - format("\"\n"); - // The message name is stored at the beginning of the string - std::string message_name = descriptor_->full_name(); - if (message_name.size() > kMaxNameLength) { - static constexpr int kNameHalfLength = (kMaxNameLength - 3) / 2; - message_name = StrCat( - message_name.substr(0, kNameHalfLength), "...", - message_name.substr(message_name.size() - kNameHalfLength)); - } - format("\"$1$\"\n", message_name); - // Then we output the actual field names - for (const auto& entry : tc_table_info_->field_entries) { - const FieldDescriptor* field = entry.field; - format("\"$1$\"\n", field->name()); - } -} - -void ParseFunctionGenerator::GenerateArenaString(Formatter& format, - const FieldDescriptor* field) { - if (HasHasbit(field)) { - format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field)); - } - format( - "if (arena != nullptr) {\n" - " ptr = ctx->ReadArenaString(ptr, &$msg$$field$, arena"); - if (IsStringInlined(field, options_)) { - GOOGLE_DCHECK(!inlined_string_indices_.empty()); - int inlined_string_index = inlined_string_indices_[field->index()]; - GOOGLE_DCHECK_GT(inlined_string_index, 0); - format(", &$msg$$inlined_string_donated_array$[0], $1$, $this$", - inlined_string_index); - } else { - GOOGLE_DCHECK(field->default_value_string().empty()); - } - format( - ");\n" - "} else {\n" - " ptr = ::_pbi::InlineGreedyStringParser(" - "$msg$$field$.MutableNoCopy(nullptr), ptr, ctx);\n" - "}\n" - "const std::string* str = &$msg$$field$.Get(); (void)str;\n"); -} - -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 = ::_pbi::Inline$3$(str, ptr, ctx);\n", - HasInternalAccessors(ctype) ? "_internal_" : "", - field->is_repeated() && !field->is_packable() ? "add" : "mutable", - parser_name); - } - // It is intentionally placed before VerifyUTF8 because it doesn't make sense - // to verify UTF8 when we already know parsing failed. - format("CHK_(ptr);\n"); - 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("::_pbi::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())); - } - format("CHK_(ptr);\n"); - } 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()->map_value(); - GOOGLE_CHECK(val); - if (val->type() == FieldDescriptor::TYPE_ENUM && - !HasPreservingUnknownEnumSemantics(field)) { - format( - "auto object = " - "::$proto_ns$::internal::InitEnumParseWrapper<" - "$unknown_fields_type$>(&$msg$$field$, $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$$field$, ptr);\n"); - } - } else if (IsLazy(field, options_, scc_analyzer_)) { - bool eager_verify = - IsEagerlyVerifiedLazy(field, options_, scc_analyzer_); - if (ShouldVerify(descriptor_, options_, scc_analyzer_)) { - format( - "ctx->set_lazy_eager_verify_func($1$);\n", - eager_verify - ? StrCat("&", ClassName(field->message_type(), true), - "::InternalVerify") - : "nullptr"); - } - if (field->real_containing_oneof()) { - format( - "if (!$msg$_internal_has_$name$()) {\n" - " $msg$clear_$1$();\n" - " $msg$$field$ = ::$proto_ns$::Arena::CreateMessage<\n" - " ::$proto_ns$::internal::LazyField>(" - "$msg$GetArenaForAllocation());\n" - " $msg$set_has_$name$();\n" - "}\n" - "auto* lazy_field = $msg$$field$;\n", - field->containing_oneof()->name()); - } else if (HasHasbit(field)) { - format( - "_Internal::set_has_$name$(&$has_bits$);\n" - "auto* lazy_field = &$msg$$field$;\n"); - } else { - format("auto* lazy_field = &$msg$$field$;\n"); - } - format( - "::$proto_ns$::internal::LazyFieldParseHelper<\n" - " ::$proto_ns$::internal::LazyField> parse_helper(\n" - " $1$::default_instance(),\n" - " $msg$GetArenaForAllocation(),\n" - " ::google::protobuf::internal::LazyVerifyOption::$2$,\n" - " lazy_field);\n" - "ptr = ctx->ParseMessage(&parse_helper, ptr);\n", - FieldMessageTypeName(field, options_), - eager_verify ? "kEager" : "kLazy"); - if (ShouldVerify(descriptor_, options_, scc_analyzer_) && - eager_verify) { - format("ctx->set_lazy_eager_verify_func(nullptr);\n"); - } - } 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$$field$.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"); - } - format("CHK_(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$$field$ = ::$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$$field$ = " - "::$proto_ns$::internal::UnalignedLoad<$primitive_type$>(ptr);\n" - "ptr += sizeof($primitive_type$);\n"); - } - break; - } - case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - GenerateLengthDelim(format, field); - 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& fields) { - if (!fields.empty()) { - GenerateFieldSwitch(format, 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& fields) { - format("switch (tag >> 3) {\n"); - format.Indent(); - - for (const auto* field : fields) { - bool cold = ShouldSplit(field, options_); - format.Set("field", FieldMemberName(field, cold)); - 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(); - if (cold) { - format("$msg$PrepareSplitMessageForWrite();\n"); - } - 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 TailCallTableInfo::FieldEntryInfo& entry, const Options& options) { - const FieldDescriptor* field = entry.field; - std::string name = "::_pbi::TcParser::Fast"; - - switch (field->type()) { - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_FLOAT: - name.append("F32"); - break; - - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_SFIXED64: - case FieldDescriptor::TYPE_DOUBLE: - name.append("F64"); - break; - - case FieldDescriptor::TYPE_BOOL: - name.append("V8"); - break; - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_UINT32: - name.append("V32"); - break; - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_UINT64: - name.append("V64"); - break; - - case FieldDescriptor::TYPE_ENUM: - if (HasPreservingUnknownEnumSemantics(field)) { - name.append("V32"); - break; - } - if (field->is_repeated() && field->is_packed()) { - GOOGLE_LOG(DFATAL) << "Enum validation not handled: " << field->DebugString(); - return ""; - } - name.append(entry.is_enum_range ? "Er" : "Ev"); - break; - - case FieldDescriptor::TYPE_SINT32: - name.append("Z32"); - break; - case FieldDescriptor::TYPE_SINT64: - name.append("Z64"); - break; - - case FieldDescriptor::TYPE_BYTES: - name.append("B"); - if (IsStringInlined(field, options)) { - name.append("i"); - } - break; - case FieldDescriptor::TYPE_STRING: - switch (GetUtf8CheckMode(field, options)) { - case Utf8CheckMode::kNone: - name.append("B"); - break; - case Utf8CheckMode::kVerify: - name.append("S"); - break; - case Utf8CheckMode::kStrict: - name.append("U"); - break; - default: - GOOGLE_LOG(DFATAL) << "Mode not handled: " - << static_cast(GetUtf8CheckMode(field, options)); - return ""; - } - if (IsStringInlined(field, options)) { - name.append("i"); - } - break; - - case FieldDescriptor::TYPE_MESSAGE: - name.append("M"); - break; - case FieldDescriptor::TYPE_GROUP: - name.append("G"); - break; - - default: - GOOGLE_LOG(DFATAL) << "Type not handled: " << field->DebugString(); - return ""; - } - - // The field implementation functions are prefixed by cardinality: - // `S` for optional or implicit fields. - // `R` for non-packed repeated. - // `P` for packed repeated. - name.append(field->is_packed() ? "P" - : field->is_repeated() ? "R" - : field->real_containing_oneof() ? "O" - : "S"); - - // Append the tag length. Fast parsing only handles 1- or 2-byte tags. - name.append(TagSize(field->number()) == 1 ? "1" : "2"); - - return name; -} - -} // namespace - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.h b/depends/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.h deleted file mode 100644 index 542a15a06..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.h +++ /dev/null @@ -1,180 +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_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__ - -#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& ordered_fields, - const std::vector& has_bit_indices, - const std::vector& inlined_string_indices, - MessageSCCAnalyzer* scc_analyzer); - - // Fields parsed by the table fast-path. - struct FastFieldInfo { - std::string func_name; - const FieldDescriptor* field; - uint16_t coded_tag; - uint8_t hasbit_idx; - uint8_t aux_idx; - }; - std::vector fast_path_fields; - - // Fields parsed by mini parsing routines. - struct FieldEntryInfo { - const FieldDescriptor* field; - int hasbit_idx; - int inlined_string_idx; - uint16_t aux_idx; - // True for enums entirely covered by the start/length fields of FieldAux: - bool is_enum_range; - }; - std::vector field_entries; - std::vector aux_entries; - - // Fields parsed by generated fallback function. - 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 a looping `_InternalParse` function. - void GenerateLoopingParseFunction(Formatter& format); - - // Generates the tail-call table definition. - void GenerateTailCallTable(Formatter& format); - void GenerateFastFieldEntries(Formatter& format); - void GenerateFieldEntries(Formatter& format); - int CalculateFieldNamesSize() const; - void GenerateFieldNames(Formatter& format); - - // 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& fields); - - // Generates a `switch` statement to parse each of `fields`. - void GenerateFieldSwitch(Formatter& format, - const std::vector& fields); - - const Descriptor* descriptor_; - MessageSCCAnalyzer* scc_analyzer_; - const Options& options_; - std::map variables_; - std::unique_ptr tc_table_info_; - std::vector inlined_string_indices_; - const std::vector ordered_fields_; - int num_hasbits_; -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/primitive_field.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/primitive_field.cc deleted file mode 100644 index 6c92ede25..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/primitive_field.cc +++ /dev/null @@ -1,539 +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 { - -using internal::WireFormatLite; - -namespace { - -// For encodings with fixed sizes, returns that size in bytes. Otherwise -// returns -1. -int FixedSize(FieldDescriptor::Type type) { - switch (type) { - case FieldDescriptor::TYPE_INT32: - return -1; - case FieldDescriptor::TYPE_INT64: - return -1; - case FieldDescriptor::TYPE_UINT32: - return -1; - case FieldDescriptor::TYPE_UINT64: - return -1; - case FieldDescriptor::TYPE_SINT32: - return -1; - case FieldDescriptor::TYPE_SINT64: - return -1; - case FieldDescriptor::TYPE_FIXED32: - return WireFormatLite::kFixed32Size; - case FieldDescriptor::TYPE_FIXED64: - return WireFormatLite::kFixed64Size; - case FieldDescriptor::TYPE_SFIXED32: - return WireFormatLite::kSFixed32Size; - case FieldDescriptor::TYPE_SFIXED64: - return WireFormatLite::kSFixed64Size; - case FieldDescriptor::TYPE_FLOAT: - return WireFormatLite::kFloatSize; - case FieldDescriptor::TYPE_DOUBLE: - return WireFormatLite::kDoubleSize; - - case FieldDescriptor::TYPE_BOOL: - return WireFormatLite::kBoolSize; - case FieldDescriptor::TYPE_ENUM: - return -1; - - case FieldDescriptor::TYPE_STRING: - return -1; - case FieldDescriptor::TYPE_BYTES: - return -1; - case FieldDescriptor::TYPE_GROUP: - return -1; - case FieldDescriptor::TYPE_MESSAGE: - return -1; - - // No default because we want the compiler to complain if any new - // types are added. - } - GOOGLE_LOG(FATAL) << "Can't get here."; - return -1; -} - -void SetPrimitiveVariables(const FieldDescriptor* descriptor, - std::map* variables, - const Options& options) { - SetCommonFieldVariables(descriptor, variables, options); - (*variables)["type"] = PrimitiveTypeName(options, descriptor->cpp_type()); - (*variables)["default"] = DefaultValue(options, descriptor); - (*variables)["cached_byte_size_name"] = MakeVarintCachedSizeName(descriptor); - bool cold = ShouldSplit(descriptor, options); - (*variables)["cached_byte_size_field"] = - MakeVarintCachedSizeFieldName(descriptor, cold); - (*variables)["tag"] = StrCat(internal::WireFormat::MakeTag(descriptor)); - int fixed_size = FixedSize(descriptor->type()); - if (fixed_size != -1) { - (*variables)["fixed_size"] = StrCat(fixed_size); - } - (*variables)["wire_format_field_type"] = FieldDescriptorProto_Type_Name( - static_cast(descriptor->type())); - (*variables)["full_name"] = descriptor->full_name(); -} - -} // namespace - -// =================================================================== - -PrimitiveFieldGenerator::PrimitiveFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : FieldGenerator(descriptor, options) { - SetPrimitiveVariables(descriptor, &variables_, options); -} - -PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {} - -void PrimitiveFieldGenerator::GeneratePrivateMembers( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$type$ $name$_;\n"); -} - -void PrimitiveFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "$deprecated_attr$$type$ ${1$$name$$}$() const;\n" - "$deprecated_attr$void ${1$set_$name$$}$($type$ value);\n" - "private:\n" - "$type$ ${1$_internal_$name$$}$() const;\n" - "void ${1$_internal_set_$name$$}$($type$ value);\n" - "public:\n", - descriptor_); -} - -void PrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$ $classname$::_internal_$name$() const {\n" - " return $field$;\n" - "}\n" - "inline $type$ $classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline void $classname$::_internal_set_$name$($type$ value) {\n" - " $set_hasbit$\n" - " $field$ = value;\n" - "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - "$maybe_prepare_split_message$" - " _internal_set_$name$(value);\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n"); -} - -void PrimitiveFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$ = $default$;\n"); -} - -void PrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->_internal_set_$name$(from._internal_$name$());\n"); -} - -void PrimitiveFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - format("swap($field$, other->$field$);\n"); -} - -void PrimitiveFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->$field$ = from.$field$;\n"); -} - -void PrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "target = stream->EnsureSpace(target);\n" - "target = " - "::_pbi::WireFormatLite::Write$declared_type$ToArray(" - "$number$, this->_internal_$name$(), target);\n"); -} - -void PrimitiveFieldGenerator::GenerateByteSize(io::Printer* printer) const { - Formatter format(printer, variables_); - int fixed_size = FixedSize(descriptor_->type()); - if (fixed_size == -1) { - 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 += ::_pbi::WireFormatLite::" - "$declared_type$SizePlusOne(this->_internal_$name$());\n"); - } else { - format( - "total_size += $tag_size$ +\n" - " ::_pbi::WireFormatLite::$declared_type$Size(\n" - " this->_internal_$name$());\n"); - } - } else { - format("total_size += $tag_size$ + $fixed_size$;\n"); - } -} - -void PrimitiveFieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("/*decltype($field$)*/$default$"); -} - -void PrimitiveFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - format("decltype(Impl_::Split::$name$_){$default$}"); - return; - } - format("decltype($field$){$default$}"); -} - -void PrimitiveFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){}"); -} - -// =================================================================== - -PrimitiveOneofFieldGenerator::PrimitiveOneofFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : PrimitiveFieldGenerator(descriptor, options) { - SetCommonOneofFieldVariables(descriptor, &variables_); -} - -PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() {} - -void PrimitiveOneofFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$ $classname$::_internal_$name$() const {\n" - " if (_internal_has_$name$()) {\n" - " return $field$;\n" - " }\n" - " return $default$;\n" - "}\n" - "inline void $classname$::_internal_set_$name$($type$ value) {\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " }\n" - " $field$ = value;\n" - "}\n" - "inline $type$ $classname$::$name$() const {\n" - "$annotate_get$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - " _internal_set_$name$(value);\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n"); -} - -void PrimitiveOneofFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$ = $default$;\n"); -} - -void PrimitiveOneofFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - // Don't print any swapping code. Swapping the union will swap this field. -} - -void PrimitiveOneofFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$ns$::_$classname$_default_instance_.$field$ = $default$;\n"); -} - -// =================================================================== - -RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : FieldGenerator(descriptor, options) { - SetPrimitiveVariables(descriptor, &variables_, options); - - if (descriptor->is_packed()) { - variables_["packed_reader"] = "ReadPackedPrimitive"; - variables_["repeated_reader"] = "ReadRepeatedPrimitiveNoInline"; - } else { - variables_["packed_reader"] = "ReadPackedPrimitiveNoInline"; - variables_["repeated_reader"] = "ReadRepeatedPrimitive"; - } -} - -RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() {} - -void RepeatedPrimitiveFieldGenerator::GeneratePrivateMembers( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("::$proto_ns$::RepeatedField< $type$ > $name$_;\n"); - if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 && - HasGeneratedMethods(descriptor_->file(), options_)) { - format("mutable std::atomic $cached_byte_size_name$;\n"); - } -} - -void RepeatedPrimitiveFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "private:\n" - "$type$ ${1$_internal_$name$$}$(int index) const;\n" - "const ::$proto_ns$::RepeatedField< $type$ >&\n" - " ${1$_internal_$name$$}$() const;\n" - "void ${1$_internal_add_$name$$}$($type$ value);\n" - "::$proto_ns$::RepeatedField< $type$ >*\n" - " ${1$_internal_mutable_$name$$}$();\n" - "public:\n" - "$deprecated_attr$$type$ ${1$$name$$}$(int index) const;\n" - "$deprecated_attr$void ${1$set_$name$$}$(int index, $type$ value);\n" - "$deprecated_attr$void ${1$add_$name$$}$($type$ value);\n" - "$deprecated_attr$const ::$proto_ns$::RepeatedField< $type$ >&\n" - " ${1$$name$$}$() const;\n" - "$deprecated_attr$::$proto_ns$::RepeatedField< $type$ >*\n" - " ${1$mutable_$name$$}$();\n", - descriptor_); -} - -void RepeatedPrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline $type$ $classname$::_internal_$name$(int index) const {\n" - " return $field$.Get(index);\n" - "}\n" - "inline $type$ $classname$::$name$(int index) const {\n" - "$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_set$" - " $field$.Set(index, value);\n" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n" - "inline void $classname$::_internal_add_$name$($type$ value) {\n" - " $field$.Add(value);\n" - "}\n" - "inline void $classname$::add_$name$($type$ value) {\n" - " _internal_add_$name$(value);\n" - "$annotate_add$" - " // @@protoc_insertion_point(field_add:$full_name$)\n" - "}\n" - "inline const ::$proto_ns$::RepeatedField< $type$ >&\n" - "$classname$::_internal_$name$() const {\n" - " return $field$;\n" - "}\n" - "inline const ::$proto_ns$::RepeatedField< $type$ >&\n" - "$classname$::$name$() const {\n" - "$annotate_list$" - " // @@protoc_insertion_point(field_list:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline ::$proto_ns$::RepeatedField< $type$ >*\n" - "$classname$::_internal_mutable_$name$() {\n" - " return &$field$;\n" - "}\n" - "inline ::$proto_ns$::RepeatedField< $type$ >*\n" - "$classname$::mutable_$name$() {\n" - "$annotate_mutable_list$" - " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - " return _internal_mutable_$name$();\n" - "}\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.Clear();\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->$field$.MergeFrom(from.$field$);\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.InternalSwap(&other->$field$);\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateDestructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.~RepeatedField();\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (descriptor_->is_packed()) { - if (FixedSize(descriptor_->type()) == -1) { - format( - "{\n" - " int byte_size = " - "$cached_byte_size_field$.load(std::memory_order_relaxed);\n" - " if (byte_size > 0) {\n" - " target = stream->Write$declared_type$Packed(\n" - " $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( - "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" - " target = stream->EnsureSpace(target);\n" - " target = ::_pbi::WireFormatLite::" - "Write$declared_type$ToArray($number$, this->_internal_$name$(i), " - "target);\n" - "}\n"); - } -} - -void RepeatedPrimitiveFieldGenerator::GenerateByteSize( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("{\n"); - format.Indent(); - int fixed_size = FixedSize(descriptor_->type()); - if (fixed_size == -1) { - format( - "size_t data_size = ::_pbi::WireFormatLite::\n" - " $declared_type$Size(this->$field$);\n"); - } else { - format( - "unsigned int count = static_cast(this->_internal_$name$_size());\n" - "size_t data_size = $fixed_size$UL * count;\n"); - } - - if (descriptor_->is_packed()) { - format( - "if (data_size > 0) {\n" - " total_size += $tag_size$ +\n" - " " - "::_pbi::WireFormatLite::Int32Size(static_cast<$int32$>(data_size));\n" - "}\n"); - if (FixedSize(descriptor_->type()) == -1) { - format( - "int cached_size = ::_pbi::ToCachedSize(data_size);\n" - "$cached_byte_size_field$.store(cached_size,\n" - " std::memory_order_relaxed);\n"); - } - format("total_size += data_size;\n"); - } else { - format( - "total_size += $tag_size$ *\n" - " " - "::_pbi::FromIntSize(this->_internal_$name$_size());\n" - "total_size += data_size;\n"); - } - format.Outdent(); - format("}\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("/*decltype($field$)*/{}"); - if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 && - HasGeneratedMethods(descriptor_->file(), options_)) { - format("\n, /*decltype($cached_byte_size_field$)*/{0}"); - } -} - -void RepeatedPrimitiveFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){arena}"); - if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 && - HasGeneratedMethods(descriptor_->file(), options_)) { - // std::atomic has no move constructor, which prevents explicit aggregate - // initialization pre-C++17. - format("\n, /*decltype($cached_byte_size_field$)*/{0}"); - } -} - -void RepeatedPrimitiveFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - - Formatter format(printer, variables_); - format("decltype($field$){from.$field$}"); - if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 && - HasGeneratedMethods(descriptor_->file(), options_)) { - // std::atomic has no move constructor. - format("\n, /*decltype($cached_byte_size_field$)*/{0}"); - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/primitive_field.h b/depends/protobuf/src/google/protobuf/compiler/cpp/primitive_field.h deleted file mode 100644 index bb8a08aa1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/primitive_field.h +++ /dev/null @@ -1,126 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class PrimitiveFieldGenerator : public FieldGenerator { - public: - PrimitiveFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~PrimitiveFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); -}; - -class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { - public: - PrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~PrimitiveOneofFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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); -}; - -class RepeatedPrimitiveFieldGenerator : public FieldGenerator { - public: - RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~RepeatedPrimitiveFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 { - GOOGLE_CHECK(!ShouldSplit(descriptor_, options_)); - } - void GenerateDestructorCode(io::Printer* printer) const override; - void GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const override; - void GenerateByteSize(io::Printer* printer) const override; - void GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/service.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/service.cc deleted file mode 100644 index 7a0d48054..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/service.cc +++ /dev/null @@ -1,328 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { - -void InitMethodVariables(const MethodDescriptor* method, const Options& options, - Formatter* format) { - format->Set("name", method->name()); - format->Set("input_type", QualifiedClassName(method->input_type(), options)); - format->Set("output_type", - QualifiedClassName(method->output_type(), options)); -} - -} // namespace - -ServiceGenerator::ServiceGenerator( - const ServiceDescriptor* descriptor, - const std::map& vars, const Options& options) - : descriptor_(descriptor), vars_(vars), options_(options) { - vars_["classname"] = descriptor_->name(); - vars_["full_name"] = descriptor_->full_name(); -} - -ServiceGenerator::~ServiceGenerator() {} - -void ServiceGenerator::GenerateDeclarations(io::Printer* printer) { - Formatter format(printer, vars_); - // Forward-declare the stub type. - format( - "class $classname$_Stub;\n" - "\n"); - - GenerateInterface(printer); - GenerateStubDefinition(printer); -} - -void ServiceGenerator::GenerateInterface(io::Printer* printer) { - Formatter format(printer, vars_); - format( - "class $dllexport_decl $$classname$ : public ::$proto_ns$::Service {\n" - " protected:\n" - " // This class should be treated as an abstract interface.\n" - " inline $classname$() {};\n" - " public:\n" - " virtual ~$classname$();\n"); - printer->Indent(); - - format( - "\n" - "typedef $classname$_Stub Stub;\n" - "\n" - "static const ::$proto_ns$::ServiceDescriptor* descriptor();\n" - "\n"); - - GenerateMethodSignatures(VIRTUAL, printer); - - format( - "\n" - "// implements Service ----------------------------------------------\n" - "\n" - "const ::$proto_ns$::ServiceDescriptor* GetDescriptor();\n" - "void CallMethod(const ::$proto_ns$::MethodDescriptor* method,\n" - " ::$proto_ns$::RpcController* controller,\n" - " const ::$proto_ns$::Message* request,\n" - " ::$proto_ns$::Message* response,\n" - " ::google::protobuf::Closure* done);\n" - "const ::$proto_ns$::Message& GetRequestPrototype(\n" - " const ::$proto_ns$::MethodDescriptor* method) const;\n" - "const ::$proto_ns$::Message& GetResponsePrototype(\n" - " const ::$proto_ns$::MethodDescriptor* method) const;\n"); - - printer->Outdent(); - format( - "\n" - " private:\n" - " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($classname$);\n" - "};\n" - "\n"); -} - -void ServiceGenerator::GenerateStubDefinition(io::Printer* printer) { - Formatter format(printer, vars_); - format( - "class $dllexport_decl $$classname$_Stub : public $classname$ {\n" - " public:\n"); - - printer->Indent(); - - format( - "$classname$_Stub(::$proto_ns$::RpcChannel* channel);\n" - "$classname$_Stub(::$proto_ns$::RpcChannel* channel,\n" - " ::$proto_ns$::Service::ChannelOwnership ownership);\n" - "~$classname$_Stub();\n" - "\n" - "inline ::$proto_ns$::RpcChannel* channel() { return channel_; }\n" - "\n" - "// implements $classname$ ------------------------------------------\n" - "\n"); - - GenerateMethodSignatures(NON_VIRTUAL, printer); - - printer->Outdent(); - format( - " private:\n" - " ::$proto_ns$::RpcChannel* channel_;\n" - " bool owns_channel_;\n" - " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($classname$_Stub);\n" - "};\n" - "\n"); -} - -void ServiceGenerator::GenerateMethodSignatures(VirtualOrNon virtual_or_non, - 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); - format.Set("virtual", virtual_or_non == VIRTUAL ? "virtual " : ""); - format( - "$virtual$void $name$(::$proto_ns$::RpcController* controller,\n" - " const $input_type$* request,\n" - " $output_type$* response,\n" - " ::google::protobuf::Closure* done);\n"); - } -} - -// =================================================================== - -void ServiceGenerator::GenerateImplementation(io::Printer* printer) { - Formatter format(printer, vars_); - format( - "$classname$::~$classname$() {}\n" - "\n" - "const ::$proto_ns$::ServiceDescriptor* $classname$::descriptor() {\n" - " " - "::$proto_ns$::internal::AssignDescriptors(&$desc_table$);\n" - " return $file_level_service_descriptors$[$1$];\n" - "}\n" - "\n" - "const ::$proto_ns$::ServiceDescriptor* $classname$::GetDescriptor() {\n" - " return descriptor();\n" - "}\n" - "\n", - index_in_metadata_); - - // Generate methods of the interface. - GenerateNotImplementedMethods(printer); - GenerateCallMethod(printer); - GenerateGetPrototype(REQUEST, printer); - GenerateGetPrototype(RESPONSE, printer); - - // Generate stub implementation. - format( - "$classname$_Stub::$classname$_Stub(::$proto_ns$::RpcChannel* channel)\n" - " : channel_(channel), owns_channel_(false) {}\n" - "$classname$_Stub::$classname$_Stub(\n" - " ::$proto_ns$::RpcChannel* channel,\n" - " ::$proto_ns$::Service::ChannelOwnership ownership)\n" - " : channel_(channel),\n" - " owns_channel_(ownership == " - "::$proto_ns$::Service::STUB_OWNS_CHANNEL) " - "{}\n" - "$classname$_Stub::~$classname$_Stub() {\n" - " if (owns_channel_) delete channel_;\n" - "}\n" - "\n"); - - GenerateStubMethods(printer); -} - -void ServiceGenerator::GenerateNotImplementedMethods(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); - format( - "void $classname$::$name$(::$proto_ns$::RpcController* controller,\n" - " const $input_type$*,\n" - " $output_type$*,\n" - " ::google::protobuf::Closure* done) {\n" - " controller->SetFailed(\"Method $name$() not implemented.\");\n" - " done->Run();\n" - "}\n" - "\n"); - } -} - -void ServiceGenerator::GenerateCallMethod(io::Printer* printer) { - Formatter format(printer, vars_); - format( - "void $classname$::CallMethod(const ::$proto_ns$::MethodDescriptor* " - "method,\n" - " ::$proto_ns$::RpcController* controller,\n" - " const ::$proto_ns$::Message* request,\n" - " ::$proto_ns$::Message* response,\n" - " ::google::protobuf::Closure* done) {\n" - " GOOGLE_DCHECK_EQ(method->service(), $file_level_service_descriptors$[$1$]);\n" - " switch(method->index()) {\n", - index_in_metadata_); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - 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_method( - " case $1$:\n" - " $name$(controller,\n" - " ::$proto_ns$::internal::DownCast(\n" - " request),\n" - " ::$proto_ns$::internal::DownCast<$output_type$*>(\n" - " response),\n" - " done);\n" - " break;\n", - i); - } - - format( - " default:\n" - " GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";\n" - " break;\n" - " }\n" - "}\n" - "\n"); -} - -void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which, - io::Printer* printer) { - Formatter format(printer, vars_); - if (which == REQUEST) { - format("const ::$proto_ns$::Message& $classname$::GetRequestPrototype(\n"); - } else { - format("const ::$proto_ns$::Message& $classname$::GetResponsePrototype(\n"); - } - - format( - " const ::$proto_ns$::MethodDescriptor* method) const {\n" - " GOOGLE_DCHECK_EQ(method->service(), descriptor());\n" - " switch(method->index()) {\n"); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - const Descriptor* type = - (which == REQUEST) ? method->input_type() : method->output_type(); - - format( - " case $1$:\n" - " return $2$::default_instance();\n", - i, QualifiedClassName(type, options_)); - } - - format( - " default:\n" - " GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";\n" - " return *::$proto_ns$::MessageFactory::generated_factory()\n" - " ->GetPrototype(method->$1$_type());\n" - " }\n" - "}\n" - "\n", - which == REQUEST ? "input" : "output"); -} - -void ServiceGenerator::GenerateStubMethods(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); - format( - "void $classname$_Stub::$name$(::$proto_ns$::RpcController* " - "controller,\n" - " const $input_type$* request,\n" - " $output_type$* response,\n" - " ::google::protobuf::Closure* done) {\n" - " channel_->CallMethod(descriptor()->method($1$),\n" - " controller, request, response, done);\n" - "}\n", - i); - } -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/string_field.cc b/depends/protobuf/src/google/protobuf/compiler/cpp/string_field.cc deleted file mode 100644 index 9e7c96d7c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/string_field.cc +++ /dev/null @@ -1,957 +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); - - const std::string kNS = "::" + (*variables)["proto_ns"] + "::internal::"; - const std::string kArenaStringPtr = kNS + "ArenaStringPtr"; - - (*variables)["default"] = DefaultValue(options, descriptor); - (*variables)["default_length"] = - StrCat(descriptor->default_value_string().length()); - (*variables)["default_variable_name"] = MakeDefaultName(descriptor); - (*variables)["default_variable_field"] = MakeDefaultFieldName(descriptor); - - if (descriptor->default_value_string().empty()) { - (*variables)["default_string"] = kNS + "GetEmptyStringAlreadyInited()"; - (*variables)["default_value"] = "&" + (*variables)["default_string"]; - (*variables)["lazy_variable_args"] = ""; - } else { - (*variables)["lazy_variable"] = - StrCat(QualifiedClassName(descriptor->containing_type(), options), - "::", MakeDefaultFieldName(descriptor)); - - (*variables)["default_string"] = (*variables)["lazy_variable"] + ".get()"; - (*variables)["default_value"] = "nullptr"; - (*variables)["lazy_variable_args"] = (*variables)["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 { - // Skips the automatic destruction; rather calls it explicitly if - // allocating arena is null. This is required to support message-owned - // arena (go/path-to-arenas) where a root proto is destroyed but - // InlinedStringField may have arena-allocated memory. - format("::$proto_ns$::internal::InlinedStringField $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"); - } - if (inlined_) { - // `_init_inline_xxx` is used for initializing default instances. - format("static std::true_type _init_inline_$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 ($field$.IsDefault()) return " - "$default_variable_field$.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" - "$maybe_prepare_split_message$" - " $set_hasbit$\n" - " $field$.$setter$(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" - "$maybe_prepare_split_message$" - " $set_hasbit$\n" - " $field$.$setter$(static_cast(arg0)," - " args..., GetArenaForAllocation(), _internal_$name$_donated(), " - "&$donating_states_word$, $mask_for_undonate$, this);\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" - "$maybe_prepare_split_message$" - " 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 $field$.Get();\n" - "}\n" - "inline void $classname$::_internal_set_$name$(const std::string& " - "value) {\n" - " $set_hasbit$\n"); - if (!inlined_) { - format( - " $field$.Set(value, GetArenaForAllocation());\n" - "}\n"); - } else { - format( - " $field$.Set(value, GetArenaForAllocation(),\n" - " _internal_$name$_donated(), &$donating_states_word$, " - "$mask_for_undonate$, this);\n" - "}\n"); - } - format( - "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " $set_hasbit$\n"); - if (!inlined_) { - format( - " return $field$.Mutable($lazy_variable_args$" - "GetArenaForAllocation());\n" - "}\n"); - } else { - format( - " return $field$.Mutable($lazy_variable_args$" - "GetArenaForAllocation(), _internal_$name$_donated(), " - "&$donating_states_word$, $mask_for_undonate$, this);\n" - "}\n"); - } - format( - "inline std::string* $classname$::$release_name$() {\n" - "$annotate_release$" - "$maybe_prepare_split_message$" - " // @@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 = $field$.Release();\n"); - if (descriptor_->default_value_string().empty()) { - format( - "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" - " if ($field$.IsDefault()) {\n" - " $field$.Set(\"\", GetArenaForAllocation());\n" - " }\n" - "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); - } - format(" return p;\n"); - } else { - format( - " return $field$.Release(GetArenaForAllocation(), " - "_internal_$name$_donated());\n"); - } - } else { - format(" return $field$.Release();\n"); - } - - format( - "}\n" - "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" - "$maybe_prepare_split_message$" - " if ($name$ != nullptr) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n"); - if (!inlined_) { - format(" $field$.SetAllocated($name$, GetArenaForAllocation());\n"); - if (descriptor_->default_value_string().empty()) { - format( - "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" - " if ($field$.IsDefault()) {\n" - " $field$.Set(\"\", GetArenaForAllocation());\n" - " }\n" - "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); - } - } else { - // Currently, string fields with default value can't be inlined. - format( - " $field$.SetAllocated(nullptr, $name$, GetArenaForAllocation(), " - "_internal_$name$_donated(), &$donating_states_word$, " - "$mask_for_undonate$, this);\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_field$" - "{{{$default$, $default_length$}}, {nullptr}};\n"); - } -} - -void StringFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - if (descriptor_->default_value_string().empty()) { - format("$field$.ClearToEmpty();\n"); - } else { - GOOGLE_DCHECK(!inlined_); - format( - "$field$.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$(!$field$.IsDefault());\n"); - } - - if (descriptor_->default_value_string().empty()) { - if (must_be_present) { - format("$field$.ClearNonDefaultToEmpty();\n"); - } else { - format("$field$.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( - "$field$.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n "); - } -} - -void StringFieldGenerator::GenerateMergingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - // TODO(gpike): improve this - format("_this->_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" - " &$field$, lhs_arena,\n" - " &other->$field$, rhs_arena\n" - ");\n"); - } else { - format( - "::$proto_ns$::internal::InlinedStringField::InternalSwap(\n" - " &$field$, lhs_arena, " - "($inlined_string_donated_array$[0] & 0x1u) == 0, this,\n" - " &other->$field$, rhs_arena, " - "(other->$inlined_string_donated_array$[0] & 0x1u) == 0, other);\n"); - } -} - -void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const { - Formatter format(printer, variables_); - if (inlined_ && descriptor_->default_value_string().empty()) { - return; - } - GOOGLE_DCHECK(!inlined_); - format("$field$.InitDefault();\n"); - if (IsString(descriptor_, options_) && - descriptor_->default_value_string().empty()) { - format( - "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" - " $field$.Set(\"\", GetArenaForAllocation());\n" - "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); - } -} - -void StringFieldGenerator::GenerateCreateSplitMessageCode( - io::Printer* printer) const { - GOOGLE_CHECK(ShouldSplit(descriptor_, options_)); - GOOGLE_CHECK(!inlined_); - Formatter format(printer, variables_); - format("ptr->$name$_.InitDefault();\n"); - if (IsString(descriptor_, options_) && - descriptor_->default_value_string().empty()) { - format( - "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" - " ptr->$name$_.Set(\"\", GetArenaForAllocation());\n" - "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); - } -} - -void StringFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - GenerateConstructorCode(printer); - if (inlined_) { - format("new (&_this->$field$) ::_pbi::InlinedStringField();\n"); - } - - if (HasHasbit(descriptor_)) { - format("if (from._internal_has_$name$()) {\n"); - } else { - format("if (!from._internal_$name$().empty()) {\n"); - } - - format.Indent(); - - if (!inlined_) { - format( - "_this->$field$.Set(from._internal_$name$(), \n" - " _this->GetArenaForAllocation());\n"); - } else { - format( - "_this->$field$.Set(from._internal_$name$(),\n" - " _this->GetArenaForAllocation(), _this->_internal_$name$_donated(), " - "&_this->$donating_states_word$, $mask_for_undonate$, _this);\n"); - } - - format.Outdent(); - format("}\n"); -} - -void StringFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { - Formatter format(printer, variables_); - if (!inlined_) { - if (ShouldSplit(descriptor_, options_)) { - format("$cached_split_ptr$->$name$_.Destroy();\n"); - return; - } - format("$field$.Destroy();\n"); - return; - } - // Explicitly calls ~InlinedStringField as its automatic call is disabled. - // Destructor has been implicitly skipped as a union, and even the - // message-owned arena is enabled, arena could still be missing for - // Arena::CreateMessage(nullptr). - GOOGLE_DCHECK(!ShouldSplit(descriptor_, options_)); - format("$field$.~InlinedStringField();\n"); -} - -ArenaDtorNeeds StringFieldGenerator::NeedsArenaDestructor() const { - return inlined_ ? ArenaDtorNeeds::kOnDemand : ArenaDtorNeeds::kNone; -} - -void StringFieldGenerator::GenerateArenaDestructorCode( - io::Printer* printer) const { - if (!inlined_) return; - Formatter format(printer, variables_); - // _this is the object being destructed (we are inside a static method here). - format( - "if (!_this->_internal_$name$_donated()) {\n" - " _this->$field$.~InlinedStringField();\n" - "}\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::GenerateConstexprAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (inlined_) { - format("/*decltype($field$)*/{nullptr, false}"); - return; - } - if (descriptor_->default_value_string().empty()) { - format( - "/*decltype($field$)*/{&::_pbi::fixed_address_empty_string, " - "::_pbi::ConstantInitialized{}}"); - } else { - format("/*decltype($field$)*/{nullptr, ::_pbi::ConstantInitialized{}}"); - } -} - -void StringFieldGenerator::GenerateAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (ShouldSplit(descriptor_, options_)) { - GOOGLE_CHECK(!inlined_); - format("decltype(Impl_::Split::$name$_){}"); - return; - } - if (!inlined_) { - format("decltype($field$){}"); - } else { - format("decltype($field$)(arena)"); - } -} - -void StringFieldGenerator::GenerateCopyAggregateInitializer( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("decltype($field$){}"); -} - -// =================================================================== - -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$.InitDefault();\n" - " }\n" - " $field$.$setter$(" - " 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$.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$.InitDefault();\n" - " }\n" - " $field$.Set(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$.InitDefault();\n" - " }\n" - " return $field$.Mutable($lazy_variable_args$" - " 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$.Release();\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$.InitAllocated($name$, GetArenaForAllocation());\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$.Destroy();\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 $field$.InternalCheckedGet(\n" - " index, ::$proto_ns$::internal::GetEmptyStringAlreadyInited());\n" - "}\n"); - } else { - format( - "inline const std::string& $classname$::_internal_$name$(int index) " - "const {\n" - " return $field$.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 $field$.Mutable(index);\n" - "}\n" - "inline void $classname$::set_$name$(int index, const std::string& " - "value) " - "{\n" - " $field$.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" - " $field$.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$" - " $field$.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" - " $field$.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" - " $field$.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 $field$.Add();\n" - "}\n" - "inline void $classname$::add_$name$(const std::string& value) {\n" - " $field$.Add()->assign(value);\n" - "$annotate_add$" - " // @@protoc_insertion_point(field_add:$full_name$)\n" - "}\n" - "inline void $classname$::add_$name$(std::string&& value) {\n" - " $field$.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$" - " $field$.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" - " $field$.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" - " $field$.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 $field$;\n" - "}\n" - "inline ::$proto_ns$::RepeatedPtrField*\n" - "$classname$::mutable_$name$() {\n" - "$annotate_mutable_list$" - " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - " return &$field$;\n" - "}\n"); -} - -void RepeatedStringFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.Clear();\n"); -} - -void RepeatedStringFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("_this->$field$.MergeFrom(from.$field$);\n"); -} - -void RepeatedStringFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.InternalSwap(&other->$field$);\n"); -} - -void RepeatedStringFieldGenerator::GenerateDestructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$field$.~RepeatedPtrField();\n"); -} - -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($field$.size());\n" - "for (int i = 0, n = $field$.size(); i < n; i++) {\n" - " total_size += " - "::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " $field$.Get(i));\n" - "}\n"); -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/cpp/string_field.h b/depends/protobuf/src/google/protobuf/compiler/cpp/string_field.h deleted file mode 100644 index db5f18bfb..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/cpp/string_field.h +++ /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. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_STRING_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CPP_STRING_FIELD_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -class StringFieldGenerator : public FieldGenerator { - public: - StringFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~StringFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 GenerateCreateSplitMessageCode(io::Printer* printer) const override; - void GenerateCopyConstructorCode(io::Printer* printer) const override; - void GenerateDestructorCode(io::Printer* printer) const override; - void GenerateArenaDestructorCode(io::Printer* printer) const override; - void GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const override; - void GenerateByteSize(io::Printer* printer) const override; - void GenerateConstexprAggregateInitializer( - io::Printer* printer) const override; - void GenerateAggregateInitializer(io::Printer* printer) const override; - void GenerateCopyAggregateInitializer(io::Printer* printer) const override; - bool IsInlined() const override { return inlined_; } - ArenaDtorNeeds NeedsArenaDestructor() const override; - - private: - bool inlined_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); -}; - -class StringOneofFieldGenerator : public StringFieldGenerator { - public: - StringOneofFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~StringOneofFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 override; - void GenerateSwappingCode(io::Printer* printer) const override; - void GenerateConstructorCode(io::Printer* printer) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOneofFieldGenerator); -}; - -class RepeatedStringFieldGenerator : public FieldGenerator { - public: - RepeatedStringFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); - ~RepeatedStringFieldGenerator() override; - - // implements FieldGenerator --------------------------------------- - 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 { - GOOGLE_CHECK(!ShouldSplit(descriptor_, options_)); - } - void GenerateDestructorCode(io::Printer* printer) const override; - void GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const override; - void GenerateByteSize(io::Printer* printer) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedStringFieldGenerator); -}; - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CPP_STRING_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc deleted file mode 100644 index 225d6dc54..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc +++ /dev/null @@ -1,116 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -// Functions to create C# XML documentation comments. -// Currently this only includes documentation comments containing text specified as comments -// in the .proto file; documentation comments generated just from field/message/enum/proto names -// is inlined in the relevant code. If more control is required, that code can be moved here. - -void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) { - std::string comments = location.leading_comments.empty() ? - location.trailing_comments : location.leading_comments; - if (comments.empty()) { - return; - } - // XML escaping... no need for apostrophes etc as the whole text is going to be a child - // node of a summary element, not part of an attribute. - comments = StringReplace(comments, "&", "&", true); - comments = StringReplace(comments, "<", "<", true); - 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. - printer->Print("/// \n"); - bool last_was_empty = false; - // We squash multiple blank lines down to one, and remove any trailing blank lines. We need - // 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) { - 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"); -} - -template -static void WriteDocCommentBody( - io::Printer* printer, const DescriptorType* descriptor) { - SourceLocation location; - if (descriptor->GetSourceLocation(&location)) { - WriteDocCommentBodyImpl(printer, location); - } -} - -void WriteMessageDocComment(io::Printer* printer, const Descriptor* message) { - WriteDocCommentBody(printer, message); -} - -void WritePropertyDocComment(io::Printer* printer, const FieldDescriptor* field) { - WriteDocCommentBody(printer, field); -} - -void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enumDescriptor) { - WriteDocCommentBody(printer, enumDescriptor); -} -void WriteEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value) { - WriteDocCommentBody(printer, value); -} - -void WriteMethodDocComment(io::Printer* printer, const MethodDescriptor* method) { - WriteDocCommentBody(printer, method); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.h deleted file mode 100644 index 75eb0ea04..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.h +++ /dev/null @@ -1,51 +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_COMPILER_CSHARP_DOC_COMMENT_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_DOC_COMMENT_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - void WriteMessageDocComment(io::Printer* printer, const Descriptor* message); - void WritePropertyDocComment(io::Printer* printer, const FieldDescriptor* field); - void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enumDescriptor); - void WriteEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value); - void WriteMethodDocComment(io::Printer* printer, const MethodDescriptor* method); -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_DOC_COMMENT_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc deleted file mode 100644 index 73679caf3..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ /dev/null @@ -1,99 +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 -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, const Options* options) : - SourceGeneratorBase(options), - descriptor_(descriptor) { -} - -EnumGenerator::~EnumGenerator() { -} - -void EnumGenerator::Generate(io::Printer* printer) { - WriteEnumDocComment(printer, descriptor_); - printer->Print("$access_level$ enum $name$ {\n", - "access_level", class_access_level(), - "name", descriptor_->name()); - printer->Indent(); - std::set used_names; - std::set used_number; - for (int i = 0; i < descriptor_->value_count(); i++) { - WriteEnumValueDocComment(printer, descriptor_->value(i)); - 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. - GOOGLE_LOG(WARNING) << "Duplicate enum value " << name << " (originally " << original_name - << ") in " << descriptor_->name() << "; adding underscore to distinguish"; - name += "_"; - } - int number = descriptor_->value(i)->number(); - if (!used_number.insert(number).second) { - printer->Print("[pbr::OriginalName(\"$original_name$\", PreferredAlias = false)] $name$ = $number$,\n", - "original_name", original_name, - "name", name, - "number", StrCat(number)); - } else { - printer->Print("[pbr::OriginalName(\"$original_name$\")] $name$ = $number$,\n", - "original_name", original_name, - "name", name, - "number", StrCat(number)); - } - } - printer->Outdent(); - printer->Print("}\n"); - printer->Print("\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.h deleted file mode 100644 index e409c2e4b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.h +++ /dev/null @@ -1,66 +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_COMPILER_CSHARP_ENUM_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ - -#include - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class EnumGenerator : public SourceGeneratorBase { - public: - EnumGenerator(const EnumDescriptor* descriptor, const Options* options); - ~EnumGenerator(); - - EnumGenerator(const EnumGenerator&) = delete; - EnumGenerator& operator=(const EnumGenerator&) = delete; - - void Generate(io::Printer* printer); - - private: - const EnumDescriptor* descriptor_; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc deleted file mode 100644 index 55fb60c50..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc +++ /dev/null @@ -1,135 +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 -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, const Options *options) - : PrimitiveFieldGenerator(descriptor, presenceIndex, options) { -} - -EnumFieldGenerator::~EnumFieldGenerator() { -} - -void EnumFieldGenerator::GenerateParsingCode(io::Printer* printer) { - printer->Print(variables_, - "$property_name$ = ($type_name$) input.ReadEnum();\n"); -} - -void EnumFieldGenerator::GenerateSerializationCode(io::Printer* printer) { - printer->Print(variables_, - "if ($has_property_check$) {\n" - " output.WriteRawTag($tag_bytes$);\n" - " output.WriteEnum((int) $property_name$);\n" - "}\n"); -} - -void EnumFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " size += $tag_size$ + pb::CodedOutputStream.ComputeEnumSize((int) $property_name$);\n" - "}\n"); -} - -void EnumFieldGenerator::GenerateCodecCode(io::Printer* printer) { - printer->Print( - variables_, - "pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x, $default_value$)"); -} - -void EnumFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); -} - -EnumOneofFieldGenerator::EnumOneofFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : PrimitiveOneofFieldGenerator(descriptor, presenceIndex, options) { -} - -EnumOneofFieldGenerator::~EnumOneofFieldGenerator() { -} - -void EnumOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print(variables_, "$property_name$ = other.$property_name$;\n"); -} - -void EnumOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) { - // TODO(jonskeet): What about if we read the default value? - printer->Print( - variables_, - "$oneof_name$_ = input.ReadEnum();\n" - "$oneof_name$Case_ = $oneof_property_name$OneofCase.$oneof_case_name$;\n"); -} - -void EnumOneofFieldGenerator::GenerateSerializationCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " output.WriteRawTag($tag_bytes$);\n" - " output.WriteEnum((int) $property_name$);\n" - "}\n"); -} - -void EnumOneofFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " size += $tag_size$ + pb::CodedOutputStream.ComputeEnumSize((int) $property_name$);\n" - "}\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.h deleted file mode 100644 index 0c6b023b1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.h +++ /dev/null @@ -1,81 +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_COMPILER_CSHARP_ENUM_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class EnumFieldGenerator : public PrimitiveFieldGenerator { - public: - EnumFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~EnumFieldGenerator(); - - EnumFieldGenerator(const EnumFieldGenerator&) = delete; - EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete; - - 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 { - public: - EnumOneofFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~EnumOneofFieldGenerator(); - - EnumOneofFieldGenerator(const EnumOneofFieldGenerator&) = delete; - EnumOneofFieldGenerator& operator=(const EnumOneofFieldGenerator&) = delete; - - 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 -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc deleted file mode 100644 index 17847e36c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ /dev/null @@ -1,464 +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 -#include -#include - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -void FieldGeneratorBase::SetCommonFieldVariables( - 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. - int tag_size = internal::WireFormat::TagSize(descriptor_->number(), descriptor_->type()); - int part_tag_size = tag_size; - if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) { - part_tag_size /= 2; - } - uint tag = internal::WireFormat::MakeTag(descriptor_); - uint8_t tag_array[5]; - io::CodedOutputStream::WriteTagToArray(tag, tag_array); - std::string tag_bytes = StrCat(tag_array[0]); - for (int i = 1; i < part_tag_size; i++) { - tag_bytes += ", " + StrCat(tag_array[i]); - } - - (*variables)["tag"] = StrCat(tag); - (*variables)["tag_size"] = StrCat(tag_size); - (*variables)["tag_bytes"] = tag_bytes; - - if (descriptor_->type() == FieldDescriptor::Type::TYPE_GROUP) { - tag = internal::WireFormatLite::MakeTag( - descriptor_->number(), - internal::WireFormatLite::WIRETYPE_END_GROUP); - io::CodedOutputStream::WriteTagToArray(tag, tag_array); - tag_bytes = StrCat(tag_array[0]); - for (int i = 1; i < part_tag_size; i++) { - tag_bytes += ", " + StrCat(tag_array[i]); - } - - variables_["end_tag"] = StrCat(tag); - variables_["end_tag_bytes"] = tag_bytes; - } - - (*variables)["access_level"] = "public"; - - (*variables)["property_name"] = property_name(); - (*variables)["type_name"] = type_name(); - (*variables)["extended_type"] = GetClassName(descriptor_->containing_type()); - (*variables)["name"] = name(); - (*variables)["descriptor_name"] = descriptor_->name(); - (*variables)["default_value"] = default_value(); - (*variables)["capitalized_type_name"] = capitalized_type_name(); - (*variables)["number"] = number(); - if (has_default_value() && !SupportsPresenceApi(descriptor_)) { - (*variables)["name_def_message"] = - (*variables)["name"] + "_ = " + (*variables)["default_value"]; - } else { - (*variables)["name_def_message"] = (*variables)["name"] + "_"; - } - 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) { - 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; - } - } else { - (*variables)["has_property_check"] = - (*variables)["property_name"] + " != " + (*variables)["default_value"]; - (*variables)["other_has_property_check"] = "other." + - (*variables)["property_name"] + " != " + (*variables)["default_value"]; - } -} - -void FieldGeneratorBase::SetCommonOneofFieldVariables( - std::map* variables) { - (*variables)["oneof_name"] = oneof_name(); - if (SupportsPresenceApi(descriptor_)) { - (*variables)["has_property_check"] = "Has" + property_name(); - } else { - (*variables)["has_property_check"] = - oneof_name() + "Case_ == " + oneof_property_name() + - "OneofCase." + oneof_case_name(); - } - (*variables)["oneof_case_name"] = oneof_case_name(); - (*variables)["oneof_property_name"] = oneof_property_name(); -} - -FieldGeneratorBase::FieldGeneratorBase(const FieldDescriptor* descriptor, - int presenceIndex, const Options* options) - : SourceGeneratorBase(options), - descriptor_(descriptor), - presenceIndex_(presenceIndex) { - SetCommonFieldVariables(&variables_); -} - -FieldGeneratorBase::~FieldGeneratorBase() { -} - -void FieldGeneratorBase::GenerateFreezingCode(io::Printer* printer) { - // No-op: only message fields and repeated fields need - // special handling for freezing, so default to not generating any code. -} - -void FieldGeneratorBase::GenerateCodecCode(io::Printer* printer) { - // No-op: expect this to be overridden by appropriate types. - // Could fail if we get called here though... -} - -void FieldGeneratorBase::GenerateExtensionCode(io::Printer* printer) { - // No-op: only message fields, enum fields, primitives, - // 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"); - } else if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE && - descriptor_->message_type()->options().deprecated()) { - printer->Print("[global::System.ObsoleteAttribute]\n"); - } -} - -void FieldGeneratorBase::AddPublicMemberAttributes(io::Printer* printer) { - AddDeprecatedFlag(printer); - WriteGeneratedCodeAttributes(printer); -} - -std::string FieldGeneratorBase::oneof_case_name() { - return GetOneofCaseName(descriptor_); -} - -std::string FieldGeneratorBase::oneof_property_name() { - return UnderscoresToCamelCase(descriptor_->containing_oneof()->name(), true); -} - -std::string FieldGeneratorBase::oneof_name() { - return UnderscoresToCamelCase(descriptor_->containing_oneof()->name(), false); -} - -std::string FieldGeneratorBase::property_name() { - return GetPropertyName(descriptor_); -} - -std::string FieldGeneratorBase::name() { - return UnderscoresToCamelCase(GetFieldName(descriptor_), false); -} - -std::string FieldGeneratorBase::type_name() { - return type_name(descriptor_); -} - -std::string FieldGeneratorBase::type_name(const FieldDescriptor* descriptor) { - switch (descriptor->type()) { - case FieldDescriptor::TYPE_ENUM: - return GetClassName(descriptor->enum_type()); - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_GROUP: - if (IsWrapperType(descriptor)) { - const FieldDescriptor* wrapped_field = - descriptor->message_type()->field(0); - 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 || - wrapped_field->type() == FieldDescriptor::TYPE_BYTES) { - return wrapped_field_type_name; - } else { - return wrapped_field_type_name + "?"; - } - } - return GetClassName(descriptor->message_type()); - case FieldDescriptor::TYPE_DOUBLE: - return "double"; - case FieldDescriptor::TYPE_FLOAT: - return "float"; - case FieldDescriptor::TYPE_INT64: - return "long"; - case FieldDescriptor::TYPE_UINT64: - return "ulong"; - case FieldDescriptor::TYPE_INT32: - return "int"; - case FieldDescriptor::TYPE_FIXED64: - return "ulong"; - case FieldDescriptor::TYPE_FIXED32: - return "uint"; - case FieldDescriptor::TYPE_BOOL: - return "bool"; - case FieldDescriptor::TYPE_STRING: - return "string"; - case FieldDescriptor::TYPE_BYTES: - return "pb::ByteString"; - case FieldDescriptor::TYPE_UINT32: - return "uint"; - case FieldDescriptor::TYPE_SFIXED32: - return "int"; - case FieldDescriptor::TYPE_SFIXED64: - return "long"; - case FieldDescriptor::TYPE_SINT32: - return "int"; - case FieldDescriptor::TYPE_SINT64: - return "long"; - default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; - return ""; - } -} - -bool FieldGeneratorBase::has_default_value() { - switch (descriptor_->type()) { - case FieldDescriptor::TYPE_ENUM: - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_GROUP: - return true; - case FieldDescriptor::TYPE_DOUBLE: - return descriptor_->default_value_double() != 0.0; - case FieldDescriptor::TYPE_FLOAT: - return descriptor_->default_value_float() != 0.0; - case FieldDescriptor::TYPE_INT64: - return descriptor_->default_value_int64() != 0L; - case FieldDescriptor::TYPE_UINT64: - return descriptor_->default_value_uint64() != 0L; - case FieldDescriptor::TYPE_INT32: - return descriptor_->default_value_int32() != 0; - case FieldDescriptor::TYPE_FIXED64: - return descriptor_->default_value_uint64() != 0L; - case FieldDescriptor::TYPE_FIXED32: - return descriptor_->default_value_uint32() != 0; - case FieldDescriptor::TYPE_BOOL: - return descriptor_->default_value_bool(); - case FieldDescriptor::TYPE_STRING: - return true; - case FieldDescriptor::TYPE_BYTES: - return true; - case FieldDescriptor::TYPE_UINT32: - return descriptor_->default_value_uint32() != 0; - case FieldDescriptor::TYPE_SFIXED32: - return descriptor_->default_value_int32() != 0; - case FieldDescriptor::TYPE_SFIXED64: - return descriptor_->default_value_int64() != 0L; - case FieldDescriptor::TYPE_SINT32: - return descriptor_->default_value_int32() != 0; - case FieldDescriptor::TYPE_SINT64: - return descriptor_->default_value_int64() != 0L; - default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; - return true; - } -} - -bool AllPrintableAscii(const std::string& text) { - for(int i = 0; i < text.size(); i++) { - if (text[i] < 0x20 || text[i] > 0x7e) { - return false; - } - } - return true; -} - -std::string FieldGeneratorBase::GetStringDefaultValueInternal(const FieldDescriptor* descriptor) { - if (descriptor->default_value_string().empty()) - return "\"\""; - else - return "global::System.Text.Encoding.UTF8.GetString(global::System." - "Convert.FromBase64String(\"" + - StringToBase64(descriptor->default_value_string()) + "\"), 0, " + StrCat(descriptor->default_value_string().length()) + ")"; -} - -std::string FieldGeneratorBase::GetBytesDefaultValueInternal(const FieldDescriptor* descriptor) { - if (descriptor->default_value_string().empty()) - return "pb::ByteString.Empty"; - else - return "pb::ByteString.FromBase64(\"" + StringToBase64(descriptor->default_value_string()) + "\")"; -} - -std::string FieldGeneratorBase::default_value() { - return default_value(descriptor_); -} - -std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor) { - switch (descriptor->type()) { - case FieldDescriptor::TYPE_ENUM: - return GetClassName(descriptor->default_value_enum()->type()) + "." + - GetEnumValueName(descriptor->default_value_enum()->type()->name(), descriptor->default_value_enum()->name()); - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_GROUP: - if (IsWrapperType(descriptor)) { - const FieldDescriptor* wrapped_field = descriptor->message_type()->field(0); - return default_value(wrapped_field); - } else { - return "null"; - } - case FieldDescriptor::TYPE_DOUBLE: { - double value = descriptor->default_value_double(); - if (value == std::numeric_limits::infinity()) { - return "double.PositiveInfinity"; - } else if (value == -std::numeric_limits::infinity()) { - return "double.NegativeInfinity"; - } else if (std::isnan(value)) { - return "double.NaN"; - } - return StrCat(value) + "D"; - } - case FieldDescriptor::TYPE_FLOAT: { - float value = descriptor->default_value_float(); - if (value == std::numeric_limits::infinity()) { - return "float.PositiveInfinity"; - } else if (value == -std::numeric_limits::infinity()) { - return "float.NegativeInfinity"; - } else if (std::isnan(value)) { - return "float.NaN"; - } - return StrCat(value) + "F"; - } - case FieldDescriptor::TYPE_INT64: - return StrCat(descriptor->default_value_int64()) + "L"; - case FieldDescriptor::TYPE_UINT64: - return StrCat(descriptor->default_value_uint64()) + "UL"; - case FieldDescriptor::TYPE_INT32: - return StrCat(descriptor->default_value_int32()); - case FieldDescriptor::TYPE_FIXED64: - return StrCat(descriptor->default_value_uint64()) + "UL"; - case FieldDescriptor::TYPE_FIXED32: - return StrCat(descriptor->default_value_uint32()); - case FieldDescriptor::TYPE_BOOL: - if (descriptor->default_value_bool()) { - return "true"; - } else { - return "false"; - } - case FieldDescriptor::TYPE_STRING: - return GetStringDefaultValueInternal(descriptor); - case FieldDescriptor::TYPE_BYTES: - return GetBytesDefaultValueInternal(descriptor); - case FieldDescriptor::TYPE_UINT32: - return StrCat(descriptor->default_value_uint32()); - case FieldDescriptor::TYPE_SFIXED32: - return StrCat(descriptor->default_value_int32()); - case FieldDescriptor::TYPE_SFIXED64: - return StrCat(descriptor->default_value_int64()) + "L"; - case FieldDescriptor::TYPE_SINT32: - return StrCat(descriptor->default_value_int32()); - case FieldDescriptor::TYPE_SINT64: - return StrCat(descriptor->default_value_int64()) + "L"; - default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; - return ""; - } -} - -std::string FieldGeneratorBase::number() { - return StrCat(descriptor_->number()); -} - -std::string FieldGeneratorBase::capitalized_type_name() { - switch (descriptor_->type()) { - case FieldDescriptor::TYPE_ENUM: - return "Enum"; - case FieldDescriptor::TYPE_MESSAGE: - return "Message"; - case FieldDescriptor::TYPE_GROUP: - return "Group"; - case FieldDescriptor::TYPE_DOUBLE: - return "Double"; - case FieldDescriptor::TYPE_FLOAT: - return "Float"; - case FieldDescriptor::TYPE_INT64: - return "Int64"; - case FieldDescriptor::TYPE_UINT64: - return "UInt64"; - case FieldDescriptor::TYPE_INT32: - return "Int32"; - case FieldDescriptor::TYPE_FIXED64: - return "Fixed64"; - case FieldDescriptor::TYPE_FIXED32: - return "Fixed32"; - case FieldDescriptor::TYPE_BOOL: - return "Bool"; - case FieldDescriptor::TYPE_STRING: - return "String"; - case FieldDescriptor::TYPE_BYTES: - return "Bytes"; - case FieldDescriptor::TYPE_UINT32: - return "UInt32"; - case FieldDescriptor::TYPE_SFIXED32: - return "SFixed32"; - case FieldDescriptor::TYPE_SFIXED64: - return "SFixed64"; - case FieldDescriptor::TYPE_SINT32: - return "SInt32"; - case FieldDescriptor::TYPE_SINT64: - return "SInt64"; - default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; - return ""; - } -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.h deleted file mode 100644 index c7b7469b9..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.h +++ /dev/null @@ -1,112 +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_COMPILER_CSHARP_FIELD_BASE_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ - -#include -#include - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class FieldGeneratorBase : public SourceGeneratorBase { - public: - FieldGeneratorBase(const FieldDescriptor* descriptor, - int presenceIndex, - const Options* options); - ~FieldGeneratorBase(); - - FieldGeneratorBase(const FieldGeneratorBase&) = delete; - FieldGeneratorBase& operator=(const FieldGeneratorBase&) = delete; - - virtual void GenerateCloningCode(io::Printer* printer) = 0; - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); - 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; - virtual void WriteEquals(io::Printer* printer) = 0; - // Currently unused, as we use reflection to generate JSON - virtual void WriteToString(io::Printer* printer) = 0; - - protected: - const FieldDescriptor* descriptor_; - const int presenceIndex_; - 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); - - std::string oneof_property_name(); - std::string oneof_case_name(); - std::string oneof_name(); - std::string property_name(); - std::string name(); - std::string type_name(); - std::string type_name(const FieldDescriptor* descriptor); - bool has_default_value(); - std::string default_value(); - std::string default_value(const FieldDescriptor* descriptor); - std::string number(); - std::string capitalized_type_name(); - - private: - void SetCommonFieldVariables(std::map* variables); - std::string GetStringDefaultValueInternal(const FieldDescriptor* descriptor); - std::string GetBytesDefaultValueInternal(const FieldDescriptor* descriptor); -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc deleted file mode 100644 index 5ce065173..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc +++ /dev/null @@ -1,112 +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 -#include -#include -#include - -namespace google { -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 std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const { - std::vector > options; - ParseGeneratorParameter(parameter, &options); - - struct Options cli_options; - - for (int i = 0; i < options.size(); i++) { - if (options[i].first == "file_extension") { - cli_options.file_extension = options[i].second; - } else if (options[i].first == "base_namespace") { - cli_options.base_namespace = options[i].second; - cli_options.base_namespace_specified = true; - } else if (options[i].first == "internal_access") { - cli_options.internal_access = true; - } else if (options[i].first == "serializable") { - cli_options.serializable = true; - } else { - *error = "Unknown generator option: " + options[i].first; - return false; - } - } - - std::string filename_error = ""; - std::string filename = GetOutputFile(file, - cli_options.file_extension, - cli_options.base_namespace_specified, - cli_options.base_namespace, - &filename_error); - - if (filename.empty()) { - *error = filename_error; - return false; - } - std::unique_ptr output( - generator_context->Open(filename)); - io::Printer printer(output.get(), '$'); - - GenerateFile(file, &printer, &cli_options); - - return true; -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc deleted file mode 100644 index 73ca86805..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ /dev/null @@ -1,599 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -CSharpType GetCSharpType(FieldDescriptor::Type type) { - switch (type) { - case FieldDescriptor::TYPE_INT32: - return CSHARPTYPE_INT32; - case FieldDescriptor::TYPE_INT64: - return CSHARPTYPE_INT64; - case FieldDescriptor::TYPE_UINT32: - return CSHARPTYPE_UINT32; - case FieldDescriptor::TYPE_UINT64: - return CSHARPTYPE_UINT32; - case FieldDescriptor::TYPE_SINT32: - return CSHARPTYPE_INT32; - case FieldDescriptor::TYPE_SINT64: - return CSHARPTYPE_INT64; - case FieldDescriptor::TYPE_FIXED32: - return CSHARPTYPE_UINT32; - case FieldDescriptor::TYPE_FIXED64: - return CSHARPTYPE_UINT64; - case FieldDescriptor::TYPE_SFIXED32: - return CSHARPTYPE_INT32; - case FieldDescriptor::TYPE_SFIXED64: - return CSHARPTYPE_INT64; - case FieldDescriptor::TYPE_FLOAT: - return CSHARPTYPE_FLOAT; - case FieldDescriptor::TYPE_DOUBLE: - return CSHARPTYPE_DOUBLE; - case FieldDescriptor::TYPE_BOOL: - return CSHARPTYPE_BOOL; - case FieldDescriptor::TYPE_ENUM: - return CSHARPTYPE_ENUM; - case FieldDescriptor::TYPE_STRING: - return CSHARPTYPE_STRING; - case FieldDescriptor::TYPE_BYTES: - return CSHARPTYPE_BYTESTRING; - case FieldDescriptor::TYPE_GROUP: - return CSHARPTYPE_MESSAGE; - case FieldDescriptor::TYPE_MESSAGE: - return CSHARPTYPE_MESSAGE; - - // No default because we want the compiler to complain if any new - // types are added. - } - GOOGLE_LOG(FATAL)<< "Can't get here."; - return (CSharpType) -1; -} - -std::string StripDotProto(const std::string& proto_file) { - int lastindex = proto_file.find_last_of("."); - return proto_file.substr(0, lastindex); -} - -std::string GetFileNamespace(const FileDescriptor* descriptor) { - if (descriptor->options().has_csharp_namespace()) { - return descriptor->options().csharp_namespace(); - } - return UnderscoresToCamelCase(descriptor->package(), true, true); -} - -// Returns the Pascal-cased last part of the proto file. For example, -// input of "google/protobuf/foo_bar.proto" would result in "FooBar". -std::string GetFileNameBase(const FileDescriptor* descriptor) { - std::string proto_file = descriptor->name(); - int lastslash = proto_file.find_last_of("/"); - std::string base = proto_file.substr(lastslash + 1); - return UnderscoresToPascalCase(StripDotProto(base)); -} - -std::string GetReflectionClassUnqualifiedName(const FileDescriptor* descriptor) { - // TODO: Detect collisions with existing messages, - // and append an underscore if necessary. - return GetFileNameBase(descriptor) + "Reflection"; -} - -std::string GetExtensionClassUnqualifiedName(const FileDescriptor* descriptor) { - // TODO: Detect collisions with existing messages, - // and append an underscore if necessary. - return GetFileNameBase(descriptor) + "Extensions"; -} - -// TODO(jtattermusch): can we reuse a utility function? -std::string UnderscoresToCamelCase(const std::string& input, - bool cap_next_letter, - bool preserve_period) { - 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') { - if (cap_next_letter) { - result += input[i] + ('A' - 'a'); - } else { - result += input[i]; - } - cap_next_letter = false; - } else if ('A' <= input[i] && input[i] <= 'Z') { - if (i == 0 && !cap_next_letter) { - // Force first letter to lower-case unless explicitly told to - // capitalize it. - result += input[i] + ('a' - 'A'); - } else { - // Capital letters after the first are left as-is. - result += input[i]; - } - cap_next_letter = false; - } else if ('0' <= input[i] && input[i] <= '9') { - result += input[i]; - cap_next_letter = true; - } else { - cap_next_letter = true; - if (input[i] == '.' && preserve_period) { - result += '.'; - } - } - } - // Add a trailing "_" if the name should be altered. - if (input.size() > 0 && input[input.size() - 1] == '#') { - result += '_'; - } - return result; -} - -std::string UnderscoresToPascalCase(const std::string& input) { - return UnderscoresToCamelCase(input, true); -} - -// Convert a string which is expected to be SHOUTY_CASE (but may not be *precisely* shouty) -// into a PascalCase string. Precise rules implemented: - -// Previous input character Current character Case -// Any Non-alphanumeric Skipped -// None - first char of input Alphanumeric Upper -// Non-letter (e.g. _ or 1) Alphanumeric Upper -// Numeric Alphanumeric Upper -// Lower letter Alphanumeric Same as current -// Upper letter Alphanumeric Lower -std::string ShoutyToPascalCase(const std::string& input) { - std::string result; - // Simple way of implementing "always start with upper" - char previous = '_'; - for (int i = 0; i < input.size(); i++) { - char current = input[i]; - if (!ascii_isalnum(current)) { - previous = current; - continue; - } - if (!ascii_isalnum(previous)) { - result += ascii_toupper(current); - } else if (ascii_isdigit(previous)) { - result += ascii_toupper(current); - } else if (ascii_islower(previous)) { - result += current; - } else { - result += ascii_tolower(current); - } - previous = current; - } - return result; -} - -// Attempt to remove a prefix from a value, ignoring casing and skipping underscores. -// (foo, foo_bar) => bar - underscore after prefix is skipped -// (FOO, foo_bar) => bar - casing is ignored -// (foo_bar, foobarbaz) => baz - underscore in prefix is ignored -// (foobar, foo_barbaz) => baz - underscore in value is ignored -// (foo, bar) => bar - prefix isn't matched; return original value -std::string TryRemovePrefix(const std::string& prefix, const std::string& value) { - // First normalize to a lower-case no-underscores prefix to match against - std::string prefix_to_match = ""; - for (size_t i = 0; i < prefix.size(); i++) { - if (prefix[i] != '_') { - prefix_to_match += ascii_tolower(prefix[i]); - } - } - - // This keeps track of how much of value we've consumed - size_t prefix_index, value_index; - for (prefix_index = 0, value_index = 0; - prefix_index < prefix_to_match.size() && value_index < value.size(); - value_index++) { - // Skip over underscores in the value - if (value[value_index] == '_') { - continue; - } - if (ascii_tolower(value[value_index]) != prefix_to_match[prefix_index++]) { - // Failed to match the prefix - bail out early. - return value; - } - } - - // If we didn't finish looking through the prefix, we can't strip it. - if (prefix_index < prefix_to_match.size()) { - return value; - } - - // Step over any underscores after the prefix - while (value_index < value.size() && value[value_index] == '_') { - value_index++; - } - - // If there's nothing left (e.g. it was a prefix with only underscores afterwards), don't strip. - if (value_index == value.size()) { - return value; - } - - return value.substr(value_index); -} - -// Format the enum value name in a pleasant way for C#: -// - Strip the enum name as a prefix if possible -// - Convert to PascalCase. -// For example, an enum called Color with a value of COLOR_BLUE should -// result in an enum value in C# called just Blue -std::string GetEnumValueName(const std::string& enum_name, const std::string& enum_value_name) { - std::string stripped = TryRemovePrefix(enum_name, enum_value_name); - std::string result = ShoutyToPascalCase(stripped); - // Just in case we have an enum name of FOO and a value of FOO_2... make sure the returned - // string is a valid identifier. - if (ascii_isdigit(result[0])) { - result = "_" + result; - } - return result; -} - -uint GetGroupEndTag(const Descriptor* descriptor) { - const Descriptor* containing_type = descriptor->containing_type(); - if (containing_type != NULL) { - const FieldDescriptor* field; - for (int i = 0; i < containing_type->field_count(); i++) { - field = containing_type->field(i); - if (field->type() == FieldDescriptor::Type::TYPE_GROUP && - field->message_type() == descriptor) { - return internal::WireFormatLite::MakeTag( - field->number(), internal::WireFormatLite::WIRETYPE_END_GROUP); - } - } - for (int i = 0; i < containing_type->extension_count(); i++) { - field = containing_type->extension(i); - if (field->type() == FieldDescriptor::Type::TYPE_GROUP && - field->message_type() == descriptor) { - return internal::WireFormatLite::MakeTag( - field->number(), internal::WireFormatLite::WIRETYPE_END_GROUP); - } - } - } else { - const FileDescriptor* containing_file = descriptor->file(); - if (containing_file != NULL) { - const FieldDescriptor* field; - for (int i = 0; i < containing_file->extension_count(); i++) { - field = containing_file->extension(i); - if (field->type() == FieldDescriptor::Type::TYPE_GROUP && - field->message_type() == descriptor) { - return internal::WireFormatLite::MakeTag( - field->number(), internal::WireFormatLite::WIRETYPE_END_GROUP); - } - } - } - } - - return 0; -} - -std::string ToCSharpName(const std::string& name, const FileDescriptor* file) { - std::string result = GetFileNamespace(file); - if (!result.empty()) { - result += '.'; - } - std::string classname; - if (file->package().empty()) { - classname = name; - } else { - // Strip the proto package from full_name since we've replaced it with - // the C# namespace. - classname = name.substr(file->package().size() + 1); - } - result += StringReplace(classname, ".", ".Types.", true); - return "global::" + result; -} - -std::string GetReflectionClassName(const FileDescriptor* descriptor) { - std::string result = GetFileNamespace(descriptor); - if (!result.empty()) { - result += '.'; - } - result += GetReflectionClassUnqualifiedName(descriptor); - return "global::" + result; -} - -std::string GetFullExtensionName(const FieldDescriptor* descriptor) { - if (descriptor->extension_scope()) { - return GetClassName(descriptor->extension_scope()) + ".Extensions." + GetPropertyName(descriptor); - } - else { - return GetExtensionClassUnqualifiedName(descriptor->file()) + "." + GetPropertyName(descriptor); - } -} - -std::string GetClassName(const Descriptor* descriptor) { - return ToCSharpName(descriptor->full_name(), descriptor->file()); -} - -std::string GetClassName(const EnumDescriptor* descriptor) { - return ToCSharpName(descriptor->full_name(), descriptor->file()); -} - -// Groups are hacky: The name of the field is just the lower-cased name -// of the group type. In C#, though, we would like to retain the original -// capitalization of the type name. -std::string GetFieldName(const FieldDescriptor* descriptor) { - if (descriptor->type() == FieldDescriptor::TYPE_GROUP) { - return descriptor->message_type()->name(); - } else { - return descriptor->name(); - } -} - -std::string GetFieldConstantName(const FieldDescriptor* field) { - return GetPropertyName(field) + "FieldNumber"; -} - -std::string GetPropertyName(const FieldDescriptor* descriptor) { - // TODO(jtattermusch): consider introducing csharp_property_name field option - std::string property_name = UnderscoresToPascalCase(GetFieldName(descriptor)); - // Avoid either our own type name or reserved names. Note that not all names - // are reserved - a field called to_string, write_to etc would still cause a problem. - // There are various ways of ending up with naming collisions, but we try to avoid obvious - // ones. - if (property_name == descriptor->containing_type()->name() - || property_name == "Types" - || property_name == "Descriptor") { - property_name += "_"; - } - return property_name; -} - -std::string GetOneofCaseName(const FieldDescriptor* descriptor) { - // The name in a oneof case enum is the same as for the property, but as we always have a "None" - // value as well, we need to reserve that by appending an underscore. - std::string property_name = GetPropertyName(descriptor); - return property_name == "None" ? "None_" : property_name; -} - -std::string GetOutputFile(const FileDescriptor* descriptor, - const std::string file_extension, - const bool generate_directories, - const std::string base_namespace, - std::string* error) { - std::string relative_filename = GetFileNameBase(descriptor) + file_extension; - if (!generate_directories) { - return relative_filename; - } - 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. - 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. - } - namespace_suffix = ns.substr(base_namespace.length()); - if (namespace_suffix.find(".") == 0) { - namespace_suffix = namespace_suffix.substr(1); - } - } - - std::string namespace_dir = StringReplace(namespace_suffix, ".", "/", true); - if (!namespace_dir.empty()) { - namespace_dir += "/"; - } - return namespace_dir + relative_filename; -} - -// TODO: c&p from Java protoc plugin -// For encodings with fixed sizes, returns that size in bytes. Otherwise -// returns -1. -int GetFixedSize(FieldDescriptor::Type type) { - switch (type) { - case FieldDescriptor::TYPE_INT32 : return -1; - case FieldDescriptor::TYPE_INT64 : return -1; - case FieldDescriptor::TYPE_UINT32 : return -1; - case FieldDescriptor::TYPE_UINT64 : return -1; - case FieldDescriptor::TYPE_SINT32 : return -1; - case FieldDescriptor::TYPE_SINT64 : return -1; - case FieldDescriptor::TYPE_FIXED32 : return internal::WireFormatLite::kFixed32Size; - case FieldDescriptor::TYPE_FIXED64 : return internal::WireFormatLite::kFixed64Size; - case FieldDescriptor::TYPE_SFIXED32: return internal::WireFormatLite::kSFixed32Size; - case FieldDescriptor::TYPE_SFIXED64: return internal::WireFormatLite::kSFixed64Size; - case FieldDescriptor::TYPE_FLOAT : return internal::WireFormatLite::kFloatSize; - case FieldDescriptor::TYPE_DOUBLE : return internal::WireFormatLite::kDoubleSize; - - case FieldDescriptor::TYPE_BOOL : return internal::WireFormatLite::kBoolSize; - case FieldDescriptor::TYPE_ENUM : return -1; - - case FieldDescriptor::TYPE_STRING : return -1; - case FieldDescriptor::TYPE_BYTES : return -1; - case FieldDescriptor::TYPE_GROUP : return -1; - case FieldDescriptor::TYPE_MESSAGE : return -1; - - // No default because we want the compiler to complain if any new - // types are added. - } - GOOGLE_LOG(FATAL) << "Can't get here."; - return -1; -} - -static const char base64_chars[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -std::string StringToBase64(const std::string& input) { - std::string result; - size_t remaining = input.size(); - const unsigned char *src = (const unsigned char*) input.c_str(); - while (remaining > 2) { - result += base64_chars[src[0] >> 2]; - result += base64_chars[((src[0] & 0x3) << 4) | (src[1] >> 4)]; - result += base64_chars[((src[1] & 0xf) << 2) | (src[2] >> 6)]; - result += base64_chars[src[2] & 0x3f]; - remaining -= 3; - src += 3; - } - switch (remaining) { - case 2: - result += base64_chars[src[0] >> 2]; - result += base64_chars[((src[0] & 0x3) << 4) | (src[1] >> 4)]; - result += base64_chars[(src[1] & 0xf) << 2]; - result += '='; - src += 2; - break; - case 1: - result += base64_chars[src[0] >> 2]; - result += base64_chars[((src[0] & 0x3) << 4)]; - result += '='; - result += '='; - src += 1; - break; - } - return result; -} - -std::string FileDescriptorToBase64(const FileDescriptor* descriptor) { - std::string fdp_bytes; - FileDescriptorProto fdp; - descriptor->CopyTo(&fdp); - fdp.SerializeToString(&fdp_bytes); - return StringToBase64(fdp_bytes); -} - -FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options* options) { - switch (descriptor->type()) { - case FieldDescriptor::TYPE_GROUP: - case FieldDescriptor::TYPE_MESSAGE: - if (descriptor->is_repeated()) { - if (descriptor->is_map()) { - return new MapFieldGenerator(descriptor, presenceIndex, options); - } else { - return new RepeatedMessageFieldGenerator(descriptor, presenceIndex, options); - } - } else { - if (IsWrapperType(descriptor)) { - if (descriptor->real_containing_oneof()) { - return new WrapperOneofFieldGenerator(descriptor, presenceIndex, options); - } else { - return new WrapperFieldGenerator(descriptor, presenceIndex, options); - } - } else { - if (descriptor->real_containing_oneof()) { - return new MessageOneofFieldGenerator(descriptor, presenceIndex, options); - } else { - return new MessageFieldGenerator(descriptor, presenceIndex, options); - } - } - } - case FieldDescriptor::TYPE_ENUM: - if (descriptor->is_repeated()) { - return new RepeatedEnumFieldGenerator(descriptor, presenceIndex, options); - } else { - if (descriptor->real_containing_oneof()) { - return new EnumOneofFieldGenerator(descriptor, presenceIndex, options); - } else { - return new EnumFieldGenerator(descriptor, presenceIndex, options); - } - } - default: - if (descriptor->is_repeated()) { - return new RepeatedPrimitiveFieldGenerator(descriptor, presenceIndex, options); - } else { - if (descriptor->real_containing_oneof()) { - return new PrimitiveOneofFieldGenerator(descriptor, presenceIndex, options); - } else { - return new PrimitiveFieldGenerator(descriptor, presenceIndex, options); - } - } - } -} - -bool IsNullable(const FieldDescriptor* descriptor) { - if (descriptor->is_repeated()) { - return true; - } - - switch (descriptor->type()) { - case FieldDescriptor::TYPE_ENUM: - case FieldDescriptor::TYPE_DOUBLE: - case FieldDescriptor::TYPE_FLOAT: - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_BOOL: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_SFIXED64: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_SINT64: - return false; - - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_GROUP: - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: - return true; - - default: - GOOGLE_LOG(FATAL) << "Unknown field type."; - return true; - } -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.h deleted file mode 100644 index 836bd5de5..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.h +++ /dev/null @@ -1,198 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ - -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -struct Options; -class FieldGeneratorBase; - -// TODO: start using this enum. -enum CSharpType { - CSHARPTYPE_INT32 = 1, - CSHARPTYPE_INT64 = 2, - CSHARPTYPE_UINT32 = 3, - CSHARPTYPE_UINT64 = 4, - CSHARPTYPE_FLOAT = 5, - CSHARPTYPE_DOUBLE = 6, - CSHARPTYPE_BOOL = 7, - CSHARPTYPE_STRING = 8, - CSHARPTYPE_BYTESTRING = 9, - CSHARPTYPE_MESSAGE = 10, - CSHARPTYPE_ENUM = 11, - MAX_CSHARPTYPE = 11 -}; - -// Converts field type to corresponding C# type. -CSharpType GetCSharpType(FieldDescriptor::Type type); - -std::string StripDotProto(const std::string& proto_file); - -// Gets unqualified name of the reflection class -std::string GetReflectionClassUnqualifiedName(const FileDescriptor* descriptor); -// Gets unqualified name of the extension class -std::string GetExtensionClassUnqualifiedName(const FileDescriptor* descriptor); - -std::string GetClassName(const EnumDescriptor* descriptor); - -std::string GetFieldName(const FieldDescriptor* descriptor); - -std::string GetFieldConstantName(const FieldDescriptor* field); - -std::string GetPropertyName(const FieldDescriptor* descriptor); - -std::string GetOneofCaseName(const FieldDescriptor* descriptor); - -int GetFixedSize(FieldDescriptor::Type type); - -std::string UnderscoresToCamelCase(const std::string& input, - bool cap_next_letter, - bool preserve_period); - -inline std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter) { - return UnderscoresToCamelCase(input, cap_next_letter, false); -} - -std::string UnderscoresToPascalCase(const std::string& input); - -// Note that we wouldn't normally want to export this (we're not expecting -// it to be used outside libprotoc itself) but this exposes it for testing. -std::string PROTOC_EXPORT GetEnumValueName(const std::string& enum_name, - const std::string& enum_value_name); - -// TODO(jtattermusch): perhaps we could move this to strutil -std::string StringToBase64(const std::string& input); - -std::string FileDescriptorToBase64(const FileDescriptor* descriptor); - -FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options* options); - -std::string GetFullExtensionName(const FieldDescriptor* descriptor); - -bool IsNullable(const FieldDescriptor* descriptor); - -// Determines whether the given message is a map entry message, -// i.e. one implicitly created by protoc due to a map field. -inline bool IsMapEntryMessage(const Descriptor* descriptor) { - return descriptor->options().map_entry(); -} - -// Checks if this descriptor is for a group and gets its end tag or 0 if it's not a group -uint GetGroupEndTag(const Descriptor* descriptor); - -// Determines whether we're generating code for the proto representation of -// descriptors etc, for use in the runtime. This is the only type which is -// allowed to use proto2 syntax, and it generates internal classes. -inline bool IsDescriptorProto(const FileDescriptor* descriptor) { - return descriptor->name() == "google/protobuf/descriptor.proto" || - descriptor->name() == "net/proto2/proto/descriptor.proto"; -} - -// Determines whether the given message is an options message within descriptor.proto. -inline bool IsDescriptorOptionMessage(const Descriptor* descriptor) { - if (!IsDescriptorProto(descriptor->file())) { - return false; - } - const std::string name = descriptor->name(); - return name == "FileOptions" || - name == "MessageOptions" || - name == "FieldOptions" || - name == "OneofOptions" || - name == "EnumOptions" || - name == "EnumValueOptions" || - name == "ServiceOptions" || - name == "MethodOptions"; -} - -inline bool IsWrapperType(const FieldDescriptor* descriptor) { - return descriptor->type() == FieldDescriptor::TYPE_MESSAGE && - descriptor->message_type()->file()->name() == "google/protobuf/wrappers.proto"; -} - -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 -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc deleted file mode 100644 index a13b995da..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc +++ /dev/null @@ -1,152 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options* options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { -} - -MapFieldGenerator::~MapFieldGenerator() { -} - -void MapFieldGenerator::GenerateMembers(io::Printer* printer) { - const FieldDescriptor* key_descriptor = - descriptor_->message_type()->map_key(); - const FieldDescriptor* value_descriptor = - descriptor_->message_type()->map_value(); - variables_["key_type_name"] = type_name(key_descriptor); - variables_["value_type_name"] = type_name(value_descriptor); - std::unique_ptr key_generator( - CreateFieldGenerator(key_descriptor, 1, this->options())); - std::unique_ptr value_generator( - CreateFieldGenerator(value_descriptor, 2, this->options())); - - printer->Print( - variables_, - "private static readonly pbc::MapField<$key_type_name$, $value_type_name$>.Codec _map_$name$_codec\n" - " = new pbc::MapField<$key_type_name$, $value_type_name$>.Codec("); - key_generator->GenerateCodecCode(printer); - printer->Print(", "); - value_generator->GenerateCodecCode(printer); - printer->Print( - variables_, - ", $tag$);\n" - "private readonly pbc::MapField<$key_type_name$, $value_type_name$> $name$_ = new pbc::MapField<$key_type_name$, $value_type_name$>();\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ pbc::MapField<$key_type_name$, $value_type_name$> $property_name$ {\n" - " get { return $name$_; }\n" - "}\n"); -} - -void MapFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "$name$_.Add(other.$name$_);\n"); -} - -void MapFieldGenerator::GenerateParsingCode(io::Printer* printer) { - GenerateParsingCode(printer, true); -} - -void MapFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { - printer->Print( - variables_, - 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_, - use_write_context - ? "$name$_.WriteTo(ref output, _map_$name$_codec);\n" - : "$name$_.WriteTo(output, _map_$name$_codec);\n"); -} - -void MapFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "size += $name$_.CalculateSize(_map_$name$_codec);\n"); -} - -void MapFieldGenerator::WriteHash(io::Printer* printer) { - printer->Print( - variables_, - "hash ^= $property_name$.GetHashCode();\n"); -} -void MapFieldGenerator::WriteEquals(io::Printer* printer) { - printer->Print( - variables_, - "if (!$property_name$.Equals(other.$property_name$)) return false;\n"); -} - -void MapFieldGenerator::WriteToString(io::Printer* printer) { - // TODO: If we ever actually use ToString, we'll need to impleme this... -} - -void MapFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$name$_ = other.$name$_.Clone();\n"); -} - -void MapFieldGenerator::GenerateFreezingCode(io::Printer* printer) { -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.h deleted file mode 100644 index 23b361991..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.h +++ /dev/null @@ -1,73 +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_COMPILER_CSHARP_MAP_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class MapFieldGenerator : public FieldGeneratorBase { - public: - MapFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options* options); - ~MapFieldGenerator(); - - MapFieldGenerator(const MapFieldGenerator&) = delete; - MapFieldGenerator& operator=(const MapFieldGenerator&) = delete; - - 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) override; - virtual void WriteEquals(io::Printer* printer) override; - virtual void WriteToString(io::Printer* printer) override; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc deleted file mode 100644 index a119bddee..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc +++ /dev/null @@ -1,779 +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 -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -bool CompareFieldNumbers(const FieldDescriptor* d1, const FieldDescriptor* d2) { - return d1->number() < d2->number(); -} - -MessageGenerator::MessageGenerator(const Descriptor* descriptor, - const Options* options) - : SourceGeneratorBase(options), - descriptor_(descriptor), - has_bit_field_count_(0), - end_tag_(GetGroupEndTag(descriptor)), - has_extension_ranges_(descriptor->extension_range_count() > 0) { - // fields by number - for (int i = 0; i < descriptor_->field_count(); i++) { - fields_by_number_.push_back(descriptor_->field(i)); - } - std::sort(fields_by_number_.begin(), fields_by_number_.end(), - CompareFieldNumbers); - - 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_++; - } - } - } -} - -MessageGenerator::~MessageGenerator() { -} - -std::string MessageGenerator::class_name() { - return descriptor_->name(); -} - -std::string MessageGenerator::full_class_name() { - return GetClassName(descriptor_); -} - -const std::vector& MessageGenerator::fields_by_number() { - return fields_by_number_; -} - -void MessageGenerator::AddDeprecatedFlag(io::Printer* printer) { - if (descriptor_->options().deprecated()) { - printer->Print("[global::System.ObsoleteAttribute]\n"); - } -} - -void MessageGenerator::AddSerializableAttribute(io::Printer* printer) { - if (this->options()->serializable) { - printer->Print("[global::System.SerializableAttribute]\n"); - } -} - -void MessageGenerator::Generate(io::Printer* printer) { - std::map vars; - vars["class_name"] = class_name(); - vars["access_level"] = class_access_level(); - - WriteMessageDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - AddSerializableAttribute(printer); - - printer->Print( - vars, - "$access_level$ sealed partial class $class_name$ : "); - - if (has_extension_ranges_) { - printer->Print(vars, "pb::IExtendableMessage<$class_name$>\n"); - } - else { - printer->Print(vars, "pb::IMessage<$class_name$>\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 - printer->Print( - vars, - "private static readonly pb::MessageParser<$class_name$> _parser = new pb::MessageParser<$class_name$>(() => new $class_name$());\n"); - - printer->Print( - "private pb::UnknownFieldSet _unknownFields;\n"); - - if (has_extension_ranges_) { - if (IsDescriptorProto(descriptor_->file())) { - printer->Print(vars, "internal pb::ExtensionSet<$class_name$> _extensions;\n"); // CustomOptions compatibility - } else { - printer->Print(vars, "private pb::ExtensionSet<$class_name$> _extensions;\n"); - } - - // a read-only property for fast - // retrieval of the set in IsInitialized - printer->Print(vars, - "private pb::ExtensionSet<$class_name$> _Extensions { get { " - "return _extensions; } }\n"); - } - - for (int i = 0; i < has_bit_field_count_; i++) { - // don't use arrays since all arrays are heap allocated, saving allocations - // use ints instead of bytes since bytes lack bitwise operators, saving casts - printer->Print("private int _hasBits$i$;\n", "i", StrCat(i)); - } - - WriteGeneratedCodeAttributes(printer); - - printer->Print( - vars, - "public static pb::MessageParser<$class_name$> Parser { get { return _parser; } }\n\n"); - - // Access the message descriptor via the relevant file descriptor or containing message descriptor. - if (!descriptor_->containing_type()) { - vars["descriptor_accessor"] = GetReflectionClassName(descriptor_->file()) - + ".Descriptor.MessageTypes[" + StrCat(descriptor_->index()) + "]"; - } else { - vars["descriptor_accessor"] = GetClassName(descriptor_->containing_type()) - + ".Descriptor.NestedTypes[" + StrCat(descriptor_->index()) + "]"; - } - - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public static pbr::MessageDescriptor Descriptor {\n" - " get { return $descriptor_accessor$; }\n" - "}\n" - "\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "pbr::MessageDescriptor pb::IMessage.Descriptor {\n" - " get { return Descriptor; }\n" - "}\n" - "\n"); - - // Parameterless constructor and partial OnConstruction method. - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public $class_name$() {\n" - " OnConstruction();\n" - "}\n\n" - "partial void OnConstruction();\n\n"); - - GenerateCloningCode(printer); - GenerateFreezingCode(printer); - - // Fields/properties - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* fieldDescriptor = descriptor_->field(i); - - // Rats: we lose the debug comment here :( - printer->Print( - "/// Field number for the \"$field_name$\" field.\n" - "public const int $field_constant_name$ = $index$;\n", - "field_name", fieldDescriptor->name(), - "field_constant_name", GetFieldConstantName(fieldDescriptor), - "index", StrCat(fieldDescriptor->number())); - std::unique_ptr generator( - CreateFieldGeneratorInternal(fieldDescriptor)); - generator->GenerateMembers(printer); - printer->Print("\n"); - } - - // 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" - "/// Enum of possible cases for the \"$original_name$\" oneof.\n" - "public enum $property_name$OneofCase {\n"); - printer->Indent(); - printer->Print("None = 0,\n"); - for (int j = 0; j < oneof->field_count(); j++) { - const FieldDescriptor* field = oneof->field(j); - printer->Print("$oneof_case_name$ = $index$,\n", - "oneof_case_name", GetOneofCaseName(field), - "index", StrCat(field->number())); - } - printer->Outdent(); - printer->Print("}\n"); - // TODO: Should we put the oneof .proto comments here? - // It's unclear exactly where they should go. - printer->Print( - vars, - "private $property_name$OneofCase $name$Case_ = $property_name$OneofCase.None;\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public $property_name$OneofCase $property_name$Case {\n" - " get { return $name$Case_; }\n" - "}\n\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public void Clear$property_name$() {\n" - " $name$Case_ = $property_name$OneofCase.None;\n" - " $name$_ = null;\n" - "}\n\n"); - } - - // Standard methods - GenerateFrameworkMethods(printer); - GenerateMessageSerializationMethods(printer); - GenerateMergingMethods(printer); - - if (has_extension_ranges_) { - printer->Print( - vars, - "public TValue GetExtension(pb::Extension<$class_name$, " - "TValue> extension) {\n" - " return pb::ExtensionSet.Get(ref _extensions, extension);\n" - "}\n" - "public pbc::RepeatedField " - "GetExtension(pb::RepeatedExtension<$class_name$, TValue> " - "extension) {\n" - " return pb::ExtensionSet.Get(ref _extensions, extension);\n" - "}\n" - "public pbc::RepeatedField " - "GetOrInitializeExtension(pb::RepeatedExtension<$class_name$, " - "TValue> extension) {\n" - " return pb::ExtensionSet.GetOrInitialize(ref _extensions, " - "extension);\n" - "}\n" - "public void SetExtension(pb::Extension<$class_name$, TValue> " - "extension, TValue value) {\n" - " pb::ExtensionSet.Set(ref _extensions, extension, value);\n" - "}\n" - "public bool HasExtension(pb::Extension<$class_name$, TValue> " - "extension) {\n" - " return pb::ExtensionSet.Has(ref _extensions, extension);\n" - "}\n" - "public void ClearExtension(pb::Extension<$class_name$, " - "TValue> extension) {\n" - " pb::ExtensionSet.Clear(ref _extensions, extension);\n" - "}\n" - "public void " - "ClearExtension(pb::RepeatedExtension<$class_name$, TValue> " - "extension) {\n" - " pb::ExtensionSet.Clear(ref _extensions, extension);\n" - "}\n\n"); - } - - // Nested messages and enums - if (HasNestedGeneratedTypes()) { - printer->Print( - vars, - "#region Nested types\n" - "/// Container for nested types declared in the $class_name$ message type.\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print("public static partial class Types {\n"); - printer->Indent(); - for (int i = 0; i < descriptor_->enum_type_count(); i++) { - EnumGenerator enumGenerator(descriptor_->enum_type(i), this->options()); - enumGenerator.Generate(printer); - } - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // Don't generate nested types for maps... - if (!IsMapEntryMessage(descriptor_->nested_type(i))) { - MessageGenerator messageGenerator( - descriptor_->nested_type(i), this->options()); - messageGenerator.Generate(printer); - } - } - printer->Outdent(); - printer->Print("}\n" - "#endregion\n" - "\n"); - } - - if (descriptor_->extension_count() > 0) { - printer->Print( - vars, - "#region Extensions\n" - "/// Container for extensions for other messages declared in the $class_name$ message type.\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print("public static partial class Extensions {\n"); - printer->Indent(); - for (int i = 0; i < descriptor_->extension_count(); i++) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->extension(i))); - generator->GenerateExtensionCode(printer); - } - printer->Outdent(); - printer->Print( - "}\n" - "#endregion\n" - "\n"); - } - - printer->Outdent(); - printer->Print("}\n"); - printer->Print("\n"); -} - -// Helper to work out whether we need to generate a class to hold nested types/enums. -// Only tricky because we don't want to generate map entry types. -bool MessageGenerator::HasNestedGeneratedTypes() -{ - if (descriptor_->enum_type_count() > 0) { - return true; - } - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - if (!IsMapEntryMessage(descriptor_->nested_type(i))) { - return true; - } - } - return false; -} - -void MessageGenerator::GenerateCloningCode(io::Printer* printer) { - std::map vars; - WriteGeneratedCodeAttributes(printer); - vars["class_name"] = class_name(); - printer->Print( - vars, - "public $class_name$($class_name$ other) : this() {\n"); - printer->Indent(); - 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 (treating optional proto3 fields as non-oneof) - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (field->real_containing_oneof()) { - continue; - } - 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 < oneof->field_count(); j++) { - const FieldDescriptor* field = oneof->field(j); - std::unique_ptr generator(CreateFieldGeneratorInternal(field)); - vars["oneof_case_name"] = GetOneofCaseName(field); - printer->Print( - vars, - "case $property_name$OneofCase.$oneof_case_name$:\n"); - printer->Indent(); - generator->GenerateCloningCode(printer); - printer->Print("break;\n"); - printer->Outdent(); - } - printer->Outdent(); - printer->Print("}\n\n"); - } - // Clone unknown fields - printer->Print( - "_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);\n"); - if (has_extension_ranges_) { - printer->Print( - "_extensions = pb::ExtensionSet.Clone(other._extensions);\n"); - } - - printer->Outdent(); - printer->Print("}\n\n"); - - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public $class_name$ Clone() {\n" - " return new $class_name$(this);\n" - "}\n\n"); -} - -void MessageGenerator::GenerateFreezingCode(io::Printer* printer) { -} - -void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { - std::map vars; - vars["class_name"] = class_name(); - - // Equality - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public override bool Equals(object other) {\n" - " return Equals(other as $class_name$);\n" - "}\n\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public bool Equals($class_name$ other) {\n" - " if (ReferenceEquals(other, null)) {\n" - " return false;\n" - " }\n" - " if (ReferenceEquals(other, this)) {\n" - " return true;\n" - " }\n"); - printer->Indent(); - for (int i = 0; i < descriptor_->field_count(); i++) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->field(i))); - generator->WriteEquals(printer); - } - 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( - "if (!Equals(_extensions, other._extensions)) {\n" - " return false;\n" - "}\n"); - } - printer->Outdent(); - printer->Print( - " return Equals(_unknownFields, other._unknownFields);\n" - "}\n\n"); - - // GetHashCode - // Start with a non-zero value to easily distinguish between null and "empty" messages. - WriteGeneratedCodeAttributes(printer); - printer->Print( - "public override int GetHashCode() {\n" - " int hash = 1;\n"); - printer->Indent(); - for (int i = 0; i < descriptor_->field_count(); i++) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->field(i))); - generator->WriteHash(printer); - } - 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( - "if (_extensions != null) {\n" - " hash ^= _extensions.GetHashCode();\n" - "}\n"); - } - printer->Print( - "if (_unknownFields != null) {\n" - " hash ^= _unknownFields.GetHashCode();\n" - "}\n" - "return hash;\n"); - printer->Outdent(); - printer->Print("}\n\n"); - - WriteGeneratedCodeAttributes(printer); - printer->Print( - "public override string ToString() {\n" - " return pb::JsonFormatter.ToDiagnosticString(this);\n" - "}\n\n"); -} - -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"); - - 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"); - printer->Print("#endif\n\n"); - - WriteGeneratedCodeAttributes(printer); - printer->Print( - "public int CalculateSize() {\n"); - printer->Indent(); - printer->Print("int size = 0;\n"); - for (int i = 0; i < descriptor_->field_count(); i++) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->field(i))); - generator->GenerateSerializedSizeCode(printer); - } - - if (has_extension_ranges_) { - printer->Print( - "if (_extensions != null) {\n" - " size += _extensions.CalculateSize();\n" - "}\n"); - } - - printer->Print( - "if (_unknownFields != null) {\n" - " size += _unknownFields.CalculateSize();\n" - "}\n"); - - printer->Print("return size;\n"); - printer->Outdent(); - 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; - vars["class_name"] = class_name(); - - WriteGeneratedCodeAttributes(printer); - printer->Print( - vars, - "public void MergeFrom($class_name$ other) {\n"); - printer->Indent(); - printer->Print( - "if (other == null) {\n" - " return;\n" - "}\n"); - // Merge non-oneof fields, treating optional proto3 fields as normal fields - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (field->real_containing_oneof()) { - continue; - } - 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 < oneof->field_count(); j++) { - const FieldDescriptor* field = oneof->field(j); - vars["oneof_case_name"] = GetOneofCaseName(field); - printer->Print( - vars, - "case $property_name$OneofCase.$oneof_case_name$:\n"); - printer->Indent(); - std::unique_ptr generator(CreateFieldGeneratorInternal(field)); - generator->GenerateMergingCode(printer); - printer->Print("break;\n"); - printer->Outdent(); - } - printer->Outdent(); - printer->Print("}\n\n"); - } - // Merge extensions - if (has_extension_ranges_) { - printer->Print("pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions);\n"); - } - - // Merge unknown fields. - printer->Print( - "_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);\n"); - - 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" - " switch(tag) {\n"); - printer->Indent(); - printer->Indent(); - if (end_tag_ != 0) { - printer->Print( - "case $end_tag$:\n" - " return;\n", - "end_tag", StrCat(end_tag_)); - } - if (has_extension_ranges_) { - printer->Print(vars, - "default:\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(vars, - "default:\n" - " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, $maybe_ref_input$);\n" - " break;\n"); - } - for (int i = 0; i < fields_by_number().size(); i++) { - const FieldDescriptor* field = fields_by_number()[i]; - internal::WireFormatLite::WireType wt = - internal::WireFormat::WireTypeForFieldType(field->type()); - uint32_t tag = internal::WireFormatLite::MakeTag(field->number(), wt); - // Handle both packed and unpacked repeated fields with the same Read*Array call; - // the two generated cases are the packed and unpacked tags. - // TODO(jonskeet): Check that is_packable is equivalent to - // is_repeated && wt in { VARINT, FIXED32, FIXED64 }. - // It looks like it is... - if (field->is_packable()) { - printer->Print( - "case $packed_tag$:\n", - "packed_tag", - StrCat( - internal::WireFormatLite::MakeTag( - field->number(), - internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED))); - } - - printer->Print("case $tag$: {\n", "tag", StrCat(tag)); - printer->Indent(); - std::unique_ptr generator( - CreateFieldGeneratorInternal(field)); - generator->GenerateParsingCode(printer, use_parse_context); - printer->Print("break;\n"); - printer->Outdent(); - printer->Print("}\n"); - } - printer->Outdent(); - printer->Print("}\n"); // switch - printer->Outdent(); - printer->Print("}\n"); // while -} - -// 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 (!RequiresPresenceBit(descriptor)) { - return -1; - } - - int index = 0; - for (int i = 0; i < fields_by_number().size(); i++) { - const FieldDescriptor* field = fields_by_number()[i]; - if (field == descriptor) { - return index; - } - if (RequiresPresenceBit(field)) { - index++; - } - } - GOOGLE_LOG(DFATAL)<< "Could not find presence index for field " << descriptor->name(); - return -1; -} - -FieldGeneratorBase* MessageGenerator::CreateFieldGeneratorInternal( - const FieldDescriptor* descriptor) { - return CreateFieldGenerator(descriptor, GetPresenceIndex(descriptor), this->options()); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message.h deleted file mode 100644 index d02767e44..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message.h +++ /dev/null @@ -1,94 +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_COMPILER_CSHARP_MESSAGE_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ - -#include -#include - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class FieldGeneratorBase; - -class MessageGenerator : public SourceGeneratorBase { - public: - MessageGenerator(const Descriptor* descriptor, const Options* options); - ~MessageGenerator(); - - MessageGenerator(const MessageGenerator&) = delete; - MessageGenerator& operator=(const MessageGenerator&) = delete; - - void GenerateCloningCode(io::Printer* printer); - void GenerateFreezingCode(io::Printer* printer); - void GenerateFrameworkMethods(io::Printer* printer); - void Generate(io::Printer* printer); - - private: - const Descriptor* descriptor_; - std::vector fields_by_number_; - int has_bit_field_count_; - uint end_tag_; - 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( - const FieldDescriptor* descriptor); - - bool HasNestedGeneratedTypes(); - - void AddDeprecatedFlag(io::Printer* printer); - void AddSerializableAttribute(io::Printer* printer); - - std::string class_name(); - std::string full_class_name(); - - // field descriptors sorted by number - const std::vector& fields_by_number(); -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc deleted file mode 100644 index 487d01dde..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc +++ /dev/null @@ -1,293 +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 - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { - if (!SupportsPresenceApi(descriptor_)) { - variables_["has_property_check"] = name() + "_ != null"; - variables_["has_not_property_check"] = name() + "_ == null"; - } -} - -MessageFieldGenerator::~MessageFieldGenerator() { - -} - -void MessageFieldGenerator::GenerateMembers(io::Printer* printer) { - printer->Print( - variables_, - "private $type_name$ $name$_;\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $name$_; }\n" - " set {\n" - " $name$_ = value;\n" - " }\n" - "}\n"); - if (SupportsPresenceApi(descriptor_)) { - printer->Print( - variables_, - "/// Gets whether the $descriptor_name$ field is set\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ bool Has$property_name$ {\n" - " get { return $name$_ != null; }\n" - "}\n"); - printer->Print( - variables_, - "/// Clears the value of the $descriptor_name$ field\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ void Clear$property_name$() {\n" - " $name$_ = null;\n" - "}\n"); - } -} - -void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "if (other.$has_property_check$) {\n" - " if ($has_not_property_check$) {\n" - " $property_name$ = new $type_name$();\n" - " }\n" - " $property_name$.MergeFrom(other.$property_name$);\n" - "}\n"); -} - -void MessageFieldGenerator::GenerateParsingCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_not_property_check$) {\n" - " $property_name$ = new $type_name$();\n" - "}\n"); - if (descriptor_->type() == FieldDescriptor::Type::TYPE_MESSAGE) { - printer->Print(variables_, "input.ReadMessage($property_name$);\n"); - } else { - printer->Print(variables_, "input.ReadGroup($property_name$);\n"); - } -} - -void MessageFieldGenerator::GenerateSerializationCode(io::Printer* printer) { - if (descriptor_->type() == FieldDescriptor::Type::TYPE_MESSAGE) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " output.WriteRawTag($tag_bytes$);\n" - " output.WriteMessage($property_name$);\n" - "}\n"); - } else { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " output.WriteRawTag($tag_bytes$);\n" - " output.WriteGroup($property_name$);\n" - " output.WriteRawTag($end_tag_bytes$);\n" - "}\n"); - } -} - -void MessageFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - if (descriptor_->type() == FieldDescriptor::Type::TYPE_MESSAGE) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " size += $tag_size$ + pb::CodedOutputStream.ComputeMessageSize($property_name$);\n" - "}\n"); - } else { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " size += $tag_size$ + pb::CodedOutputStream.ComputeGroupSize($property_name$);\n" - "}\n"); - } -} - -void MessageFieldGenerator::WriteHash(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n"); -} -void MessageFieldGenerator::WriteEquals(io::Printer* printer) { - printer->Print( - variables_, - "if (!object.Equals($property_name$, other.$property_name$)) return false;\n"); -} -void MessageFieldGenerator::WriteToString(io::Printer* printer) { - variables_["field_name"] = GetFieldName(descriptor_); - printer->Print( - variables_, - "PrintField(\"$field_name$\", has$property_name$, $name$_, writer);\n"); -} -void MessageFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); -} -void MessageFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$name$_ = other.$has_property_check$ ? other.$name$_.Clone() : null;\n"); -} - -void MessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) { -} - -void MessageFieldGenerator::GenerateCodecCode(io::Printer* printer) { - if (descriptor_->type() == FieldDescriptor::Type::TYPE_MESSAGE) { - printer->Print( - variables_, - "pb::FieldCodec.ForMessage($tag$, $type_name$.Parser)"); - } else { - printer->Print( - variables_, - "pb::FieldCodec.ForGroup($tag$, $end_tag$, $type_name$.Parser)"); - } -} - -MessageOneofFieldGenerator::MessageOneofFieldGenerator( - const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options) - : MessageFieldGenerator(descriptor, presenceIndex, options) { - SetCommonOneofFieldVariables(&variables_); -} - -MessageOneofFieldGenerator::~MessageOneofFieldGenerator() { - -} - -void MessageOneofFieldGenerator::GenerateMembers(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : null; }\n" - " set {\n" - " $oneof_name$_ = value;\n" - " $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None : $oneof_property_name$OneofCase.$oneof_case_name$;\n" - " }\n" - "}\n"); - if (SupportsPresenceApi(descriptor_)) { - printer->Print( - variables_, - "/// Gets whether the \"$descriptor_name$\" field is set\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ bool Has$property_name$ {\n" - " get { return $oneof_name$Case_ == $oneof_property_name$OneofCase.$oneof_case_name$; }\n" - "}\n"); - printer->Print( - variables_, - "/// Clears the value of the oneof if it's currently set to \"$descriptor_name$\" \n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ void Clear$property_name$() {\n" - " if ($has_property_check$) {\n" - " Clear$oneof_property_name$();\n" - " }\n" - "}\n"); - } -} - -void MessageOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print(variables_, - "if ($property_name$ == null) {\n" - " $property_name$ = new $type_name$();\n" - "}\n" - "$property_name$.MergeFrom(other.$property_name$);\n"); -} - -void MessageOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) { - // TODO(jonskeet): We may be able to do better than this - printer->Print( - variables_, - "$type_name$ subBuilder = new $type_name$();\n" - "if ($has_property_check$) {\n" - " subBuilder.MergeFrom($property_name$);\n" - "}\n"); - if (descriptor_->type() == FieldDescriptor::Type::TYPE_MESSAGE) { - printer->Print("input.ReadMessage(subBuilder);\n"); - } else { - printer->Print("input.ReadGroup(subBuilder);\n"); - } - printer->Print(variables_, "$property_name$ = subBuilder;\n"); -} - -void MessageOneofFieldGenerator::WriteToString(io::Printer* printer) { - printer->Print( - variables_, - "PrintField(\"$descriptor_name$\", $has_property_check$, $oneof_name$_, writer);\n"); -} - -void MessageOneofFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$property_name$ = other.$property_name$.Clone();\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.h deleted file mode 100644 index e76dfd20a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.h +++ /dev/null @@ -1,91 +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_COMPILER_CSHARP_MESSAGE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class MessageFieldGenerator : public FieldGeneratorBase { - public: - MessageFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~MessageFieldGenerator(); - - MessageFieldGenerator(const MessageFieldGenerator&) = delete; - MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete; - - 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) override; - virtual void WriteEquals(io::Printer* printer) override; - virtual void WriteToString(io::Printer* printer) override; -}; - -class MessageOneofFieldGenerator : public MessageFieldGenerator { - public: - MessageOneofFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~MessageOneofFieldGenerator(); - - MessageOneofFieldGenerator(const MessageOneofFieldGenerator&) = delete; - MessageOneofFieldGenerator& operator=(const MessageOneofFieldGenerator&) = - delete; - - 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 -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h deleted file mode 100644 index 67e53b640..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h +++ /dev/null @@ -1,109 +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. -// -// Provides a mechanism for mapping a descriptor to the -// fully-qualified name of the corresponding C# class. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__ - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { - -class Descriptor; -class EnumDescriptor; -class FileDescriptor; -class ServiceDescriptor; - -namespace compiler { -namespace csharp { - -// Requires: -// descriptor != NULL -// -// Returns: -// The namespace to use for given file descriptor. -std::string PROTOC_EXPORT GetFileNamespace(const FileDescriptor* descriptor); - -// Requires: -// descriptor != NULL -// -// Returns: -// The fully-qualified C# class name. -std::string PROTOC_EXPORT GetClassName(const Descriptor* descriptor); - -// Requires: -// descriptor != NULL -// -// Returns: -// 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. -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 -// namespace. base_namespace can be used to strip some of the top level -// directories. E.g. for file with namespace "Bar.Foo" and base_namespace="Bar", -// the resulting file will be put under directory "Foo" (and not "Bar/Foo"). -// -// Requires: -// descriptor != NULL -// error != NULL -// -// Returns: -// 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. -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 -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_options.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_options.h deleted file mode 100644 index 42ff6d866..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_options.h +++ /dev/null @@ -1,81 +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_COMPILER_CSHARP_OPTIONS_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_OPTIONS_H__ - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -// Generator options (used by csharp_generator.cc): -struct Options { - Options() : - file_extension(".cs"), - base_namespace(""), - base_namespace_specified(false), - internal_access(false), - serializable(false) { - } - // Extension of the generated file. Defaults to ".cs" - std::string file_extension; - // Base namespace to use to create directory hierarchy. Defaults to "". - // This option allows the simple creation of a conventional C# file layout, - // where directories are created relative to a project-specific base - // namespace. For example, in a project with a base namespace of PetShop, a - // proto of user.proto with a C# namespace of PetShop.Model.Shared would - // generate Model/Shared/User.cs underneath the specified --csharp_out - // directory. - // - // If no base namespace is specified, all files are generated in the - // --csharp_out directory, with no subdirectories created automatically. - std::string base_namespace; - // Whether the base namespace has been explicitly specified by the user. - // This is required as the base namespace can be explicitly set to the empty - // string, meaning "create a full directory hierarchy, starting from the first - // segment of the namespace." - bool base_namespace_specified; - // Whether the generated classes should have accessibility level of "internal". - // Defaults to false that generates "public" classes. - bool internal_access; - // Whether the generated classes should have a global::System.Serializable attribute added - // Defaults to false - bool serializable; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_OPTIONS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc deleted file mode 100644 index e7d51168d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc +++ /dev/null @@ -1,349 +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 -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -PrimitiveFieldGenerator::PrimitiveFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { - // TODO(jonskeet): Make this cleaner... - is_value_type = descriptor->type() != FieldDescriptor::TYPE_STRING - && descriptor->type() != FieldDescriptor::TYPE_BYTES; - 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"; - } -} - -PrimitiveFieldGenerator::~PrimitiveFieldGenerator() { -} - -void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { - - // 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); - - // 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_, - " get { return $name$_ ?? $default_value_access$; }\n"); - } else { - printer->Print( - variables_, - // 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_, - " 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_, - " $set_has_field$;\n"); - } - if (is_value_type) { - printer->Print( - variables_, - " $name$_ = value;\n"); - } else { - printer->Print( - variables_, - " $name$_ = pb::ProtoPreconditions.CheckNotNull(value, \"value\");\n"); - } - printer->Print( - " }\n" - "}\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_, - "$access_level$ bool Has$property_name$ {\n" - " get { return "); - if (IsNullable(descriptor_)) { - printer->Print( - variables_, - "$name$_ != null; }\n}\n"); - } else { - printer->Print( - variables_, - "$has_field_check$; }\n}\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_, - "$access_level$ void Clear$property_name$() {\n"); - if (IsNullable(descriptor_)) { - printer->Print(variables_, " $name$_ = null;\n"); - } else { - printer->Print(variables_, " $clear_has_field$;\n"); - } - printer->Print("}\n"); - } -} - -void PrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($other_has_property_check$) {\n" - " $property_name$ = other.$property_name$;\n" - "}\n"); -} - -void PrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer) { - // Note: invoke the property setter rather than writing straight to the field, - // so that we can normalize "null to empty" for strings and bytes. - printer->Print( - variables_, - "$property_name$ = input.Read$capitalized_type_name$();\n"); -} - -void PrimitiveFieldGenerator::GenerateSerializationCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " output.WriteRawTag($tag_bytes$);\n" - " output.Write$capitalized_type_name$($property_name$);\n" - "}\n"); -} - -void PrimitiveFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "if ($has_property_check$) {\n"); - printer->Indent(); - int fixedSize = GetFixedSize(descriptor_->type()); - if (fixedSize == -1) { - printer->Print( - variables_, - "size += $tag_size$ + pb::CodedOutputStream.Compute$capitalized_type_name$Size($property_name$);\n"); - } else { - printer->Print( - "size += $tag_size$ + $fixed_size$;\n", - "fixed_size", StrCat(fixedSize), - "tag_size", variables_["tag_size"]); - } - printer->Outdent(); - printer->Print("}\n"); -} - -void PrimitiveFieldGenerator::WriteHash(io::Printer* printer) { - const char *text = "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n"; - if (descriptor_->type() == FieldDescriptor::TYPE_FLOAT) { - text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode($property_name$);\n"; - } else if (descriptor_->type() == FieldDescriptor::TYPE_DOUBLE) { - text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode($property_name$);\n"; - } - printer->Print(variables_, text); -} -void PrimitiveFieldGenerator::WriteEquals(io::Printer* printer) { - const char *text = "if ($property_name$ != other.$property_name$) return false;\n"; - if (descriptor_->type() == FieldDescriptor::TYPE_FLOAT) { - text = "if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n"; - } else if (descriptor_->type() == FieldDescriptor::TYPE_DOUBLE) { - text = "if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n"; - } - printer->Print(variables_, text); -} -void PrimitiveFieldGenerator::WriteToString(io::Printer* printer) { - printer->Print( - variables_, - "PrintField(\"$descriptor_name$\", $has_property_check$, $property_name$, writer);\n"); -} - -void PrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$name$_ = other.$name$_;\n"); -} - -void PrimitiveFieldGenerator::GenerateCodecCode(io::Printer* printer) { - printer->Print( - variables_, - "pb::FieldCodec.For$capitalized_type_name$($tag$, $default_value$)"); -} - -void PrimitiveFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); -} - -PrimitiveOneofFieldGenerator::PrimitiveOneofFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : PrimitiveFieldGenerator(descriptor, presenceIndex, options) { - SetCommonOneofFieldVariables(&variables_); -} - -PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() { -} - -void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : $default_value$; }\n" - " set {\n"); - if (is_value_type) { - printer->Print( - variables_, - " $oneof_name$_ = value;\n"); - } else { - printer->Print( - variables_, - " $oneof_name$_ = pb::ProtoPreconditions.CheckNotNull(value, \"value\");\n"); - } - printer->Print( - variables_, - " $oneof_name$Case_ = $oneof_property_name$OneofCase.$oneof_case_name$;\n" - " }\n" - "}\n"); - if (SupportsPresenceApi(descriptor_)) { - printer->Print( - variables_, - "/// Gets whether the \"$descriptor_name$\" field is set\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ bool Has$property_name$ {\n" - " get { return $oneof_name$Case_ == $oneof_property_name$OneofCase.$oneof_case_name$; }\n" - "}\n"); - printer->Print( - variables_, - "/// Clears the value of the oneof if it's currently set to \"$descriptor_name$\" \n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ void Clear$property_name$() {\n" - " if ($has_property_check$) {\n" - " Clear$oneof_property_name$();\n" - " }\n" - "}\n"); - } -} - -void PrimitiveOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print(variables_, "$property_name$ = other.$property_name$;\n"); -} - -void PrimitiveOneofFieldGenerator::WriteToString(io::Printer* printer) { - printer->Print(variables_, - "PrintField(\"$descriptor_name$\", $has_property_check$, $oneof_name$_, writer);\n"); -} - -void PrimitiveOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) { - printer->Print( - variables_, - "$property_name$ = input.Read$capitalized_type_name$();\n"); -} - -void PrimitiveOneofFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$property_name$ = other.$property_name$;\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.h deleted file mode 100644 index 6d495d55e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.h +++ /dev/null @@ -1,95 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -struct Options; - -class PrimitiveFieldGenerator : public FieldGeneratorBase { - public: - PrimitiveFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~PrimitiveFieldGenerator(); - - PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; - PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; - - 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; -}; - -class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { - public: - PrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~PrimitiveOneofFieldGenerator(); - - PrimitiveOneofFieldGenerator(const PrimitiveOneofFieldGenerator&) = delete; - PrimitiveOneofFieldGenerator& operator=(const PrimitiveOneofFieldGenerator&) = - delete; - - 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 -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc deleted file mode 100644 index d9ab4b49b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ /dev/null @@ -1,330 +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 -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -ReflectionClassGenerator::ReflectionClassGenerator(const FileDescriptor* file, - const Options* options) - : SourceGeneratorBase(options), - file_(file) { - namespace_ = GetFileNamespace(file); - reflectionClassname_ = GetReflectionClassUnqualifiedName(file); - extensionClassname_ = GetExtensionClassUnqualifiedName(file); -} - -ReflectionClassGenerator::~ReflectionClassGenerator() { -} - -void ReflectionClassGenerator::Generate(io::Printer* printer) { - WriteIntroduction(printer); - - WriteDescriptor(printer); - // Close the class declaration. - printer->Outdent(); - printer->Print("}\n"); - - if (file_->extension_count() > 0) { - printer->Print( - "/// Holder for extension identifiers generated from the top " - "level of $file_name$\n" - "$access_level$ static partial class $class_name$ {\n", - "access_level", class_access_level(), "class_name", extensionClassname_, - "file_name", file_->name()); - printer->Indent(); - for (int i = 0; i < file_->extension_count(); i++) { - std::unique_ptr generator( - CreateFieldGenerator(file_->extension(i), -1, this->options())); - generator->GenerateExtensionCode(printer); - } - printer->Outdent(); - printer->Print( - "}\n" - "\n"); - } - - // write children: Enums - if (file_->enum_type_count() > 0) { - printer->Print("#region Enums\n"); - for (int i = 0; i < file_->enum_type_count(); i++) { - EnumGenerator enumGenerator(file_->enum_type(i), this->options()); - enumGenerator.Generate(printer); - } - printer->Print("#endregion\n"); - printer->Print("\n"); - } - - // write children: Messages - if (file_->message_type_count() > 0) { - printer->Print("#region Messages\n"); - for (int i = 0; i < file_->message_type_count(); i++) { - MessageGenerator messageGenerator(file_->message_type(i), this->options()); - messageGenerator.Generate(printer); - } - printer->Print("#endregion\n"); - printer->Print("\n"); - } - - // TODO(jtattermusch): add insertion point for services. - - if (!namespace_.empty()) { - printer->Outdent(); - printer->Print("}\n"); - } - printer->Print("\n"); - printer->Print("#endregion Designer generated code\n"); -} - -void ReflectionClassGenerator::WriteIntroduction(io::Printer* printer) { - printer->Print( - "// \n" - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "// source: $file_name$\n" - "// \n" - "#pragma warning disable 1591, 0612, 3021, 8981\n" - "#region Designer generated code\n" - "\n" - "using pb = global::Google.Protobuf;\n" - "using pbc = global::Google.Protobuf.Collections;\n" - "using pbr = global::Google.Protobuf.Reflection;\n" - "using scg = global::System.Collections.Generic;\n", - "file_name", file_->name()); - - if (!namespace_.empty()) { - printer->Print("namespace $namespace$ {\n", "namespace", namespace_); - printer->Indent(); - printer->Print("\n"); - } - - printer->Print( - "/// Holder for reflection information generated from $file_name$\n" - "$access_level$ static partial class $reflection_class_name$ {\n" - "\n", - "file_name", file_->name(), - "access_level", class_access_level(), - "reflection_class_name", reflectionClassname_); - printer->Indent(); -} - -void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { - printer->Print( - "#region Descriptor\n" - "/// File descriptor for $file_name$\n" - "public static pbr::FileDescriptor Descriptor {\n" - " get { return descriptor; }\n" - "}\n" - "private static pbr::FileDescriptor descriptor;\n" - "\n" - "static $reflection_class_name$() {\n", - "file_name", file_->name(), - "reflection_class_name", reflectionClassname_); - printer->Indent(); - printer->Print( - "byte[] descriptorData = global::System.Convert.FromBase64String(\n"); - printer->Indent(); - printer->Indent(); - printer->Print("string.Concat(\n"); - printer->Indent(); - - // TODO(jonskeet): Consider a C#-escaping format here instead of just Base64. - std::string base64 = FileDescriptorToBase64(file_); - while (base64.size() > 60) { - printer->Print("\"$base64$\",\n", "base64", base64.substr(0, 60)); - base64 = base64.substr(60); - } - printer->Print("\"$base64$\"));\n", "base64", base64); - printer->Outdent(); - printer->Outdent(); - printer->Outdent(); - - // ----------------------------------------------------------------- - // Invoke InternalBuildGeneratedFileFrom() to build the file. - printer->Print( - "descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,\n"); - printer->Print(" new pbr::FileDescriptor[] { "); - for (int i = 0; i < file_->dependency_count(); i++) { - printer->Print( - "$full_reflection_class_name$.Descriptor, ", - "full_reflection_class_name", - GetReflectionClassName(file_->dependency(i))); - } - printer->Print("},\n" - " new pbr::GeneratedClrTypeInfo("); - // Specify all the generated code information, recursively. - if (file_->enum_type_count() > 0) { - printer->Print("new[] {"); - for (int i = 0; i < file_->enum_type_count(); i++) { - printer->Print("typeof($type_name$), ", "type_name", GetClassName(file_->enum_type(i))); - } - printer->Print("}, "); - } - else { - printer->Print("null, "); - } - if (file_->extension_count() > 0) { - std::vector extensions; - for (int i = 0; i < file_->extension_count(); i++) { - extensions.push_back(GetFullExtensionName(file_->extension(i))); - } - printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", Join(extensions, ", ")); - } - else { - printer->Print("null, "); - } - if (file_->message_type_count() > 0) { - printer->Print("new pbr::GeneratedClrTypeInfo[] {\n"); - printer->Indent(); - printer->Indent(); - printer->Indent(); - for (int i = 0; i < file_->message_type_count(); i++) { - WriteGeneratedCodeInfo(file_->message_type(i), printer, i == file_->message_type_count() - 1); - } - printer->Outdent(); - printer->Print("\n}));\n"); - printer->Outdent(); - printer->Outdent(); - } - else { - printer->Print("null));\n"); - } - - printer->Outdent(); - printer->Print("}\n"); - printer->Print("#endregion\n\n"); -} - -// Write out the generated code for a particular message. This consists of the CLR type, property names -// corresponding to fields, names corresponding to oneofs, nested enums, and nested types. Each array part -// can be specified as null if it would be empty, to make the generated code somewhat simpler to read. -// We write a line break at the end of each generated code info, so that in the final file we'll see all -// the types, pre-ordered depth first, one per line. The indentation will be slightly unusual, -// in that it will look like a single array when it's actually constructing a tree, but it'll be easy to -// read even with multiple levels of nesting. -// The "last" parameter indicates whether this message descriptor is the last one being printed in this immediate -// context. It governs whether or not a trailing comma and newline is written after the constructor, effectively -// just controlling the formatting in the generated code. -void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descriptor, io::Printer* printer, bool last) { - if (IsMapEntryMessage(descriptor)) { - printer->Print("null, "); - return; - } - // Generated message type - printer->Print("new pbr::GeneratedClrTypeInfo(typeof($type_name$), $type_name$.Parser, ", "type_name", GetClassName(descriptor)); - - // Fields - if (descriptor->field_count() > 0) { - std::vector fields; - fields.reserve(descriptor->field_count()); - for (int i = 0; i < descriptor->field_count(); i++) { - fields.push_back(GetPropertyName(descriptor->field(i))); - } - printer->Print("new[]{ \"$fields$\" }, ", "fields", Join(fields, "\", \"")); - } - else { - printer->Print("null, "); - } - - // Oneofs - if (descriptor->oneof_decl_count() > 0) { - std::vector oneofs; - oneofs.reserve(descriptor->oneof_decl_count()); - for (int i = 0; i < descriptor->oneof_decl_count(); i++) { - oneofs.push_back(UnderscoresToCamelCase(descriptor->oneof_decl(i)->name(), true)); - } - printer->Print("new[]{ \"$oneofs$\" }, ", "oneofs", Join(oneofs, "\", \"")); - } - else { - printer->Print("null, "); - } - - // Nested enums - if (descriptor->enum_type_count() > 0) { - std::vector enums; - enums.reserve(descriptor->enum_type_count()); - for (int i = 0; i < descriptor->enum_type_count(); i++) { - enums.push_back(GetClassName(descriptor->enum_type(i))); - } - printer->Print("new[]{ typeof($enums$) }, ", "enums", Join(enums, "), typeof(")); - } - else { - printer->Print("null, "); - } - - // Extensions - if (descriptor->extension_count() > 0) { - std::vector extensions; - for (int i = 0; i < descriptor->extension_count(); i++) { - extensions.push_back(GetFullExtensionName(descriptor->extension(i))); - } - printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", Join(extensions, ", ")); - } - else { - printer->Print("null, "); - } - - // Nested types - if (descriptor->nested_type_count() > 0) { - // Need to specify array type explicitly here, as all elements may be null. - printer->Print("new pbr::GeneratedClrTypeInfo[] { "); - for (int i = 0; i < descriptor->nested_type_count(); i++) { - WriteGeneratedCodeInfo(descriptor->nested_type(i), printer, i == descriptor->nested_type_count() - 1); - } - printer->Print("}"); - } - else { - printer->Print("null"); - } - printer->Print(last ? ")" : "),\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.h deleted file mode 100644 index 955472776..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.h +++ /dev/null @@ -1,75 +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_COMPILER_CSHARP_REFLECTION_CLASS_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__ - -#include - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class ReflectionClassGenerator : public SourceGeneratorBase { - public: - ReflectionClassGenerator(const FileDescriptor* file, const Options* options); - ~ReflectionClassGenerator(); - - ReflectionClassGenerator(const ReflectionClassGenerator&) = delete; - ReflectionClassGenerator& operator=(const ReflectionClassGenerator&) = delete; - - void Generate(io::Printer* printer); - - private: - const FileDescriptor* file_; - - std::string namespace_; - std::string reflectionClassname_; - std::string extensionClassname_; - - void WriteIntroduction(io::Printer* printer); - void WriteDescriptor(io::Printer* printer); - void WriteGeneratedCodeInfo(const Descriptor* descriptor, - io::Printer* printer, - bool last); -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc deleted file mode 100644 index 04bc7bbb1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc +++ /dev/null @@ -1,148 +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 -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { -} - -RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() { - -} - -void RepeatedEnumFieldGenerator::GenerateMembers(io::Printer* printer) { - printer->Print( - variables_, - "private static readonly pb::FieldCodec<$type_name$> _repeated_$name$_codec\n" - " = pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x);\n"); - printer->Print(variables_, - "private readonly pbc::RepeatedField<$type_name$> $name$_ = new pbc::RepeatedField<$type_name$>();\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ pbc::RepeatedField<$type_name$> $property_name$ {\n" - " get { return $name$_; }\n" - "}\n"); -} - -void RepeatedEnumFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "$name$_.Add(other.$name$_);\n"); -} - -void RepeatedEnumFieldGenerator::GenerateParsingCode(io::Printer* printer) { - GenerateParsingCode(printer, true); -} - -void RepeatedEnumFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { - printer->Print( - variables_, - 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_, - use_write_context - ? "$name$_.WriteTo(ref output, _repeated_$name$_codec);\n" - : "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); -} - -void RepeatedEnumFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "size += $name$_.CalculateSize(_repeated_$name$_codec);\n"); -} - -void RepeatedEnumFieldGenerator::WriteHash(io::Printer* printer) { - printer->Print( - variables_, - "hash ^= $name$_.GetHashCode();\n"); -} - -void RepeatedEnumFieldGenerator::WriteEquals(io::Printer* printer) { - printer->Print( - variables_, - "if(!$name$_.Equals(other.$name$_)) return false;\n"); -} - -void RepeatedEnumFieldGenerator::WriteToString(io::Printer* printer) { - printer->Print(variables_, - "PrintField(\"$descriptor_name$\", $name$_, writer);\n"); -} - -void RepeatedEnumFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$name$_ = other.$name$_.Clone();\n"); -} - -void RepeatedEnumFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::RepeatedExtension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::RepeatedExtension<$extended_type$, $type_name$>($number$, " - "pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x));\n"); -} - -void RepeatedEnumFieldGenerator::GenerateFreezingCode(io::Printer* printer) { -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h deleted file mode 100644 index 2379f38e2..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h +++ /dev/null @@ -1,77 +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_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -// TODO(jonskeet): Refactor repeated field support; all the implementations are -// *really* similar. We should probably have a RepeatedFieldGeneratorBase. -class RepeatedEnumFieldGenerator : public FieldGeneratorBase { - public: - RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~RepeatedEnumFieldGenerator(); - - RepeatedEnumFieldGenerator(const RepeatedEnumFieldGenerator&) = delete; - RepeatedEnumFieldGenerator& operator=(const RepeatedEnumFieldGenerator&) = - delete; - - 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) override; - virtual void WriteEquals(io::Printer* printer) override; - virtual void WriteToString(io::Printer* printer) override; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc deleted file mode 100644 index 8a93cd13c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc +++ /dev/null @@ -1,174 +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 -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { -} - -RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() { - -} - -void RepeatedMessageFieldGenerator::GenerateMembers(io::Printer* printer) { - printer->Print( - variables_, - "private static readonly pb::FieldCodec<$type_name$> _repeated_$name$_codec\n" - " = "); - // Don't want to duplicate the codec code here... maybe we should have a - // "create single field generator for this repeated field" - // function, but it doesn't seem worth it for just this. - if (IsWrapperType(descriptor_)) { - std::unique_ptr single_generator( - new WrapperFieldGenerator(descriptor_, presenceIndex_, this->options())); - single_generator->GenerateCodecCode(printer); - } else { - std::unique_ptr single_generator( - new MessageFieldGenerator(descriptor_, presenceIndex_, this->options())); - single_generator->GenerateCodecCode(printer); - } - printer->Print(";\n"); - printer->Print( - variables_, - "private readonly pbc::RepeatedField<$type_name$> $name$_ = new pbc::RepeatedField<$type_name$>();\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ pbc::RepeatedField<$type_name$> $property_name$ {\n" - " get { return $name$_; }\n" - "}\n"); -} - -void RepeatedMessageFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "$name$_.Add(other.$name$_);\n"); -} - -void RepeatedMessageFieldGenerator::GenerateParsingCode(io::Printer* printer) { - GenerateParsingCode(printer, true); -} - -void RepeatedMessageFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { - printer->Print( - variables_, - 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_, - use_write_context - ? "$name$_.WriteTo(ref output, _repeated_$name$_codec);\n" - : "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); -} - -void RepeatedMessageFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "size += $name$_.CalculateSize(_repeated_$name$_codec);\n"); -} - -void RepeatedMessageFieldGenerator::WriteHash(io::Printer* printer) { - printer->Print( - variables_, - "hash ^= $name$_.GetHashCode();\n"); -} - -void RepeatedMessageFieldGenerator::WriteEquals(io::Printer* printer) { - printer->Print( - variables_, - "if(!$name$_.Equals(other.$name$_)) return false;\n"); -} - -void RepeatedMessageFieldGenerator::WriteToString(io::Printer* printer) { - variables_["field_name"] = GetFieldName(descriptor_); - printer->Print( - variables_, - "PrintField(\"$field_name$\", $name$_, writer);\n"); -} - -void RepeatedMessageFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$name$_ = other.$name$_.Clone();\n"); -} - -void RepeatedMessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) { -} - -void RepeatedMessageFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::RepeatedExtension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::RepeatedExtension<$extended_type$, $type_name$>($number$, "); - if (IsWrapperType(descriptor_)) { - std::unique_ptr single_generator( - new WrapperFieldGenerator(descriptor_, -1, this->options())); - single_generator->GenerateCodecCode(printer); - } else { - std::unique_ptr single_generator( - new MessageFieldGenerator(descriptor_, -1, this->options())); - single_generator->GenerateCodecCode(printer); - } - printer->Print(");\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h deleted file mode 100644 index 026efea85..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h +++ /dev/null @@ -1,77 +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_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -struct Options; - -class RepeatedMessageFieldGenerator : public FieldGeneratorBase { - public: - RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~RepeatedMessageFieldGenerator(); - - RepeatedMessageFieldGenerator(const RepeatedMessageFieldGenerator&) = delete; - RepeatedMessageFieldGenerator& operator=( - const RepeatedMessageFieldGenerator&) = delete; - - 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) override; - virtual void WriteEquals(io::Printer* printer) override; - virtual void WriteToString(io::Printer* printer) override; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc deleted file mode 100644 index 0eacf91ce..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc +++ /dev/null @@ -1,145 +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 -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { -} - -RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() { - -} - -void RepeatedPrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { - printer->Print( - variables_, - "private static readonly pb::FieldCodec<$type_name$> _repeated_$name$_codec\n" - " = pb::FieldCodec.For$capitalized_type_name$($tag$);\n"); - printer->Print(variables_, - "private readonly pbc::RepeatedField<$type_name$> $name$_ = new pbc::RepeatedField<$type_name$>();\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ pbc::RepeatedField<$type_name$> $property_name$ {\n" - " get { return $name$_; }\n" - "}\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "$name$_.Add(other.$name$_);\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer) { - GenerateParsingCode(printer, true); -} - -void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { - printer->Print( - variables_, - 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_, - use_write_context - ? "$name$_.WriteTo(ref output, _repeated_$name$_codec);\n" - : "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { - printer->Print( - variables_, - "size += $name$_.CalculateSize(_repeated_$name$_codec);\n"); -} - -void RepeatedPrimitiveFieldGenerator::WriteHash(io::Printer* printer) { - printer->Print( - variables_, - "hash ^= $name$_.GetHashCode();\n"); -} -void RepeatedPrimitiveFieldGenerator::WriteEquals(io::Printer* printer) { - printer->Print( - variables_, - "if(!$name$_.Equals(other.$name$_)) return false;\n"); -} -void RepeatedPrimitiveFieldGenerator::WriteToString(io::Printer* printer) { - printer->Print(variables_, - "PrintField(\"$descriptor_name$\", $name$_, writer);\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$name$_ = other.$name$_.Clone();\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateFreezingCode(io::Printer* printer) { -} - -void RepeatedPrimitiveFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::RepeatedExtension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::RepeatedExtension<$extended_type$, $type_name$>($number$, pb::FieldCodec.For$capitalized_type_name$($tag$));\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h deleted file mode 100644 index bdd12a02f..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h +++ /dev/null @@ -1,73 +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_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase { - public: - RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, const Options* options); - ~RepeatedPrimitiveFieldGenerator(); - - RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) = delete; - RepeatedPrimitiveFieldGenerator& operator=(const RepeatedPrimitiveFieldGenerator&) = delete; - - 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) override; - virtual void WriteEquals(io::Printer* printer) override; - virtual void WriteToString(io::Printer* printer) override; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc deleted file mode 100644 index 7157e6ee1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc +++ /dev/null @@ -1,75 +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 -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -SourceGeneratorBase::SourceGeneratorBase( - const Options *options) : options_(options) { -} - -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() { - return this->options()->internal_access ? "internal" : "public"; -} - -const Options* SourceGeneratorBase::options() { - return this->options_; -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h deleted file mode 100644 index 17a526916..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h +++ /dev/null @@ -1,71 +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_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ - -#include - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -struct Options; - -class SourceGeneratorBase { - protected: - SourceGeneratorBase(const Options* options); - virtual ~SourceGeneratorBase(); - - SourceGeneratorBase(const SourceGeneratorBase&) = delete; - SourceGeneratorBase& operator=(const SourceGeneratorBase&) = delete; - - std::string class_access_level(); - const Options* options(); - - // Write any attributes used to decorate generated function members (methods and properties). - // Should not be used to decorate types. - void WriteGeneratedCodeAttributes(io::Printer* printer); - - private: - const Options *options_; -}; - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ - diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc deleted file mode 100644 index e638dd862..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc +++ /dev/null @@ -1,308 +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 -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -WrapperFieldGenerator::WrapperFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, const Options *options) - : FieldGeneratorBase(descriptor, presenceIndex, options) { - variables_["has_property_check"] = name() + "_ != null"; - variables_["has_not_property_check"] = name() + "_ == null"; - const FieldDescriptor* wrapped_field = descriptor->message_type()->field(0); - is_value_type = wrapped_field->type() != FieldDescriptor::TYPE_STRING && - wrapped_field->type() != FieldDescriptor::TYPE_BYTES; - if (is_value_type) { - variables_["nonnullable_type_name"] = type_name(wrapped_field); - } -} - -WrapperFieldGenerator::~WrapperFieldGenerator() { -} - -void WrapperFieldGenerator::GenerateMembers(io::Printer* printer) { - printer->Print( - variables_, - "private static readonly pb::FieldCodec<$type_name$> _single_$name$_codec = "); - GenerateCodecCode(printer); - printer->Print( - variables_, - ";\n" - "private $type_name$ $name$_;\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $name$_; }\n" - " set {\n" - " $name$_ = value;\n" - " }\n" - "}\n\n"); - if (SupportsPresenceApi(descriptor_)) { - printer->Print( - variables_, - "/// Gets whether the $descriptor_name$ field is set\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ bool Has$property_name$ {\n" - " get { return $name$_ != null; }\n" - "}\n\n"); - printer->Print( - variables_, - "/// Clears the value of the $descriptor_name$ field\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ void Clear$property_name$() {\n" - " $name$_ = null;\n" - "}\n"); - } -} - -void WrapperFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print( - variables_, - "if (other.$has_property_check$) {\n" - " if ($has_not_property_check$ || other.$property_name$ != $default_value$) {\n" - " $property_name$ = other.$property_name$;\n" - " }\n" - "}\n"); -} - -void WrapperFieldGenerator::GenerateParsingCode(io::Printer* printer) { - GenerateParsingCode(printer, true); -} - -void WrapperFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { - printer->Print( - variables_, - 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_, - 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) { - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " size += _single_$name$_codec.CalculateSizeWithTag($property_name$);\n" - "}\n"); -} - -void WrapperFieldGenerator::WriteHash(io::Printer* printer) { - const char *text = "if ($has_property_check$) hash ^= $property_name$.GetHashCode();\n"; - if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_FLOAT) { - text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode($property_name$);\n"; - } - else if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_DOUBLE) { - text = "if ($has_property_check$) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode($property_name$);\n"; - } - printer->Print(variables_, text); -} - -void WrapperFieldGenerator::WriteEquals(io::Printer* printer) { - const char *text = "if ($property_name$ != other.$property_name$) return false;\n"; - if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_FLOAT) { - text = "if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n"; - } - else if (descriptor_->message_type()->field(0)->type() == FieldDescriptor::TYPE_DOUBLE) { - text = "if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals($property_name$, other.$property_name$)) return false;\n"; - } - printer->Print(variables_, text); -} - -void WrapperFieldGenerator::WriteToString(io::Printer* printer) { - // TODO: Implement if we ever actually need it... -} - -void WrapperFieldGenerator::GenerateCloningCode(io::Printer* printer) { - printer->Print(variables_, - "$property_name$ = other.$property_name$;\n"); -} - -void WrapperFieldGenerator::GenerateCodecCode(io::Printer* printer) { - if (is_value_type) { - printer->Print( - variables_, - "pb::FieldCodec.ForStructWrapper<$nonnullable_type_name$>($tag$)"); - } else { - printer->Print( - variables_, - "pb::FieldCodec.ForClassWrapper<$type_name$>($tag$)"); - } -} - -void WrapperFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); -} - -WrapperOneofFieldGenerator::WrapperOneofFieldGenerator( - const FieldDescriptor* descriptor, int presenceIndex, const Options *options) - : WrapperFieldGenerator(descriptor, presenceIndex, options) { - SetCommonOneofFieldVariables(&variables_); -} - -WrapperOneofFieldGenerator::~WrapperOneofFieldGenerator() { -} - -void WrapperOneofFieldGenerator::GenerateMembers(io::Printer* printer) { - // Note: deliberately _oneof_$name$_codec, not _$oneof_name$_codec... we have one codec per field. - printer->Print( - variables_, - "private static readonly pb::FieldCodec<$type_name$> _oneof_$name$_codec = "); - GenerateCodecCode(printer); - printer->Print(";\n"); - WritePropertyDocComment(printer, descriptor_); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : ($type_name$) null; }\n" - " set {\n" - " $oneof_name$_ = value;\n" - " $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None : $oneof_property_name$OneofCase.$oneof_case_name$;\n" - " }\n" - "}\n"); - if (SupportsPresenceApi(descriptor_)) { - printer->Print( - variables_, - "/// Gets whether the \"$descriptor_name$\" field is set\n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ bool Has$property_name$ {\n" - " get { return $oneof_name$Case_ == $oneof_property_name$OneofCase.$oneof_case_name$; }\n" - "}\n"); - printer->Print( - variables_, - "/// Clears the value of the oneof if it's currently set to \"$descriptor_name$\" \n"); - AddPublicMemberAttributes(printer); - printer->Print( - variables_, - "$access_level$ void Clear$property_name$() {\n" - " if ($has_property_check$) {\n" - " Clear$oneof_property_name$();\n" - " }\n" - "}\n"); - } -} - -void WrapperOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) { - printer->Print(variables_, "$property_name$ = other.$property_name$;\n"); -} - -void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) { - GenerateParsingCode(printer, true); -} - -void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { - printer->Print( - variables_, - 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_, - 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) { - // TODO: I suspect this is wrong... - printer->Print( - variables_, - "if ($has_property_check$) {\n" - " size += _oneof_$name$_codec.CalculateSizeWithTag($property_name$);\n" - "}\n"); -} - -} // namespace csharp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h deleted file mode 100644 index cc8a3137d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h +++ /dev/null @@ -1,97 +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_COMPILER_CSHARP_WRAPPER_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_CSHARP_WRAPPER_FIELD_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace csharp { - -struct Options; - -class WrapperFieldGenerator : public FieldGeneratorBase { - public: - WrapperFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~WrapperFieldGenerator(); - - WrapperFieldGenerator(const WrapperFieldGenerator&) = delete; - WrapperFieldGenerator& operator=(const WrapperFieldGenerator&) = delete; - - 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) 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 -}; - -class WrapperOneofFieldGenerator : public WrapperFieldGenerator { - public: - WrapperOneofFieldGenerator(const FieldDescriptor* descriptor, - int presenceIndex, - const Options *options); - ~WrapperOneofFieldGenerator(); - - WrapperOneofFieldGenerator(const WrapperOneofFieldGenerator&) = delete; - WrapperOneofFieldGenerator& operator=(const WrapperOneofFieldGenerator&) = delete; - - 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 -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_WRAPPER_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/context.cc b/depends/protobuf/src/google/protobuf/compiler/java/context.cc deleted file mode 100644 index cdc0d4475..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/context.cc +++ /dev/null @@ -1,202 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -Context::Context(const FileDescriptor* file, const Options& options) - : name_resolver_(new ClassNameResolver), options_(options) { - InitializeFieldGeneratorInfo(file); -} - -Context::~Context() {} - -ClassNameResolver* Context::GetNameResolver() const { - return name_resolver_.get(); -} - -namespace { -// Whether two fields have conflicting accessors (assuming name1 and name2 -// are different). name1 and name2 are field1 and field2's camel-case name -// respectively. -bool IsConflicting(const FieldDescriptor* field1, const std::string& name1, - const FieldDescriptor* field2, const std::string& name2, - std::string* info) { - if (field1->is_repeated()) { - if (field2->is_repeated()) { - // Both fields are repeated. - return false; - } else { - // field1 is repeated, and field2 is not. - if (name1 + "Count" == name2) { - *info = "both repeated field \"" + field1->name() + "\" and singular " + - "field \"" + field2->name() + "\" generate the method \"" + - "get" + name1 + "Count()\""; - return true; - } - if (name1 + "List" == name2) { - *info = "both repeated field \"" + field1->name() + "\" and singular " + - "field \"" + field2->name() + "\" generate the method \"" + - "get" + name1 + "List()\""; - return true; - } - // Well, there are obviously many more conflicting cases, but it probably - // doesn't worth the effort to exhaust all of them because they rarely - // happen and as we are continuing adding new methods/changing existing - // methods the number of different conflicting cases will keep growing. - // We can just add more cases here when they are found in the real world. - return false; - } - } else { - if (field2->is_repeated()) { - return IsConflicting(field2, name2, field1, name1, info); - } else { - // None of the two fields are repeated. - return false; - } - } -} -} // namespace - -void Context::InitializeFieldGeneratorInfo(const FileDescriptor* file) { - for (int i = 0; i < file->message_type_count(); ++i) { - InitializeFieldGeneratorInfoForMessage(file->message_type(i)); - } -} - -void Context::InitializeFieldGeneratorInfoForMessage( - const Descriptor* message) { - for (int i = 0; i < message->nested_type_count(); ++i) { - 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)); - } - InitializeFieldGeneratorInfoForFields(fields); - - for (int i = 0; i < message->oneof_decl_count(); ++i) { - const OneofDescriptor* oneof = message->oneof_decl(i); - OneofGeneratorInfo info; - info.name = UnderscoresToCamelCase(oneof->name(), false); - info.capitalized_name = UnderscoresToCamelCase(oneof->name(), true); - oneof_generator_info_map_[oneof] = info; - } -} - -void Context::InitializeFieldGeneratorInfoForFields( - const std::vector& fields) { - // Find out all fields that conflict with some other field in the same - // message. - std::vector is_conflict(fields.size()); - std::vector conflict_reason(fields.size()); - for (int i = 0; i < fields.size(); ++i) { - const FieldDescriptor* field = fields[i]; - const std::string& name = UnderscoresToCapitalizedCamelCase(field); - for (int j = i + 1; j < fields.size(); ++j) { - const FieldDescriptor* other = fields[j]; - const std::string& other_name = UnderscoresToCapitalizedCamelCase(other); - if (name == other_name) { - is_conflict[i] = is_conflict[j] = true; - conflict_reason[i] = conflict_reason[j] = - "capitalized name of field \"" + field->name() + - "\" conflicts with field \"" + other->name() + "\""; - } else if (IsConflicting(field, name, other, other_name, - &conflict_reason[j])) { - is_conflict[i] = is_conflict[j] = true; - conflict_reason[i] = conflict_reason[j]; - } - } - if (is_conflict[i]) { - GOOGLE_LOG(WARNING) << "field \"" << field->full_name() << "\" is conflicting " - << "with another field: " << conflict_reason[i]; - } - } - for (int i = 0; i < fields.size(); ++i) { - const FieldDescriptor* field = fields[i]; - FieldGeneratorInfo info; - info.name = CamelCaseFieldName(field); - info.capitalized_name = UnderscoresToCapitalizedCamelCase(field); - // For fields conflicting with some other fields, we append the field - // number to their field names in generated code to avoid conflicts. - if (is_conflict[i]) { - info.name += StrCat(field->number()); - info.capitalized_name += StrCat(field->number()); - info.disambiguated_reason = conflict_reason[i]; - } - field_generator_info_map_[field] = info; - } -} - -const FieldGeneratorInfo* Context::GetFieldGeneratorInfo( - const FieldDescriptor* field) const { - const FieldGeneratorInfo* result = - FindOrNull(field_generator_info_map_, field); - if (result == NULL) { - GOOGLE_LOG(FATAL) << "Can not find FieldGeneratorInfo for field: " - << field->full_name(); - } - return result; -} - -const OneofGeneratorInfo* Context::GetOneofGeneratorInfo( - const OneofDescriptor* oneof) const { - const OneofGeneratorInfo* result = - FindOrNull(oneof_generator_info_map_, oneof); - if (result == NULL) { - GOOGLE_LOG(FATAL) << "Can not find OneofGeneratorInfo for oneof: " - << oneof->name(); - } - return result; -} - -// Does this message class have generated parsing, serialization, and other -// standard methods for which reflection-based fallback implementations exist? -bool Context::HasGeneratedMethods(const Descriptor* descriptor) const { - return options_.enforce_lite || - descriptor->file()->options().optimize_for() != FileOptions::CODE_SIZE; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/context.h b/depends/protobuf/src/google/protobuf/compiler/java/context.h deleted file mode 100644 index c224ab73f..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/context.h +++ /dev/null @@ -1,113 +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_COMPILER_JAVA_CONTEXT_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_CONTEXT_H__ - -#include -#include -#include - -#include -#include - -namespace google { -namespace protobuf { -class FileDescriptor; -class FieldDescriptor; -class OneofDescriptor; -class Descriptor; -class EnumDescriptor; -namespace compiler { -namespace java { -class ClassNameResolver; // name_resolver.h -} -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -struct FieldGeneratorInfo; -struct OneofGeneratorInfo; -// A context object holds the information that is shared among all code -// generators. -class Context { - public: - Context(const FileDescriptor* file, const Options& options); - ~Context(); - - // Get the name resolver associated with this context. The resolver - // can be used to map descriptors to Java class names. - ClassNameResolver* GetNameResolver() const; - - // Get the FieldGeneratorInfo for a given field. - const FieldGeneratorInfo* GetFieldGeneratorInfo( - const FieldDescriptor* field) const; - - // Get the OneofGeneratorInfo for a given oneof. - const OneofGeneratorInfo* GetOneofGeneratorInfo( - const OneofDescriptor* oneof) const; - - const Options& options() const { return options_; } - - // Enforces all the files (including transitive dependencies) to use - // LiteRuntime. - - bool EnforceLite() const { return options_.enforce_lite; } - - // Does this message class have generated parsing, serialization, and other - // standard methods for which reflection-based fallback implementations exist? - bool HasGeneratedMethods(const Descriptor* descriptor) const; - - private: - void InitializeFieldGeneratorInfo(const FileDescriptor* file); - void InitializeFieldGeneratorInfoForMessage(const Descriptor* message); - void InitializeFieldGeneratorInfoForFields( - const std::vector& fields); - - std::unique_ptr name_resolver_; - std::map - field_generator_info_map_; - std::map - oneof_generator_info_map_; - Options options_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Context); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_CONTEXT_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/doc_comment.cc b/depends/protobuf/src/google/protobuf/compiler/java/doc_comment.cc deleted file mode 100644 index 066bff643..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/doc_comment.cc +++ /dev/null @@ -1,444 +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 java { - -std::string EscapeJavadoc(const std::string& input) { - std::string result; - result.reserve(input.size() * 2); - - char prev = '*'; - - for (std::string::size_type i = 0; i < input.size(); i++) { - char c = input[i]; - switch (c) { - case '*': - // Avoid "/*". - if (prev == '/') { - result.append("*"); - } else { - result.push_back(c); - } - break; - case '/': - // Avoid "*/". - if (prev == '*') { - result.append("/"); - } else { - result.push_back(c); - } - break; - case '@': - // '@' starts javadoc tags including the @deprecated tag, which will - // cause a compile-time error if inserted before a declaration that - // does not have a corresponding @Deprecated annotation. - result.append("@"); - break; - case '<': - // Avoid interpretation as HTML. - result.append("<"); - break; - case '>': - // Avoid interpretation as HTML. - result.append(">"); - break; - case '&': - // Avoid interpretation as HTML. - result.append("&"); - break; - case '\\': - // Java interprets Unicode escape sequences anywhere! - result.append("\"); - break; - default: - result.push_back(c); - break; - } - - prev = c; - } - - return result; -} - -static void WriteDocCommentBodyForLocation(io::Printer* printer, - const SourceLocation& location) { - std::string comments = location.leading_comments.empty() - ? location.trailing_comments - : location.leading_comments; - if (!comments.empty()) { - // TODO(kenton): Ideally we should parse the comment text as Markdown and - // write it back as HTML, but this requires a Markdown parser. For now - // we just use
 to get fixed-width text formatting.
-
-    // If the comment itself contains block comment start or end markers,
-    // HTML-escape them so that they don't accidentally close the doc comment.
-    comments = EscapeJavadoc(comments);
-
-    std::vector lines = Split(comments, "\n");
-    while (!lines.empty() && lines.back().empty()) {
-      lines.pop_back();
-    }
-
-    printer->Print(" * 
\n");
-    for (int i = 0; i < lines.size(); i++) {
-      // Most lines should start with a space.  Watch out for lines that start
-      // with a /, since putting that right after the leading asterisk will
-      // close the comment.
-      if (!lines[i].empty() && lines[i][0] == '/') {
-        printer->Print(" * $line$\n", "line", lines[i]);
-      } else {
-        printer->Print(" *$line$\n", "line", lines[i]);
-      }
-    }
-    printer->Print(
-        " * 
\n" - " *\n"); - } -} - -template -static void WriteDocCommentBody(io::Printer* printer, - const DescriptorType* descriptor) { - SourceLocation location; - if (descriptor->GetSourceLocation(&location)) { - WriteDocCommentBodyForLocation(printer, location); - } -} - -static std::string FirstLineOf(const std::string& value) { - std::string result = value; - - std::string::size_type pos = result.find_first_of('\n'); - if (pos != std::string::npos) { - result.erase(pos); - } - - // If line ends in an opening brace, make it "{ ... }" so it looks nice. - if (!result.empty() && result[result.size() - 1] == '{') { - result.append(" ... }"); - } - - return result; -} - -void WriteMessageDocComment(io::Printer* printer, const Descriptor* message) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, message); - printer->Print( - " * Protobuf type {@code $fullname$}\n" - " */\n", - "fullname", EscapeJavadoc(message->full_name())); -} - -void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field) { - // We start the comment with the main body based on the comments from the - // .proto file (if present). We then continue with the field declaration, - // e.g.: - // optional string foo = 5; - // And then we end with the javadoc tags if applicable. - // If the field is a group, the debug string might end with {. - printer->Print("/**\n"); - WriteDocCommentBody(printer, field); - printer->Print(" * $def$\n", "def", - EscapeJavadoc(FirstLineOf(field->DebugString()))); - 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; - } - - std::string startLine = "0"; - SourceLocation location; - if (field->GetSourceLocation(&location)) { - startLine = std::to_string(location.start_line); - } - - printer->Print(" * @deprecated $name$ is deprecated.\n", "name", - field->full_name()); - printer->Print(" * See $file$;l=$line$\n", "file", field->file()->name(), - "line", startLine); -} - -void WriteFieldAccessorDocComment(io::Printer* printer, - const FieldDescriptor* field, - const FieldAccessorType type, - const bool builder) { - printer->Print("/**\n"); - 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", - field->camelcase_name()); - break; - case GETTER: - printer->Print(" * @return The $name$.\n", "name", - field->camelcase_name()); - break; - case SETTER: - printer->Print(" * @param value The $name$ to set.\n", "name", - field->camelcase_name()); - break; - case CLEARER: - // Print nothing - break; - // Repeated - case LIST_COUNT: - printer->Print(" * @return The count of $name$.\n", "name", - field->camelcase_name()); - break; - case LIST_GETTER: - printer->Print(" * @return A list containing the $name$.\n", "name", - field->camelcase_name()); - break; - case LIST_INDEXED_GETTER: - printer->Print(" * @param index The index of the element to return.\n"); - printer->Print(" * @return The $name$ at the given index.\n", "name", - field->camelcase_name()); - break; - case LIST_INDEXED_SETTER: - printer->Print(" * @param index The index to set the value at.\n"); - printer->Print(" * @param value The $name$ to set.\n", "name", - field->camelcase_name()); - break; - case LIST_ADDER: - printer->Print(" * @param value The $name$ to add.\n", "name", - field->camelcase_name()); - break; - case LIST_MULTI_ADDER: - printer->Print(" * @param values The $name$ to add.\n", "name", - field->camelcase_name()); - break; - } - if (builder) { - printer->Print(" * @return This builder for chaining.\n"); - } - printer->Print(" */\n"); -} - -void WriteFieldEnumValueAccessorDocComment(io::Printer* printer, - const FieldDescriptor* field, - const FieldAccessorType type, - const bool builder) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, field); - printer->Print(" * $def$\n", "def", - EscapeJavadoc(FirstLineOf(field->DebugString()))); - WriteDeprecatedJavadoc(printer, field, type); - switch (type) { - case HAZZER: - // Should never happen - break; - case GETTER: - printer->Print( - " * @return The enum numeric value on the wire for $name$.\n", "name", - field->camelcase_name()); - break; - case SETTER: - printer->Print( - " * @param value The enum numeric value on the wire for $name$ to " - "set.\n", - "name", field->camelcase_name()); - break; - case CLEARER: - // Print nothing - break; - // Repeated - case LIST_COUNT: - // Should never happen - break; - case LIST_GETTER: - printer->Print( - " * @return A list containing the enum numeric values on the wire " - "for $name$.\n", - "name", field->camelcase_name()); - break; - case LIST_INDEXED_GETTER: - printer->Print(" * @param index The index of the value to return.\n"); - printer->Print( - " * @return The enum numeric value on the wire of $name$ at the " - "given index.\n", - "name", field->camelcase_name()); - break; - case LIST_INDEXED_SETTER: - printer->Print(" * @param index The index to set the value at.\n"); - printer->Print( - " * @param value The enum numeric value on the wire for $name$ to " - "set.\n", - "name", field->camelcase_name()); - break; - case LIST_ADDER: - printer->Print( - " * @param value The enum numeric value on the wire for $name$ to " - "add.\n", - "name", field->camelcase_name()); - break; - case LIST_MULTI_ADDER: - printer->Print( - " * @param values The enum numeric values on the wire for $name$ to " - "add.\n", - "name", field->camelcase_name()); - break; - } - if (builder) { - printer->Print(" * @return This builder for chaining.\n"); - } - printer->Print(" */\n"); -} - -void WriteFieldStringBytesAccessorDocComment(io::Printer* printer, - const FieldDescriptor* field, - const FieldAccessorType type, - const bool builder) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, field); - printer->Print(" * $def$\n", "def", - EscapeJavadoc(FirstLineOf(field->DebugString()))); - WriteDeprecatedJavadoc(printer, field, type); - switch (type) { - case HAZZER: - // Should never happen - break; - case GETTER: - printer->Print(" * @return The bytes for $name$.\n", "name", - field->camelcase_name()); - break; - case SETTER: - printer->Print(" * @param value The bytes for $name$ to set.\n", "name", - field->camelcase_name()); - break; - case CLEARER: - // Print nothing - break; - // Repeated - case LIST_COUNT: - // Should never happen - break; - case LIST_GETTER: - printer->Print(" * @return A list containing the bytes for $name$.\n", - "name", field->camelcase_name()); - break; - case LIST_INDEXED_GETTER: - printer->Print(" * @param index The index of the value to return.\n"); - printer->Print(" * @return The bytes of the $name$ at the given index.\n", - "name", field->camelcase_name()); - break; - case LIST_INDEXED_SETTER: - printer->Print(" * @param index The index to set the value at.\n"); - printer->Print(" * @param value The bytes of the $name$ to set.\n", - "name", field->camelcase_name()); - break; - case LIST_ADDER: - printer->Print(" * @param value The bytes of the $name$ to add.\n", - "name", field->camelcase_name()); - break; - case LIST_MULTI_ADDER: - printer->Print(" * @param values The bytes of the $name$ to add.\n", - "name", field->camelcase_name()); - break; - } - if (builder) { - printer->Print(" * @return This builder for chaining.\n"); - } - printer->Print(" */\n"); -} - -// Enum - -void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, enum_); - printer->Print( - " * Protobuf enum {@code $fullname$}\n" - " */\n", - "fullname", EscapeJavadoc(enum_->full_name())); -} - -void WriteEnumValueDocComment(io::Printer* printer, - const EnumValueDescriptor* value) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, value); - printer->Print( - " * $def$\n" - " */\n", - "def", EscapeJavadoc(FirstLineOf(value->DebugString()))); -} - -void WriteServiceDocComment(io::Printer* printer, - const ServiceDescriptor* service) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, service); - printer->Print( - " * Protobuf service {@code $fullname$}\n" - " */\n", - "fullname", EscapeJavadoc(service->full_name())); -} - -void WriteMethodDocComment(io::Printer* printer, - const MethodDescriptor* method) { - printer->Print("/**\n"); - WriteDocCommentBody(printer, method); - printer->Print( - " * $def$\n" - " */\n", - "def", EscapeJavadoc(FirstLineOf(method->DebugString()))); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/doc_comment.h b/depends/protobuf/src/google/protobuf/compiler/java/doc_comment.h deleted file mode 100644 index 7f687781f..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/doc_comment.h +++ /dev/null @@ -1,102 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__ - -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -enum FieldAccessorType { - HAZZER, - GETTER, - SETTER, - CLEARER, - // Repeated - LIST_COUNT, - LIST_GETTER, - LIST_INDEXED_GETTER, - LIST_INDEXED_SETTER, - LIST_ADDER, - LIST_MULTI_ADDER -}; - -void WriteMessageDocComment(io::Printer* printer, const Descriptor* message); -void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field); -void WriteFieldAccessorDocComment(io::Printer* printer, - const FieldDescriptor* field, - const FieldAccessorType type, - const bool builder = false); -void WriteFieldEnumValueAccessorDocComment(io::Printer* printer, - const FieldDescriptor* field, - const FieldAccessorType type, - const bool builder = false); -void WriteFieldStringBytesAccessorDocComment(io::Printer* printer, - const FieldDescriptor* field, - const FieldAccessorType type, - const bool builder = false); -void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_); -void WriteEnumValueDocComment(io::Printer* printer, - const EnumValueDescriptor* value); -void WriteServiceDocComment(io::Printer* printer, - const ServiceDescriptor* service); -void WriteMethodDocComment(io::Printer* printer, - const MethodDescriptor* method); - -// Exposed for testing only. -PROTOC_EXPORT std::string EscapeJavadoc(const std::string& input); - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum.cc b/depends/protobuf/src/google/protobuf/compiler/java/enum.cc deleted file mode 100644 index 0cab93c39..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum.cc +++ /dev/null @@ -1,397 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, - bool immutable_api, Context* context) - : descriptor_(descriptor), - immutable_api_(immutable_api), - context_(context), - name_resolver_(context->GetNameResolver()) { - for (int i = 0; i < descriptor_->value_count(); i++) { - const EnumValueDescriptor* value = descriptor_->value(i); - const EnumValueDescriptor* canonical_value = - descriptor_->FindValueByNumber(value->number()); - - if (value == canonical_value) { - canonical_values_.push_back(value); - } else { - Alias alias; - alias.value = value; - alias.canonical_value = canonical_value; - aliases_.push_back(alias); - } - } -} - -EnumGenerator::~EnumGenerator() {} - -void EnumGenerator::Generate(io::Printer* printer) { - WriteEnumDocComment(printer, descriptor_); - MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_); - printer->Print( - "$deprecation$public enum $classname$\n" - " implements com.google.protobuf.ProtocolMessageEnum {\n", - "classname", descriptor_->name(), "deprecation", - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""); - printer->Annotate("classname", descriptor_); - printer->Indent(); - - bool ordinal_is_index = true; - std::string index_text = "ordinal()"; - for (int i = 0; i < canonical_values_.size(); i++) { - if (canonical_values_[i]->index() != i) { - ordinal_is_index = false; - index_text = "index"; - break; - } - } - - for (int i = 0; i < canonical_values_.size(); i++) { - std::map vars; - vars["name"] = canonical_values_[i]->name(); - vars["index"] = StrCat(canonical_values_[i]->index()); - vars["number"] = StrCat(canonical_values_[i]->number()); - WriteEnumValueDocComment(printer, canonical_values_[i]); - if (canonical_values_[i]->options().deprecated()) { - printer->Print("@java.lang.Deprecated\n"); - } - if (ordinal_is_index) { - printer->Print(vars, "$name$($number$),\n"); - } else { - printer->Print(vars, "$name$($index$, $number$),\n"); - } - printer->Annotate("name", canonical_values_[i]); - } - - if (SupportUnknownEnumValue(descriptor_->file())) { - if (ordinal_is_index) { - printer->Print("${$UNRECOGNIZED$}$(-1),\n", "{", "", "}", ""); - } else { - printer->Print("${$UNRECOGNIZED$}$(-1, -1),\n", "{", "", "}", ""); - } - printer->Annotate("{", "}", descriptor_); - } - - printer->Print( - ";\n" - "\n"); - - // ----------------------------------------------------------------- - - for (int i = 0; i < aliases_.size(); i++) { - std::map vars; - vars["classname"] = descriptor_->name(); - vars["name"] = aliases_[i].value->name(); - vars["canonical_name"] = aliases_[i].canonical_value->name(); - WriteEnumValueDocComment(printer, aliases_[i].value); - printer->Print( - vars, "public static final $classname$ $name$ = $canonical_name$;\n"); - printer->Annotate("name", aliases_[i].value); - } - - for (int i = 0; i < descriptor_->value_count(); i++) { - std::map vars; - vars["name"] = descriptor_->value(i)->name(); - 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, - "$deprecation$public static final int ${$$name$_VALUE$}$ = " - "$number$;\n"); - printer->Annotate("{", "}", descriptor_->value(i)); - } - printer->Print("\n"); - - // ----------------------------------------------------------------- - - printer->Print( - "\n" - "public final int getNumber() {\n"); - if (SupportUnknownEnumValue(descriptor_->file())) { - if (ordinal_is_index) { - printer->Print( - " if (this == UNRECOGNIZED) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"Can't get the number of an unknown enum value.\");\n" - " }\n"); - } else { - printer->Print( - " if (index == -1) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"Can't get the number of an unknown enum value.\");\n" - " }\n"); - } - } - printer->Print( - " return value;\n" - "}\n" - "\n" - "/**\n" - " * @param value The numeric wire value of the corresponding enum " - "entry.\n" - " * @return The enum associated with the given numeric wire value.\n" - " * @deprecated Use {@link #forNumber(int)} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public static $classname$ valueOf(int value) {\n" - " return forNumber(value);\n" - "}\n" - "\n" - "/**\n" - " * @param value The numeric wire value of the corresponding enum " - "entry.\n" - " * @return The enum associated with the given numeric wire value.\n" - " */\n" - "public static $classname$ forNumber(int value) {\n" - " switch (value) {\n", - "classname", descriptor_->name()); - printer->Indent(); - printer->Indent(); - - for (int i = 0; i < canonical_values_.size(); i++) { - printer->Print("case $number$: return $name$;\n", "name", - canonical_values_[i]->name(), "number", - StrCat(canonical_values_[i]->number())); - } - - printer->Outdent(); - printer->Outdent(); - printer->Print( - " default: return null;\n" - " }\n" - "}\n" - "\n" - "public static com.google.protobuf.Internal.EnumLiteMap<$classname$>\n" - " internalGetValueMap() {\n" - " return internalValueMap;\n" - "}\n" - "private static final com.google.protobuf.Internal.EnumLiteMap<\n" - " $classname$> internalValueMap =\n" - " new com.google.protobuf.Internal.EnumLiteMap<$classname$>() {\n" - " public $classname$ findValueByNumber(int number) {\n" - " return $classname$.forNumber(number);\n" - " }\n" - " };\n" - "\n", - "classname", descriptor_->name()); - - // ----------------------------------------------------------------- - // Reflection - - if (HasDescriptorMethods(descriptor_, context_->EnforceLite())) { - printer->Print( - "public final com.google.protobuf.Descriptors.EnumValueDescriptor\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" - " getDescriptorForType() {\n" - " return getDescriptor();\n" - "}\n" - "public static final com.google.protobuf.Descriptors.EnumDescriptor\n" - " getDescriptor() {\n", - "index_text", index_text); - - // TODO(kenton): Cache statically? Note that we can't access descriptors - // at module init time because it wouldn't work with descriptor.proto, but - // we can cache the value the first time getDescriptor() is called. - if (descriptor_->containing_type() == NULL) { - // The class generated for the File fully populates the descriptor with - // extensions in both the mutable and immutable cases. (In the mutable api - // this is accomplished by attempting to load the immutable outer class). - printer->Print( - " return $file$.getDescriptor().getEnumTypes().get($index$);\n", - "file", - name_resolver_->GetClassName(descriptor_->file(), immutable_api_), - "index", StrCat(descriptor_->index())); - } else { - printer->Print( - " return $parent$.$descriptor$.getEnumTypes().get($index$);\n", - "parent", - name_resolver_->GetClassName(descriptor_->containing_type(), - immutable_api_), - "descriptor", - descriptor_->containing_type() - ->options() - .no_standard_descriptor_accessor() - ? "getDefaultInstance().getDescriptorForType()" - : "getDescriptor()", - "index", StrCat(descriptor_->index())); - } - - printer->Print( - "}\n" - "\n" - "private static final $classname$[] VALUES = ", - "classname", descriptor_->name()); - - if (CanUseEnumValues()) { - // If the constants we are going to output are exactly the ones we - // have declared in the Java enum in the same order, then we can use - // the values() method that the Java compiler automatically generates - // 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( - "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( - "\n" - "public static $classname$ valueOf(\n" - " com.google.protobuf.Descriptors.EnumValueDescriptor desc) {\n" - " if (desc.getType() != getDescriptor()) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"EnumValueDescriptor is not for this type.\");\n" - " }\n", - "classname", descriptor_->name()); - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - " if (desc.getIndex() == -1) {\n" - " return UNRECOGNIZED;\n" - " }\n"); - } - printer->Print( - " return VALUES[desc.getIndex()];\n" - "}\n" - "\n"); - - if (!ordinal_is_index) { - printer->Print("private final int index;\n"); - } - } - - // ----------------------------------------------------------------- - - printer->Print("private final int value;\n\n"); - - if (ordinal_is_index) { - printer->Print("private $classname$(int value) {\n", "classname", - descriptor_->name()); - } else { - printer->Print("private $classname$(int index, int value) {\n", "classname", - descriptor_->name()); - } - if (HasDescriptorMethods(descriptor_, context_->EnforceLite()) && - !ordinal_is_index) { - printer->Print(" this.index = index;\n"); - } - printer->Print( - " this.value = value;\n" - "}\n"); - - printer->Print( - "\n" - "// @@protoc_insertion_point(enum_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - printer->Outdent(); - printer->Print("}\n\n"); -} - -bool EnumGenerator::CanUseEnumValues() { - if (canonical_values_.size() != descriptor_->value_count()) { - return false; - } - for (int i = 0; i < descriptor_->value_count(); i++) { - if (descriptor_->value(i)->name() != canonical_values_[i]->name()) { - return false; - } - } - return true; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum_field.cc b/depends/protobuf/src/google/protobuf/compiler/java/enum_field.cc deleted file mode 100644 index e64ee5bc2..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum_field.cc +++ /dev/null @@ -1,1150 +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 "google/protobuf/compiler/java/enum_field.h" - -#include -#include -#include - -#include "google/protobuf/stubs/logging.h" -#include "google/protobuf/stubs/common.h" -#include "google/protobuf/io/printer.h" -#include "google/protobuf/wire_format.h" -#include "google/protobuf/stubs/strutil.h" -#include "google/protobuf/compiler/java/context.h" -#include "google/protobuf/compiler/java/doc_comment.h" -#include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/name_resolver.h" - -// Must be last. -#include "google/protobuf/port_def.inc" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { - -void SetEnumVariables( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, ClassNameResolver* name_resolver, - std::map* variables, - Context* context) { - SetCommonFieldVariables(descriptor, info, variables); - - (*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))); - (*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->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); - if (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_message"] = - GenerateSetBit(messageBitIndex) + ";"; - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_message"] = ""; - (*variables)["set_has_field_bit_to_local"] = ""; - variables->insert({"is_field_present_message", - StrCat((*variables)["name"], "_ != ", - (*variables)["default"], ".getNumber()")}); - } - - // 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); - - (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_builder"] = - GenerateSetBit(builderBitIndex) + ";"; - (*variables)["clear_has_field_bit_builder"] = - GenerateClearBit(builderBitIndex) + ";"; - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - - if (SupportUnknownEnumValue(descriptor->file())) { - variables->insert( - {"unknown", StrCat((*variables)["type"], ".UNRECOGNIZED")}); - } else { - variables->insert({"unknown", (*variables)["default"]}); - } -} - -} // namespace - -// =================================================================== - -ImmutableEnumFieldGenerator::ImmutableEnumFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : descriptor_(descriptor), - message_bit_index_(messageBitIndex), - builder_bit_index_(builderBitIndex), - name_resolver_(context->GetNameResolver()) { - SetEnumVariables(descriptor, messageBitIndex, builderBitIndex, - context->GetFieldGeneratorInfo(descriptor), name_resolver_, - &variables_, context); -} - -ImmutableEnumFieldGenerator::~ImmutableEnumFieldGenerator() {} - -int ImmutableEnumFieldGenerator::GetMessageBitIndex() const { - return message_bit_index_; -} - -int ImmutableEnumFieldGenerator::GetBuilderBitIndex() const { - return builder_bit_index_; -} - -int ImmutableEnumFieldGenerator::GetNumBitsForMessage() const { - return HasHasbit(descriptor_) ? 1 : 0; -} - -int ImmutableEnumFieldGenerator::GetNumBitsForBuilder() const { return 1; } - -void ImmutableEnumFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$boolean has$capitalized_name$();\n"); - } - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Value();\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, "$deprecation$$type$ get$capitalized_name$();\n"); -} - -void ImmutableEnumFieldGenerator::GenerateMembers(io::Printer* printer) const { - printer->Print(variables_, "private int $name$_ = $default_number$;\n"); - PrintExtraFieldInfo(variables_, printer); - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - 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_, - "@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_, - "@java.lang.Override $deprecation$public $type$ " - "${$get$capitalized_name$$}$() {\n" - " $type$ result = $type$.forNumber($name$_);\n" - " return result == null ? $unknown$ : result;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutableEnumFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - printer->Print(variables_, "private int $name$_ = $default_number$;\n"); - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - 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_, - "@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" - " $name$_ = value;\n" - " $set_has_field_bit_builder$\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " $type$ result = $type$.forNumber($name$_);\n" - " return result == null ? $unknown$ : result;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " if (value == null) {\n" - " throw new NullPointerException();\n" - " }\n" - " $set_has_field_bit_builder$\n" - " $name$_ = value.getNumber();\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " $clear_has_field_bit_builder$\n" - " $name$_ = $default_number$;\n" - " onChanged();\n" - " return this;\n" - "}\n"); - 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 -} - -void ImmutableEnumFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $default_number$;\n"); -} - -void ImmutableEnumFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $default_number$;\n"); -} - -void ImmutableEnumFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - printer->Print(variables_, - "if (other.has$capitalized_name$()) {\n" - " set$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); - } else if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "if (other.$name$_ != $default_number$) {\n" - " set$capitalized_name$Value(other.get$capitalized_name$Value());\n" - "}\n"); - } else { - GOOGLE_LOG(FATAL) << "Can't reach here."; - } -} - -void ImmutableEnumFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($get_has_field_bit_from_local$) {\n" - " result.$name$_ = $name$_;\n"); - if (GetNumBitsForMessage() > 0) { - printer->Print(variables_, " $set_has_field_bit_to_local$;\n"); - } - printer->Print("}\n"); -} - -void ImmutableEnumFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print(variables_, - "$name$_ = input.readEnum();\n" - "$set_has_field_bit_builder$\n"); - } else { - 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" - " $name$_ = tmpRaw;\n" - " $set_has_field_bit_builder$\n" - "}\n"); - } -} - -void ImmutableEnumFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($is_field_present_message$) {\n" - " output.writeEnum($number$, $name$_);\n" - "}\n"); -} - -void ImmutableEnumFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($is_field_present_message$) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .computeEnumSize($number$, $name$_);\n" - "}\n"); -} - -void ImmutableEnumFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print(variables_, "if ($name$_ != other.$name$_) return false;\n"); -} - -void ImmutableEnumFieldGenerator::GenerateHashCode(io::Printer* printer) const { - printer->Print(variables_, - "hash = (37 * hash) + $constant_name$;\n" - "hash = (53 * hash) + $name$_;\n"); -} - -std::string ImmutableEnumFieldGenerator::GetBoxedType() const { - return name_resolver_->GetImmutableClassName(descriptor_->enum_type()); -} - -// =================================================================== - -ImmutableEnumOneofFieldGenerator::ImmutableEnumOneofFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutableEnumFieldGenerator(descriptor, messageBitIndex, builderBitIndex, - context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutableEnumOneofFieldGenerator::~ImmutableEnumOneofFieldGenerator() {} - -void ImmutableEnumOneofFieldGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - 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( - variables_, - "$deprecation$public int ${$get$capitalized_name$Value$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " return (java.lang.Integer) $oneof_name$_;\n" - " }\n" - " return $default_number$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " $type$ result = $type$.forNumber(\n" - " (java.lang.Integer) $oneof_name$_);\n" - " return result == null ? $unknown$ : result;\n" - " }\n" - " return $default$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutableEnumOneofFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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" - " }\n" - " return $default_number$;\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_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - " onChanged();\n" - " return this;\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" - " $type$ result = $type$.forNumber(\n" - " (java.lang.Integer) $oneof_name$_);\n" - " return result == null ? $unknown$ : result;\n" - " }\n" - " return $default$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " if (value == null) {\n" - " throw new NullPointerException();\n" - " }\n" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value.getNumber();\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " onChanged();\n" - " }\n" - " return this;\n" - "}\n"); - 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 { - // No-Op: Handled by single statement for the oneof -} - -void ImmutableEnumOneofFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "set$capitalized_name$Value(other.get$capitalized_name$Value());\n"); - } else { - printer->Print(variables_, - "set$capitalized_name$(other.get$capitalized_name$());\n"); - } -} - -void ImmutableEnumOneofFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print(variables_, - "int rawValue = input.readEnum();\n" - "$set_oneof_case_message$;\n" - "$oneof_name$_ = rawValue;\n"); - } else { - printer->Print(variables_, - "int rawValue = input.readEnum();\n" - "$type$ value =\n" - " $type$.forNumber(rawValue);\n" - "if (value == null) {\n" - " mergeUnknownVarintField($number$, rawValue);\n" - "} else {\n" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = rawValue;\n" - "}\n"); - } -} - -void ImmutableEnumOneofFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($has_oneof_case_message$) {\n" - " output.writeEnum($number$, ((java.lang.Integer) $oneof_name$_));\n" - "}\n"); -} - -void ImmutableEnumOneofFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($has_oneof_case_message$) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .computeEnumSize($number$, ((java.lang.Integer) $oneof_name$_));\n" - "}\n"); -} - -void ImmutableEnumOneofFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "if (get$capitalized_name$Value()\n" - " != other.get$capitalized_name$Value()) return false;\n"); - } else { - printer->Print( - variables_, - "if (!get$capitalized_name$()\n" - " .equals(other.get$capitalized_name$())) return false;\n"); - } -} - -void ImmutableEnumOneofFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print(variables_, - "hash = (37 * hash) + $constant_name$;\n" - "hash = (53 * hash) + get$capitalized_name$Value();\n"); - } else { - printer->Print( - variables_, - "hash = (37 * hash) + $constant_name$;\n" - "hash = (53 * hash) + get$capitalized_name$().getNumber();\n"); - } -} - -// =================================================================== - -RepeatedImmutableEnumFieldGenerator::RepeatedImmutableEnumFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutableEnumFieldGenerator(descriptor, messageBitIndex, builderBitIndex, - context) {} - -RepeatedImmutableEnumFieldGenerator::~RepeatedImmutableEnumFieldGenerator() {} - -int RepeatedImmutableEnumFieldGenerator::GetNumBitsForMessage() const { - return 0; -} - -int RepeatedImmutableEnumFieldGenerator::GetNumBitsForBuilder() const { - return 1; -} - -void RepeatedImmutableEnumFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print( - variables_, - "$deprecation$java.util.List<$type$> get$capitalized_name$List();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$$type$ get$capitalized_name$(int index);\n"); - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$java.util.List\n" - "get$capitalized_name$ValueList();\n"); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Value(int index);\n"); - } -} - -void RepeatedImmutableEnumFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "@SuppressWarnings(\"serial\")\n" - "private java.util.List $name$_;\n" - "private static final " - "com.google.protobuf.Internal.ListAdapter.Converter<\n" - " java.lang.Integer, $type$> $name$_converter_ =\n" - " new com.google.protobuf.Internal.ListAdapter.Converter<\n" - " java.lang.Integer, $type$>() {\n" - " public $type$ convert(java.lang.Integer from) {\n" - " $type$ result = $type$.forNumber(from);\n" - " return result == null ? $unknown$ : result;\n" - " }\n" - " };\n"); - PrintExtraFieldInfo(variables_, printer); - 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" - " java.lang.Integer, $type$>($name$_, $name$_converter_);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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"); - printer->Annotate("{", "}", descriptor_); - 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"); - printer->Annotate("{", "}", descriptor_); - 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" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - - if (descriptor_->is_packed()) { - printer->Print(variables_, "private int $name$MemoizedSerializedSize;\n"); - } -} - -void RepeatedImmutableEnumFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - printer->Print( - variables_, - // One field is the list and the other field keeps track of whether the - // 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 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 - // list can never be modified. - "private java.util.List $name$_ =\n" - " java.util.Collections.emptyList();\n" - - "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$get_mutable_bit_builder$) {\n" - " $name$_ = new java.util.ArrayList($name$_);\n" - " $set_mutable_bit_builder$;\n" - " }\n" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print( - variables_, - // Note: We return an unmodifiable list because otherwise the caller - // could hold on to the returned list and modify it after the message - // has been built, thus mutating the message which is supposed to be - // immutable. - "$deprecation$public java.util.List<$type$> " - "${$get$capitalized_name$List$}$() {\n" - " return new com.google.protobuf.Internal.ListAdapter<\n" - " java.lang.Integer, $type$>($name$_, $name$_converter_);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return $name$_converter_.convert($name$_.get(index));\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$ value) {\n" - " if (value == null) {\n" - " throw new NullPointerException();\n" - " }\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.set(index, value.getNumber());\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$$}$($type$ value) {\n" - " if (value == null) {\n" - " throw new NullPointerException();\n" - " }\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value.getNumber());\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " for ($type$ value : values) {\n" - " $name$_.add(value.getNumber());\n" - " }\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " $name$_ = java.util.Collections.emptyList();\n" - " $clear_mutable_bit_builder$;\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$public java.util.List\n" - "${$get$capitalized_name$ValueList$}$() {\n" - " return java.util.Collections.unmodifiableList($name$_);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$public int " - "${$get$capitalized_name$Value$}$(int index) {\n" - " return $name$_.get(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$set$capitalized_name$Value$}$(\n" - " int index, int value) {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.set(index, value);\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$Value$}$(int value) {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value);\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_MULTI_ADDER, /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$Value$}$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " for (int value : values) {\n" - " $name$_.add(value);\n" - " }\n" - " onChanged();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -void RepeatedImmutableEnumFieldGenerator:: - GenerateFieldBuilderInitializationCode(io::Printer* printer) const { - // noop for enums -} - -void RepeatedImmutableEnumFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = java.util.Collections.emptyList();\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - printer->Print(variables_, - "$name$_ = java.util.Collections.emptyList();\n" - "$clear_mutable_bit_builder$;\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - // The code below does two optimizations: - // 1. If the other list is empty, there's nothing to do. This ensures we - // don't allocate a new array if we already have an immutable one. - // 2. If the other list is non-empty and our current list is empty, we can - // reuse the other list which is guaranteed to be immutable. - printer->Print(variables_, - "if (!other.$name$_.isEmpty()) {\n" - " if ($name$_.isEmpty()) {\n" - " $name$_ = other.$name$_;\n" - " $clear_mutable_bit_builder$;\n" - " } else {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.addAll(other.$name$_);\n" - " }\n" - " onChanged();\n" - "}\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - // The code below ensures that the result has an immutable list. If our - // list is immutable, we can just reuse it. If not, we make it immutable. - printer->Print( - variables_, - "if ($get_mutable_bit_builder$) {\n" - " $name$_ = java.util.Collections.unmodifiableList($name$_);\n" - " $clear_mutable_bit_builder$;\n" - "}\n" - "result.$name$_ = $name$_;\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - // Read and store the enum - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print(variables_, - "int tmpRaw = input.readEnum();\n" - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(tmpRaw);\n"); - } else { - 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::GenerateBuilderParsingCodeFromPacked( - io::Printer* printer) const { - // Wrap GenerateParsingCode's contents with a while loop. - - printer->Print(variables_, - "int length = input.readRawVarint32();\n" - "int oldLimit = input.pushLimit(length);\n" - "while(input.getBytesUntilLimit() > 0) {\n"); - printer->Indent(); - - GenerateBuilderParsingCode(printer); - - printer->Outdent(); - printer->Print(variables_, - "}\n" - "input.popLimit(oldLimit);\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - if (descriptor_->is_packed()) { - printer->Print(variables_, - "if (get$capitalized_name$List().size() > 0) {\n" - " output.writeUInt32NoTag($tag$);\n" - " output.writeUInt32NoTag($name$MemoizedSerializedSize);\n" - "}\n" - "for (int i = 0; i < $name$_.size(); i++) {\n" - " output.writeEnumNoTag($name$_.get(i));\n" - "}\n"); - } else { - printer->Print(variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " output.writeEnum($number$, $name$_.get(i));\n" - "}\n"); - } -} - -void RepeatedImmutableEnumFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "{\n" - " int dataSize = 0;\n"); - printer->Indent(); - - printer->Print(variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " dataSize += com.google.protobuf.CodedOutputStream\n" - " .computeEnumSizeNoTag($name$_.get(i));\n" - "}\n"); - printer->Print("size += dataSize;\n"); - if (descriptor_->is_packed()) { - printer->Print(variables_, - "if (!get$capitalized_name$List().isEmpty()) {" - " size += $tag_size$;\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .computeUInt32SizeNoTag(dataSize);\n" - "}"); - } else { - printer->Print(variables_, "size += $tag_size$ * $name$_.size();\n"); - } - - // cache the data size for packed fields. - if (descriptor_->is_packed()) { - printer->Print(variables_, "$name$MemoizedSerializedSize = dataSize;\n"); - } - - printer->Outdent(); - printer->Print("}\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print(variables_, - "if (!$name$_.equals(other.$name$_)) return false;\n"); -} - -void RepeatedImmutableEnumFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print(variables_, - "if (get$capitalized_name$Count() > 0) {\n" - " hash = (37 * hash) + $constant_name$;\n" - " hash = (53 * hash) + $name$_.hashCode();\n" - "}\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()); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include "google/protobuf/port_undef.inc" diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum_field.h b/depends/protobuf/src/google/protobuf/compiler/java/enum_field.h deleted file mode 100644 index 8f0a5c3e9..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum_field.h +++ /dev/null @@ -1,164 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__ - -#include -#include - -#include "google/protobuf/compiler/java/field.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableEnumFieldGenerator : public ImmutableFieldGenerator { - public: - explicit ImmutableEnumFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - Context* context); - ImmutableEnumFieldGenerator(const ImmutableEnumFieldGenerator&) = delete; - ImmutableEnumFieldGenerator& operator=(const ImmutableEnumFieldGenerator&) = - delete; - ~ImmutableEnumFieldGenerator() override; - - // implements ImmutableFieldGenerator - // --------------------------------------- - int GetMessageBitIndex() const override; - int GetBuilderBitIndex() const override; - 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_; - int message_bit_index_; - int builder_bit_index_; - std::map variables_; - ClassNameResolver* name_resolver_; -}; - -class ImmutableEnumOneofFieldGenerator : public ImmutableEnumFieldGenerator { - public: - ImmutableEnumOneofFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - Context* context); - ImmutableEnumOneofFieldGenerator(const ImmutableEnumOneofFieldGenerator&) = - delete; - ImmutableEnumOneofFieldGenerator& operator=( - const ImmutableEnumOneofFieldGenerator&) = delete; - ~ImmutableEnumOneofFieldGenerator() override; - - 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; -}; - -class RepeatedImmutableEnumFieldGenerator : public ImmutableEnumFieldGenerator { - public: - explicit RepeatedImmutableEnumFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, Context* context); - RepeatedImmutableEnumFieldGenerator( - const RepeatedImmutableEnumFieldGenerator&) = delete; - RepeatedImmutableEnumFieldGenerator& operator=( - const RepeatedImmutableEnumFieldGenerator&) = delete; - ~RepeatedImmutableEnumFieldGenerator() override; - - // implements ImmutableFieldGenerator --------------------------------------- - 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; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum_field_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/enum_field_lite.cc deleted file mode 100644 index e80b938f3..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum_field_lite.cc +++ /dev/null @@ -1,923 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { -bool EnableExperimentalRuntimeForLite() { -#ifdef PROTOBUF_EXPERIMENT - return PROTOBUF_EXPERIMENT; -#else // PROTOBUF_EXPERIMENT - return false; -#endif // !PROTOBUF_EXPERIMENT -} - -void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, const FieldGeneratorInfo* info, - ClassNameResolver* name_resolver, - std::map* variables) { - SetCommonFieldVariables(descriptor, info, variables); - - (*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))); - (*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 (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_message"] = - GenerateSetBit(messageBitIndex) + ";"; - (*variables)["clear_has_field_bit_message"] = - GenerateClearBit(messageBitIndex) + ";"; - - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_message"] = ""; - (*variables)["clear_has_field_bit_message"] = ""; - - (*variables)["is_field_present_message"] = - (*variables)["name"] + "_ != " + (*variables)["default"] + - ".getNumber()"; - } - - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); - - if (SupportUnknownEnumValue(descriptor->file())) { - (*variables)["unknown"] = (*variables)["type"] + ".UNRECOGNIZED"; - } else { - (*variables)["unknown"] = (*variables)["default"]; - } - - // 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"; -} - -} // namespace - -// =================================================================== - -ImmutableEnumFieldLiteGenerator::ImmutableEnumFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : descriptor_(descriptor), - messageBitIndex_(messageBitIndex), - context_(context), - name_resolver_(context->GetNameResolver()) { - SetEnumVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), name_resolver_, - &variables_); -} - -ImmutableEnumFieldLiteGenerator::~ImmutableEnumFieldLiteGenerator() {} - -int ImmutableEnumFieldLiteGenerator::GetNumBitsForMessage() const { - return HasHasbit(descriptor_) ? 1 : 0; -} - -void ImmutableEnumFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$boolean has$capitalized_name$();\n"); - } - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Value();\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, "$deprecation$$type$ get$capitalized_name$();\n"); -} - -void ImmutableEnumFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "private int $name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - 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"); - 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" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " $type$ result = $type$.forNumber($name$_);\n" - " return result == null ? $unknown$ : result;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Generate private setters for the builder to proxy into. - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$Value(int value) {\n" - " $set_has_field_bit_message$" - " $name$_ = value;\n" - "}\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$($type$ value) {\n" - " $name$_ = value.getNumber();\n" - " $set_has_field_bit_message$\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $clear_has_field_bit_message$\n" - " $name$_ = $default_number$;\n" - "}\n"); -} - -void ImmutableEnumFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - if (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( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Value$}$() {\n" - " return instance.get$capitalized_name$Value();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$Value$}$(int value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$Value(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - 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_)) { - printer->Print(variables_, "$name$_ = $default_number$;\n"); - } -} - -void ImmutableEnumFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - if (HasHasbit(descriptor_)) { - WriteIntToUtf16CharSequence(messageBitIndex_, output); - } - printer->Print(variables_, "\"$name$_\",\n"); - if (!SupportUnknownEnumValue((descriptor_))) { - PrintEnumVerifierLogic(printer, descriptor_, variables_, - /*var_name=*/"$type$", - /*terminating_string=*/",\n", - /*enforce_lite=*/context_->EnforceLite()); - } -} - -std::string ImmutableEnumFieldLiteGenerator::GetBoxedType() const { - return name_resolver_->GetImmutableClassName(descriptor_->enum_type()); -} - -// =================================================================== - -ImmutableEnumOneofFieldLiteGenerator::ImmutableEnumOneofFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : ImmutableEnumFieldLiteGenerator(descriptor, messageBitIndex, context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutableEnumOneofFieldLiteGenerator::~ImmutableEnumOneofFieldLiteGenerator() {} - -void ImmutableEnumOneofFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - 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$_;\n" - " }\n" - " return $default_number$;\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" - " $type$ result = $type$.forNumber((java.lang.Integer) " - "$oneof_name$_);\n" - " return result == null ? $unknown$ : result;\n" - " }\n" - " return $default$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Generate private setters for the builder to proxy into. - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$Value(int value) {\n" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - "}\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$($type$ value) {\n" - " $oneof_name$_ = value.getNumber();\n" - " $set_oneof_case_message$;\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " }\n" - "}\n"); -} - -void ImmutableEnumOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - WriteIntToUtf16CharSequence(descriptor_->containing_oneof()->index(), output); - if (!SupportUnknownEnumValue(descriptor_)) { - PrintEnumVerifierLogic(printer, descriptor_, variables_, - /*var_name=*/"$type$", - /*terminating_string=*/",\n", - /*enforce_lite=*/context_->EnforceLite()); - } -} - -void ImmutableEnumOneofFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Value$}$() {\n" - " return instance.get$capitalized_name$Value();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$Value$}$(int value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$Value(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -// =================================================================== - -RepeatedImmutableEnumFieldLiteGenerator:: - RepeatedImmutableEnumFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context) - : descriptor_(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()) { - SetEnumVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), name_resolver_, - &variables_); -} - -RepeatedImmutableEnumFieldLiteGenerator:: - ~RepeatedImmutableEnumFieldLiteGenerator() {} - -int RepeatedImmutableEnumFieldLiteGenerator::GetNumBitsForMessage() const { - return 0; -} - -void RepeatedImmutableEnumFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print( - variables_, - "$deprecation$java.util.List<$type$> get$capitalized_name$List();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$$type$ get$capitalized_name$(int index);\n"); - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$java.util.List\n" - "get$capitalized_name$ValueList();\n"); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Value(int index);\n"); - } -} - -void RepeatedImmutableEnumFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "private com.google.protobuf.Internal.IntList $name$_;\n" - "private static final " - "com.google.protobuf.Internal.ListAdapter.Converter<\n" - " java.lang.Integer, $type$> $name$_converter_ =\n" - " new com.google.protobuf.Internal.ListAdapter.Converter<\n" - " java.lang.Integer, $type$>() {\n" - " @java.lang.Override\n" - " public $type$ convert(java.lang.Integer from) {\n" - " $type$ result = $type$.forNumber(from);\n" - " return result == null ? $unknown$ : result;\n" - " }\n" - " };\n"); - PrintExtraFieldInfo(variables_, printer); - 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" - " java.lang.Integer, $type$>($name$_, $name$_converter_);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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"); - printer->Annotate("{", "}", descriptor_); - 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" - " $type$ result = $type$.forNumber($name$_.getInt(index));\n" - " return result == null ? $unknown$ : result;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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$_.getInt(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - - if (!EnableExperimentalRuntimeForLite() && descriptor_->is_packed() && - context_->HasGeneratedMethods(descriptor_->containing_type())) { - printer->Print(variables_, "private int $name$MemoizedSerializedSize;\n"); - } - - // Generate private setters for the builder to proxy into. - printer->Print( - variables_, - "private void ensure$capitalized_name$IsMutable() {\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(tmp);\n" - " }\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER); - printer->Print(variables_, - "private void set$capitalized_name$(\n" - " int index, $type$ value) {\n" - " $null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.setInt(index, value.getNumber());\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER); - printer->Print(variables_, - "private void add$capitalized_name$($type$ value) {\n" - " $null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.addInt(value.getNumber());\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER); - printer->Print(variables_, - "private void addAll$capitalized_name$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " for ($type$ value : values) {\n" - " $name$_.addInt(value.getNumber());\n" - " }\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $name$_ = emptyIntList();\n" - "}\n"); - - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$Value(\n" - " int index, int value) {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.setInt(index, value);\n" - "}\n"); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_ADDER); - printer->Print(variables_, - "private void add$capitalized_name$Value(int value) {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.addInt(value);\n" - "}\n"); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_MULTI_ADDER); - printer->Print(variables_, - "private void addAll$capitalized_name$Value(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " for (int value : values) {\n" - " $name$_.addInt(value);\n" - " }\n" - "}\n"); - } -} - -void RepeatedImmutableEnumFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - printer->Print(variables_, "\"$name$_\",\n"); - if (!SupportUnknownEnumValue(descriptor_->file())) { - PrintEnumVerifierLogic(printer, descriptor_, variables_, - /*var_name=*/"$type$", - /*terminating_string=*/",\n", - /*enforce_lite=*/context_->EnforceLite()); - } -} - -void RepeatedImmutableEnumFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.List<$type$> " - "${$get$capitalized_name$List$}$() {\n" - " return instance.get$capitalized_name$List();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return instance.get$capitalized_name$Count();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return instance.get$capitalized_name$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(index, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " copyOnWrite();\n" - " instance.addAll$capitalized_name$(values);" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - 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 java.util.Collections.unmodifiableList(\n" - " instance.get$capitalized_name$ValueList());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public int " - "${$get$capitalized_name$Value$}$(int index) {\n" - " return instance.get$capitalized_name$Value(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$set$capitalized_name$Value$}$(\n" - " int index, int value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$Value(index, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$Value$}$(int value) {\n" - " instance.add$capitalized_name$Value(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldEnumValueAccessorDocComment(printer, descriptor_, - LIST_MULTI_ADDER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$Value$}$(\n" - " java.lang.Iterable values) {\n" - " copyOnWrite();\n" - " instance.addAll$capitalized_name$Value(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -void RepeatedImmutableEnumFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const { - 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()); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum_field_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/enum_field_lite.h deleted file mode 100644 index 492b268be..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum_field_lite.h +++ /dev/null @@ -1,140 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_LITE_H__ - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableEnumFieldLiteGenerator : public ImmutableFieldLiteGenerator { - public: - explicit ImmutableEnumFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context); - ~ImmutableEnumFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator - // ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - protected: - const FieldDescriptor* descriptor_; - std::map variables_; - const int messageBitIndex_; - Context* context_; - ClassNameResolver* name_resolver_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumFieldLiteGenerator); -}; - -class ImmutableEnumOneofFieldLiteGenerator - : public ImmutableEnumFieldLiteGenerator { - public: - ImmutableEnumOneofFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, Context* context); - ~ImmutableEnumOneofFieldLiteGenerator() override; - - void GenerateMembers(io::Printer* printer) const override; - void GenerateBuilderMembers(io::Printer* printer) const override; - void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumOneofFieldLiteGenerator); -}; - -class RepeatedImmutableEnumFieldLiteGenerator - : public ImmutableFieldLiteGenerator { - public: - explicit RepeatedImmutableEnumFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutableEnumFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - private: - const FieldDescriptor* descriptor_; - std::map variables_; - Context* context_; - ClassNameResolver* name_resolver_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableEnumFieldLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/enum_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/enum_lite.cc deleted file mode 100644 index 4387090a0..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/enum_lite.cc +++ /dev/null @@ -1,236 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -EnumLiteGenerator::EnumLiteGenerator(const EnumDescriptor* descriptor, - bool immutable_api, Context* context) - : descriptor_(descriptor), - immutable_api_(immutable_api), - context_(context), - name_resolver_(context->GetNameResolver()) { - for (int i = 0; i < descriptor_->value_count(); i++) { - const EnumValueDescriptor* value = descriptor_->value(i); - const EnumValueDescriptor* canonical_value = - descriptor_->FindValueByNumber(value->number()); - - if (value == canonical_value) { - canonical_values_.push_back(value); - } else { - Alias alias; - alias.value = value; - alias.canonical_value = canonical_value; - aliases_.push_back(alias); - } - } -} - -EnumLiteGenerator::~EnumLiteGenerator() {} - -void EnumLiteGenerator::Generate(io::Printer* printer) { - WriteEnumDocComment(printer, descriptor_); - MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_); - printer->Print( - "$deprecation$public enum $classname$\n" - " implements com.google.protobuf.Internal.EnumLite {\n", - "classname", descriptor_->name(), "deprecation", - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""); - printer->Annotate("classname", descriptor_); - printer->Indent(); - - for (int i = 0; i < canonical_values_.size(); i++) { - std::map vars; - vars["name"] = canonical_values_[i]->name(); - vars["number"] = StrCat(canonical_values_[i]->number()); - WriteEnumValueDocComment(printer, canonical_values_[i]); - if (canonical_values_[i]->options().deprecated()) { - printer->Print("@java.lang.Deprecated\n"); - } - printer->Print(vars, "$name$($number$),\n"); - printer->Annotate("name", canonical_values_[i]); - } - - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print("${$UNRECOGNIZED$}$(-1),\n", "{", "", "}", ""); - printer->Annotate("{", "}", descriptor_); - } - - printer->Print( - ";\n" - "\n"); - - // ----------------------------------------------------------------- - - for (int i = 0; i < aliases_.size(); i++) { - std::map vars; - vars["classname"] = descriptor_->name(); - vars["name"] = aliases_[i].value->name(); - vars["canonical_name"] = aliases_[i].canonical_value->name(); - WriteEnumValueDocComment(printer, aliases_[i].value); - printer->Print( - vars, "public static final $classname$ $name$ = $canonical_name$;\n"); - printer->Annotate("name", aliases_[i].value); - } - - for (int i = 0; i < descriptor_->value_count(); i++) { - std::map vars; - vars["name"] = descriptor_->value(i)->name(); - 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, - "$deprecation$public static final int ${$$name$_VALUE$}$ = " - "$number$;\n"); - printer->Annotate("{", "}", descriptor_->value(i)); - } - printer->Print("\n"); - - // ----------------------------------------------------------------- - - printer->Print( - "\n" - "@java.lang.Override\n" - "public final int getNumber() {\n"); - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - " if (this == UNRECOGNIZED) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"Can't get the number of an unknown enum value.\");\n" - " }\n"); - } - printer->Print( - " return value;\n" - "}\n" - "\n" - "/**\n" - " * @param value The number of the enum to look for.\n" - " * @return The enum associated with the given number.\n" - " * @deprecated Use {@link #forNumber(int)} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public static $classname$ valueOf(int value) {\n" - " return forNumber(value);\n" - "}\n" - "\n" - "public static $classname$ forNumber(int value) {\n" - " switch (value) {\n", - "classname", descriptor_->name()); - printer->Indent(); - printer->Indent(); - - for (int i = 0; i < canonical_values_.size(); i++) { - printer->Print("case $number$: return $name$;\n", "name", - canonical_values_[i]->name(), "number", - StrCat(canonical_values_[i]->number())); - } - - printer->Outdent(); - printer->Outdent(); - printer->Print( - " default: return null;\n" - " }\n" - "}\n" - "\n" - "public static com.google.protobuf.Internal.EnumLiteMap<$classname$>\n" - " internalGetValueMap() {\n" - " return internalValueMap;\n" - "}\n" - "private static final com.google.protobuf.Internal.EnumLiteMap<\n" - " $classname$> internalValueMap =\n" - " new com.google.protobuf.Internal.EnumLiteMap<$classname$>() {\n" - " @java.lang.Override\n" - " public $classname$ findValueByNumber(int number) {\n" - " return $classname$.forNumber(number);\n" - " }\n" - " };\n" - "\n" - "public static com.google.protobuf.Internal.EnumVerifier \n" - " internalGetVerifier() {\n" - " return $classname$Verifier.INSTANCE;\n" - "}\n" - "\n" - "private static final class $classname$Verifier implements \n" - " com.google.protobuf.Internal.EnumVerifier { \n" - " static final com.google.protobuf.Internal.EnumVerifier " - " INSTANCE = new $classname$Verifier();\n" - " @java.lang.Override\n" - " public boolean isInRange(int number) {\n" - " return $classname$.forNumber(number) != null;\n" - " }\n" - " };\n" - "\n", - "classname", descriptor_->name()); - - printer->Print( - "private final int value;\n\n" - "private $classname$(int value) {\n", - "classname", descriptor_->name()); - printer->Print( - " this.value = value;\n" - "}\n"); - - printer->Print( - "\n" - "// @@protoc_insertion_point(enum_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - printer->Outdent(); - printer->Print("}\n\n"); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/extension.cc b/depends/protobuf/src/google/protobuf/compiler/java/extension.cc deleted file mode 100644 index 8b93eb18d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/extension.cc +++ /dev/null @@ -1,177 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -ImmutableExtensionGenerator::ImmutableExtensionGenerator( - const FieldDescriptor* descriptor, Context* context) - : descriptor_(descriptor), name_resolver_(context->GetNameResolver()) { - if (descriptor_->extension_scope() != NULL) { - scope_ = - name_resolver_->GetImmutableClassName(descriptor_->extension_scope()); - } else { - scope_ = name_resolver_->GetImmutableClassName(descriptor_->file()); - } -} - -ImmutableExtensionGenerator::~ImmutableExtensionGenerator() {} - -// Initializes the vars referenced in the generated code templates. -void ExtensionGenerator::InitTemplateVars( - const FieldDescriptor* descriptor, const std::string& scope, bool immutable, - ClassNameResolver* name_resolver, - std::map* vars_pointer) { - std::map& vars = *vars_pointer; - vars["scope"] = scope; - vars["name"] = UnderscoresToCamelCaseCheckReserved(descriptor); - vars["containing_type"] = - name_resolver->GetClassName(descriptor->containing_type(), immutable); - vars["number"] = StrCat(descriptor->number()); - vars["constant_name"] = FieldConstantName(descriptor); - vars["index"] = StrCat(descriptor->index()); - vars["default"] = descriptor->is_repeated() - ? "" - : DefaultValue(descriptor, immutable, name_resolver); - vars["type_constant"] = FieldTypeName(GetType(descriptor)); - vars["packed"] = descriptor->is_packed() ? "true" : "false"; - vars["enum_map"] = "null"; - vars["prototype"] = "null"; - - JavaType java_type = GetJavaType(descriptor); - std::string singular_type; - switch (java_type) { - case JAVATYPE_MESSAGE: - singular_type = - name_resolver->GetClassName(descriptor->message_type(), immutable); - vars["prototype"] = singular_type + ".getDefaultInstance()"; - break; - case JAVATYPE_ENUM: - singular_type = - name_resolver->GetClassName(descriptor->enum_type(), immutable); - vars["enum_map"] = singular_type + ".internalGetValueMap()"; - break; - case JAVATYPE_STRING: - singular_type = "java.lang.String"; - break; - case JAVATYPE_BYTES: - singular_type = immutable ? "com.google.protobuf.ByteString" : "byte[]"; - break; - default: - singular_type = BoxedPrimitiveTypeName(java_type); - break; - } - vars["type"] = descriptor->is_repeated() - ? "java.util.List<" + singular_type + ">" - : singular_type; - vars["singular_type"] = singular_type; -} - -void ImmutableExtensionGenerator::Generate(io::Printer* printer) { - std::map vars; - const bool kUseImmutableNames = true; - InitTemplateVars(descriptor_, scope_, kUseImmutableNames, name_resolver_, - &vars); - printer->Print(vars, "public static final int $constant_name$ = $number$;\n"); - - WriteFieldDocComment(printer, descriptor_); - if (descriptor_->extension_scope() == NULL) { - // Non-nested - printer->Print( - vars, - "public static final\n" - " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" - " $containing_type$,\n" - " $type$> $name$ = com.google.protobuf.GeneratedMessage\n" - " .newFileScopedGeneratedExtension(\n" - " $singular_type$.class,\n" - " $prototype$);\n"); - } else { - // Nested - printer->Print( - vars, - "public static final\n" - " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" - " $containing_type$,\n" - " $type$> $name$ = com.google.protobuf.GeneratedMessage\n" - " .newMessageScopedGeneratedExtension(\n" - " $scope$.getDefaultInstance(),\n" - " $index$,\n" - " $singular_type$.class,\n" - " $prototype$);\n"); - } - printer->Annotate("name", descriptor_); -} - -int ImmutableExtensionGenerator::GenerateNonNestedInitializationCode( - io::Printer* printer) { - int bytecode_estimate = 0; - if (descriptor_->extension_scope() == NULL) { - // Only applies to non-nested extensions. - printer->Print( - "$name$.internalInit(descriptor.getExtensions().get($index$));\n", - "name", UnderscoresToCamelCaseCheckReserved(descriptor_), "index", - StrCat(descriptor_->index())); - bytecode_estimate += 21; - } - return bytecode_estimate; -} - -int ImmutableExtensionGenerator::GenerateRegistrationCode( - io::Printer* printer) { - printer->Print("registry.add($scope$.$name$);\n", "scope", scope_, "name", - UnderscoresToCamelCaseCheckReserved(descriptor_)); - return 7; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/extension.h b/depends/protobuf/src/google/protobuf/compiler/java/extension.h deleted file mode 100644 index 318cfa4cc..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/extension.h +++ /dev/null @@ -1,115 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -class FieldDescriptor; // descriptor.h -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -// 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. -class ExtensionGenerator { - public: - explicit ExtensionGenerator() {} - virtual ~ExtensionGenerator() {} - - virtual void Generate(io::Printer* printer) = 0; - - // Returns an estimate of the number of bytes the printed code will compile - // to - virtual int GenerateNonNestedInitializationCode(io::Printer* printer) = 0; - - // Returns an estimate of the number of bytes the printed code will compile - // to - virtual int GenerateRegistrationCode(io::Printer* printer) = 0; - - protected: - static void InitTemplateVars( - const FieldDescriptor* descriptor, const std::string& scope, - bool immutable, ClassNameResolver* name_resolver, - std::map* vars_pointer); - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); -}; - -class ImmutableExtensionGenerator : public ExtensionGenerator { - public: - explicit ImmutableExtensionGenerator(const FieldDescriptor* descriptor, - Context* context); - ~ImmutableExtensionGenerator() override; - - void Generate(io::Printer* printer) override; - int GenerateNonNestedInitializationCode(io::Printer* printer) override; - int GenerateRegistrationCode(io::Printer* printer) override; - - protected: - const FieldDescriptor* descriptor_; - ClassNameResolver* name_resolver_; - std::string scope_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableExtensionGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/extension_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/extension_lite.cc deleted file mode 100644 index bffb1d650..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/extension_lite.cc +++ /dev/null @@ -1,120 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -ImmutableExtensionLiteGenerator::ImmutableExtensionLiteGenerator( - const FieldDescriptor* descriptor, Context* context) - : descriptor_(descriptor), name_resolver_(context->GetNameResolver()) { - if (descriptor_->extension_scope() != NULL) { - scope_ = - name_resolver_->GetImmutableClassName(descriptor_->extension_scope()); - } else { - scope_ = name_resolver_->GetImmutableClassName(descriptor_->file()); - } -} - -ImmutableExtensionLiteGenerator::~ImmutableExtensionLiteGenerator() {} - -void ImmutableExtensionLiteGenerator::Generate(io::Printer* printer) { - std::map vars; - const bool kUseImmutableNames = true; - InitTemplateVars(descriptor_, scope_, kUseImmutableNames, name_resolver_, - &vars); - printer->Print(vars, "public static final int $constant_name$ = $number$;\n"); - - WriteFieldDocComment(printer, descriptor_); - if (descriptor_->is_repeated()) { - printer->Print( - vars, - "public static final\n" - " com.google.protobuf.GeneratedMessageLite.GeneratedExtension<\n" - " $containing_type$,\n" - " $type$> $name$ = com.google.protobuf.GeneratedMessageLite\n" - " .newRepeatedGeneratedExtension(\n" - " $containing_type$.getDefaultInstance(),\n" - " $prototype$,\n" - " $enum_map$,\n" - " $number$,\n" - " com.google.protobuf.WireFormat.FieldType.$type_constant$,\n" - " $packed$,\n" - " $singular_type$.class);\n"); - } else { - printer->Print( - vars, - "public static final\n" - " com.google.protobuf.GeneratedMessageLite.GeneratedExtension<\n" - " $containing_type$,\n" - " $type$> $name$ = com.google.protobuf.GeneratedMessageLite\n" - " .newSingularGeneratedExtension(\n" - " $containing_type$.getDefaultInstance(),\n" - " $default$,\n" - " $prototype$,\n" - " $enum_map$,\n" - " $number$,\n" - " com.google.protobuf.WireFormat.FieldType.$type_constant$,\n" - " $singular_type$.class);\n"); - } - printer->Annotate("name", descriptor_); -} - -int ImmutableExtensionLiteGenerator::GenerateNonNestedInitializationCode( - io::Printer* printer) { - return 0; -} - -int ImmutableExtensionLiteGenerator::GenerateRegistrationCode( - io::Printer* printer) { - printer->Print("registry.add($scope$.$name$);\n", "scope", scope_, "name", - UnderscoresToCamelCaseCheckReserved(descriptor_)); - return 7; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/extension_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/extension_lite.h deleted file mode 100644 index 264230cb0..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/extension_lite.h +++ /dev/null @@ -1,75 +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_COMPILER_JAVA_EXTENSION_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_LITE_H__ - -#include -#include - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -// Generates code for a lite 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. -class ImmutableExtensionLiteGenerator : public ExtensionGenerator { - public: - explicit ImmutableExtensionLiteGenerator(const FieldDescriptor* descriptor, - Context* context); - ~ImmutableExtensionLiteGenerator() override; - - void Generate(io::Printer* printer) override; - - // Returns an estimate of the number of bytes the printed code will compile to - int GenerateNonNestedInitializationCode(io::Printer* printer) override; - - // Returns an estimate of the number of bytes the printed code will compile to - int GenerateRegistrationCode(io::Printer* printer) override; - - private: - const FieldDescriptor* descriptor_; - ClassNameResolver* name_resolver_; - std::string scope_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableExtensionLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/field.cc b/depends/protobuf/src/google/protobuf/compiler/java/field.cc deleted file mode 100644 index 3dd528ff3..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/field.cc +++ /dev/null @@ -1,312 +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 - - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { - -ImmutableFieldGenerator* MakeImmutableGenerator(const FieldDescriptor* field, - int messageBitIndex, - int builderBitIndex, - Context* context) { - if (field->is_repeated()) { - switch (GetJavaType(field)) { - case JAVATYPE_MESSAGE: - if (IsMapEntry(field->message_type())) { - return new ImmutableMapFieldGenerator(field, messageBitIndex, - builderBitIndex, context); - } else { - return new RepeatedImmutableMessageFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - } - case JAVATYPE_ENUM: - return new RepeatedImmutableEnumFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - case JAVATYPE_STRING: - return new RepeatedImmutableStringFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - default: - return new RepeatedImmutablePrimitiveFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - } - } else { - if (IsRealOneof(field)) { - switch (GetJavaType(field)) { - case JAVATYPE_MESSAGE: - return new ImmutableMessageOneofFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - case JAVATYPE_ENUM: - return new ImmutableEnumOneofFieldGenerator(field, messageBitIndex, - builderBitIndex, context); - case JAVATYPE_STRING: - return new ImmutableStringOneofFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - default: - return new ImmutablePrimitiveOneofFieldGenerator( - field, messageBitIndex, builderBitIndex, context); - } - } else { - switch (GetJavaType(field)) { - case JAVATYPE_MESSAGE: - return new ImmutableMessageFieldGenerator(field, messageBitIndex, - builderBitIndex, context); - case JAVATYPE_ENUM: - return new ImmutableEnumFieldGenerator(field, messageBitIndex, - builderBitIndex, context); - case JAVATYPE_STRING: - return new ImmutableStringFieldGenerator(field, messageBitIndex, - builderBitIndex, context); - default: - return new ImmutablePrimitiveFieldGenerator(field, messageBitIndex, - builderBitIndex, context); - } - } - } -} - -ImmutableFieldLiteGenerator* MakeImmutableLiteGenerator( - const FieldDescriptor* field, int messageBitIndex, Context* context) { - if (field->is_repeated()) { - switch (GetJavaType(field)) { - case JAVATYPE_MESSAGE: - if (IsMapEntry(field->message_type())) { - return new ImmutableMapFieldLiteGenerator(field, messageBitIndex, - context); - } else { - return new RepeatedImmutableMessageFieldLiteGenerator( - field, messageBitIndex, context); - } - case JAVATYPE_ENUM: - return new RepeatedImmutableEnumFieldLiteGenerator( - field, messageBitIndex, context); - case JAVATYPE_STRING: - return new RepeatedImmutableStringFieldLiteGenerator( - field, messageBitIndex, context); - default: - return new RepeatedImmutablePrimitiveFieldLiteGenerator( - field, messageBitIndex, context); - } - } else { - if (IsRealOneof(field)) { - switch (GetJavaType(field)) { - case JAVATYPE_MESSAGE: - return new ImmutableMessageOneofFieldLiteGenerator( - field, messageBitIndex, context); - case JAVATYPE_ENUM: - return new ImmutableEnumOneofFieldLiteGenerator( - field, messageBitIndex, context); - case JAVATYPE_STRING: - return new ImmutableStringOneofFieldLiteGenerator( - field, messageBitIndex, context); - default: - return new ImmutablePrimitiveOneofFieldLiteGenerator( - field, messageBitIndex, context); - } - } else { - switch (GetJavaType(field)) { - case JAVATYPE_MESSAGE: - return new ImmutableMessageFieldLiteGenerator(field, messageBitIndex, - context); - case JAVATYPE_ENUM: - return new ImmutableEnumFieldLiteGenerator(field, messageBitIndex, - context); - case JAVATYPE_STRING: - return new ImmutableStringFieldLiteGenerator(field, messageBitIndex, - context); - default: - return new ImmutablePrimitiveFieldLiteGenerator( - field, messageBitIndex, context); - } - } - } -} - - -static inline void ReportUnexpectedPackedFieldsCall(io::Printer* printer) { - // Reaching here indicates a bug. Cases are: - // - This FieldGenerator should support packing, - // but this method should be overridden. - // - This FieldGenerator doesn't support packing, and this method - // should never have been called. - GOOGLE_LOG(FATAL) << "GenerateBuilderParsingCodeFromPacked() " - << "called on field generator that does not support packing."; -} - -} // namespace - -ImmutableFieldGenerator::~ImmutableFieldGenerator() {} - -void ImmutableFieldGenerator::GenerateBuilderParsingCodeFromPacked( - io::Printer* printer) const { - ReportUnexpectedPackedFieldsCall(printer); -} - -ImmutableFieldLiteGenerator::~ImmutableFieldLiteGenerator() {} - -// =================================================================== - -template <> -FieldGeneratorMap::FieldGeneratorMap( - const Descriptor* descriptor, Context* context) - : descriptor_(descriptor), field_generators_(descriptor->field_count()) { - // Construct all the FieldGenerators and assign them bit indices for their - // bit fields. - int messageBitIndex = 0; - int builderBitIndex = 0; - for (int i = 0; i < descriptor->field_count(); i++) { - ImmutableFieldGenerator* generator = MakeImmutableGenerator( - descriptor->field(i), messageBitIndex, builderBitIndex, context); - field_generators_[i].reset(generator); - messageBitIndex += generator->GetNumBitsForMessage(); - builderBitIndex += generator->GetNumBitsForBuilder(); - } -} - -template <> -FieldGeneratorMap::~FieldGeneratorMap() {} - -template <> -FieldGeneratorMap::FieldGeneratorMap( - const Descriptor* descriptor, Context* context) - : descriptor_(descriptor), field_generators_(descriptor->field_count()) { - // Construct all the FieldGenerators and assign them bit indices for their - // bit fields. - int messageBitIndex = 0; - for (int i = 0; i < descriptor->field_count(); i++) { - ImmutableFieldLiteGenerator* generator = MakeImmutableLiteGenerator( - descriptor->field(i), messageBitIndex, context); - field_generators_[i].reset(generator); - messageBitIndex += generator->GetNumBitsForMessage(); - } -} - -template <> -FieldGeneratorMap::~FieldGeneratorMap() {} - - -void SetCommonFieldVariables(const FieldDescriptor* descriptor, - const FieldGeneratorInfo* info, - std::map* variables) { - (*variables)["field_name"] = descriptor->name(); - (*variables)["name"] = info->name; - (*variables)["classname"] = descriptor->containing_type()->name(); - (*variables)["capitalized_name"] = info->capitalized_name; - (*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, - const OneofGeneratorInfo* info, - std::map* variables) { - (*variables)["oneof_name"] = info->name; - (*variables)["oneof_capitalized_name"] = info->capitalized_name; - (*variables)["oneof_index"] = - StrCat(descriptor->containing_oneof()->index()); - (*variables)["oneof_stored_type"] = GetOneofStoredType(descriptor); - (*variables)["set_oneof_case_message"] = - info->name + "Case_ = " + StrCat(descriptor->number()); - (*variables)["clear_oneof_case_message"] = info->name + "Case_ = 0"; - (*variables)["has_oneof_case_message"] = - info->name + "Case_ == " + StrCat(descriptor->number()); -} - -void PrintExtraFieldInfo(const std::map& variables, - io::Printer* printer) { - const std::map::const_iterator it = - variables.find("disambiguated_reason"); - if (it != variables.end() && !it->second.empty()) { - printer->Print( - variables, - "// An alternative name is used for field \"$field_name$\" because:\n" - "// $disambiguated_reason$\n"); - } -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/field.h b/depends/protobuf/src/google/protobuf/compiler/java/field.h deleted file mode 100644 index 7f82316b4..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/field.h +++ /dev/null @@ -1,192 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ - -#include -#include -#include -#include - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableFieldGenerator { - public: - ImmutableFieldGenerator() {} - virtual ~ImmutableFieldGenerator(); - - virtual int GetMessageBitIndex() const = 0; - virtual int GetBuilderBitIndex() const = 0; - virtual int GetNumBitsForMessage() const = 0; - virtual int GetNumBitsForBuilder() const = 0; - virtual void GenerateInterfaceMembers(io::Printer* printer) const = 0; - virtual void GenerateMembers(io::Printer* printer) const = 0; - virtual void GenerateBuilderMembers(io::Printer* printer) const = 0; - virtual void GenerateInitializationCode(io::Printer* printer) const = 0; - 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 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; - - virtual std::string GetBoxedType() const = 0; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldGenerator); -}; - -class ImmutableFieldLiteGenerator { - public: - ImmutableFieldLiteGenerator() {} - virtual ~ImmutableFieldLiteGenerator(); - - virtual int GetNumBitsForMessage() const = 0; - virtual void GenerateInterfaceMembers(io::Printer* printer) const = 0; - virtual void GenerateMembers(io::Printer* printer) const = 0; - 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; - virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0; - - virtual std::string GetBoxedType() const = 0; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldLiteGenerator); -}; - - -// Convenience class which constructs FieldGenerators for a Descriptor. -template -class FieldGeneratorMap { - public: - explicit FieldGeneratorMap(const Descriptor* descriptor, Context* context); - ~FieldGeneratorMap(); - - const FieldGeneratorType& get(const FieldDescriptor* field) const; - - private: - const Descriptor* descriptor_; - std::vector> field_generators_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); -}; - -template -inline const FieldGeneratorType& FieldGeneratorMap::get( - const FieldDescriptor* field) const { - GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); - return *field_generators_[field->index()]; -} - -// Instantiate template for mutable and immutable maps. -template <> -FieldGeneratorMap::FieldGeneratorMap( - const Descriptor* descriptor, Context* context); - -template <> -FieldGeneratorMap::~FieldGeneratorMap(); - - -template <> -FieldGeneratorMap::FieldGeneratorMap( - const Descriptor* descriptor, Context* context); - -template <> -FieldGeneratorMap::~FieldGeneratorMap(); - - -// Field information used in FieldGenerators. -struct FieldGeneratorInfo { - std::string name; - std::string capitalized_name; - std::string disambiguated_reason; -}; - -// Oneof information used in OneofFieldGenerators. -struct OneofGeneratorInfo { - std::string name; - std::string capitalized_name; -}; - -// Set some common variables used in variable FieldGenerators. -void SetCommonFieldVariables(const FieldDescriptor* descriptor, - const FieldGeneratorInfo* info, - std::map* variables); - -// Set some common oneof variables used in OneofFieldGenerators. -void SetCommonOneofVariables(const FieldDescriptor* descriptor, - const OneofGeneratorInfo* info, - std::map* variables); - -// Print useful comments before a field's accessors. -void PrintExtraFieldInfo(const std::map& variables, - io::Printer* printer); - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/file.cc b/depends/protobuf/src/google/protobuf/compiler/java/file.cc deleted file mode 100644 index cf2770344..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/file.cc +++ /dev/null @@ -1,739 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { - -struct FieldDescriptorCompare { - bool operator()(const FieldDescriptor* f1, const FieldDescriptor* f2) const { - if (f1 == NULL) { - return false; - } - if (f2 == NULL) { - return true; - } - return f1->full_name() < f2->full_name(); - } -}; - -typedef std::set - FieldDescriptorSet; - -// Recursively searches the given message to collect extensions. -// Returns true if all the extensions can be recognized. The extensions will be -// appended in to the extensions parameter. -// Returns false when there are unknown fields, in which case the data in the -// extensions output parameter is not reliable and should be discarded. -bool CollectExtensions(const Message& message, FieldDescriptorSet* extensions) { - const Reflection* reflection = message.GetReflection(); - - // There are unknown fields that could be extensions, thus this call fails. - if (reflection->GetUnknownFields(message).field_count() > 0) return false; - - std::vector fields; - reflection->ListFields(message, &fields); - - for (int i = 0; i < fields.size(); i++) { - if (fields[i]->is_extension()) { - extensions->insert(fields[i]); - } - - if (GetJavaType(fields[i]) == JAVATYPE_MESSAGE) { - if (fields[i]->is_repeated()) { - int size = reflection->FieldSize(message, fields[i]); - for (int j = 0; j < size; j++) { - const Message& sub_message = - reflection->GetRepeatedMessage(message, fields[i], j); - if (!CollectExtensions(sub_message, extensions)) return false; - } - } else { - const Message& sub_message = reflection->GetMessage(message, fields[i]); - if (!CollectExtensions(sub_message, extensions)) return false; - } - } - } - - return true; -} - -// Finds all extensions in the given message and its sub-messages. If the -// message contains unknown fields (which could be extensions), then those -// extensions are defined in alternate_pool. -// The message will be converted to a DynamicMessage backed by alternate_pool -// in order to handle this case. -void CollectExtensions(const FileDescriptorProto& file_proto, - const DescriptorPool& alternate_pool, - FieldDescriptorSet* extensions, - const std::string& file_data) { - if (!CollectExtensions(file_proto, extensions)) { - // There are unknown fields in the file_proto, which are probably - // extensions. We need to parse the data into a dynamic message based on the - // builder-pool to find out all extensions. - const Descriptor* file_proto_desc = alternate_pool.FindMessageTypeByName( - file_proto.GetDescriptor()->full_name()); - GOOGLE_CHECK(file_proto_desc) - << "Find unknown fields in FileDescriptorProto when building " - << file_proto.name() - << ". It's likely that those fields are custom options, however, " - "descriptor.proto is not in the transitive dependencies. " - "This normally should not happen. Please report a bug."; - DynamicMessageFactory factory; - std::unique_ptr dynamic_file_proto( - factory.GetPrototype(file_proto_desc)->New()); - GOOGLE_CHECK(dynamic_file_proto.get() != NULL); - GOOGLE_CHECK(dynamic_file_proto->ParseFromString(file_data)); - - // Collect the extensions again from the dynamic message. There should be no - // more unknown fields this time, i.e. all the custom options should be - // parsed as extensions now. - extensions->clear(); - GOOGLE_CHECK(CollectExtensions(*dynamic_file_proto, extensions)) - << "Find unknown fields in FileDescriptorProto when building " - << file_proto.name() - << ". It's likely that those fields are custom options, however, " - "those options cannot be recognized in the builder pool. " - "This normally should not happen. Please report a bug."; - } -} - -// Our static initialization methods can become very, very large. -// So large that if we aren't careful we end up blowing the JVM's -// 64K bytes of bytecode/method. Fortunately, since these static -// methods are executed only once near the beginning of a program, -// there's usually plenty of stack space available and we can -// extend our methods by simply chaining them to another method -// with a tail call. This inserts the sequence call-next-method, -// end this one, begin-next-method as needed. -void MaybeRestartJavaMethod(io::Printer* printer, int* bytecode_estimate, - int* method_num, const char* chain_statement, - const char* method_decl) { - // The goal here is to stay under 64K bytes of jvm bytecode/method, - // since otherwise we hit a hardcoded limit in the jvm and javac will - // then fail with the error "code too large". This limit lets our - // estimates be off by a factor of two and still we're okay. - static const int bytesPerMethod = kMaxStaticSize; - - if ((*bytecode_estimate) > bytesPerMethod) { - ++(*method_num); - printer->Print(chain_statement, "method_num", StrCat(*method_num)); - printer->Outdent(); - printer->Print("}\n"); - printer->Print(method_decl, "method_num", StrCat(*method_num)); - printer->Indent(); - *bytecode_estimate = 0; - } -} -} // namespace - -FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options, - bool immutable_api) - : file_(file), - java_package_(FileJavaPackage(file, immutable_api)), - message_generators_(file->message_type_count()), - extension_generators_(file->extension_count()), - context_(new Context(file, options)), - name_resolver_(context_->GetNameResolver()), - options_(options), - immutable_api_(immutable_api) { - classname_ = name_resolver_->GetFileClassName(file, immutable_api); - generator_factory_.reset(new ImmutableGeneratorFactory(context_.get())); - for (int i = 0; i < file_->message_type_count(); ++i) { - message_generators_[i].reset( - generator_factory_->NewMessageGenerator(file_->message_type(i))); - } - for (int i = 0; i < file_->extension_count(); ++i) { - extension_generators_[i].reset( - generator_factory_->NewExtensionGenerator(file_->extension(i))); - } -} - -FileGenerator::~FileGenerator() {} - -bool FileGenerator::Validate(std::string* error) { - // Check that no class name matches the file's class name. This is a common - // problem that leads to Java compile errors that can be hard to understand. - // It's especially bad when using the java_multiple_files, since we would - // end up overwriting the outer class with one of the inner ones. - if (name_resolver_->HasConflictingClassName(file_, classname_, - NameEquality::EXACT_EQUAL)) { - error->assign(file_->name()); - error->append( - ": Cannot generate Java output because the file's outer class name, " - "\""); - error->append(classname_); - error->append( - "\", matches the name of one of the types declared inside it. " - "Please either rename the type or use the java_outer_classname " - "option to specify a different outer class name for the .proto file."); - return false; - } - // Similar to the check above, but ignore the case this time. This is not a - // problem on Linux, but will lead to Java compile errors on Windows / Mac - // because filenames are case-insensitive on those platforms. - if (name_resolver_->HasConflictingClassName( - file_, classname_, NameEquality::EQUAL_IGNORE_CASE)) { - GOOGLE_LOG(WARNING) - << file_->name() << ": The file's outer class name, \"" << classname_ - << "\", matches the name of one of the types declared inside it when " - << "case is ignored. This can cause compilation issues on Windows / " - << "MacOS. Please either rename the type or use the " - << "java_outer_classname option to specify a different outer class " - << "name for the .proto file to be safe."; - } - - // Print a warning if optimize_for = LITE_RUNTIME is used. - if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME && - !options_.enforce_lite) { - GOOGLE_LOG(WARNING) - << "The optimize_for = LITE_RUNTIME option is no longer supported by " - << "protobuf Java code generator and is ignored--protoc will always " - << "generate full runtime code for Java. To use Java Lite runtime, " - << "users should use the Java Lite plugin instead. See:\n" - << " " - "https://github.com/protocolbuffers/protobuf/blob/main/java/" - "lite.md"; - } - return true; -} - -void FileGenerator::Generate(io::Printer* printer) { - // We don't import anything because we refer to all classes by their - // fully-qualified names in the generated source. - printer->Print( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "// source: $filename$\n" - "\n", - "filename", file_->name()); - if (!java_package_.empty()) { - printer->Print( - "package $package$;\n" - "\n", - "package", java_package_); - } - PrintGeneratedAnnotation( - printer, '$', options_.annotate_code ? classname_ + ".java.pb.meta" : ""); - - printer->Print( - "$deprecation$public final class $classname$ {\n" - " private $ctor$() {}\n", - "deprecation", - file_->options().deprecated() ? "@java.lang.Deprecated " : "", - "classname", classname_, "ctor", classname_); - printer->Annotate("classname", file_->name()); - printer->Indent(); - - // ----------------------------------------------------------------- - - printer->Print( - "public static void registerAllExtensions(\n" - " com.google.protobuf.ExtensionRegistryLite registry) {\n"); - - printer->Indent(); - - for (int i = 0; i < file_->extension_count(); i++) { - extension_generators_[i]->GenerateRegistrationCode(printer); - } - - for (int i = 0; i < file_->message_type_count(); i++) { - message_generators_[i]->GenerateExtensionRegistrationCode(printer); - } - - printer->Outdent(); - printer->Print("}\n"); - if (HasDescriptorMethods(file_, context_->EnforceLite())) { - // Overload registerAllExtensions for the non-lite usage to - // redundantly maintain the original signature (this is - // redundant because ExtensionRegistryLite now invokes - // ExtensionRegistry in the non-lite usage). Intent is - // to remove this in the future. - printer->Print( - "\n" - "public static void registerAllExtensions(\n" - " com.google.protobuf.ExtensionRegistry registry) {\n" - " registerAllExtensions(\n" - " (com.google.protobuf.ExtensionRegistryLite) registry);\n" - "}\n"); - } - - // ----------------------------------------------------------------- - - if (!MultipleJavaFiles(file_, immutable_api_)) { - for (int i = 0; i < file_->enum_type_count(); i++) { - if (HasDescriptorMethods(file_, context_->EnforceLite())) { - EnumGenerator(file_->enum_type(i), immutable_api_, context_.get()) - .Generate(printer); - } else { - EnumLiteGenerator(file_->enum_type(i), immutable_api_, context_.get()) - .Generate(printer); - } - } - for (int i = 0; i < file_->message_type_count(); i++) { - message_generators_[i]->GenerateInterface(printer); - message_generators_[i]->Generate(printer); - } - if (HasGenericServices(file_, context_->EnforceLite())) { - for (int i = 0; i < file_->service_count(); i++) { - std::unique_ptr generator( - generator_factory_->NewServiceGenerator(file_->service(i))); - generator->Generate(printer); - } - } - } - - // Extensions must be generated in the outer class since they are values, - // not classes. - for (int i = 0; i < file_->extension_count(); i++) { - extension_generators_[i]->Generate(printer); - } - - // Static variables. We'd like them to be final if possible, but due to - // the JVM's 64k size limit on static blocks, we have to initialize some - // of them in methods; thus they cannot be final. - int static_block_bytecode_estimate = 0; - for (int i = 0; i < file_->message_type_count(); i++) { - message_generators_[i]->GenerateStaticVariables( - printer, &static_block_bytecode_estimate); - } - - printer->Print("\n"); - - if (HasDescriptorMethods(file_, context_->EnforceLite())) { - if (immutable_api_) { - GenerateDescriptorInitializationCodeForImmutable(printer); - } else { - GenerateDescriptorInitializationCodeForMutable(printer); - } - } else { - printer->Print("static {\n"); - printer->Indent(); - int bytecode_estimate = 0; - int method_num = 0; - - for (int i = 0; i < file_->message_type_count(); i++) { - bytecode_estimate += - message_generators_[i]->GenerateStaticVariableInitializers(printer); - MaybeRestartJavaMethod( - printer, &bytecode_estimate, &method_num, - "_clinit_autosplit_$method_num$();\n", - "private static void _clinit_autosplit_$method_num$() {\n"); - } - - printer->Outdent(); - printer->Print("}\n"); - } - - printer->Print( - "\n" - "// @@protoc_insertion_point(outer_class_scope)\n"); - - printer->Outdent(); - printer->Print("}\n"); -} - -void FileGenerator::GenerateDescriptorInitializationCodeForImmutable( - io::Printer* printer) { - printer->Print( - "public static com.google.protobuf.Descriptors.FileDescriptor\n" - " getDescriptor() {\n" - " return descriptor;\n" - "}\n" - "private static $final$ com.google.protobuf.Descriptors.FileDescriptor\n" - " descriptor;\n" - "static {\n", - // TODO(dweis): Mark this as final. - "final", ""); - printer->Indent(); - - SharedCodeGenerator shared_code_generator(file_, options_); - shared_code_generator.GenerateDescriptors(printer); - - int bytecode_estimate = 0; - int method_num = 0; - - for (int i = 0; i < file_->message_type_count(); i++) { - bytecode_estimate += - message_generators_[i]->GenerateStaticVariableInitializers(printer); - MaybeRestartJavaMethod( - printer, &bytecode_estimate, &method_num, - "_clinit_autosplit_dinit_$method_num$();\n", - "private static void _clinit_autosplit_dinit_$method_num$() {\n"); - } - for (int i = 0; i < file_->extension_count(); i++) { - bytecode_estimate += - extension_generators_[i]->GenerateNonNestedInitializationCode(printer); - MaybeRestartJavaMethod( - printer, &bytecode_estimate, &method_num, - "_clinit_autosplit_dinit_$method_num$();\n", - "private static void _clinit_autosplit_dinit_$method_num$() {\n"); - } - - // Proto compiler builds a DescriptorPool, which holds all the descriptors to - // generate, when processing the ".proto" files. We call this DescriptorPool - // the parsed pool (a.k.a. file_->pool()). - // - // Note that when users try to extend the (.*)DescriptorProto in their - // ".proto" files, it does not affect the pre-built FileDescriptorProto class - // in proto compiler. When we put the descriptor data in the file_proto, those - // extensions become unknown fields. - // - // Now we need to find out all the extension value to the (.*)DescriptorProto - // in the file_proto message, and prepare an ExtensionRegistry to return. - // - // To find those extensions, we need to parse the data into a dynamic message - // of the FileDescriptor based on the builder-pool, then we can use - // reflections to find all extension fields - FileDescriptorProto file_proto; - file_->CopyTo(&file_proto); - std::string file_data; - file_proto.SerializeToString(&file_data); - FieldDescriptorSet extensions; - CollectExtensions(file_proto, *file_->pool(), &extensions, file_data); - - if (extensions.size() > 0) { - // Must construct an ExtensionRegistry containing all existing extensions - // and use it to parse the descriptor data again to recognize extensions. - printer->Print( - "com.google.protobuf.ExtensionRegistry registry =\n" - " com.google.protobuf.ExtensionRegistry.newInstance();\n"); - FieldDescriptorSet::iterator it; - for (it = extensions.begin(); it != extensions.end(); it++) { - std::unique_ptr generator( - generator_factory_->NewExtensionGenerator(*it)); - bytecode_estimate += generator->GenerateRegistrationCode(printer); - MaybeRestartJavaMethod( - printer, &bytecode_estimate, &method_num, - "_clinit_autosplit_dinit_$method_num$(registry);\n", - "private static void _clinit_autosplit_dinit_$method_num$(\n" - " com.google.protobuf.ExtensionRegistry registry) {\n"); - } - printer->Print( - "com.google.protobuf.Descriptors.FileDescriptor\n" - " .internalUpdateFileDescriptor(descriptor, registry);\n"); - } - - // Force descriptor initialization of all dependencies. - for (int i = 0; i < file_->dependency_count(); i++) { - if (ShouldIncludeDependency(file_->dependency(i), true)) { - std::string dependency = - name_resolver_->GetImmutableClassName(file_->dependency(i)); - printer->Print("$dependency$.getDescriptor();\n", "dependency", - dependency); - } - } - - printer->Outdent(); - printer->Print("}\n"); -} - -void FileGenerator::GenerateDescriptorInitializationCodeForMutable( - io::Printer* printer) { - printer->Print( - "public static com.google.protobuf.Descriptors.FileDescriptor\n" - " getDescriptor() {\n" - " return descriptor;\n" - "}\n" - "private static final com.google.protobuf.Descriptors.FileDescriptor\n" - " descriptor;\n" - "static {\n"); - printer->Indent(); - - printer->Print( - "descriptor = $immutable_package$.$descriptor_classname$.descriptor;\n", - "immutable_package", FileJavaPackage(file_, true), "descriptor_classname", - name_resolver_->GetDescriptorClassName(file_)); - - for (int i = 0; i < file_->message_type_count(); i++) { - message_generators_[i]->GenerateStaticVariableInitializers(printer); - } - for (int i = 0; i < file_->extension_count(); i++) { - extension_generators_[i]->GenerateNonNestedInitializationCode(printer); - } - - // Check if custom options exist. If any, try to load immutable classes since - // custom options are only represented with immutable messages. - FileDescriptorProto file_proto; - file_->CopyTo(&file_proto); - std::string file_data; - file_proto.SerializeToString(&file_data); - FieldDescriptorSet extensions; - CollectExtensions(file_proto, *file_->pool(), &extensions, file_data); - - if (extensions.size() > 0) { - // Try to load immutable messages' outer class. Its initialization code - // will take care of interpreting custom options. - printer->Print( - "try {\n" - // Note that we have to load the immutable class dynamically here as - // we want the mutable code to be independent from the immutable code - // at compile time. It is required to implement dual-compile for - // mutable and immutable API in blaze. - " java.lang.Class immutableClass = java.lang.Class.forName(\n" - " \"$immutable_classname$\");\n" - "} catch (java.lang.ClassNotFoundException e) {\n", - "immutable_classname", name_resolver_->GetImmutableClassName(file_)); - printer->Indent(); - - // The immutable class can not be found. We try our best to collect all - // custom option extensions to interpret the custom options. - printer->Print( - "com.google.protobuf.ExtensionRegistry registry =\n" - " com.google.protobuf.ExtensionRegistry.newInstance();\n" - "com.google.protobuf.MessageLite defaultExtensionInstance = null;\n"); - FieldDescriptorSet::iterator it; - for (it = extensions.begin(); it != extensions.end(); it++) { - const FieldDescriptor* field = *it; - std::string scope; - if (field->extension_scope() != NULL) { - scope = name_resolver_->GetMutableClassName(field->extension_scope()) + - ".getDescriptor()"; - } else { - scope = FileJavaPackage(field->file(), true) + "." + - name_resolver_->GetDescriptorClassName(field->file()) + - ".descriptor"; - } - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print( - "defaultExtensionInstance = com.google.protobuf.Internal\n" - " .getDefaultInstance(\"$class$\");\n" - "if (defaultExtensionInstance != null) {\n" - " registry.add(\n" - " $scope$.getExtensions().get($index$),\n" - " (com.google.protobuf.Message) defaultExtensionInstance);\n" - "}\n", - "scope", scope, "index", StrCat(field->index()), "class", - name_resolver_->GetImmutableClassName(field->message_type())); - } else { - printer->Print("registry.add($scope$.getExtensions().get($index$));\n", - "scope", scope, "index", StrCat(field->index())); - } - } - printer->Print( - "com.google.protobuf.Descriptors.FileDescriptor\n" - " .internalUpdateFileDescriptor(descriptor, registry);\n"); - - printer->Outdent(); - printer->Print("}\n"); - } - - // Force descriptor initialization of all dependencies. - for (int i = 0; i < file_->dependency_count(); i++) { - if (ShouldIncludeDependency(file_->dependency(i), false)) { - std::string dependency = - name_resolver_->GetMutableClassName(file_->dependency(i)); - printer->Print("$dependency$.getDescriptor();\n", "dependency", - dependency); - } - } - - printer->Outdent(); - printer->Print("}\n"); -} - -template -static void GenerateSibling( - const std::string& package_dir, const std::string& java_package, - const DescriptorClass* descriptor, GeneratorContext* context, - std::vector* file_list, bool annotate_code, - std::vector* annotation_list, const std::string& name_suffix, - GeneratorClass* generator, - void (GeneratorClass::*pfn)(io::Printer* printer)) { - std::string filename = - package_dir + descriptor->name() + name_suffix + ".java"; - file_list->push_back(filename); - std::string info_full_path = filename + ".pb.meta"; - GeneratedCodeInfo annotations; - io::AnnotationProtoCollector annotation_collector( - &annotations); - - std::unique_ptr output(context->Open(filename)); - io::Printer printer(output.get(), '$', - annotate_code ? &annotation_collector : NULL); - - 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->*pfn)(&printer); - - if (annotate_code) { - std::unique_ptr info_output( - context->Open(info_full_path)); - annotations.SerializeToZeroCopyStream(info_output.get()); - annotation_list->push_back(info_full_path); - } -} - -void FileGenerator::GenerateSiblings( - const std::string& package_dir, GeneratorContext* context, - std::vector* file_list, - std::vector* annotation_list) { - if (MultipleJavaFiles(file_, immutable_api_)) { - for (int i = 0; i < file_->enum_type_count(); i++) { - if (HasDescriptorMethods(file_, context_->EnforceLite())) { - EnumGenerator generator(file_->enum_type(i), immutable_api_, - context_.get()); - GenerateSibling( - package_dir, java_package_, file_->enum_type(i), context, file_list, - options_.annotate_code, annotation_list, "", &generator, - &EnumGenerator::Generate); - } else { - EnumLiteGenerator generator(file_->enum_type(i), immutable_api_, - context_.get()); - GenerateSibling( - package_dir, java_package_, file_->enum_type(i), context, file_list, - options_.annotate_code, annotation_list, "", &generator, - &EnumLiteGenerator::Generate); - } - } - for (int i = 0; i < file_->message_type_count(); i++) { - if (immutable_api_) { - GenerateSibling( - package_dir, java_package_, file_->message_type(i), context, - file_list, options_.annotate_code, annotation_list, "OrBuilder", - message_generators_[i].get(), &MessageGenerator::GenerateInterface); - } - GenerateSibling( - package_dir, java_package_, file_->message_type(i), context, - file_list, options_.annotate_code, annotation_list, "", - message_generators_[i].get(), &MessageGenerator::Generate); - } - if (HasGenericServices(file_, context_->EnforceLite())) { - for (int i = 0; i < file_->service_count(); i++) { - std::unique_ptr generator( - generator_factory_->NewServiceGenerator(file_->service(i))); - GenerateSibling( - package_dir, java_package_, file_->service(i), context, file_list, - options_.annotate_code, annotation_list, "", generator.get(), - &ServiceGenerator::Generate); - } - } - } -} - -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; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/file.h b/depends/protobuf/src/google/protobuf/compiler/java/file.h deleted file mode 100644 index b2e037300..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/file.h +++ /dev/null @@ -1,126 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ - -#include -#include -#include - -#include -#include - -namespace google { -namespace protobuf { -class FileDescriptor; // descriptor.h -namespace io { -class Printer; // printer.h -} -namespace compiler { -class GeneratorContext; // code_generator.h -namespace java { -class Context; // context.h -class MessageGenerator; // message.h -class GeneratorFactory; // generator_factory.h -class ExtensionGenerator; // extension.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class FileGenerator { - public: - FileGenerator(const FileDescriptor* file, const Options& options, - bool immutable_api = true); - ~FileGenerator(); - - // Checks for problems that would otherwise lead to cryptic compile errors. - // Returns true if there are no problems, or writes an error description to - // the given string and returns false otherwise. - bool Validate(std::string* error); - - 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). - void GenerateSiblings(const std::string& package_dir, - GeneratorContext* generator_context, - std::vector* file_list, - std::vector* annotation_list); - - const std::string& java_package() { return java_package_; } - const std::string& classname() { return classname_; } - - private: - void GenerateDescriptorInitializationCodeForImmutable(io::Printer* printer); - void GenerateDescriptorInitializationCodeForMutable(io::Printer* printer); - - bool ShouldIncludeDependency(const FileDescriptor* descriptor, - bool immutable_api_); - - const FileDescriptor* file_; - std::string java_package_; - std::string classname_; - - std::vector> message_generators_; - std::vector> extension_generators_; - std::unique_ptr generator_factory_; - std::unique_ptr context_; - ClassNameResolver* name_resolver_; - const Options options_; - bool immutable_api_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/generator.cc b/depends/protobuf/src/google/protobuf/compiler/java/generator.cc deleted file mode 100644 index 85e399135..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/generator.cc +++ /dev/null @@ -1,212 +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 - -namespace google { -namespace protobuf { -namespace compiler { -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, - std::string* error) const { - // ----------------------------------------------------------------- - // parse generator options - - std::vector > options; - ParseGeneratorParameter(parameter, &options); - Options file_options; - - for (int i = 0; i < options.size(); i++) { - if (options[i].first == "output_list_file") { - file_options.output_list_file = options[i].second; - } else if (options[i].first == "immutable") { - file_options.generate_immutable_code = true; - } else if (options[i].first == "mutable") { - file_options.generate_mutable_code = true; - } else if (options[i].first == "shared") { - file_options.generate_shared_code = true; - } else if (options[i].first == "lite") { - // Note: Java Lite does not guarantee API/ABI stability. We may choose to - // break existing API in order to boost performance / reduce code size. - file_options.enforce_lite = true; - } else if (options[i].first == "annotate_code") { - file_options.annotate_code = true; - } else if (options[i].first == "annotation_list_file") { - file_options.annotation_list_file = options[i].second; - } else { - *error = "Unknown generator option: " + options[i].first; - return false; - } - } - - if (file_options.enforce_lite && file_options.generate_mutable_code) { - *error = "lite runtime generator option cannot be used with mutable API."; - return false; - } - - // By default we generate immutable code and shared code for immutable API. - if (!file_options.generate_immutable_code && - !file_options.generate_mutable_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::vector file_generators; - if (file_options.generate_immutable_code) { - file_generators.push_back(new FileGenerator(file, file_options, - /* immutable = */ true)); - } - if (file_options.generate_mutable_code) { - file_generators.push_back(new FileGenerator(file, file_options, - /* mutable = */ false)); - } - - for (int i = 0; i < file_generators.size(); ++i) { - if (!file_generators[i]->Validate(error)) { - for (int j = 0; j < file_generators.size(); ++j) { - delete file_generators[j]; - } - return false; - } - } - - for (int i = 0; i < file_generators.size(); ++i) { - FileGenerator* file_generator = file_generators[i]; - - std::string package_dir = JavaPackageToDir(file_generator->java_package()); - - std::string java_filename = package_dir; - java_filename += file_generator->classname(); - java_filename += ".java"; - all_files.push_back(java_filename); - std::string info_full_path = java_filename + ".pb.meta"; - if (file_options.annotate_code) { - all_annotations.push_back(info_full_path); - } - - // Generate main java file. - std::unique_ptr output( - context->Open(java_filename)); - GeneratedCodeInfo annotations; - io::AnnotationProtoCollector annotation_collector( - &annotations); - io::Printer printer( - output.get(), '$', - file_options.annotate_code ? &annotation_collector : NULL); - - file_generator->Generate(&printer); - - // Generate sibling files. - file_generator->GenerateSiblings(package_dir, context, &all_files, - &all_annotations); - - if (file_options.annotate_code) { - std::unique_ptr info_output( - context->Open(info_full_path)); - annotations.SerializeToZeroCopyStream(info_output.get()); - } - } - - - for (int i = 0; i < file_generators.size(); ++i) { - delete file_generators[i]; - } - file_generators.clear(); - - // 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 .java files being generated. - std::unique_ptr srclist_raw_output( - context->Open(file_options.output_list_file)); - io::Printer srclist_printer(srclist_raw_output.get(), '$'); - for (int i = 0; i < all_files.size(); i++) { - srclist_printer.Print("$filename$\n", "filename", all_files[i]); - } - } - - 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 .java files being generated. - std::unique_ptr annotation_list_raw_output( - context->Open(file_options.annotation_list_file)); - io::Printer annotation_list_printer(annotation_list_raw_output.get(), '$'); - for (int i = 0; i < all_annotations.size(); i++) { - annotation_list_printer.Print("$filename$\n", "filename", - all_annotations[i]); - } - } - - return true; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/generator_factory.cc b/depends/protobuf/src/google/protobuf/compiler/java/generator_factory.cc deleted file mode 100644 index dd526ba7c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/generator_factory.cc +++ /dev/null @@ -1,86 +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: liujisi@google.com (Pherl Liu) - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -GeneratorFactory::GeneratorFactory() {} -GeneratorFactory::~GeneratorFactory() {} - -// =================================================================== - -ImmutableGeneratorFactory::ImmutableGeneratorFactory(Context* context) - : context_(context) {} -ImmutableGeneratorFactory::~ImmutableGeneratorFactory() {} - -MessageGenerator* ImmutableGeneratorFactory::NewMessageGenerator( - const Descriptor* descriptor) const { - if (HasDescriptorMethods(descriptor, context_->EnforceLite())) { - return new ImmutableMessageGenerator(descriptor, context_); - } else { - return new ImmutableMessageLiteGenerator(descriptor, context_); - } -} - -ExtensionGenerator* ImmutableGeneratorFactory::NewExtensionGenerator( - const FieldDescriptor* descriptor) const { - if (HasDescriptorMethods(descriptor->file(), context_->EnforceLite())) { - return new ImmutableExtensionGenerator(descriptor, context_); - } else { - return new ImmutableExtensionLiteGenerator(descriptor, context_); - } -} - -ServiceGenerator* ImmutableGeneratorFactory::NewServiceGenerator( - const ServiceDescriptor* descriptor) const { - return new ImmutableServiceGenerator(descriptor, context_); -} - - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/generator_factory.h b/depends/protobuf/src/google/protobuf/compiler/java/generator_factory.h deleted file mode 100644 index 807bca383..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/generator_factory.h +++ /dev/null @@ -1,103 +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: liujisi@google.com (Pherl Liu) - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__ - -#include - -namespace google { -namespace protobuf { -class FieldDescriptor; // descriptor.h -class Descriptor; // descriptor.h -class ServiceDescriptor; // descriptor.h -namespace compiler { -namespace java { -class MessageGenerator; // message.h -class ExtensionGenerator; // extension.h -class ServiceGenerator; // service.h -class Context; // context.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class GeneratorFactory { - public: - GeneratorFactory(); - virtual ~GeneratorFactory(); - - virtual MessageGenerator* NewMessageGenerator( - const Descriptor* descriptor) const = 0; - - virtual ExtensionGenerator* NewExtensionGenerator( - const FieldDescriptor* descriptor) const = 0; - - virtual ServiceGenerator* NewServiceGenerator( - const ServiceDescriptor* descriptor) const = 0; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratorFactory); -}; - -// Factory that creates generators for immutable-default messages. -class ImmutableGeneratorFactory : public GeneratorFactory { - public: - ImmutableGeneratorFactory(Context* context); - ~ImmutableGeneratorFactory() override; - - MessageGenerator* NewMessageGenerator( - const Descriptor* descriptor) const override; - - ExtensionGenerator* NewExtensionGenerator( - const FieldDescriptor* descriptor) const override; - - ServiceGenerator* NewServiceGenerator( - const ServiceDescriptor* descriptor) const override; - - private: - Context* context_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableGeneratorFactory); -}; - - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/helpers.cc b/depends/protobuf/src/google/protobuf/compiler/java/helpers.cc deleted file mode 100644 index 15ee8f55d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/helpers.cc +++ /dev/null @@ -1,1115 +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 // for hash - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -const char kThickSeparator[] = - "// ===================================================================\n"; -const char kThinSeparator[] = - "// -------------------------------------------------------------------\n"; - -namespace { - -const char* kDefaultPackage = ""; - -// Names that should be avoided (in UpperCamelCase format). -// Using them will cause the compiler to generate accessors whose names -// collide with methods defined in base classes. -// Keep this list in sync with specialFieldNames in -// java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java -const char* kForbiddenWordList[] = { - // java.lang.Object: - "Class", - // com.google.protobuf.MessageLiteOrBuilder: - "DefaultInstanceForType", - // com.google.protobuf.MessageLite: - "ParserForType", - "SerializedSize", - // com.google.protobuf.MessageOrBuilder: - "AllFields", - "DescriptorForType", - "InitializationErrorString", - "UnknownFields", - // obsolete. kept for backwards compatibility of generated code - "CachedSize", -}; - -const std::unordered_set* kReservedNames = - new std::unordered_set({ - "abstract", "assert", "boolean", "break", "byte", - "case", "catch", "char", "class", "const", - "continue", "default", "do", "double", "else", - "enum", "extends", "final", "finally", "float", - "for", "goto", "if", "implements", "import", - "instanceof", "int", "interface", "long", "native", - "new", "package", "private", "protected", "public", - "return", "short", "static", "strictfp", "super", - "switch", "synchronized", "this", "throw", "throws", - "transient", "try", "void", "volatile", "while", - }); - -bool IsForbidden(const std::string& field_name) { - for (int i = 0; i < GOOGLE_ARRAYSIZE(kForbiddenWordList); ++i) { - if (UnderscoresToCamelCase(field_name, true) == kForbiddenWordList[i]) { - return true; - } - } - return false; -} - -std::string FieldName(const FieldDescriptor* field) { - std::string field_name; - // Groups are hacky: The name of the field is just the lower-cased name - // of the group type. In Java, though, we would like to retain the original - // capitalization of the type name. - if (GetType(field) == FieldDescriptor::TYPE_GROUP) { - field_name = field->message_type()->name(); - } else { - field_name = field->name(); - } - if (IsForbidden(field_name)) { - // Append a trailing "#" to indicate that the name should be decorated to - // avoid collision with other names. - field_name += "#"; - } - return field_name; -} - - -} // namespace - -void PrintGeneratedAnnotation(io::Printer* printer, char delimiter, - const std::string& annotation_file) { - if (annotation_file.empty()) { - return; - } - std::string ptemplate = - "@javax.annotation.Generated(value=\"protoc\", comments=\"annotations:"; - ptemplate.push_back(delimiter); - ptemplate.append("annotation_file"); - ptemplate.push_back(delimiter); - ptemplate.append("\")\n"); - printer->Print(ptemplate.c_str(), "annotation_file", annotation_file); -} - -void PrintEnumVerifierLogic(io::Printer* printer, - const FieldDescriptor* descriptor, - const std::map& variables, - const char* var_name, - const char* terminating_string, bool enforce_lite) { - std::string enum_verifier_string = - enforce_lite ? StrCat(var_name, ".internalGetVerifier()") - : StrCat( - "new com.google.protobuf.Internal.EnumVerifier() {\n" - " @java.lang.Override\n" - " public boolean isInRange(int number) {\n" - " return ", - var_name, - ".forNumber(number) != null;\n" - " }\n" - " }"); - printer->Print( - variables, - StrCat(enum_verifier_string, terminating_string).c_str()); -} - -std::string UnderscoresToCamelCase(const std::string& input, - bool cap_next_letter) { - GOOGLE_CHECK(!input.empty()); - 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') { - if (cap_next_letter) { - result += input[i] + ('A' - 'a'); - } else { - result += input[i]; - } - cap_next_letter = false; - } else if ('A' <= input[i] && input[i] <= 'Z') { - if (i == 0 && !cap_next_letter) { - // Force first letter to lower-case unless explicitly told to - // capitalize it. - result += input[i] + ('a' - 'A'); - } else { - // Capital letters after the first are left as-is. - result += input[i]; - } - cap_next_letter = false; - } else if ('0' <= input[i] && input[i] <= '9') { - result += input[i]; - cap_next_letter = true; - } else { - cap_next_letter = true; - } - } - // Add a trailing "_" if the name should be altered. - if (input[input.size() - 1] == '#') { - result += '_'; - } - 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); -} - -std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) { - return UnderscoresToCamelCase(FieldName(field), true); -} - -std::string CapitalizedFieldName(const FieldDescriptor* field) { - return UnderscoresToCapitalizedCamelCase(field); -} - -std::string UnderscoresToCamelCase(const MethodDescriptor* method) { - return UnderscoresToCamelCase(method->name(), false); -} - -std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field) { - std::string name = UnderscoresToCamelCase(field); - if (kReservedNames->find(name) != kReservedNames->end()) { - return name + "_"; - } - return 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", - }); - -bool IsForbiddenKotlin(const std::string& field_name) { - return kKotlinForbiddenNames->find(field_name) != - kKotlinForbiddenNames->end(); -} - -std::string UniqueFileScopeIdentifier(const Descriptor* descriptor) { - return "static_" + StringReplace(descriptor->full_name(), ".", "_", true); -} - -std::string CamelCaseFieldName(const FieldDescriptor* field) { - std::string fieldName = UnderscoresToCamelCase(field); - if ('0' <= fieldName[0] && fieldName[0] <= '9') { - return '_' + fieldName; - } - return fieldName; -} - -std::string FileClassName(const FileDescriptor* file, bool immutable) { - ClassNameResolver name_resolver; - return name_resolver.GetFileClassName(file, immutable); -} - -std::string FileJavaPackage(const FileDescriptor* file, bool immutable) { - std::string result; - - if (file->options().has_java_package()) { - result = file->options().java_package(); - } else { - result = kDefaultPackage; - if (!file->package().empty()) { - if (!result.empty()) result += '.'; - result += file->package(); - } - } - - return result; -} - -std::string FileJavaPackage(const FileDescriptor* file) { - return FileJavaPackage(file, true /* immutable */); -} - -std::string JavaPackageToDir(std::string package_name) { - std::string package_dir = StringReplace(package_name, ".", "/", true); - if (!package_dir.empty()) package_dir += "/"; - return package_dir; -} - -std::string ClassName(const Descriptor* descriptor) { - ClassNameResolver name_resolver; - return name_resolver.GetClassName(descriptor, true); -} - -std::string ClassName(const EnumDescriptor* descriptor) { - ClassNameResolver name_resolver; - return name_resolver.GetClassName(descriptor, true); -} - -std::string ClassName(const ServiceDescriptor* descriptor) { - ClassNameResolver name_resolver; - return name_resolver.GetClassName(descriptor, true); -} - -std::string ClassName(const FileDescriptor* descriptor) { - ClassNameResolver name_resolver; - return name_resolver.GetClassName(descriptor, true); -} - - -std::string ExtraMessageInterfaces(const Descriptor* descriptor) { - std::string interfaces = "// @@protoc_insertion_point(message_implements:" + - descriptor->full_name() + ")"; - return interfaces; -} - - -std::string ExtraBuilderInterfaces(const Descriptor* descriptor) { - std::string interfaces = "// @@protoc_insertion_point(builder_implements:" + - descriptor->full_name() + ")"; - return interfaces; -} - -std::string ExtraMessageOrBuilderInterfaces(const Descriptor* descriptor) { - std::string interfaces = "// @@protoc_insertion_point(interface_extends:" + - descriptor->full_name() + ")"; - return interfaces; -} - -std::string FieldConstantName(const FieldDescriptor* field) { - std::string name = field->name() + "_FIELD_NUMBER"; - ToUpper(&name); - return name; -} - -FieldDescriptor::Type GetType(const FieldDescriptor* field) { - return field->type(); -} - -JavaType GetJavaType(const FieldDescriptor* field) { - switch (GetType(field)) { - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_SFIXED32: - return JAVATYPE_INT; - - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_SFIXED64: - return JAVATYPE_LONG; - - case FieldDescriptor::TYPE_FLOAT: - return JAVATYPE_FLOAT; - - case FieldDescriptor::TYPE_DOUBLE: - return JAVATYPE_DOUBLE; - - case FieldDescriptor::TYPE_BOOL: - return JAVATYPE_BOOLEAN; - - case FieldDescriptor::TYPE_STRING: - return JAVATYPE_STRING; - - case FieldDescriptor::TYPE_BYTES: - return JAVATYPE_BYTES; - - case FieldDescriptor::TYPE_ENUM: - return JAVATYPE_ENUM; - - case FieldDescriptor::TYPE_GROUP: - case FieldDescriptor::TYPE_MESSAGE: - return JAVATYPE_MESSAGE; - - // No default because we want the compiler to complain if any new - // types are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return JAVATYPE_INT; -} - -const char* PrimitiveTypeName(JavaType type) { - switch (type) { - case JAVATYPE_INT: - return "int"; - case JAVATYPE_LONG: - return "long"; - case JAVATYPE_FLOAT: - return "float"; - case JAVATYPE_DOUBLE: - return "double"; - case JAVATYPE_BOOLEAN: - return "boolean"; - case JAVATYPE_STRING: - return "java.lang.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; -} - -const char* PrimitiveTypeName(const FieldDescriptor* descriptor) { - return PrimitiveTypeName(GetJavaType(descriptor)); -} - -const char* BoxedPrimitiveTypeName(JavaType type) { - switch (type) { - case JAVATYPE_INT: - return "java.lang.Integer"; - case JAVATYPE_LONG: - return "java.lang.Long"; - case JAVATYPE_FLOAT: - return "java.lang.Float"; - case JAVATYPE_DOUBLE: - return "java.lang.Double"; - case JAVATYPE_BOOLEAN: - return "java.lang.Boolean"; - case JAVATYPE_STRING: - return "java.lang.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; -} - -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) { - case JAVATYPE_ENUM: - return "java.lang.Integer"; - case JAVATYPE_MESSAGE: - return ClassName(field->message_type()); - default: - return BoxedPrimitiveTypeName(javaType); - } -} - -const char* FieldTypeName(FieldDescriptor::Type field_type) { - switch (field_type) { - case FieldDescriptor::TYPE_INT32: - return "INT32"; - case FieldDescriptor::TYPE_UINT32: - return "UINT32"; - case FieldDescriptor::TYPE_SINT32: - return "SINT32"; - case FieldDescriptor::TYPE_FIXED32: - return "FIXED32"; - case FieldDescriptor::TYPE_SFIXED32: - return "SFIXED32"; - case FieldDescriptor::TYPE_INT64: - return "INT64"; - case FieldDescriptor::TYPE_UINT64: - return "UINT64"; - case FieldDescriptor::TYPE_SINT64: - return "SINT64"; - case FieldDescriptor::TYPE_FIXED64: - return "FIXED64"; - case FieldDescriptor::TYPE_SFIXED64: - return "SFIXED64"; - case FieldDescriptor::TYPE_FLOAT: - return "FLOAT"; - case FieldDescriptor::TYPE_DOUBLE: - return "DOUBLE"; - case FieldDescriptor::TYPE_BOOL: - return "BOOL"; - case FieldDescriptor::TYPE_STRING: - return "STRING"; - case FieldDescriptor::TYPE_BYTES: - return "BYTES"; - case FieldDescriptor::TYPE_ENUM: - return "ENUM"; - case FieldDescriptor::TYPE_GROUP: - return "GROUP"; - case FieldDescriptor::TYPE_MESSAGE: - return "MESSAGE"; - - // No default because we want the compiler to complain if any new - // types are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return NULL; -} - -bool AllAscii(const std::string& text) { - for (int i = 0; i < text.size(); i++) { - if ((text[i] & 0x80) != 0) { - return false; - } - } - return true; -} - -std::string DefaultValue(const FieldDescriptor* field, bool immutable, - ClassNameResolver* name_resolver) { - // Switch on CppType since we need to know which default_value_* method - // of FieldDescriptor to call. - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - 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())); - case FieldDescriptor::CPPTYPE_INT64: - return StrCat(field->default_value_int64()) + "L"; - case FieldDescriptor::CPPTYPE_UINT64: - return StrCat(static_cast(field->default_value_uint64())) + - "L"; - case FieldDescriptor::CPPTYPE_DOUBLE: { - double value = field->default_value_double(); - if (value == std::numeric_limits::infinity()) { - return "Double.POSITIVE_INFINITY"; - } else if (value == -std::numeric_limits::infinity()) { - return "Double.NEGATIVE_INFINITY"; - } else if (value != value) { - return "Double.NaN"; - } else { - return SimpleDtoa(value) + "D"; - } - } - case FieldDescriptor::CPPTYPE_FLOAT: { - float value = field->default_value_float(); - if (value == std::numeric_limits::infinity()) { - return "Float.POSITIVE_INFINITY"; - } else if (value == -std::numeric_limits::infinity()) { - return "Float.NEGATIVE_INFINITY"; - } else if (value != value) { - return "Float.NaN"; - } else { - return SimpleFtoa(value) + "F"; - } - } - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool() ? "true" : "false"; - case FieldDescriptor::CPPTYPE_STRING: - if (GetType(field) == FieldDescriptor::TYPE_BYTES) { - if (field->has_default_value()) { - // See comments in Internal.java for gory details. - return strings::Substitute( - "com.google.protobuf.Internal.bytesDefaultValue(\"$0\")", - CEscape(field->default_value_string())); - } else { - return "com.google.protobuf.ByteString.EMPTY"; - } - } else { - if (AllAscii(field->default_value_string())) { - // All chars are ASCII. In this case CEscape() works fine. - return "\"" + CEscape(field->default_value_string()) + "\""; - } else { - // See comments in Internal.java for gory details. - return strings::Substitute( - "com.google.protobuf.Internal.stringDefaultValue(\"$0\")", - CEscape(field->default_value_string())); - } - } - - case FieldDescriptor::CPPTYPE_ENUM: - return name_resolver->GetClassName(field->enum_type(), immutable) + "." + - field->default_value_enum()->name(); - - case FieldDescriptor::CPPTYPE_MESSAGE: - return name_resolver->GetClassName(field->message_type(), immutable) + - ".getDefaultInstance()"; - - // No default because we want the compiler to complain if any new - // types are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return ""; -} - -bool IsDefaultValueJavaDefault(const FieldDescriptor* field) { - // Switch on CppType since we need to know which default_value_* method - // of FieldDescriptor to call. - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return field->default_value_int32() == 0; - case FieldDescriptor::CPPTYPE_UINT32: - return field->default_value_uint32() == 0; - case FieldDescriptor::CPPTYPE_INT64: - return field->default_value_int64() == 0L; - case FieldDescriptor::CPPTYPE_UINT64: - return field->default_value_uint64() == 0L; - case FieldDescriptor::CPPTYPE_DOUBLE: - return field->default_value_double() == 0.0; - case FieldDescriptor::CPPTYPE_FLOAT: - return field->default_value_float() == 0.0; - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool() == false; - case FieldDescriptor::CPPTYPE_ENUM: - return field->default_value_enum()->number() == 0; - case FieldDescriptor::CPPTYPE_STRING: - case FieldDescriptor::CPPTYPE_MESSAGE: - return false; - - // No default because we want the compiler to complain if any new - // types are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return false; -} - -bool IsByteStringWithCustomDefaultValue(const FieldDescriptor* field) { - return GetJavaType(field) == JAVATYPE_BYTES && - field->default_value_string() != ""; -} - -const char* bit_masks[] = { - "0x00000001", "0x00000002", "0x00000004", "0x00000008", - "0x00000010", "0x00000020", "0x00000040", "0x00000080", - - "0x00000100", "0x00000200", "0x00000400", "0x00000800", - "0x00001000", "0x00002000", "0x00004000", "0x00008000", - - "0x00010000", "0x00020000", "0x00040000", "0x00080000", - "0x00100000", "0x00200000", "0x00400000", "0x00800000", - - "0x01000000", "0x02000000", "0x04000000", "0x08000000", - "0x10000000", "0x20000000", "0x40000000", "0x80000000", -}; - -std::string GetBitFieldName(int index) { - std::string varName = "bitField"; - varName += StrCat(index); - varName += "_"; - return varName; -} - -std::string GetBitFieldNameForBit(int bitIndex) { - return GetBitFieldName(bitIndex / 32); -} - -namespace { - -std::string GenerateGetBitInternal(const std::string& prefix, int bitIndex) { - std::string varName = prefix + GetBitFieldNameForBit(bitIndex); - int bitInVarIndex = bitIndex % 32; - - std::string mask = bit_masks[bitInVarIndex]; - std::string result = "((" + varName + " & " + mask + ") != 0)"; - return result; -} - -std::string GenerateSetBitInternal(const std::string& prefix, int bitIndex) { - std::string varName = prefix + GetBitFieldNameForBit(bitIndex); - int bitInVarIndex = bitIndex % 32; - - std::string mask = bit_masks[bitInVarIndex]; - std::string result = varName + " |= " + mask; - return result; -} - -} // namespace - -std::string GenerateGetBit(int bitIndex) { - return GenerateGetBitInternal("", bitIndex); -} - -std::string GenerateSetBit(int bitIndex) { - return GenerateSetBitInternal("", bitIndex); -} - -std::string GenerateClearBit(int bitIndex) { - std::string varName = GetBitFieldNameForBit(bitIndex); - int bitInVarIndex = bitIndex % 32; - - std::string mask = bit_masks[bitInVarIndex]; - std::string result = varName + " = (" + varName + " & ~" + mask + ")"; - return result; -} - -std::string GenerateGetBitFromLocal(int bitIndex) { - return GenerateGetBitInternal("from_", bitIndex); -} - -std::string GenerateSetBitToLocal(int bitIndex) { - return GenerateSetBitInternal("to_", bitIndex); -} - -std::string GenerateGetBitMutableLocal(int bitIndex) { - return GenerateGetBitInternal("mutable_", bitIndex); -} - -std::string GenerateSetBitMutableLocal(int bitIndex) { - return GenerateSetBitInternal("mutable_", bitIndex); -} - -bool IsReferenceType(JavaType type) { - switch (type) { - case JAVATYPE_INT: - return false; - case JAVATYPE_LONG: - return false; - case JAVATYPE_FLOAT: - return false; - case JAVATYPE_DOUBLE: - return false; - case JAVATYPE_BOOLEAN: - return false; - case JAVATYPE_STRING: - return true; - case JAVATYPE_BYTES: - return true; - case JAVATYPE_ENUM: - return true; - case JAVATYPE_MESSAGE: - return true; - - // No default because we want the compiler to complain if any new - // JavaTypes are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return false; -} - -const char* GetCapitalizedType(const FieldDescriptor* field, bool immutable) { - switch (GetType(field)) { - case FieldDescriptor::TYPE_INT32: - return "Int32"; - case FieldDescriptor::TYPE_UINT32: - return "UInt32"; - case FieldDescriptor::TYPE_SINT32: - return "SInt32"; - case FieldDescriptor::TYPE_FIXED32: - return "Fixed32"; - case FieldDescriptor::TYPE_SFIXED32: - return "SFixed32"; - case FieldDescriptor::TYPE_INT64: - return "Int64"; - case FieldDescriptor::TYPE_UINT64: - return "UInt64"; - case FieldDescriptor::TYPE_SINT64: - return "SInt64"; - case FieldDescriptor::TYPE_FIXED64: - return "Fixed64"; - case FieldDescriptor::TYPE_SFIXED64: - return "SFixed64"; - case FieldDescriptor::TYPE_FLOAT: - return "Float"; - case FieldDescriptor::TYPE_DOUBLE: - return "Double"; - case FieldDescriptor::TYPE_BOOL: - return "Bool"; - case FieldDescriptor::TYPE_STRING: - return "String"; - case FieldDescriptor::TYPE_BYTES: { - return "Bytes"; - } - case FieldDescriptor::TYPE_ENUM: - return "Enum"; - case FieldDescriptor::TYPE_GROUP: - return "Group"; - case FieldDescriptor::TYPE_MESSAGE: - return "Message"; - - // No default because we want the compiler to complain if any new - // types are added. - } - - GOOGLE_LOG(FATAL) << "Can't get here."; - return NULL; -} - -// For encodings with fixed sizes, returns that size in bytes. Otherwise -// returns -1. -int FixedSize(FieldDescriptor::Type type) { - switch (type) { - case FieldDescriptor::TYPE_INT32: - return -1; - case FieldDescriptor::TYPE_INT64: - return -1; - case FieldDescriptor::TYPE_UINT32: - return -1; - case FieldDescriptor::TYPE_UINT64: - return -1; - case FieldDescriptor::TYPE_SINT32: - return -1; - case FieldDescriptor::TYPE_SINT64: - return -1; - case FieldDescriptor::TYPE_FIXED32: - return WireFormatLite::kFixed32Size; - case FieldDescriptor::TYPE_FIXED64: - return WireFormatLite::kFixed64Size; - case FieldDescriptor::TYPE_SFIXED32: - return WireFormatLite::kSFixed32Size; - case FieldDescriptor::TYPE_SFIXED64: - return WireFormatLite::kSFixed64Size; - case FieldDescriptor::TYPE_FLOAT: - return WireFormatLite::kFloatSize; - case FieldDescriptor::TYPE_DOUBLE: - return WireFormatLite::kDoubleSize; - - case FieldDescriptor::TYPE_BOOL: - return WireFormatLite::kBoolSize; - case FieldDescriptor::TYPE_ENUM: - return -1; - - case FieldDescriptor::TYPE_STRING: - return -1; - case FieldDescriptor::TYPE_BYTES: - return -1; - case FieldDescriptor::TYPE_GROUP: - return -1; - case FieldDescriptor::TYPE_MESSAGE: - return -1; - - // No default because we want the compiler to complain if any new - // types are added. - } - GOOGLE_LOG(FATAL) << "Can't get here."; - return -1; -} - -// Sort the fields of the given Descriptor by number into a new[]'d array -// and return it. The caller should delete the returned array. -const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor) { - const FieldDescriptor** fields = - new const FieldDescriptor*[descriptor->field_count()]; - for (int i = 0; i < descriptor->field_count(); i++) { - fields[i] = descriptor->field(i); - } - std::sort(fields, fields + descriptor->field_count(), - FieldOrderingByNumber()); - return fields; -} - -// Returns true if the message type has any required fields. If it doesn't, -// we can optimize out calls to its isInitialized() method. -// -// already_seen is used to avoid checking the same type multiple times -// (and also to protect against recursion). -bool HasRequiredFields(const Descriptor* type, - std::unordered_set* already_seen) { - if (already_seen->count(type) > 0) { - // The type is already in cache. This means that either: - // a. The type has no required fields. - // b. We are in the midst of checking if the type has required fields, - // somewhere up the stack. In this case, we know that if the type - // has any required fields, they'll be found when we return to it, - // and the whole call to HasRequiredFields() will return true. - // Therefore, we don't have to check if this type has required fields - // here. - return false; - } - already_seen->insert(type); - - // If the type has extensions, an extension with message type could contain - // required fields, so we have to be conservative and assume such an - // extension exists. - if (type->extension_range_count() > 0) return true; - - for (int i = 0; i < type->field_count(); i++) { - const FieldDescriptor* field = type->field(i); - if (field->is_required()) { - return true; - } - if (GetJavaType(field) == JAVATYPE_MESSAGE) { - if (HasRequiredFields(field->message_type(), already_seen)) { - return true; - } - } - } - - return false; -} - -bool HasRequiredFields(const Descriptor* type) { - std::unordered_set already_seen; - return HasRequiredFields(type, &already_seen); -} - -bool HasRepeatedFields(const Descriptor* descriptor) { - for (int i = 0; i < descriptor->field_count(); ++i) { - const FieldDescriptor* field = descriptor->field(i); - if (field->is_repeated()) { - return true; - } - } - return false; -} - -// Encode an unsigned 32-bit value into a sequence of UTF-16 characters. -// -// If the value is in [0x0000, 0xD7FF], we encode it with a single character -// with the same numeric value. -// -// If the value is larger than 0xD7FF, we encode its lowest 13 bits into a -// character in the range [0xE000, 0xFFFF] by combining these 13 bits with -// 0xE000 using logic-or. Then we shift the value to the right by 13 bits, and -// encode the remaining value by repeating this same process until we get to -// a value in [0x0000, 0xD7FF] where we will encode it using a character with -// the same numeric value. -// -// 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_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)); - return; - } - // Encode into multiple chars. All except the last char will be in the range - // [0xE000, 0xFFFF], and the last char will be in the range [0x0000, 0xD7FF]. - // Note that we don't use any value in range [0xD800, 0xDFFF] because they - // have to come in pairs and the encoding is just more space-efficient w/o - // them. - while (number >= 0xD800) { - // [0xE000, 0xFFFF] can represent 13 bits of info. - output->push_back(static_cast(0xE000 | (number & 0x1FFF))); - number >>= 13; - } - output->push_back(static_cast(number)); -} - -int GetExperimentalJavaFieldTypeForSingular(const FieldDescriptor* field) { - // j/c/g/protobuf/FieldType.java lists field types in a slightly different - // order from FieldDescriptor::Type so we can't do a simple cast. - // - // TODO(xiaofeng): Make j/c/g/protobuf/FieldType.java follow the same order. - int result = field->type(); - if (result == FieldDescriptor::TYPE_GROUP) { - return 17; - } else if (result < FieldDescriptor::TYPE_GROUP) { - return result - 1; - } else { - return result - 2; - } -} - -int GetExperimentalJavaFieldTypeForRepeated(const FieldDescriptor* field) { - if (field->type() == FieldDescriptor::TYPE_GROUP) { - return 49; - } else { - return GetExperimentalJavaFieldTypeForSingular(field) + 18; - } -} - -int GetExperimentalJavaFieldTypeForPacked(const FieldDescriptor* field) { - int result = field->type(); - if (result < FieldDescriptor::TYPE_STRING) { - return result + 34; - } else if (result > FieldDescriptor::TYPE_BYTES) { - return result + 30; - } else { - GOOGLE_LOG(FATAL) << field->full_name() << " can't be packed."; - return 0; - } -} - -int GetExperimentalJavaFieldType(const FieldDescriptor* field) { - static const int kMapFieldType = 50; - static const int kOneofFieldTypeOffset = 51; - static const int kRequiredBit = 0x100; - 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; - } - if (field->is_required() || (GetJavaType(field) == JAVATYPE_MESSAGE && - HasRequiredFields(field->message_type()))) { - extra_bits |= kCheckInitialized; - } - if (HasHasbit(field)) { - extra_bits |= kHasHasBit; - } - - if (field->is_map()) { - if (!SupportUnknownEnumValue(field)) { - const FieldDescriptor* value = field->message_type()->map_value(); - if (GetJavaType(value) == JAVATYPE_ENUM) { - extra_bits |= kMapWithProto2EnumValue; - } - } - return kMapFieldType | extra_bits; - } else if (field->is_packed()) { - return GetExperimentalJavaFieldTypeForPacked(field); - } else if (field->is_repeated()) { - return GetExperimentalJavaFieldTypeForRepeated(field) | extra_bits; - } else if (IsRealOneof(field)) { - return (GetExperimentalJavaFieldTypeForSingular(field) + - kOneofFieldTypeOffset) | - extra_bits; - } else { - return GetExperimentalJavaFieldTypeForSingular(field) | extra_bits; - } -} - -// Escape a UTF-16 character to be embedded in a Java string. -void EscapeUtf16ToString(uint16_t code, std::string* output) { - if (code == '\t') { - output->append("\\t"); - } else if (code == '\b') { - output->append("\\b"); - } else if (code == '\n') { - output->append("\\n"); - } else if (code == '\r') { - output->append("\\r"); - } else if (code == '\f') { - output->append("\\f"); - } else if (code == '\'') { - output->append("\\'"); - } else if (code == '\"') { - output->append("\\\""); - } else if (code == '\\') { - output->append("\\\\"); - } else if (code >= 0x20 && code <= 0x7f) { - output->push_back(static_cast(code)); - } else { - output->append(StringPrintf("\\u%04x", code)); - } -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/helpers.h b/depends/protobuf/src/google/protobuf/compiler/java/helpers.h deleted file mode 100644 index 9f1a55734..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/helpers.h +++ /dev/null @@ -1,474 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__ - -#include -#include - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -// Commonly-used separator comments. Thick is a line of '=', thin is a line -// of '-'. -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 -// character. annotation_file will be included verbatim into a Java literal -// string, so it should not contain quotes or invalid Java escape sequences; -// however, these are unlikely to appear in practice, as the value of -// annotation_file should be generated from the filename of the source file -// being annotated (which in turn must be a Java identifier plus ".java"). -void PrintGeneratedAnnotation(io::Printer* printer, char delimiter = '$', - const std::string& annotation_file = ""); - -// If a GeneratedMessageLite contains non-lite enums, then its verifier -// must be instantiated inline, rather than retrieved from the enum class. -void PrintEnumVerifierLogic(io::Printer* printer, - const FieldDescriptor* descriptor, - const std::map& variables, - 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, - bool cap_first_letter); -// Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes -// "fooBarBaz" or "FooBarBaz", respectively. -std::string UnderscoresToCamelCase(const FieldDescriptor* field); -std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field); - -// Similar, but for method names. (Typically, this merely has the effect -// of lower-casing the first letter of the name.) -std::string UnderscoresToCamelCase(const MethodDescriptor* method); - -// Same as UnderscoresToCamelCase, but checks for reserved keywords -std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field); - -// Similar to UnderscoresToCamelCase, but guarantees that the result is a -// complete Java identifier by adding a _ if needed. -std::string CamelCaseFieldName(const FieldDescriptor* field); - -// Get an identifier that uniquely identifies this type within the file. -// This is used to declare static variables related to this type at the -// outermost file scope. -std::string UniqueFileScopeIdentifier(const Descriptor* descriptor); - -// 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. -// TODO(xiaofeng): remove the default value after updating client code. -std::string FileClassName(const FileDescriptor* file, bool immutable = true); - -// Returns the file's Java package name. -std::string FileJavaPackage(const FileDescriptor* file, bool immutable); - -// Returns output directory for the given package name. -std::string JavaPackageToDir(std::string package_name); - -// 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); -// Comma-separate list of option-specified interfaces implemented by the -// MutableMessage, to follow the "implements" declaration of the MutableMessage -// definition. -std::string ExtraMutableMessageInterfaces(const Descriptor* descriptor); -// Comma-separate list of option-specified interfaces implemented by the -// Builder, to follow the "implements" declaration of the Builder definition. -std::string ExtraBuilderInterfaces(const Descriptor* descriptor); -// Comma-separate list of option-specified interfaces extended by the -// MessageOrBuilder, to follow the "extends" declaration of the -// MessageOrBuilder definition. -std::string ExtraMessageOrBuilderInterfaces(const Descriptor* descriptor); - -// Get the unqualified Java class name for mutable messages. i.e. without -// package or outer classnames. -inline std::string ShortMutableJavaClassName(const Descriptor* descriptor) { - return descriptor->name(); -} - -// Whether the given descriptor is for one of the core descriptor protos. We -// cannot currently use the new runtime with core protos since there is a -// bootstrapping problem with obtaining their descriptors. -inline bool IsDescriptorProto(const Descriptor* descriptor) { - return descriptor->file()->name() == "net/proto2/proto/descriptor.proto" || - descriptor->file()->name() == "google/protobuf/descriptor.proto"; -} - -// Returns the stored type string used by the experimental runtime for oneof -// fields. -std::string GetOneofStoredType(const FieldDescriptor* field); - -// We use either the proto1 enums if the enum is generated, otherwise fall back -// to use integers. -enum class Proto1EnumRepresentation { - kEnum, - kInteger, -}; - -// Returns which representation we should use. -inline Proto1EnumRepresentation GetProto1EnumRepresentation( - const EnumDescriptor* descriptor) { - if (descriptor->containing_type() != nullptr) { - return Proto1EnumRepresentation::kEnum; - } - return Proto1EnumRepresentation::kInteger; -} - -// 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(); -} - - -// Returns true if `descriptor` will be written to its own .java file. -// `immutable` should be set to true if we're generating for the immutable API. -template -bool IsOwnFile(const Descriptor* descriptor, bool immutable) { - return descriptor->containing_type() == NULL && - MultipleJavaFiles(descriptor->file(), immutable); -} - -template <> -inline bool IsOwnFile(const ServiceDescriptor* descriptor, bool immutable) { - return MultipleJavaFiles(descriptor->file(), immutable); -} - -// If `descriptor` describes an object with its own .java file, -// returns the name (relative to that .java file) of the file that stores -// annotation data for that descriptor. `suffix` is usually empty, but may -// (e.g.) be "OrBuilder" for some generated interfaces. -template -std::string AnnotationFileName(const Descriptor* descriptor, - const std::string& suffix) { - return descriptor->name() + suffix + ".java.pb.meta"; -} - -template -void MaybePrintGeneratedAnnotation(Context* context, io::Printer* printer, - Descriptor* descriptor, bool immutable, - const std::string& suffix = "") { - if (IsOwnFile(descriptor, immutable)) { - PrintGeneratedAnnotation(printer, '$', - context->options().annotate_code - ? AnnotationFileName(descriptor, suffix) - : ""); - } -} - -// Get the unqualified name that should be used for a field's field -// number constant. -std::string FieldConstantName(const FieldDescriptor* field); - -// Returns the type of the FieldDescriptor. -// This does nothing interesting for the open source release, but is used for -// hacks that improve compatibility with version 1 protocol buffers at Google. -FieldDescriptor::Type GetType(const FieldDescriptor* field); - -enum JavaType { - JAVATYPE_INT, - JAVATYPE_LONG, - JAVATYPE_FLOAT, - JAVATYPE_DOUBLE, - JAVATYPE_BOOLEAN, - JAVATYPE_STRING, - JAVATYPE_BYTES, - JAVATYPE_ENUM, - JAVATYPE_MESSAGE -}; - -JavaType GetJavaType(const FieldDescriptor* field); - -const char* PrimitiveTypeName(JavaType type); - -// Get the fully-qualified class name for a boxed primitive type, e.g. -// "java.lang.Integer" for JAVATYPE_INT. Returns NULL for enum and message -// 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". -const char* FieldTypeName(const FieldDescriptor::Type field_type); - -class ClassNameResolver; -std::string DefaultValue(const FieldDescriptor* field, bool immutable, - ClassNameResolver* name_resolver); -inline std::string ImmutableDefaultValue(const FieldDescriptor* field, - ClassNameResolver* name_resolver) { - return DefaultValue(field, true, name_resolver); -} -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 */, - bool enforce_lite) { - return !enforce_lite; -} -inline bool HasDescriptorMethods(const EnumDescriptor* /* descriptor */, - bool enforce_lite) { - return !enforce_lite; -} -inline bool HasDescriptorMethods(const FileDescriptor* /* descriptor */, - bool enforce_lite) { - return !enforce_lite; -} - -// Should we generate generic services for this file? -inline bool HasGenericServices(const FileDescriptor* file, bool enforce_lite) { - return file->service_count() > 0 && - HasDescriptorMethods(file, enforce_lite) && - file->options().java_generic_services(); -} - -// Methods for shared bitfields. - -// Gets the name of the shared bitfield for the given index. -std::string GetBitFieldName(int index); - -// Gets the name of the shared bitfield for the given bit index. -// Effectively, GetBitFieldName(bitIndex / 32) -std::string GetBitFieldNameForBit(int bitIndex); - -// Generates the java code for the expression that returns the boolean value -// of the bit of the shared bitfields for the given bit index. -// Example: "((bitField1_ & 0x04) == 0x04)" -std::string GenerateGetBit(int bitIndex); - -// Generates the java code for the expression that sets the bit of the shared -// bitfields for the given bit index. -// Example: "bitField1_ = (bitField1_ | 0x04)" -std::string GenerateSetBit(int bitIndex); - -// Generates the java code for the expression that clears the bit of the shared -// bitfields for the given bit index. -// Example: "bitField1_ = (bitField1_ & ~0x04)" -std::string GenerateClearBit(int bitIndex); - -// Does the same as GenerateGetBit but operates on the bit field on a local -// variable. This is used by the builder to copy the value in the builder to -// the message. -// Example: "((from_bitField1_ & 0x04) == 0x04)" -std::string GenerateGetBitFromLocal(int bitIndex); - -// Does the same as GenerateSetBit but operates on the bit field on a local -// variable. This is used by the builder to copy the value in the builder to -// the message. -// Example: "to_bitField1_ = (to_bitField1_ | 0x04)" -std::string GenerateSetBitToLocal(int bitIndex); - -// Does the same as GenerateGetBit but operates on the bit field on a local -// variable. This is used by the parsing constructor to record if a repeated -// field is mutable. -// Example: "((mutable_bitField1_ & 0x04) == 0x04)" -std::string GenerateGetBitMutableLocal(int bitIndex); - -// Does the same as GenerateSetBit but operates on the bit field on a local -// variable. This is used by the parsing constructor to record if a repeated -// field is mutable. -// Example: "mutable_bitField1_ = (mutable_bitField1_ | 0x04)" -std::string GenerateSetBitMutableLocal(int bitIndex); - -// Returns whether the JavaType is a reference type. -bool IsReferenceType(JavaType type); - -// Returns the capitalized name for calling relative functions in -// CodedInputStream -const char* GetCapitalizedType(const FieldDescriptor* field, bool immutable); - -// For encodings with fixed sizes, returns that size in bytes. Otherwise -// returns -1. -int FixedSize(FieldDescriptor::Type type); - -// Comparators used to sort fields in MessageGenerator -struct FieldOrderingByNumber { - inline bool operator()(const FieldDescriptor* a, - const FieldDescriptor* b) const { - return a->number() < b->number(); - } -}; - -struct ExtensionRangeOrdering { - bool operator()(const Descriptor::ExtensionRange* a, - const Descriptor::ExtensionRange* b) const { - return a->start < b->start; - } -}; - -// Sort the fields of the given Descriptor by number into a new[]'d array -// and return it. The caller should delete the returned array. -const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor); - -// Does this message class have any packed fields? -inline bool HasPackedFields(const Descriptor* descriptor) { - for (int i = 0; i < descriptor->field_count(); i++) { - if (descriptor->field(i)->is_packed()) { - return true; - } - } - return false; -} - -// Check a message type and its sub-message types recursively to see if any of -// them has a required field. Return true if a required field is found. -bool HasRequiredFields(const Descriptor* descriptor); - -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. -inline bool ExposePublicParser(const FileDescriptor* descriptor) { - // TODO(liujisi): Mark the PARSER private in 3.1.x releases. - return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO2; -} - -// Whether unknown enum values are kept (i.e., not stored in UnknownFieldSet -// but in the message and can be queried using additional getters that return -// ints. -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); - -inline bool IsMapEntry(const Descriptor* descriptor) { - return descriptor->options().map_entry(); -} - -inline bool IsMapField(const FieldDescriptor* descriptor) { - return descriptor->is_map(); -} - -inline bool IsAnyMessage(const Descriptor* descriptor) { - return descriptor->full_name() == "google.protobuf.Any"; -} - -inline bool IsWrappersProtoFile(const FileDescriptor* descriptor) { - return descriptor->name() == "google/protobuf/wrappers.proto"; -} - -inline bool CheckUtf8(const FieldDescriptor* descriptor) { - return descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 || - descriptor->file()->options().java_string_check_utf8(); -} - -inline std::string GeneratedCodeVersionSuffix() { - return "V3"; -} - -void WriteUInt32ToUtf16CharSequence(uint32_t number, - std::vector* output); - -inline void WriteIntToUtf16CharSequence(int value, - 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_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 -// byte: -// bit 0: whether the field is required. -// bit 1: whether the field requires UTF-8 validation. -// bit 2: whether the field needs isInitialized check. -// bit 3: whether the field is a map field with proto2 enum value. -// bits 4-7: unused -int GetExperimentalJavaFieldType(const FieldDescriptor* field); - -// To get the total number of entries need to be built for experimental runtime -// and the first field number that are not in the table part -std::pair GetTableDrivenNumberOfEntriesAndLookUpStartFieldNumber( - const FieldDescriptor** fields, int count); -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/java_generator.h b/depends/protobuf/src/google/protobuf/compiler/java/java_generator.h deleted file mode 100644 index 294b1bde0..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/java_generator.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_JAVA_GENERATOR_H_ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_JAVA_GENERATOR_H_ - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_JAVA_GENERATOR_H_ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/kotlin_generator.cc b/depends/protobuf/src/google/protobuf/compiler/java/kotlin_generator.cc deleted file mode 100644 index 1af548a9e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/kotlin_generator.cc +++ /dev/null @@ -1,158 +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 - -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") { - // Note: the option is considered always set regardless of the input. - 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") { - // Note: the option is considered always set regardless of the input. - 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; - } - } - - // We only support generation of immutable code so we do it. - 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( - new FileGenerator(file, file_options, /* immutable_api = */ true)); - - if (!file_generator || !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/depends/protobuf/src/google/protobuf/compiler/java/kotlin_generator.h b/depends/protobuf/src/google/protobuf/compiler/java/kotlin_generator.h deleted file mode 100644 index ccd9688ca..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/kotlin_generator.h +++ /dev/null @@ -1,74 +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. - -// 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 - -// Must be included last. -#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/depends/protobuf/src/google/protobuf/compiler/java/map_field.cc b/depends/protobuf/src/google/protobuf/compiler/java/map_field.cc deleted file mode 100644 index b70d12aeb..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/map_field.cc +++ /dev/null @@ -1,923 +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 "google/protobuf/compiler/java/map_field.h" - -#include "google/protobuf/io/printer.h" -#include "google/protobuf/compiler/java/context.h" -#include "google/protobuf/compiler/java/doc_comment.h" -#include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/name_resolver.h" - -// Must be last. -#include "google/protobuf/port_def.inc" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { - -const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) { - GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type()); - const Descriptor* message = descriptor->message_type(); - GOOGLE_CHECK(message->options().map_entry()); - return message->map_key(); -} - -const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) { - GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type()); - const Descriptor* message = descriptor->message_type(); - GOOGLE_CHECK(message->options().map_entry()); - return message->map_value(); -} - -std::string TypeName(const FieldDescriptor* field, - ClassNameResolver* name_resolver, bool boxed) { - 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 boxed ? BoxedPrimitiveTypeName(GetJavaType(field)) - : PrimitiveTypeName(GetJavaType(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())); -} - -void SetMessageVariables( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, Context* context, - std::map* variables) { - SetCommonFieldVariables(descriptor, info, variables); - ClassNameResolver* name_resolver = context->GetNameResolver(); - - (*variables)["type"] = - name_resolver->GetImmutableClassName(descriptor->message_type()); - const FieldDescriptor* key = KeyField(descriptor); - const FieldDescriptor* value = ValueField(descriptor); - const JavaType keyJavaType = GetJavaType(key); - const JavaType valueJavaType = GetJavaType(value); - - std::string pass_through_nullness = "/* nullable */\n"; - - (*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); - (*variables)["key_wire_type"] = WireType(key); - (*variables)["key_default_value"] = DefaultValue(key, true, name_resolver); - (*variables)["key_null_check"] = - IsReferenceType(keyJavaType) - ? "if (key == null) { throw new NullPointerException(\"map key\"); }" - : ""; - (*variables)["value_null_check"] = - valueJavaType != JAVATYPE_ENUM && IsReferenceType(valueJavaType) - ? "if (value == null) { " - "throw new NullPointerException(\"map value\"); }" - : ""; - if (valueJavaType == JAVATYPE_ENUM) { - // We store enums as Integers internally. - (*variables)["value_type"] = "int"; - variables->insert( - {"value_type_pass_through_nullness", (*variables)["value_type"]}); - (*variables)["boxed_value_type"] = "java.lang.Integer"; - (*variables)["value_wire_type"] = WireType(value); - (*variables)["value_default_value"] = - DefaultValue(value, true, name_resolver) + ".getNumber()"; - - (*variables)["value_enum_type"] = TypeName(value, name_resolver, false); - - variables->insert( - {"value_enum_type_pass_through_nullness", - StrCat(pass_through_nullness, (*variables)["value_enum_type"])}); - - if (SupportUnknownEnumValue(descriptor->file())) { - // Map unknown values to a special UNRECOGNIZED value if supported. - variables->insert( - {"unrecognized_value", - StrCat((*variables)["value_enum_type"], ".UNRECOGNIZED")}); - } else { - // Map unknown values to the default value if we don't have UNRECOGNIZED. - (*variables)["unrecognized_value"] = - DefaultValue(value, true, name_resolver); - } - } else { - (*variables)["value_type"] = TypeName(value, name_resolver, false); - - variables->insert( - {"value_type_pass_through_nullness", - StrCat( - (IsReferenceType(valueJavaType) ? pass_through_nullness : ""), - (*variables)["value_type"])}); - - (*variables)["boxed_value_type"] = TypeName(value, name_resolver, true); - (*variables)["value_wire_type"] = WireType(value); - (*variables)["value_default_value"] = - DefaultValue(value, true, name_resolver); - } - variables->insert( - {"type_parameters", StrCat((*variables)["boxed_key_type"], ", ", - (*variables)["boxed_value_type"])}); - // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported - // by the proto compiler - (*variables)["deprecation"] = - descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); - (*variables)["on_changed"] = "onChanged();"; - - variables->insert( - {"default_entry", StrCat((*variables)["capitalized_name"], - "DefaultEntryHolder.defaultEntry")}); - variables->insert({"map_field_parameter", (*variables)["default_entry"]}); - (*variables)["descriptor"] = - name_resolver->GetImmutableClassName(descriptor->file()) + ".internal_" + - UniqueFileScopeIdentifier(descriptor->message_type()) + "_descriptor, "; - (*variables)["ver"] = GeneratedCodeVersionSuffix(); - - (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_builder"] = - GenerateSetBit(builderBitIndex) + ";"; - (*variables)["clear_has_field_bit_builder"] = - GenerateClearBit(builderBitIndex) + ";"; -} - -} // namespace - -ImmutableMapFieldGenerator::ImmutableMapFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : descriptor_(descriptor), - message_bit_index_(messageBitIndex), - builder_bit_index_(builderBitIndex), - name_resolver_(context->GetNameResolver()), - context_(context) { - SetMessageVariables(descriptor, messageBitIndex, builderBitIndex, - context->GetFieldGeneratorInfo(descriptor), context, - &variables_); -} - -ImmutableMapFieldGenerator::~ImmutableMapFieldGenerator() {} - -int ImmutableMapFieldGenerator::GetMessageBitIndex() const { - return message_bit_index_; -} - -int ImmutableMapFieldGenerator::GetBuilderBitIndex() const { - return builder_bit_index_; -} - -int ImmutableMapFieldGenerator::GetNumBitsForMessage() const { return 0; } - -int ImmutableMapFieldGenerator::GetNumBitsForBuilder() const { return 1; } - -void ImmutableMapFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$int ${$get$capitalized_name$Count$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$boolean ${$contains$capitalized_name$$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print(variables_, - "/**\n" - " * Use {@link #get$capitalized_name$Map()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "${$get$capitalized_name$$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "${$get$capitalized_name$Map$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$$value_enum_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_enum_type_pass_through_nullness$ " - " defaultValue);\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$$value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "/**\n" - " * Use {@link #get$capitalized_name$ValueMap()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$Value$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$ValueMap$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$$value_type_pass_through_nullness$ " - "${$get$capitalized_name$ValueOrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type_pass_through_nullness$ defaultValue);\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$$value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - } - } else { - printer->Print(variables_, - "/**\n" - " * Use {@link #get$capitalized_name$Map()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$Map$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$$value_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type_pass_through_nullness$ defaultValue);\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$$value_type$ ${$get$capitalized_name$OrThrow$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -void ImmutableMapFieldGenerator::GenerateMembers(io::Printer* printer) const { - printer->Print( - variables_, - "private static final class $capitalized_name$DefaultEntryHolder {\n" - " static final com.google.protobuf.MapEntry<\n" - " $type_parameters$> defaultEntry =\n" - " com.google.protobuf.MapEntry\n" - " .<$type_parameters$>newDefaultInstance(\n" - " $descriptor$\n" - " $key_wire_type$,\n" - " $key_default_value$,\n" - " $value_wire_type$,\n" - " $value_default_value$);\n" - "}\n"); - printer->Print(variables_, - "@SuppressWarnings(\"serial\")\n" - "private com.google.protobuf.MapField<\n" - " $type_parameters$> $name$_;\n" - "private com.google.protobuf.MapField<$type_parameters$>\n" - "internalGet$capitalized_name$() {\n" - " if ($name$_ == null) {\n" - " return com.google.protobuf.MapField.emptyMapField(\n" - " $map_field_parameter$);\n" - " }\n" - " return $name$_;\n" - "}\n"); - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print( - variables_, - "private static final\n" - "com.google.protobuf.Internal.MapAdapter.Converter<\n" - " java.lang.Integer, $value_enum_type$> $name$ValueConverter =\n" - " com.google.protobuf.Internal.MapAdapter.newEnumConverter(\n" - " $value_enum_type$.internalGetValueMap(),\n" - " $unrecognized_value$);\n"); - printer->Print( - variables_, - "private static final java.util.Map<$boxed_key_type$, " - "$value_enum_type$>\n" - "internalGetAdapted$capitalized_name$Map(\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map) {\n" - " return new com.google.protobuf.Internal.MapAdapter<\n" - " $boxed_key_type$, $value_enum_type$, java.lang.Integer>(\n" - " map, $name$ValueConverter);\n" - "}\n"); - } - GenerateMapGetters(printer); -} - -void ImmutableMapFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "private com.google.protobuf.MapField<\n" - " $type_parameters$> $name$_;\n" - "$deprecation$private com.google.protobuf.MapField<$type_parameters$>\n" - " internalGet$capitalized_name$() {\n" - " if ($name$_ == null) {\n" - " return com.google.protobuf.MapField.emptyMapField(\n" - " $map_field_parameter$);\n" - " }\n" - " return $name$_;\n" - "}\n" - "$deprecation$private com.google.protobuf.MapField<$type_parameters$>\n" - " internalGetMutable$capitalized_name$() {\n" - " if ($name$_ == null) {\n" - " $name$_ = com.google.protobuf.MapField.newMapField(\n" - " $map_field_parameter$);\n" - " }\n" - " if (!$name$_.isMutable()) {\n" - " $name$_ = $name$_.copy();\n" - " }\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - " return $name$_;\n" - "}\n"); - GenerateMapGetters(printer); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " $clear_has_field_bit_builder$\n" - " internalGetMutable$capitalized_name$().getMutableMap()\n" - " .clear();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$remove$capitalized_name$$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " internalGetMutable$capitalized_name$().getMutableMap()\n" - " .remove(key);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print( - variables_, - "/**\n" - " * Use alternate mutation accessors instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - " ${$getMutable$capitalized_name$$}$() {\n" - " $set_has_field_bit_builder$\n" - " return internalGetAdapted$capitalized_name$Map(\n" - " internalGetMutable$capitalized_name$().getMutableMap());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$put$capitalized_name$$}$(\n" - " $key_type$ key,\n" - " $value_enum_type$ value) {\n" - " $key_null_check$\n" - " $value_null_check$\n" - " internalGetMutable$capitalized_name$().getMutableMap()\n" - " .put(key, $name$ValueConverter.doBackward(value));\n" - " $set_has_field_bit_builder$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$putAll$capitalized_name$$}$(\n" - " java.util.Map<$boxed_key_type$, $value_enum_type$> values) {\n" - " internalGetAdapted$capitalized_name$Map(\n" - " internalGetMutable$capitalized_name$().getMutableMap())\n" - " .putAll(values);\n" - " $set_has_field_bit_builder$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "/**\n" - " * Use alternate mutation accessors instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n" - "${$getMutable$capitalized_name$Value$}$() {\n" - " $set_has_field_bit_builder$\n" - " return internalGetMutable$capitalized_name$().getMutableMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$put$capitalized_name$Value$}$(\n" - " $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" - " $set_has_field_bit_builder$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$putAll$capitalized_name$Value$}$(\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> values) {\n" - " internalGetMutable$capitalized_name$().getMutableMap()\n" - " .putAll(values);\n" - " $set_has_field_bit_builder$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - } else { - printer->Print( - variables_, - "/**\n" - " * Use alternate mutation accessors instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public java.util.Map<$type_parameters$>\n" - " ${$getMutable$capitalized_name$$}$() {\n" - " $set_has_field_bit_builder$\n" - " return internalGetMutable$capitalized_name$().getMutableMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$put$capitalized_name$$}$(\n" - " $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" - " $set_has_field_bit_builder$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$putAll$capitalized_name$$}$(\n" - " java.util.Map<$type_parameters$> values) {\n" - " internalGetMutable$capitalized_name$().getMutableMap()\n" - " .putAll(values);\n" - " $set_has_field_bit_builder$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -void ImmutableMapFieldGenerator::GenerateMapGetters( - io::Printer* printer) const { - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return internalGet$capitalized_name$().getMap().size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$contains$capitalized_name$$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " return internalGet$capitalized_name$().getMap().containsKey(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print(variables_, - "/**\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" - " return get$capitalized_name$Map();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.Map<$boxed_key_type$, " - "$value_enum_type$>\n" - "${$get$capitalized_name$Map$}$() {\n" - " return internalGetAdapted$capitalized_name$Map(\n" - " internalGet$capitalized_name$().getMap());" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $value_enum_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_enum_type_pass_through_nullness$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$().getMap();\n" - " return map.containsKey(key)\n" - " ? $name$ValueConverter.doForward(map.get(key))\n" - " : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $value_enum_type$ get$capitalized_name$OrThrow(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$().getMap();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return $name$ValueConverter.doForward(map.get(key));\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "/**\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" - " return get$capitalized_name$ValueMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.Map<$boxed_key_type$, " - "$boxed_value_type$>\n" - "${$get$capitalized_name$ValueMap$}$() {\n" - " return internalGet$capitalized_name$().getMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $value_type_pass_through_nullness$ " - "${$get$capitalized_name$ValueOrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type_pass_through_nullness$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$().getMap();\n" - " return map.containsKey(key) ? map.get(key) : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $value_type$ " - "${$get$capitalized_name$ValueOrThrow$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$().getMap();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - } else { - printer->Print(variables_, - "/**\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" - " return get$capitalized_name$Map();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.Map<$type_parameters$> " - "${$get$capitalized_name$Map$}$() {\n" - " return internalGet$capitalized_name$().getMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $value_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type_pass_through_nullness$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$type_parameters$> map =\n" - " internalGet$capitalized_name$().getMap();\n" - " return map.containsKey(key) ? map.get(key) : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $value_type$ ${$get$capitalized_name$OrThrow$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " java.util.Map<$type_parameters$> map =\n" - " internalGet$capitalized_name$().getMap();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -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" - "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. -} - -void ImmutableMapFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - // Nothing to initialize. -} - -void ImmutableMapFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - // No need to clear the has-bit since we clear the bitField ints all at once. - printer->Print(variables_, - "internalGetMutable$capitalized_name$().clear();\n"); -} - -void ImmutableMapFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - printer->Print(variables_, - "internalGetMutable$capitalized_name$().mergeFrom(\n" - " other.internalGet$capitalized_name$());\n" - "$set_has_field_bit_builder$\n"); -} - -void ImmutableMapFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($get_has_field_bit_from_local$) {\n" - " result.$name$_ = internalGet$capitalized_name$();\n" - " result.$name$_.makeImmutable();\n" - "}\n"); -} - -void ImmutableMapFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - 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" - "if ($value_enum_type$.forNumber($name$__.getValue()) == null) {\n" - " mergeUnknownLengthDelimitedField($number$, bytes);\n" - "} else {\n" - " internalGetMutable$capitalized_name$().getMutableMap().put(\n" - " $name$__.getKey(), $name$__.getValue());\n" - " $set_has_field_bit_builder$\n" - "}\n"); - } else { - printer->Print( - variables_, - "com.google.protobuf.MapEntry<$type_parameters$>\n" - "$name$__ = input.readMessage(\n" - " $default_entry$.getParserForType(), extensionRegistry);\n" - "internalGetMutable$capitalized_name$().getMutableMap().put(\n" - " $name$__.getKey(), $name$__.getValue());\n" - "$set_has_field_bit_builder$\n"); - } -} -void ImmutableMapFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "com.google.protobuf.GeneratedMessage$ver$\n" - " .serialize$short_key_type$MapTo(\n" - " output,\n" - " internalGet$capitalized_name$(),\n" - " $default_entry$,\n" - " $number$);\n"); -} - -void ImmutableMapFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print( - variables_, - "for (java.util.Map.Entry<$type_parameters$> entry\n" - " : internalGet$capitalized_name$().getMap().entrySet()) {\n" - " com.google.protobuf.MapEntry<$type_parameters$>\n" - " $name$__ = $default_entry$.newBuilderForType()\n" - " .setKey(entry.getKey())\n" - " .setValue(entry.getValue())\n" - " .build();\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .computeMessageSize($number$, $name$__);\n" - "}\n"); -} - -void ImmutableMapFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print(variables_, - "if (!internalGet$capitalized_name$().equals(\n" - " other.internalGet$capitalized_name$())) return false;\n"); -} - -void ImmutableMapFieldGenerator::GenerateHashCode(io::Printer* printer) const { - printer->Print( - variables_, - "if (!internalGet$capitalized_name$().getMap().isEmpty()) {\n" - " hash = (37 * hash) + $constant_name$;\n" - " hash = (53 * hash) + internalGet$capitalized_name$().hashCode();\n" - "}\n"); -} - -std::string ImmutableMapFieldGenerator::GetBoxedType() const { - return name_resolver_->GetImmutableClassName(descriptor_->message_type()); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include "google/protobuf/port_undef.inc" diff --git a/depends/protobuf/src/google/protobuf/compiler/java/map_field.h b/depends/protobuf/src/google/protobuf/compiler/java/map_field.h deleted file mode 100644 index d54a28bd5..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/map_field.h +++ /dev/null @@ -1,86 +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_COMPILER_JAVA_MAP_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_H__ - -#include "google/protobuf/compiler/java/field.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableMapFieldGenerator : public ImmutableFieldGenerator { - public: - explicit ImmutableMapFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - Context* context); - ~ImmutableMapFieldGenerator() override; - - // implements ImmutableFieldGenerator --------------------------------------- - int GetMessageBitIndex() const override; - int GetBuilderBitIndex() const override; - 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_; - int message_bit_index_; - int builder_bit_index_; - std::map variables_; - ClassNameResolver* name_resolver_; - Context* context_; - void GenerateMapGetters(io::Printer* printer) const; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/map_field_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/map_field_lite.cc deleted file mode 100644 index ed6f8f39f..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/map_field_lite.cc +++ /dev/null @@ -1,927 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { - -const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) { - GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type()); - const Descriptor* message = descriptor->message_type(); - GOOGLE_CHECK(message->options().map_entry()); - return message->map_key(); -} - -const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) { - GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type()); - const Descriptor* message = descriptor->message_type(); - GOOGLE_CHECK(message->options().map_entry()); - return message->map_value(); -} - -std::string TypeName(const FieldDescriptor* field, - ClassNameResolver* name_resolver, bool boxed) { - 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 boxed ? BoxedPrimitiveTypeName(GetJavaType(field)) - : PrimitiveTypeName(GetJavaType(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())); -} - -void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, const FieldGeneratorInfo* info, - Context* context, - std::map* variables) { - SetCommonFieldVariables(descriptor, info, variables); - - ClassNameResolver* name_resolver = context->GetNameResolver(); - (*variables)["type"] = - name_resolver->GetImmutableClassName(descriptor->message_type()); - const FieldDescriptor* key = KeyField(descriptor); - const FieldDescriptor* value = ValueField(descriptor); - const JavaType keyJavaType = GetJavaType(key); - const JavaType valueJavaType = GetJavaType(value); - - std::string pass_through_nullness = "/* nullable */\n"; - - (*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) - ? "java.lang.Class keyClass = key.getClass();" - : ""; - (*variables)["value_null_check"] = - IsReferenceType(valueJavaType) - ? "java.lang.Class valueClass = value.getClass();" - : ""; - - if (GetJavaType(value) == JAVATYPE_ENUM) { - // We store enums as Integers internally. - (*variables)["value_type"] = "int"; - (*variables)["boxed_value_type"] = "java.lang.Integer"; - (*variables)["value_wire_type"] = WireType(value); - (*variables)["value_default_value"] = - DefaultValue(value, true, name_resolver) + ".getNumber()"; - - (*variables)["value_enum_type"] = TypeName(value, name_resolver, false); - - (*variables)["value_enum_type_pass_through_nullness"] = - pass_through_nullness + (*variables)["value_enum_type"]; - - if (SupportUnknownEnumValue(descriptor->file())) { - // Map unknown values to a special UNRECOGNIZED value if supported. - (*variables)["unrecognized_value"] = - (*variables)["value_enum_type"] + ".UNRECOGNIZED"; - } else { - // Map unknown values to the default value if we don't have UNRECOGNIZED. - (*variables)["unrecognized_value"] = - DefaultValue(value, true, name_resolver); - } - } else { - (*variables)["value_type"] = TypeName(value, name_resolver, false); - - (*variables)["value_type_pass_through_nullness"] = - (IsReferenceType(valueJavaType) ? pass_through_nullness : "") + - (*variables)["value_type"]; - - (*variables)["boxed_value_type"] = TypeName(value, name_resolver, true); - (*variables)["value_wire_type"] = WireType(value); - (*variables)["value_default_value"] = - DefaultValue(value, true, name_resolver); - } - (*variables)["type_parameters"] = - (*variables)["boxed_key_type"] + ", " + (*variables)["boxed_value_type"]; - // 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)["default_entry"] = - (*variables)["capitalized_name"] + "DefaultEntryHolder.defaultEntry"; -} - -} // namespace - -ImmutableMapFieldLiteGenerator::ImmutableMapFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : descriptor_(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()) { - SetMessageVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), context, - &variables_); -} - -ImmutableMapFieldLiteGenerator::~ImmutableMapFieldLiteGenerator() {} - -int ImmutableMapFieldLiteGenerator::GetNumBitsForMessage() const { return 0; } - -void ImmutableMapFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$int ${$get$capitalized_name$Count$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$boolean ${$contains$capitalized_name$$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print(variables_, - "/**\n" - " * Use {@link #get$capitalized_name$Map()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "${$get$capitalized_name$$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "${$get$capitalized_name$Map$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$$value_enum_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_enum_type_pass_through_nullness$ " - " defaultValue);\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$$value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "/**\n" - " * Use {@link #get$capitalized_name$ValueMap()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$Value$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$ValueMap$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$\n" - "$value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type$ defaultValue);\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$\n" - "$value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - } - } else { - printer->Print(variables_, - "/**\n" - " * Use {@link #get$capitalized_name$Map()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.Map<$type_parameters$>\n" - "${$get$capitalized_name$Map$}$();\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$\n" - "$value_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type_pass_through_nullness$ defaultValue);\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$\n" - "$value_type$ ${$get$capitalized_name$OrThrow$}$(\n" - " $key_type$ key);\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -void ImmutableMapFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "private static final class $capitalized_name$DefaultEntryHolder {\n" - " static final com.google.protobuf.MapEntryLite<\n" - " $type_parameters$> defaultEntry =\n" - " com.google.protobuf.MapEntryLite\n" - " .<$type_parameters$>newDefaultInstance(\n" - " $key_wire_type$,\n" - " $key_default_value$,\n" - " $value_wire_type$,\n" - " $value_default_value$);\n" - "}\n"); - printer->Print(variables_, - "private com.google.protobuf.MapFieldLite<\n" - " $type_parameters$> $name$_ =\n" - " com.google.protobuf.MapFieldLite.emptyMapField();\n" - "private com.google.protobuf.MapFieldLite<$type_parameters$>\n" - "internalGet$capitalized_name$() {\n" - " return $name$_;\n" - "}\n" - "private com.google.protobuf.MapFieldLite<$type_parameters$>\n" - "internalGetMutable$capitalized_name$() {\n" - " if (!$name$_.isMutable()) {\n" - " $name$_ = $name$_.mutableCopy();\n" - " }\n" - " return $name$_;\n" - "}\n"); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public int ${$get$capitalized_name$Count$}$() {\n" - " return internalGet$capitalized_name$().size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public boolean ${$contains$capitalized_name$$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " return internalGet$capitalized_name$().containsKey(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print( - variables_, - "private static final\n" - "com.google.protobuf.Internal.MapAdapter.Converter<\n" - " java.lang.Integer, $value_enum_type$> $name$ValueConverter =\n" - " com.google.protobuf.Internal.MapAdapter.newEnumConverter(\n" - " $value_enum_type$.internalGetValueMap(),\n" - " $unrecognized_value$);\n"); - printer->Print(variables_, - "/**\n" - " * Use {@link #get$capitalized_name$Map()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "${$get$capitalized_name$$}$() {\n" - " return get$capitalized_name$Map();\n" - "}\n"); - 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" - " return java.util.Collections.unmodifiableMap(\n" - " new com.google.protobuf.Internal.MapAdapter<\n" - " $boxed_key_type$, $value_enum_type$, java.lang.Integer>(\n" - " internalGet$capitalized_name$(),\n" - " $name$ValueConverter));\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - " $value_enum_type$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$();\n" - " return map.containsKey(key)\n" - " ? $name$ValueConverter.doForward(map.get(key))\n" - " : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return $name$ValueConverter.doForward(map.get(key));\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "/**\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" - " return get$capitalized_name$ValueMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - " return java.util.Collections.unmodifiableMap(\n" - " internalGet$capitalized_name$());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$();\n" - " return map.containsKey(key) ? map.get(key) : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " internalGet$capitalized_name$();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - } else { - printer->Print(variables_, - "/**\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" - " return get$capitalized_name$Map();\n" - "}\n"); - 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" - " return java.util.Collections.unmodifiableMap(\n" - " internalGet$capitalized_name$());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_type$ ${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$type_parameters$> map =\n" - " internalGet$capitalized_name$();\n" - " return map.containsKey(key) ? map.get(key) : defaultValue;\n" - "}\n"); - 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" - " $key_null_check$\n" - " java.util.Map<$type_parameters$> map =\n" - " internalGet$capitalized_name$();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - - // Generate private setters for the builder to proxy into. - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "private java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "getMutable$capitalized_name$Map() {\n" - " return new com.google.protobuf.Internal.MapAdapter<\n" - " $boxed_key_type$, $value_enum_type$, java.lang.Integer>(\n" - " internalGetMutable$capitalized_name$(),\n" - " $name$ValueConverter);\n" - "}\n"); - if (SupportUnknownEnumValue(descriptor_->file())) { - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "private java.util.Map<$boxed_key_type$, $boxed_value_type$>\n" - "getMutable$capitalized_name$ValueMap() {\n" - " return internalGetMutable$capitalized_name$();\n" - "}\n"); - } - } else { - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private java.util.Map<$type_parameters$>\n" - "getMutable$capitalized_name$Map() {\n" - " return internalGetMutable$capitalized_name$();\n" - "}\n"); - } -} - -void ImmutableMapFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - printer->Print(variables_, - "\"$name$_\",\n" - "$default_entry$,\n"); - if (!SupportUnknownEnumValue(descriptor_) && - GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - PrintEnumVerifierLogic(printer, ValueField(descriptor_), variables_, - /*var_name=*/"$value_enum_type$", - /*terminating_string=*/",\n", - /*enforce_lite=*/context_->EnforceLite()); - } -} - -void ImmutableMapFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public int ${$get$capitalized_name$Count$}$() {\n" - " return instance.get$capitalized_name$Map().size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public boolean ${$contains$capitalized_name$$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " return instance.get$capitalized_name$Map().containsKey(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - printer->Print(variables_, - "$deprecation$\n" - "public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$Map().clear();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$\n" - "public Builder ${$remove$capitalized_name$$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$Map().remove(key);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - if (GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { - printer->Print(variables_, - "/**\n" - " * Use {@link #get$capitalized_name$Map()} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public java.util.Map<$boxed_key_type$, $value_enum_type$>\n" - "${$get$capitalized_name$$}$() {\n" - " return get$capitalized_name$Map();\n" - "}\n"); - 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" - " return java.util.Collections.unmodifiableMap(\n" - " instance.get$capitalized_name$Map());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_enum_type_pass_through_nullness$ " - "${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_enum_type_pass_through_nullness$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $value_enum_type$> map =\n" - " instance.get$capitalized_name$Map();\n" - " return map.containsKey(key)\n" - " ? map.get(key)\n" - " : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $value_enum_type$> map =\n" - " instance.get$capitalized_name$Map();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$put$capitalized_name$$}$(\n" - " $key_type$ key,\n" - " $value_enum_type$ value) {\n" - " $key_null_check$\n" - " $value_null_check$\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$Map().put(key, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$putAll$capitalized_name$$}$(\n" - " java.util.Map<$boxed_key_type$, $value_enum_type$> values) {\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$Map().putAll(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - if (SupportUnknownEnumValue(descriptor_->file())) { - printer->Print( - variables_, - "/**\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" - " return get$capitalized_name$ValueMap();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - " return java.util.Collections.unmodifiableMap(\n" - " instance.get$capitalized_name$ValueMap());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " instance.get$capitalized_name$ValueMap();\n" - " return map.containsKey(key) ? map.get(key) : defaultValue;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n" - " $key_type$ key) {\n" - " $key_null_check$\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> map =\n" - " instance.get$capitalized_name$ValueMap();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$put$capitalized_name$Value$}$(\n" - " $key_type$ key,\n" - " $value_type$ value) {\n" - " $key_null_check$\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$ValueMap().put(key, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$putAll$capitalized_name$Value$}$(\n" - " java.util.Map<$boxed_key_type$, $boxed_value_type$> values) {\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$ValueMap().putAll(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - } else { - printer->Print(variables_, - "/**\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" - " return get$capitalized_name$Map();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$" - "public java.util.Map<$type_parameters$> " - "${$get$capitalized_name$Map$}$() {\n" - " return java.util.Collections.unmodifiableMap(\n" - " instance.get$capitalized_name$Map());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$\n" - "public $value_type$ ${$get$capitalized_name$OrDefault$}$(\n" - " $key_type$ key,\n" - " $value_type$ defaultValue) {\n" - " $key_null_check$\n" - " java.util.Map<$type_parameters$> map =\n" - " instance.get$capitalized_name$Map();\n" - " return map.containsKey(key) ? map.get(key) : defaultValue;\n" - "}\n"); - 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" - " $key_null_check$\n" - " java.util.Map<$type_parameters$> map =\n" - " instance.get$capitalized_name$Map();\n" - " if (!map.containsKey(key)) {\n" - " throw new java.lang.IllegalArgumentException();\n" - " }\n" - " return map.get(key);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$" - "public Builder ${$put$capitalized_name$$}$(\n" - " $key_type$ key,\n" - " $value_type$ value) {\n" - " $key_null_check$\n" - " $value_null_check$\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$Map().put(key, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$" - "public Builder ${$putAll$capitalized_name$$}$(\n" - " java.util.Map<$type_parameters$> values) {\n" - " copyOnWrite();\n" - " instance.getMutable$capitalized_name$Map().putAll(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } -} - -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. -} - -std::string ImmutableMapFieldLiteGenerator::GetBoxedType() const { - return name_resolver_->GetImmutableClassName(descriptor_->message_type()); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/map_field_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/map_field_lite.h deleted file mode 100644 index 964f0982b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/map_field_lite.h +++ /dev/null @@ -1,74 +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_COMPILER_JAVA_MAP_FIELD_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__ - -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableMapFieldLiteGenerator : public ImmutableFieldLiteGenerator { - public: - explicit ImmutableMapFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context); - ~ImmutableMapFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - private: - const FieldDescriptor* descriptor_; - std::map variables_; - Context* context_; - ClassNameResolver* name_resolver_; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message.cc b/depends/protobuf/src/google/protobuf/compiler/java/message.cc deleted file mode 100644 index a29d9a78e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message.cc +++ /dev/null @@ -1,1603 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -namespace { -std::string MapValueImmutableClassdName(const Descriptor* descriptor, - ClassNameResolver* name_resolver) { - const FieldDescriptor* value_field = descriptor->map_value(); - GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type()); - return name_resolver->GetImmutableClassName(value_field->message_type()); -} -} // namespace - -// =================================================================== - -MessageGenerator::MessageGenerator(const 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() {} - -// =================================================================== -ImmutableMessageGenerator::ImmutableMessageGenerator( - const Descriptor* descriptor, Context* context) - : MessageGenerator(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()), - field_generators_(descriptor, context_) { - GOOGLE_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite())) - << "Generator factory error: A non-lite message generator is used to " - "generate lite messages."; -} - -ImmutableMessageGenerator::~ImmutableMessageGenerator() {} - -void ImmutableMessageGenerator::GenerateStaticVariables( - io::Printer* printer, int* bytecode_estimate) { - // Because descriptor.proto (com.google.protobuf.DescriptorProtos) is - // used in the construction of descriptors, we have a tricky bootstrapping - // problem. To help control static initialization order, we make sure all - // descriptors and other static data that depends on them are members of - // the outermost class in the file. This way, they will be initialized in - // a deterministic order. - - std::map vars; - vars["identifier"] = UniqueFileScopeIdentifier(descriptor_); - vars["index"] = StrCat(descriptor_->index()); - vars["classname"] = name_resolver_->GetImmutableClassName(descriptor_); - if (descriptor_->containing_type() != NULL) { - vars["parent"] = UniqueFileScopeIdentifier(descriptor_->containing_type()); - } - if (MultipleJavaFiles(descriptor_->file(), /* immutable = */ true)) { - // We can only make these package-private since the classes that use them - // are in separate files. - vars["private"] = ""; - } else { - vars["private"] = "private "; - } - if (*bytecode_estimate <= kMaxStaticSize) { - vars["final"] = "final "; - } else { - vars["final"] = ""; - } - - // The descriptor for this type. - printer->Print( - vars, - // TODO(teboring): final needs to be added back. The way to fix it is to - // generate methods that can construct the types, and then still declare - // the types, and then init them in clinit with the new method calls. - "$private$static $final$com.google.protobuf.Descriptors.Descriptor\n" - " internal_$identifier$_descriptor;\n"); - *bytecode_estimate += 30; - - // And the FieldAccessorTable. - GenerateFieldAccessorTable(printer, bytecode_estimate); - - // Generate static members for all nested types. - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // TODO(kenton): Reuse MessageGenerator objects? - ImmutableMessageGenerator(descriptor_->nested_type(i), context_) - .GenerateStaticVariables(printer, bytecode_estimate); - } -} - -int ImmutableMessageGenerator::GenerateStaticVariableInitializers( - io::Printer* printer) { - int bytecode_estimate = 0; - std::map vars; - vars["identifier"] = UniqueFileScopeIdentifier(descriptor_); - vars["index"] = StrCat(descriptor_->index()); - vars["classname"] = name_resolver_->GetImmutableClassName(descriptor_); - if (descriptor_->containing_type() != NULL) { - vars["parent"] = UniqueFileScopeIdentifier(descriptor_->containing_type()); - } - - // The descriptor for this type. - if (descriptor_->containing_type() == NULL) { - printer->Print(vars, - "internal_$identifier$_descriptor =\n" - " getDescriptor().getMessageTypes().get($index$);\n"); - bytecode_estimate += 30; - } else { - printer->Print( - vars, - "internal_$identifier$_descriptor =\n" - " internal_$parent$_descriptor.getNestedTypes().get($index$);\n"); - bytecode_estimate += 30; - } - - // And the FieldAccessorTable. - bytecode_estimate += GenerateFieldAccessorTableInitializer(printer); - - // Generate static member initializers for all nested types. - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // TODO(kenton): Reuse MessageGenerator objects? - bytecode_estimate += - ImmutableMessageGenerator(descriptor_->nested_type(i), context_) - .GenerateStaticVariableInitializers(printer); - } - return bytecode_estimate; -} - -void ImmutableMessageGenerator::GenerateFieldAccessorTable( - io::Printer* printer, int* bytecode_estimate) { - std::map vars; - vars["identifier"] = UniqueFileScopeIdentifier(descriptor_); - if (MultipleJavaFiles(descriptor_->file(), /* immutable = */ true)) { - // We can only make these package-private since the classes that use them - // are in separate files. - vars["private"] = ""; - } else { - vars["private"] = "private "; - } - if (*bytecode_estimate <= kMaxStaticSize) { - vars["final"] = "final "; - } else { - vars["final"] = ""; - } - vars["ver"] = GeneratedCodeVersionSuffix(); - printer->Print( - vars, - "$private$static $final$\n" - " 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(); -} - -int ImmutableMessageGenerator::GenerateFieldAccessorTableInitializer( - io::Printer* printer) { - int bytecode_estimate = 10; - printer->Print( - "internal_$identifier$_fieldAccessorTable = new\n" - " com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable(\n" - " internal_$identifier$_descriptor,\n" - " 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); - bytecode_estimate += 6; - printer->Print("\"$oneof_name$\", ", "oneof_name", info->capitalized_name); - } - printer->Print("});\n"); - return bytecode_estimate; -} - -// =================================================================== - -void ImmutableMessageGenerator::GenerateInterface(io::Printer* printer) { - MaybePrintGeneratedAnnotation(context_, printer, descriptor_, - /* immutable = */ true, "OrBuilder"); - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "$deprecation$public interface ${$$classname$OrBuilder$}$ extends\n" - " $extra_interfaces$\n" - " com.google.protobuf.GeneratedMessage$ver$.\n" - " ExtendableMessageOrBuilder<$classname$> {\n", - "deprecation", - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : "", - "extra_interfaces", ExtraMessageOrBuilderInterfaces(descriptor_), - "classname", descriptor_->name(), "{", "", "}", "", "ver", - GeneratedCodeVersionSuffix()); - } else { - printer->Print( - "$deprecation$public interface ${$$classname$OrBuilder$}$ extends\n" - " $extra_interfaces$\n" - " com.google.protobuf.MessageOrBuilder {\n", - "deprecation", - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : "", - "extra_interfaces", ExtraMessageOrBuilderInterfaces(descriptor_), - "classname", descriptor_->name(), "{", "", "}", ""); - } - printer->Annotate("{", "}", descriptor_); - - printer->Indent(); - for (int i = 0; i < descriptor_->field_count(); i++) { - printer->Print("\n"); - field_generators_.get(descriptor_->field(i)) - .GenerateInterfaceMembers(printer); - } - for (auto oneof : oneofs_) { - printer->Print( - "\n" - "public $classname$.$oneof_capitalized_name$Case " - "get$oneof_capitalized_name$Case();\n", - "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "classname", - context_->GetNameResolver()->GetImmutableClassName(descriptor_)); - } - printer->Outdent(); - - printer->Print("}\n"); -} - -// =================================================================== - -void ImmutableMessageGenerator::Generate(io::Printer* printer) { - bool is_own_file = IsOwnFile(descriptor_, /* immutable = */ true); - - std::map variables; - variables["static"] = is_own_file ? "" : "static "; - variables["classname"] = descriptor_->name(); - variables["extra_interfaces"] = ExtraMessageInterfaces(descriptor_); - variables["ver"] = GeneratedCodeVersionSuffix(); - variables["deprecation"] = - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""; - - 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) { - printer->Print( - variables, - "$deprecation$public $static$final class $classname$ extends\n"); - printer->Annotate("classname", descriptor_); - printer->Print( - variables, - " com.google.protobuf.GeneratedMessage$ver$.ExtendableMessage<\n" - " $classname$> implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n"); - builder_type = strings::Substitute( - "com.google.protobuf.GeneratedMessage$1.ExtendableBuilder<$0, ?>", - name_resolver_->GetImmutableClassName(descriptor_), - GeneratedCodeVersionSuffix()); - } else { - printer->Print( - variables, - "$deprecation$public $static$final class $classname$ extends\n"); - printer->Annotate("classname", descriptor_); - printer->Print(variables, - " com.google.protobuf.GeneratedMessage$ver$ implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n"); - builder_type = - strings::Substitute("com.google.protobuf.GeneratedMessage$0.Builder", - GeneratedCodeVersionSuffix()); - } - printer->Print("private static final long serialVersionUID = 0L;\n"); - - printer->Indent(); - // Using builder_type, instead of Builder, prevents the Builder class from - // being loaded into PermGen space when the default instance is created. - // This optimizes the PermGen space usage for clients that do not modify - // messages. - printer->Print( - "// Use $classname$.newBuilder() to construct.\n" - "private $classname$($buildertype$ builder) {\n" - " super(builder);\n" - "}\n", - "classname", descriptor_->name(), "buildertype", builder_type); - printer->Print("private $classname$() {\n", "classname", descriptor_->name()); - printer->Indent(); - GenerateInitializers(printer); - printer->Outdent(); - printer->Print( - "}\n" - "\n"); - - printer->Print(variables, - "@java.lang.Override\n" - "@SuppressWarnings({\"unused\"})\n" - "protected java.lang.Object newInstance(\n" - " UnusedPrivateParameter unused) {\n" - " return new $classname$();\n" - "}\n" - "\n"); - - // TODO(b/248149118): Remove this superfluous override. - printer->Print( - "@java.lang.Override\n" - "public final com.google.protobuf.UnknownFieldSet\n" - "getUnknownFields() {\n" - " return this.unknownFields;\n" - "}\n"); - - GenerateDescriptorMethods(printer); - - // Nested types - for (int i = 0; i < descriptor_->enum_type_count(); i++) { - EnumGenerator(descriptor_->enum_type(i), true, context_).Generate(printer); - } - - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // Don't generate Java classes for map entry messages. - if (IsMapEntry(descriptor_->nested_type(i))) continue; - ImmutableMessageGenerator messageGenerator(descriptor_->nested_type(i), - context_); - messageGenerator.GenerateInterface(printer); - messageGenerator.Generate(printer); - } - - // Integers for bit fields. - int totalBits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - totalBits += - field_generators_.get(descriptor_->field(i)).GetNumBitsForMessage(); - } - int totalInts = (totalBits + 31) / 32; - for (int i = 0; i < totalInts; i++) { - printer->Print("private int $bit_field_name$;\n", "bit_field_name", - GetBitFieldName(i)); - } - - // oneof - std::map vars; - 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()); - // oneofCase_ and oneof_ - printer->Print(vars, - "private int $oneof_name$Case_ = 0;\n" - "private java.lang.Object $oneof_name$_;\n"); - // OneofCase enum - printer->Print( - vars, - "public enum $oneof_capitalized_name$Case\n" - // TODO(dweis): Remove EnumLite when we want to break compatibility with - // 3.x users - " implements com.google.protobuf.Internal.EnumLite,\n" - " com.google.protobuf.AbstractMessage.InternalOneOfEnum {\n"); - printer->Indent(); - 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 " : "", - "field_name", ToUpper(field->name()), "field_number", - StrCat(field->number())); - } - printer->Print("$cap_oneof_name$_NOT_SET(0);\n", "cap_oneof_name", - ToUpper(vars["oneof_name"])); - printer->Print(vars, - "private final int value;\n" - "private $oneof_capitalized_name$Case(int value) {\n" - " this.value = value;\n" - "}\n"); - printer->Print( - vars, - "/**\n" - " * @param value The number of the enum to look for.\n" - " * @return The enum associated with the given number.\n" - " * @deprecated Use {@link #forNumber(int)} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public static $oneof_capitalized_name$Case valueOf(int value) {\n" - " return forNumber(value);\n" - "}\n" - "\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); - printer->Print(" case $field_number$: return $field_name$;\n", - "field_number", StrCat(field->number()), - "field_name", ToUpper(field->name())); - } - printer->Print( - " case 0: return $cap_oneof_name$_NOT_SET;\n" - " default: return null;\n" - " }\n" - "}\n" - "public int getNumber() {\n" - " return this.value;\n" - "}\n", - "cap_oneof_name", ToUpper(vars["oneof_name"])); - printer->Outdent(); - printer->Print("};\n\n"); - // oneofCase() - printer->Print(vars, - "public $oneof_capitalized_name$Case\n" - "get$oneof_capitalized_name$Case() {\n" - " return $oneof_capitalized_name$Case.forNumber(\n" - " $oneof_name$Case_);\n" - "}\n" - "\n"); - } - - if (IsAnyMessage(descriptor_)) { - GenerateAnyMethods(printer); - } - - // Fields - for (int i = 0; i < descriptor_->field_count(); i++) { - 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"); - } - - if (context_->HasGeneratedMethods(descriptor_)) { - GenerateIsInitialized(printer); - GenerateMessageSerializationMethods(printer); - GenerateEqualsAndHashCode(printer); - } - - - GenerateParseFromMethods(printer); - GenerateBuilder(printer); - - printer->Print( - "\n" - "// @@protoc_insertion_point(class_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - // Carefully initialize the default instance in such a way that it doesn't - // conflict with other initialization. - printer->Print("private static final $classname$ DEFAULT_INSTANCE;\n", - "classname", - name_resolver_->GetImmutableClassName(descriptor_)); - printer->Print( - "static {\n" - " DEFAULT_INSTANCE = new $classname$();\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Print( - "public static $classname$ getDefaultInstance() {\n" - " return DEFAULT_INSTANCE;\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - // 'of' method for Wrappers - if (IsWrappersProtoFile(descriptor_->file())) { - printer->Print( - "public static $classname$ of($field_type$ value) {\n" - " return newBuilder().setValue(value).build();\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "field_type", PrimitiveTypeName(GetJavaType(descriptor_->field(0)))); - } - - GenerateParser(printer); - - printer->Print( - "@java.lang.Override\n" - "public $classname$ getDefaultInstanceForType() {\n" - " return DEFAULT_INSTANCE;\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - // Extensions must be declared after the DEFAULT_INSTANCE is initialized - // because the DEFAULT_INSTANCE is used by the extension to lazily retrieve - // the outer class's FileDescriptor. - for (int i = 0; i < descriptor_->extension_count(); i++) { - ImmutableExtensionGenerator(descriptor_->extension(i), context_) - .Generate(printer); - } - - printer->Outdent(); - printer->Print("}\n\n"); -} - -// =================================================================== - -void ImmutableMessageGenerator::GenerateMessageSerializationMethods( - io::Printer* printer) { - std::unique_ptr sorted_fields( - 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)); - } - std::sort(sorted_extensions.begin(), sorted_extensions.end(), - ExtensionRangeOrdering()); - printer->Print( - "@java.lang.Override\n" - "public void writeTo(com.google.protobuf.CodedOutputStream output)\n" - " throws java.io.IOException {\n"); - printer->Indent(); - - if (HasPackedFields(descriptor_)) { - // writeTo(CodedOutputStream output) might be invoked without - // getSerializedSize() ever being called, but we need the memoized - // sizes in case this message has packed fields. Rather than emit checks - // for each packed field, just call getSerializedSize() up front. In most - // cases, getSerializedSize() will have already been called anyway by one - // of the wrapper writeTo() methods, making this call cheap. - printer->Print("getSerializedSize();\n"); - } - - if (descriptor_->extension_range_count() > 0) { - if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "com.google.protobuf.GeneratedMessage$ver$\n" - " .ExtendableMessage<$classname$>.ExtensionWriter\n" - " extensionWriter = newMessageSetExtensionWriter();\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "ver", GeneratedCodeVersionSuffix()); - } else { - printer->Print( - "com.google.protobuf.GeneratedMessage$ver$\n" - " .ExtendableMessage<$classname$>.ExtensionWriter\n" - " extensionWriter = newExtensionWriter();\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "ver", GeneratedCodeVersionSuffix()); - } - } - - // Merge the fields and the extension ranges, both sorted by field number. - for (int i = 0, j = 0; - i < descriptor_->field_count() || j < sorted_extensions.size();) { - if (i == descriptor_->field_count()) { - GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); - } else if (j == sorted_extensions.size()) { - GenerateSerializeOneField(printer, sorted_fields[i++]); - } else if (sorted_fields[i]->number() < sorted_extensions[j]->start) { - GenerateSerializeOneField(printer, sorted_fields[i++]); - } else { - GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); - } - } - - if (descriptor_->options().message_set_wire_format()) { - printer->Print("getUnknownFields().writeAsMessageSetTo(output);\n"); - } else { - printer->Print("getUnknownFields().writeTo(output);\n"); - } - - printer->Outdent(); - printer->Print( - "}\n" - "\n" - "@java.lang.Override\n" - "public int getSerializedSize() {\n" - " int size = memoizedSize;\n" - " if (size != -1) return size;\n" - "\n"); - printer->Indent(); - - printer->Print("size = 0;\n"); - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(sorted_fields[i]).GenerateSerializedSizeCode(printer); - } - - if (descriptor_->extension_range_count() > 0) { - if (descriptor_->options().message_set_wire_format()) { - printer->Print("size += extensionsSerializedSizeAsMessageSet();\n"); - } else { - printer->Print("size += extensionsSerializedSize();\n"); - } - } - - if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "size += getUnknownFields().getSerializedSizeAsMessageSet();\n"); - } else { - printer->Print("size += getUnknownFields().getSerializedSize();\n"); - } - - printer->Print( - "memoizedSize = size;\n" - "return size;\n"); - - printer->Outdent(); - printer->Print( - "}\n" - "\n"); -} - -void ImmutableMessageGenerator::GenerateParseFromMethods(io::Printer* printer) { - // Note: These are separate from GenerateMessageSerializationMethods() - // because they need to be generated even for messages that are optimized - // for code size. - printer->Print( - "public static $classname$ parseFrom(\n" - " java.nio.ByteBuffer data)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return PARSER.parseFrom(data);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " java.nio.ByteBuffer data,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return PARSER.parseFrom(data, extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.ByteString data)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return PARSER.parseFrom(data);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.ByteString data,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return PARSER.parseFrom(data, extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(byte[] data)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return PARSER.parseFrom(data);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " byte[] data,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return PARSER.parseFrom(data, extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(java.io.InputStream input)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage$ver$\n" - " .parseWithIOException(PARSER, input);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " java.io.InputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage$ver$\n" - " .parseWithIOException(PARSER, input, extensionRegistry);\n" - "}\n" - "public static $classname$ parseDelimitedFrom(java.io.InputStream " - "input)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage$ver$\n" - " .parseDelimitedWithIOException(PARSER, input);\n" - "}\n" - "public static $classname$ parseDelimitedFrom(\n" - " java.io.InputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage$ver$\n" - " .parseDelimitedWithIOException(PARSER, input, " - "extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.CodedInputStream input)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage$ver$\n" - " .parseWithIOException(PARSER, input);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.CodedInputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage$ver$\n" - " .parseWithIOException(PARSER, input, extensionRegistry);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), "ver", - GeneratedCodeVersionSuffix()); -} - -void ImmutableMessageGenerator::GenerateSerializeOneField( - io::Printer* printer, const FieldDescriptor* field) { - field_generators_.get(field).GenerateSerializationCode(printer); -} - -void ImmutableMessageGenerator::GenerateSerializeOneExtensionRange( - io::Printer* printer, const Descriptor::ExtensionRange* range) { - printer->Print("extensionWriter.writeUntil($end$, output);\n", "end", - StrCat(range->end)); -} - -// =================================================================== - -void ImmutableMessageGenerator::GenerateBuilder(io::Printer* printer) { - // LITE_RUNTIME implements this at the GeneratedMessageLite level. - printer->Print( - "@java.lang.Override\n" - "public Builder newBuilderForType() { return newBuilder(); }\n"); - - printer->Print( - "public static Builder newBuilder() {\n" - " return DEFAULT_INSTANCE.toBuilder();\n" - "}\n" - "public static Builder newBuilder($classname$ prototype) {\n" - " return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n" - "}\n" - "@java.lang.Override\n" - "public Builder toBuilder() {\n" - " return this == DEFAULT_INSTANCE\n" - " ? new Builder() : new Builder().mergeFrom(this);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Print( - "@java.lang.Override\n" - "protected Builder newBuilderForType(\n" - " com.google.protobuf.GeneratedMessage$ver$.BuilderParent parent) {\n" - " Builder builder = new Builder(parent);\n" - " return builder;\n" - "}\n", - "ver", GeneratedCodeVersionSuffix()); - - MessageBuilderGenerator builderGenerator(descriptor_, context_); - builderGenerator.Generate(printer); -} - -void ImmutableMessageGenerator::GenerateDescriptorMethods( - io::Printer* printer) { - if (!descriptor_->options().no_standard_descriptor_accessor()) { - printer->Print( - "public static final com.google.protobuf.Descriptors.Descriptor\n" - " getDescriptor() {\n" - " return $fileclass$.internal_$identifier$_descriptor;\n" - "}\n" - "\n", - "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), - "identifier", UniqueFileScopeIdentifier(descriptor_)); - } - std::vector map_fields; - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (GetJavaType(field) == JAVATYPE_MESSAGE && - IsMapEntry(field->message_type())) { - map_fields.push_back(field); - } - } - if (!map_fields.empty()) { - printer->Print( - "@SuppressWarnings({\"rawtypes\"})\n" - "@java.lang.Override\n" - "protected com.google.protobuf.MapField internalGetMapField(\n" - " int number) {\n" - " switch (number) {\n"); - printer->Indent(); - printer->Indent(); - for (int i = 0; i < map_fields.size(); ++i) { - const FieldDescriptor* field = map_fields[i]; - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - printer->Print( - "case $number$:\n" - " return internalGet$capitalized_name$();\n", - "number", StrCat(field->number()), "capitalized_name", - info->capitalized_name); - } - printer->Print( - "default:\n" - " throw new RuntimeException(\n" - " \"Invalid map field number: \" + number);\n"); - printer->Outdent(); - printer->Outdent(); - printer->Print( - " }\n" - "}\n"); - } - printer->Print( - "@java.lang.Override\n" - "protected com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable\n" - " internalGetFieldAccessorTable() {\n" - " return $fileclass$.internal_$identifier$_fieldAccessorTable\n" - " .ensureFieldAccessorsInitialized(\n" - " $classname$.class, $classname$.Builder.class);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), - "identifier", UniqueFileScopeIdentifier(descriptor_), "ver", - GeneratedCodeVersionSuffix()); -} - -// =================================================================== - -void ImmutableMessageGenerator::GenerateIsInitialized(io::Printer* printer) { - // Memoizes whether the protocol buffer is fully initialized (has all - // required fields). -1 means not yet computed. 0 means false and 1 means - // true. - printer->Print("private byte memoizedIsInitialized = -1;\n"); - printer->Print( - "@java.lang.Override\n" - "public final boolean isInitialized() {\n"); - printer->Indent(); - - // Don't directly compare to -1 to avoid an Android x86 JIT bug. - printer->Print( - "byte isInitialized = memoizedIsInitialized;\n" - "if (isInitialized == 1) return true;\n" - "if (isInitialized == 0) return false;\n" - "\n"); - - // Check that all required fields in this message are set. - // TODO(kenton): We can optimize this when we switch to putting all the - // "has" fields into a single bitfield. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - - if (field->is_required()) { - printer->Print( - "if (!has$name$()) {\n" - " memoizedIsInitialized = 0;\n" - " return false;\n" - "}\n", - "name", info->capitalized_name); - } - } - - // Now check that all embedded messages are initialized. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - if (GetJavaType(field) == JAVATYPE_MESSAGE && - HasRequiredFields(field->message_type())) { - switch (field->label()) { - case FieldDescriptor::LABEL_REQUIRED: - printer->Print( - "if (!get$name$().isInitialized()) {\n" - " memoizedIsInitialized = 0;\n" - " return false;\n" - "}\n", - "type", - name_resolver_->GetImmutableClassName(field->message_type()), - "name", info->capitalized_name); - break; - case FieldDescriptor::LABEL_OPTIONAL: - printer->Print( - "if (has$name$()) {\n" - " if (!get$name$().isInitialized()) {\n" - " memoizedIsInitialized = 0;\n" - " return false;\n" - " }\n" - "}\n", - "name", info->capitalized_name); - break; - case FieldDescriptor::LABEL_REPEATED: - if (IsMapEntry(field->message_type())) { - printer->Print( - "for ($type$ item : get$name$Map().values()) {\n" - " if (!item.isInitialized()) {\n" - " memoizedIsInitialized = 0;\n" - " return false;\n" - " }\n" - "}\n", - "type", - MapValueImmutableClassdName(field->message_type(), - name_resolver_), - "name", info->capitalized_name); - } else { - printer->Print( - "for (int i = 0; i < get$name$Count(); i++) {\n" - " if (!get$name$(i).isInitialized()) {\n" - " memoizedIsInitialized = 0;\n" - " return false;\n" - " }\n" - "}\n", - "type", - name_resolver_->GetImmutableClassName(field->message_type()), - "name", info->capitalized_name); - } - break; - } - } - } - - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "if (!extensionsAreInitialized()) {\n" - " memoizedIsInitialized = 0;\n" - " return false;\n" - "}\n"); - } - - printer->Outdent(); - - printer->Print(" memoizedIsInitialized = 1;\n"); - - printer->Print( - " return true;\n" - "}\n" - "\n"); -} - -// =================================================================== - -namespace { -bool CheckHasBitsForEqualsAndHashCode(const FieldDescriptor* field) { - if (field->is_repeated()) { - return false; - } - if (HasHasbit(field)) { - return true; - } - return GetJavaType(field) == JAVATYPE_MESSAGE && !IsRealOneof(field); -} -} // namespace - -void ImmutableMessageGenerator::GenerateEqualsAndHashCode( - io::Printer* printer) { - printer->Print( - "@java.lang.Override\n" - "public boolean equals("); - printer->Print("final java.lang.Object obj) {\n"); - printer->Indent(); - printer->Print( - "if (obj == this) {\n" - " return true;\n" - "}\n" - "if (!(obj instanceof $classname$)) {\n" - " return super.equals(obj);\n" - "}\n" - "$classname$ other = ($classname$) obj;\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (!IsRealOneof(field)) { - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - bool check_has_bits = CheckHasBitsForEqualsAndHashCode(field); - if (check_has_bits) { - printer->Print( - "if (has$name$() != other.has$name$()) return false;\n" - "if (has$name$()) {\n", - "name", info->capitalized_name); - printer->Indent(); - } - field_generators_.get(field).GenerateEqualsCode(printer); - if (check_has_bits) { - printer->Outdent(); - printer->Print("}\n"); - } - } - } - - // Compare oneofs. - 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(oneof)->capitalized_name); - printer->Print("switch ($oneof_name$Case_) {\n", "oneof_name", - context_->GetOneofGeneratorInfo(oneof)->name); - printer->Indent(); - 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(); - field_generators_.get(field).GenerateEqualsCode(printer); - printer->Print("break;\n"); - printer->Outdent(); - } - printer->Print( - "case 0:\n" - "default:\n"); - printer->Outdent(); - printer->Print("}\n"); - } - - // Always consider unknown fields for equality. This will sometimes return - // false for non-canonical ordering when running in LITE_RUNTIME but it's - // the best we can do. - printer->Print( - "if (!getUnknownFields().equals(other.getUnknownFields())) return " - "false;\n"); - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "if (!getExtensionFields().equals(other.getExtensionFields()))\n" - " return false;\n"); - } - printer->Print("return true;\n"); - printer->Outdent(); - printer->Print( - "}\n" - "\n"); - - printer->Print( - "@java.lang.Override\n" - "public int hashCode() {\n"); - printer->Indent(); - printer->Print("if (memoizedHashCode != 0) {\n"); - printer->Indent(); - printer->Print("return memoizedHashCode;\n"); - printer->Outdent(); - printer->Print( - "}\n" - "int hash = 41;\n"); - - // If we output a getDescriptor() method, use that as it is more efficient. - if (descriptor_->options().no_standard_descriptor_accessor()) { - printer->Print("hash = (19 * hash) + getDescriptorForType().hashCode();\n"); - } else { - printer->Print("hash = (19 * hash) + getDescriptor().hashCode();\n"); - } - - // hashCode non-oneofs. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (!IsRealOneof(field)) { - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - bool check_has_bits = CheckHasBitsForEqualsAndHashCode(field); - if (check_has_bits) { - printer->Print("if (has$name$()) {\n", "name", info->capitalized_name); - printer->Indent(); - } - field_generators_.get(field).GenerateHashCode(printer); - if (check_has_bits) { - printer->Outdent(); - printer->Print("}\n"); - } - } - } - - // hashCode oneofs. - for (auto oneof : oneofs_) { - printer->Print("switch ($oneof_name$Case_) {\n", "oneof_name", - context_->GetOneofGeneratorInfo(oneof)->name); - printer->Indent(); - 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(); - field_generators_.get(field).GenerateHashCode(printer); - printer->Print("break;\n"); - printer->Outdent(); - } - printer->Print( - "case 0:\n" - "default:\n"); - printer->Outdent(); - printer->Print("}\n"); - } - - if (descriptor_->extension_range_count() > 0) { - printer->Print("hash = hashFields(hash, getExtensionFields());\n"); - } - - printer->Print("hash = (29 * hash) + getUnknownFields().hashCode();\n"); - printer->Print( - "memoizedHashCode = hash;\n" - "return hash;\n"); - printer->Outdent(); - printer->Print( - "}\n" - "\n"); -} - -// =================================================================== - -void ImmutableMessageGenerator::GenerateExtensionRegistrationCode( - io::Printer* printer) { - for (int i = 0; i < descriptor_->extension_count(); i++) { - ImmutableExtensionGenerator(descriptor_->extension(i), context_) - .GenerateRegistrationCode(printer); - } - - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - ImmutableMessageGenerator(descriptor_->nested_type(i), context_) - .GenerateExtensionRegistrationCode(printer); - } -} - -// =================================================================== -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" - " @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()); -} - -// =================================================================== -void ImmutableMessageGenerator::GenerateInitializers(io::Printer* printer) { - for (int i = 0; i < descriptor_->field_count(); i++) { - if (!IsRealOneof(descriptor_->field(i))) { - field_generators_.get(descriptor_->field(i)) - .GenerateInitializationCode(printer); - } - } -} - -// =================================================================== -void ImmutableMessageGenerator::GenerateMutableCopy(io::Printer* printer) { - printer->Print( - "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( - "@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 ImmutableMessageGenerator::GenerateKotlinMembers( - io::Printer* printer) const { - printer->Print( - "@kotlin.jvm.JvmName(\"-initialize$camelcase_name$\")\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"); -} - -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\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; - ImmutableMessageGenerator(descriptor_->nested_type(i), context_) - .GenerateTopLevelKotlinMembers(printer); - } - - GenerateKotlinOrNull(printer); -} - -void ImmutableMessageGenerator::GenerateKotlinOrNull(io::Printer* printer) const { - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (field->has_presence() && GetJavaType(field) == JAVATYPE_MESSAGE) { - printer->Print( - "public val $full_classname$OrBuilder.$camelcase_name$OrNull: $full_name$?\n" - " get() = if (has$name$()) get$name$() else null\n\n", - "full_classname", name_resolver_->GetClassName(descriptor_, true), - "camelcase_name", context_->GetFieldGeneratorInfo(field)->name, - "full_name", - name_resolver_->GetImmutableClassName(field->message_type()), "name", - context_->GetFieldGeneratorInfo(field)->capitalized_name); - } - } -} - -void ImmutableMessageGenerator::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" - "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); -} - -void ImmutableMessageGenerator::GenerateAnyMethods(io::Printer* printer) { - printer->Print( - "private static String getTypeUrl(\n" - " java.lang.String typeUrlPrefix,\n" - " com.google.protobuf.Descriptors.Descriptor descriptor) {\n" - " return typeUrlPrefix.endsWith(\"/\")\n" - " ? typeUrlPrefix + descriptor.getFullName()\n" - " : typeUrlPrefix + \"/\" + descriptor.getFullName();\n" - "}\n" - "\n" - "private static String getTypeNameFromTypeUrl(\n" - " java.lang.String typeUrl) {\n" - " int pos = typeUrl.lastIndexOf('/');\n" - " return pos == -1 ? \"\" : typeUrl.substring(pos + 1);\n" - "}\n" - "\n" - "public static Any pack(\n" - " T message) {\n" - " return Any.newBuilder()\n" - " .setTypeUrl(getTypeUrl(\"type.googleapis.com\",\n" - " message.getDescriptorForType()))\n" - " .setValue(message.toByteString())\n" - " .build();\n" - "}\n" - "\n" - "/**\n" - " * Packs a message using the given type URL prefix. The type URL will\n" - " * be constructed by concatenating the message type's full name to the\n" - " * prefix with an optional \"/\" separator if the prefix doesn't end\n" - " * with \"/\" already.\n" - " */\n" - "public static Any pack(\n" - " T message, java.lang.String typeUrlPrefix) {\n" - " return Any.newBuilder()\n" - " .setTypeUrl(getTypeUrl(typeUrlPrefix,\n" - " message.getDescriptorForType()))\n" - " .setValue(message.toByteString())\n" - " .build();\n" - "}\n" - "\n" - "public boolean is(\n" - " java.lang.Class clazz) {\n" - " T defaultInstance =\n" - " com.google.protobuf.Internal.getDefaultInstance(clazz);\n" - " return getTypeNameFromTypeUrl(getTypeUrl()).equals(\n" - " defaultInstance.getDescriptorForType().getFullName());\n" - "}\n" - "\n" - "private volatile com.google.protobuf.Message cachedUnpackValue;\n" - "\n" - "@java.lang.SuppressWarnings(\"unchecked\")\n" - "public T unpack(\n" - " java.lang.Class clazz)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " boolean invalidClazz = false;\n" - " if (cachedUnpackValue != null) {\n" - " if (cachedUnpackValue.getClass() == clazz) {\n" - " return (T) cachedUnpackValue;\n" - " }\n" - " invalidClazz = true;\n" - " }\n" - " if (invalidClazz || !is(clazz)) {\n" - " throw new com.google.protobuf.InvalidProtocolBufferException(\n" - " \"Type of the Any message does not match the given class.\");\n" - " }\n" - " T defaultInstance =\n" - " com.google.protobuf.Internal.getDefaultInstance(clazz);\n" - " T result = (T) defaultInstance.getParserForType()\n" - " .parseFrom(getValue());\n" - " cachedUnpackValue = result;\n" - " return result;\n" - "}\n"); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message.h b/depends/protobuf/src/google/protobuf/compiler/java/message.h deleted file mode 100644 index 2dbd0dd9b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message.h +++ /dev/null @@ -1,155 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -static const int kMaxStaticSize = 1 << 15; // aka 32k - -class MessageGenerator { - public: - explicit MessageGenerator(const Descriptor* descriptor); - virtual ~MessageGenerator(); - - // All static variables have to be declared at the top-level of the file - // so that we can control initialization order, which is important for - // DescriptorProto bootstrapping to work. - virtual void GenerateStaticVariables(io::Printer* printer, - int* bytecode_estimate) = 0; - - // Output code which initializes the static variables generated by - // GenerateStaticVariables(). Returns an estimate of bytecode size. - virtual int GenerateStaticVariableInitializers(io::Printer* printer) = 0; - - // Generate the class itself. - virtual void Generate(io::Printer* printer) = 0; - - // Generates the base interface that both the class and its builder - // implement - virtual void GenerateInterface(io::Printer* printer) = 0; - - // 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); -}; - -class ImmutableMessageGenerator : public MessageGenerator { - public: - ImmutableMessageGenerator(const Descriptor* descriptor, Context* context); - ~ImmutableMessageGenerator() override; - - 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 - 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); - - // Returns an estimate of the number of bytes the printed code will compile to - int GenerateFieldAccessorTableInitializer(io::Printer* printer); - - void GenerateMessageSerializationMethods(io::Printer* printer); - void GenerateParseFromMethods(io::Printer* printer); - void GenerateSerializeOneField(io::Printer* printer, - const FieldDescriptor* field); - void GenerateSerializeOneExtensionRange( - io::Printer* printer, const Descriptor::ExtensionRange* range); - - void GenerateBuilder(io::Printer* printer); - void GenerateIsInitialized(io::Printer* printer); - void GenerateDescriptorMethods(io::Printer* printer); - void GenerateInitializers(io::Printer* printer); - 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 GenerateKotlinOrNull(io::Printer* printer) const; - void GenerateAnyMethods(io::Printer* printer); - - Context* context_; - ClassNameResolver* name_resolver_; - FieldGeneratorMap field_generators_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_builder.cc b/depends/protobuf/src/google/protobuf/compiler/java/message_builder.cc deleted file mode 100644 index 32ad668de..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_builder.cc +++ /dev/null @@ -1,909 +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: dweis@google.com (Daniel Weis) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#include "google/protobuf/compiler/java/message_builder.h" - -#include -#include -#include -#include -#include - -#include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/io/printer.h" -#include "google/protobuf/wire_format.h" -#include "google/protobuf/stubs/strutil.h" -#include "google/protobuf/stubs/substitute.h" -#include "google/protobuf/compiler/java/context.h" -#include "google/protobuf/compiler/java/doc_comment.h" -#include "google/protobuf/compiler/java/enum.h" -#include "google/protobuf/compiler/java/extension.h" -#include "google/protobuf/compiler/java/generator_factory.h" -#include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/name_resolver.h" -#include "google/protobuf/descriptor.pb.h" - -// Must be last. -#include "google/protobuf/port_def.inc" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -namespace { -std::string MapValueImmutableClassdName(const Descriptor* descriptor, - ClassNameResolver* name_resolver) { - const FieldDescriptor* value_field = descriptor->map_value(); - GOOGLE_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type()); - return name_resolver->GetImmutableClassName(value_field->message_type()); -} -} // namespace - -MessageBuilderGenerator::MessageBuilderGenerator(const Descriptor* descriptor, - Context* context) - : descriptor_(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()), - field_generators_(descriptor, context_) { - 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() {} - -void MessageBuilderGenerator::Generate(io::Printer* printer) { - WriteMessageDocComment(printer, descriptor_); - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "public static final class Builder extends\n" - " com.google.protobuf.GeneratedMessage$ver$.ExtendableBuilder<\n" - " $classname$, Builder> implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "extra_interfaces", ExtraBuilderInterfaces(descriptor_), "ver", - GeneratedCodeVersionSuffix()); - } else { - printer->Print( - "public static final class Builder extends\n" - " com.google.protobuf.GeneratedMessage$ver$.Builder " - "implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "extra_interfaces", ExtraBuilderInterfaces(descriptor_), "ver", - GeneratedCodeVersionSuffix()); - } - printer->Indent(); - - GenerateDescriptorMethods(printer); - GenerateCommonBuilderMethods(printer); - - if (context_->HasGeneratedMethods(descriptor_)) { - GenerateIsInitialized(printer); - GenerateBuilderParsingMethods(printer); - } - - // oneof - std::map vars; - 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()); - // oneofCase_ and oneof_ - printer->Print(vars, - "private int $oneof_name$Case_ = 0;\n" - "private java.lang.Object $oneof_name$_;\n"); - // oneofCase() and clearOneof() - printer->Print(vars, - "public $oneof_capitalized_name$Case\n" - " get$oneof_capitalized_name$Case() {\n" - " return $oneof_capitalized_name$Case.forNumber(\n" - " $oneof_name$Case_);\n" - "}\n" - "\n" - "public Builder clear$oneof_capitalized_name$() {\n" - " $oneof_name$Case_ = 0;\n" - " $oneof_name$_ = null;\n" - " onChanged();\n" - " return this;\n" - "}\n" - "\n"); - } - - // Integers for bit fields. - int totalBits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - totalBits += - field_generators_.get(descriptor_->field(i)).GetNumBitsForBuilder(); - } - int totalInts = (totalBits + 31) / 32; - for (int i = 0; i < totalInts; i++) { - printer->Print("private int $bit_field_name$;\n", "bit_field_name", - GetBitFieldName(i)); - } - - for (int i = 0; i < descriptor_->field_count(); i++) { - printer->Print("\n"); - field_generators_.get(descriptor_->field(i)) - .GenerateBuilderMembers(printer); - } - - // Override methods declared in GeneratedMessage to return the concrete - // generated type so callsites won't depend on GeneratedMessage. This - // is needed to keep binary compatibility when we change generated code - // to subclass a different GeneratedMessage class (e.g., in v3.0.0 release - // we changed all generated code to subclass GeneratedMessageV3). - printer->Print( - "@java.lang.Override\n" - "public final Builder setUnknownFields(\n" - " final com.google.protobuf.UnknownFieldSet unknownFields) {\n" - " return super.setUnknownFields(unknownFields);\n" - "}\n" - "\n" - "@java.lang.Override\n" - "public final Builder mergeUnknownFields(\n" - " final com.google.protobuf.UnknownFieldSet unknownFields) {\n" - " return super.mergeUnknownFields(unknownFields);\n" - "}\n" - "\n"); - - printer->Print( - "\n" - "// @@protoc_insertion_point(builder_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - printer->Outdent(); - printer->Print("}\n"); -} - -// =================================================================== - -void MessageBuilderGenerator::GenerateDescriptorMethods(io::Printer* printer) { - if (!descriptor_->options().no_standard_descriptor_accessor()) { - printer->Print( - "public static final com.google.protobuf.Descriptors.Descriptor\n" - " getDescriptor() {\n" - " return $fileclass$.internal_$identifier$_descriptor;\n" - "}\n" - "\n", - "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), - "identifier", UniqueFileScopeIdentifier(descriptor_)); - } - std::vector map_fields; - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (GetJavaType(field) == JAVATYPE_MESSAGE && - IsMapEntry(field->message_type())) { - map_fields.push_back(field); - } - } - if (!map_fields.empty()) { - printer->Print( - "@SuppressWarnings({\"rawtypes\"})\n" - "protected com.google.protobuf.MapField internalGetMapField(\n" - " int number) {\n" - " switch (number) {\n"); - printer->Indent(); - printer->Indent(); - for (int i = 0; i < map_fields.size(); ++i) { - const FieldDescriptor* field = map_fields[i]; - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - printer->Print( - "case $number$:\n" - " return internalGet$capitalized_name$();\n", - "number", StrCat(field->number()), "capitalized_name", - info->capitalized_name); - } - printer->Print( - "default:\n" - " throw new RuntimeException(\n" - " \"Invalid map field number: \" + number);\n"); - printer->Outdent(); - printer->Outdent(); - printer->Print( - " }\n" - "}\n"); - printer->Print( - "@SuppressWarnings({\"rawtypes\"})\n" - "protected com.google.protobuf.MapField internalGetMutableMapField(\n" - " int number) {\n" - " switch (number) {\n"); - printer->Indent(); - printer->Indent(); - for (int i = 0; i < map_fields.size(); ++i) { - const FieldDescriptor* field = map_fields[i]; - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - printer->Print( - "case $number$:\n" - " return internalGetMutable$capitalized_name$();\n", - "number", StrCat(field->number()), "capitalized_name", - info->capitalized_name); - } - printer->Print( - "default:\n" - " throw new RuntimeException(\n" - " \"Invalid map field number: \" + number);\n"); - printer->Outdent(); - printer->Outdent(); - printer->Print( - " }\n" - "}\n"); - } - printer->Print( - "@java.lang.Override\n" - "protected com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable\n" - " internalGetFieldAccessorTable() {\n" - " return $fileclass$.internal_$identifier$_fieldAccessorTable\n" - " .ensureFieldAccessorsInitialized(\n" - " $classname$.class, $classname$.Builder.class);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), - "identifier", UniqueFileScopeIdentifier(descriptor_), "ver", - GeneratedCodeVersionSuffix()); -} - -// =================================================================== - -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" - "$force_builder_init$\n" - "}\n" - "\n", - "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" - "$force_builder_init$\n" - "}\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), "ver", - GeneratedCodeVersionSuffix(), "force_builder_init", force_builder_init); - - 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 (!IsRealOneof(descriptor_->field(i))) { - field_generators_.get(descriptor_->field(i)) - .GenerateFieldBuilderInitializationCode(printer); - } - } - printer->Outdent(); - printer->Outdent(); - - printer->Print( - " }\n" - "}\n"); - } - - printer->Print( - "@java.lang.Override\n" - "public Builder clear() {\n" - " super.clear();\n"); - - printer->Indent(); - int totalBuilderInts = (descriptor_->field_count() + 31) / 32; - for (int i = 0; i < totalBuilderInts; i++) { - printer->Print("$bit_field_name$ = 0;\n", "bit_field_name", - GetBitFieldName(i)); - } - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(descriptor_->field(i)) - .GenerateBuilderClearCode(printer); - } - - for (auto oneof : oneofs_) { - printer->Print( - "$oneof_name$Case_ = 0;\n" - "$oneof_name$_ = null;\n", - "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name); - } - - printer->Outdent(); - - printer->Print( - " return this;\n" - "}\n" - "\n"); - - printer->Print( - "@java.lang.Override\n" - "public com.google.protobuf.Descriptors.Descriptor\n" - " getDescriptorForType() {\n" - " return $fileclass$.internal_$identifier$_descriptor;\n" - "}\n" - "\n", - "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), - "identifier", UniqueFileScopeIdentifier(descriptor_)); - - // LITE runtime implements this in GeneratedMessageLite. - printer->Print( - "@java.lang.Override\n" - "public $classname$ getDefaultInstanceForType() {\n" - " return $classname$.getDefaultInstance();\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Print( - "@java.lang.Override\n" - "public $classname$ build() {\n" - " $classname$ result = buildPartial();\n" - " if (!result.isInitialized()) {\n" - " throw newUninitializedMessageException(result);\n" - " }\n" - " return result;\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - GenerateBuildPartial(printer); - - // Override methods declared in GeneratedMessage to return the concrete - // generated type so callsites won't depend on GeneratedMessage. This - // is needed to keep binary compatibility when we change generated code - // to subclass a different GeneratedMessage class (e.g., in v3.0.0 release - // we changed all generated code to subclass GeneratedMessageV3). - printer->Print( - "@java.lang.Override\n" - "public Builder clone() {\n" - " return super.clone();\n" - "}\n" - "@java.lang.Override\n" - "public Builder setField(\n" - " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " java.lang.Object value) {\n" - " return super.setField(field, value);\n" - "}\n" - "@java.lang.Override\n" - "public Builder clearField(\n" - " com.google.protobuf.Descriptors.FieldDescriptor field) {\n" - " return super.clearField(field);\n" - "}\n" - "@java.lang.Override\n" - "public Builder clearOneof(\n" - " com.google.protobuf.Descriptors.OneofDescriptor oneof) {\n" - " return super.clearOneof(oneof);\n" - "}\n" - "@java.lang.Override\n" - "public Builder setRepeatedField(\n" - " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " int index, java.lang.Object value) {\n" - " return super.setRepeatedField(field, index, value);\n" - "}\n" - "@java.lang.Override\n" - "public Builder addRepeatedField(\n" - " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " java.lang.Object value) {\n" - " return super.addRepeatedField(field, value);\n" - "}\n"); - - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "@java.lang.Override\n" - "public Builder setExtension(\n" - " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" - " $classname$, Type> extension,\n" - " Type value) {\n" - " return super.setExtension(extension, value);\n" - "}\n" - "@java.lang.Override\n" - "public Builder setExtension(\n" - " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" - " $classname$, java.util.List> extension,\n" - " int index, Type value) {\n" - " return super.setExtension(extension, index, value);\n" - "}\n" - "@java.lang.Override\n" - "public Builder addExtension(\n" - " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" - " $classname$, java.util.List> extension,\n" - " Type value) {\n" - " return super.addExtension(extension, value);\n" - "}\n" - "@java.lang.Override\n" - "public Builder clearExtension(\n" - " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" - " $classname$, ?> extension) {\n" - " return super.clearExtension(extension);\n" - "}\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - } - - // ----------------------------------------------------------------- - - if (context_->HasGeneratedMethods(descriptor_)) { - printer->Print( - "@java.lang.Override\n" - "public Builder mergeFrom(com.google.protobuf.Message other) {\n" - " if (other instanceof $classname$) {\n" - " return mergeFrom(($classname$)other);\n" - " } else {\n" - " super.mergeFrom(other);\n" - " return this;\n" - " }\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Print( - "public Builder mergeFrom($classname$ other) {\n" - // Optimization: If other is the default instance, we know none of its - // fields are set so we can skip the merge. - " if (other == $classname$.getDefaultInstance()) return this;\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - printer->Indent(); - - for (int i = 0; i < descriptor_->field_count(); i++) { - if (!IsRealOneof(descriptor_->field(i))) { - field_generators_.get(descriptor_->field(i)) - .GenerateMergingCode(printer); - } - } - - // Merge oneof fields. - for (auto oneof : oneofs_) { - printer->Print("switch (other.get$oneof_capitalized_name$Case()) {\n", - "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(oneof)->capitalized_name); - printer->Indent(); - 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(); - field_generators_.get(field).GenerateMergingCode(printer); - printer->Print("break;\n"); - printer->Outdent(); - printer->Print("}\n"); - } - printer->Print( - "case $cap_oneof_name$_NOT_SET: {\n" - " break;\n" - "}\n", - "cap_oneof_name", - ToUpper(context_->GetOneofGeneratorInfo(oneof)->name)); - printer->Outdent(); - printer->Print("}\n"); - } - - printer->Outdent(); - - // if message type has extensions - if (descriptor_->extension_range_count() > 0) { - printer->Print(" this.mergeExtensionFields(other);\n"); - } - - printer->Print(" this.mergeUnknownFields(other.getUnknownFields());\n"); - - printer->Print(" onChanged();\n"); - - printer->Print( - " return this;\n" - "}\n" - "\n"); - } -} - -void MessageBuilderGenerator::GenerateBuildPartial(io::Printer* printer) { - printer->Print( - "@java.lang.Override\n" - "public $classname$ buildPartial() {\n" - " $classname$ result = new $classname$(this);\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Indent(); - - // Handle the repeated fields first so that the "mutable bits" are cleared. - bool has_repeated_fields = false; - for (int i = 0; i < descriptor_->field_count(); ++i) { - if (descriptor_->field(i)->is_repeated() && - !IsMapField(descriptor_->field(i))) { - has_repeated_fields = true; - printer->Print("buildPartialRepeatedFields(result);\n"); - break; - } - } - - // One buildPartial#() per from_bit_field - int totalBuilderInts = (descriptor_->field_count() + 31) / 32; - if (totalBuilderInts > 0) { - for (int i = 0; i < totalBuilderInts; ++i) { - printer->Print( - "if ($bit_field_name$ != 0) { buildPartial$piece$(result); }\n", - "bit_field_name", GetBitFieldName(i), "piece", StrCat(i)); - } - } - - if (!oneofs_.empty()) { - printer->Print("buildPartialOneofs(result);\n"); - } - - printer->Outdent(); - printer->Print( - " onBuilt();\n" - " return result;\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - // Build Repeated Fields - if (has_repeated_fields) { - printer->Print( - "private void buildPartialRepeatedFields($classname$ result) {\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - printer->Indent(); - for (int i = 0; i < descriptor_->field_count(); ++i) { - if (descriptor_->field(i)->is_repeated() && - !IsMapField(descriptor_->field(i))) { - const ImmutableFieldGenerator& field = - field_generators_.get(descriptor_->field(i)); - field.GenerateBuildingCode(printer); - } - } - printer->Outdent(); - printer->Print("}\n\n"); - } - - // Build non-oneof fields - int start_field = 0; - for (int i = 0; i < totalBuilderInts; i++) { - start_field = GenerateBuildPartialPiece(printer, i, start_field); - } - - // Build Oneofs - if (!oneofs_.empty()) { - printer->Print("private void buildPartialOneofs($classname$ result) {\n", - "classname", - name_resolver_->GetImmutableClassName(descriptor_)); - printer->Indent(); - for (auto oneof : oneofs_) { - printer->Print( - "result.$oneof_name$Case_ = $oneof_name$Case_;\n" - "result.$oneof_name$_ = this.$oneof_name$_;\n", - "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name); - for (int i = 0; i < oneof->field_count(); ++i) { - if (oneof->field(i)->message_type() != nullptr) { - const ImmutableFieldGenerator& field = - field_generators_.get(oneof->field(i)); - field.GenerateBuildingCode(printer); - } - } - } - printer->Outdent(); - printer->Print("}\n\n"); - } -} - -int MessageBuilderGenerator::GenerateBuildPartialPiece(io::Printer* printer, - int piece, - int first_field) { - printer->Print( - "private void buildPartial$piece$($classname$ result) {\n" - " int from_$bit_field_name$ = $bit_field_name$;\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), "piece", - StrCat(piece), "bit_field_name", GetBitFieldName(piece)); - printer->Indent(); - std::set declared_to_bitfields; - - int bit = 0; - int next = first_field; - for (; bit < 32 && next < descriptor_->field_count(); ++next) { - const ImmutableFieldGenerator& field = - field_generators_.get(descriptor_->field(next)); - bit += field.GetNumBitsForBuilder(); - - // Skip oneof fields that are handled separately - if (IsRealOneof(descriptor_->field(next))) { - continue; - } - - // Skip repeated fields because they are currently handled - // in separate buildPartial sub-methods. - if (descriptor_->field(next)->is_repeated() && - !IsMapField(descriptor_->field(next))) { - continue; - } - // Skip fields without presence bits in the builder - if (field.GetNumBitsForBuilder() == 0) { - continue; - } - - // Track message bits if necessary - if (field.GetNumBitsForMessage() > 0) { - int to_bitfield = field.GetMessageBitIndex() / 32; - if (declared_to_bitfields.count(to_bitfield) == 0) { - printer->Print("int to_$bit_field_name$ = 0;\n", "bit_field_name", - GetBitFieldName(to_bitfield)); - declared_to_bitfields.insert(to_bitfield); - } - } - - // Copy the field from the builder to the message - field.GenerateBuildingCode(printer); - } - - // Copy the bit field results to the generated message - for (int to_bitfield : declared_to_bitfields) { - printer->Print("result.$bit_field_name$ |= to_$bit_field_name$;\n", - "bit_field_name", GetBitFieldName(to_bitfield)); - } - - printer->Outdent(); - printer->Print("}\n\n"); - - return next; -} - -// =================================================================== - -void MessageBuilderGenerator::GenerateBuilderParsingMethods( - io::Printer* printer) { - printer->Print( - "@java.lang.Override\n" - "public Builder mergeFrom(\n" - " com.google.protobuf.CodedInputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " if (extensionRegistry == null) {\n" - " throw new java.lang.NullPointerException();\n" - " }\n" - " try {\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" - " throw e.unwrapIOException();\n" - " } finally {\n" - " onChanged();\n" - " } // finally\n" - " return this;\n" - "}\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); -} - -// =================================================================== - -void MessageBuilderGenerator::GenerateIsInitialized(io::Printer* printer) { - printer->Print( - "@java.lang.Override\n" - "public final boolean isInitialized() {\n"); - printer->Indent(); - - // Check that all required fields in this message are set. - // TODO(kenton): We can optimize this when we switch to putting all the - // "has" fields into a single bitfield. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - - if (field->is_required()) { - printer->Print( - "if (!has$name$()) {\n" - " return false;\n" - "}\n", - "name", info->capitalized_name); - } - } - - // Now check that all embedded messages are initialized. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); - if (GetJavaType(field) == JAVATYPE_MESSAGE && - HasRequiredFields(field->message_type())) { - switch (field->label()) { - case FieldDescriptor::LABEL_REQUIRED: - printer->Print( - "if (!get$name$().isInitialized()) {\n" - " return false;\n" - "}\n", - "type", - name_resolver_->GetImmutableClassName(field->message_type()), - "name", info->capitalized_name); - break; - case FieldDescriptor::LABEL_OPTIONAL: - printer->Print( - "if (has$name$()) {\n" - " if (!get$name$().isInitialized()) {\n" - " return false;\n" - " }\n" - "}\n", - "name", info->capitalized_name); - break; - case FieldDescriptor::LABEL_REPEATED: - if (IsMapEntry(field->message_type())) { - printer->Print( - "for ($type$ item : get$name$Map().values()) {\n" - " if (!item.isInitialized()) {\n" - " return false;\n" - " }\n" - "}\n", - "type", - MapValueImmutableClassdName(field->message_type(), - name_resolver_), - "name", info->capitalized_name); - } else { - printer->Print( - "for (int i = 0; i < get$name$Count(); i++) {\n" - " if (!get$name$(i).isInitialized()) {\n" - " return false;\n" - " }\n" - "}\n", - "type", - name_resolver_->GetImmutableClassName(field->message_type()), - "name", info->capitalized_name); - } - break; - } - } - } - - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "if (!extensionsAreInitialized()) {\n" - " return false;\n" - "}\n"); - } - - printer->Outdent(); - - printer->Print( - " return true;\n" - "}\n" - "\n"); -} - -// =================================================================== - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include "google/protobuf/port_undef.inc" diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_builder.h b/depends/protobuf/src/google/protobuf/compiler/java/message_builder.h deleted file mode 100644 index 4b1cc7e98..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_builder.h +++ /dev/null @@ -1,100 +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: dweis@google.com (Daniel Weis) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class MessageBuilderGenerator { - public: - explicit MessageBuilderGenerator(const Descriptor* descriptor, - Context* context); - virtual ~MessageBuilderGenerator(); - - virtual void Generate(io::Printer* printer); - - private: - void GenerateCommonBuilderMethods(io::Printer* printer); - void GenerateBuildPartial(io::Printer* printer); - int GenerateBuildPartialPiece(io::Printer* printer, int piece, - int first_field); - int GenerateBuildPartialPieceWithoutPresence(io::Printer* printer, int piece, - int first_field); - 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); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_builder_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/message_builder_lite.cc deleted file mode 100644 index 526f949b6..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_builder_lite.cc +++ /dev/null @@ -1,156 +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: dweis@google.com (Daniel Weis) -// 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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -MessageBuilderLiteGenerator::MessageBuilderLiteGenerator( - const Descriptor* descriptor, Context* context) - : descriptor_(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()), - field_generators_(descriptor, context_) { - 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() {} - -void MessageBuilderLiteGenerator::Generate(io::Printer* printer) { - WriteMessageDocComment(printer, descriptor_); - printer->Print( - "public static final class Builder extends\n" - " com.google.protobuf.GeneratedMessageLite.$extendible$Builder<\n" - " $classname$, Builder> implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "extra_interfaces", ExtraBuilderInterfaces(descriptor_), "extendible", - descriptor_->extension_range_count() > 0 ? "Extendable" : ""); - printer->Indent(); - - GenerateCommonBuilderMethods(printer); - - // oneof - std::map vars; - 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()); - - // oneofCase() and clearOneof() - printer->Print(vars, - "@java.lang.Override\n" - "public $oneof_capitalized_name$Case\n" - " get$oneof_capitalized_name$Case() {\n" - " return instance.get$oneof_capitalized_name$Case();\n" - "}\n" - "\n" - "public Builder clear$oneof_capitalized_name$() {\n" - " copyOnWrite();\n" - " instance.clear$oneof_capitalized_name$();\n" - " return this;\n" - "}\n" - "\n"); - } - - for (int i = 0; i < descriptor_->field_count(); i++) { - printer->Print("\n"); - field_generators_.get(descriptor_->field(i)) - .GenerateBuilderMembers(printer); - } - - printer->Print( - "\n" - "// @@protoc_insertion_point(builder_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - printer->Outdent(); - printer->Print("}\n"); -} - -// =================================================================== - -void MessageBuilderLiteGenerator::GenerateCommonBuilderMethods( - io::Printer* printer) { - printer->Print( - "// Construct using $classname$.newBuilder()\n" - "private Builder() {\n" - " super(DEFAULT_INSTANCE);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); -} - -// =================================================================== - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_builder_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/message_builder_lite.h deleted file mode 100644 index 0d895fcf0..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_builder_lite.h +++ /dev/null @@ -1,87 +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: dweis@google.com (Daniel Weis) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_LITE_H__ - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class MessageBuilderLiteGenerator { - public: - explicit MessageBuilderLiteGenerator(const Descriptor* descriptor, - Context* context); - virtual ~MessageBuilderLiteGenerator(); - - virtual void Generate(io::Printer* printer); - - private: - void GenerateCommonBuilderMethods(io::Printer* printer); - - const Descriptor* descriptor_; - Context* context_; - ClassNameResolver* name_resolver_; - FieldGeneratorMap field_generators_; - std::set oneofs_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageBuilderLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_field.cc b/depends/protobuf/src/google/protobuf/compiler/java/message_field.cc deleted file mode 100644 index 5093be4bb..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_field.cc +++ /dev/null @@ -1,1452 +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 "google/protobuf/compiler/java/message_field.h" - -#include -#include - -#include "google/protobuf/io/printer.h" -#include "google/protobuf/wire_format.h" -#include "google/protobuf/stubs/strutil.h" -#include "google/protobuf/compiler/java/context.h" -#include "google/protobuf/compiler/java/doc_comment.h" -#include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/name_resolver.h" - -// Must be last. -#include "google/protobuf/port_def.inc" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - - -namespace { - -void SetMessageVariables( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, ClassNameResolver* name_resolver, - std::map* variables, - Context* context) { - SetCommonFieldVariables(descriptor, info, variables); - - (*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"] = - (GetType(descriptor) == FieldDescriptor::TYPE_GROUP) ? "Group" - : "Message"; - // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported - // by the proto compiler - (*variables)["deprecation"] = - descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? StrCat("@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 (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); - - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_to_local"] = ""; - variables->insert({"is_field_present_message", - StrCat((*variables)["name"], "_ != null")}); - } - - // 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); - - (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); - (*variables)["set_has_field_bit_builder"] = - GenerateSetBit(builderBitIndex) + ";"; - (*variables)["clear_has_field_bit_builder"] = - GenerateClearBit(builderBitIndex) + ";"; - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); -} - -} // namespace - -// =================================================================== - -ImmutableMessageFieldGenerator::ImmutableMessageFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : descriptor_(descriptor), - message_bit_index_(messageBitIndex), - builder_bit_index_(builderBitIndex), - name_resolver_(context->GetNameResolver()), - context_(context) { - SetMessageVariables(descriptor, messageBitIndex, builderBitIndex, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_, context); -} - -ImmutableMessageFieldGenerator::~ImmutableMessageFieldGenerator() {} - -int ImmutableMessageFieldGenerator::GetMessageBitIndex() const { - return message_bit_index_; -} - -int ImmutableMessageFieldGenerator::GetBuilderBitIndex() const { - return builder_bit_index_; -} - -int ImmutableMessageFieldGenerator::GetNumBitsForMessage() const { - return HasHasbit(descriptor_) ? 1 : 0; -} - -int ImmutableMessageFieldGenerator::GetNumBitsForBuilder() const { return 1; } - -void ImmutableMessageFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - // TODO(jonp): In the future, consider having a method specific to the - // interface so that builders can choose dynamically to either return a - // message or a nested builder, so that asking for the interface doesn't - // cause a message to ever be built. - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, "$deprecation$$type$ get$capitalized_name$();\n"); - - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$$type$OrBuilder get$capitalized_name$OrBuilder();\n"); -} - -void ImmutableMessageFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "private $type$ $name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - - 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"); - printer->Annotate("{", "}", descriptor_); - } else { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $name$_ != null;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - 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"); - printer->Annotate("{", "}", descriptor_); - - 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" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutableMessageFieldGenerator::PrintNestedBuilderCondition( - io::Printer* printer, const char* regular_case, - const char* nested_builder_case) const { - printer->Print(variables_, "if ($name$Builder_ == null) {\n"); - printer->Indent(); - printer->Print(variables_, regular_case); - printer->Outdent(); - printer->Print("} else {\n"); - printer->Indent(); - printer->Print(variables_, nested_builder_case); - printer->Outdent(); - printer->Print("}\n"); -} - -void ImmutableMessageFieldGenerator::PrintNestedBuilderFunction( - io::Printer* printer, const char* method_prototype, - const char* regular_case, const char* nested_builder_case, - const char* trailing_code) const { - printer->Print(variables_, method_prototype); - printer->Annotate("{", "}", descriptor_); - printer->Print(" {\n"); - printer->Indent(); - PrintNestedBuilderCondition(printer, regular_case, nested_builder_case); - if (trailing_code != NULL) { - printer->Print(variables_, trailing_code); - } - printer->Outdent(); - printer->Print("}\n"); -} - -void ImmutableMessageFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // When using nested-builders, the code initially works just like the - // non-nested builder case. It only creates a nested builder lazily on - // demand and then forever delegates to it after creation. - printer->Print(variables_, "private $type$ $name$_;\n"); - - printer->Print(variables_, - // If this builder is non-null, it is used and the other fields - // are ignored. - "private com.google.protobuf.SingleFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder> $name$Builder_;" - "\n"); - - // The comments above the methods below are based on a hypothetical - // field of type "Field" called "Field". - - // boolean hasField() - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_builder$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field getField() - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - PrintNestedBuilderFunction( - printer, "$deprecation$public $type$ ${$get$capitalized_name$$}$()", - "return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n", - "return $name$Builder_.getMessage();\n", NULL); - - // Field.Builder setField(Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$set$capitalized_name$$}$($type$ value)", - - "if (value == null) {\n" - " throw new NullPointerException();\n" - "}\n" - "$name$_ = value;\n", - - "$name$Builder_.setMessage(value);\n", - - "$set_has_field_bit_builder$\n" - "$on_changed$\n" - "return this;\n"); - - // Field.Builder setField(Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " $type$.Builder builderForValue)", - - "$name$_ = builderForValue.build();\n", - - "$name$Builder_.setMessage(builderForValue.build());\n", - - "$set_has_field_bit_builder$\n" - "$on_changed$\n" - "return this;\n"); - - // Message.Builder mergeField(Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$merge$capitalized_name$$}$($type$ value)", - "if ($get_has_field_bit_builder$ &&\n" - " $name$_ != null &&\n" - " $name$_ != $type$.getDefaultInstance()) {\n" - " get$capitalized_name$Builder().mergeFrom(value);\n" - "} else {\n" - " $name$_ = value;\n" - "}\n", - - "$name$Builder_.mergeFrom(value);\n", - - "$set_has_field_bit_builder$\n" - "$on_changed$\n" - "return this;\n"); - - // Message.Builder clearField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder clear$capitalized_name$() {\n" - " $clear_has_field_bit_builder$\n" - " $name$_ = null;\n" - " if ($name$Builder_ != null) {\n" - " $name$Builder_.dispose();\n" - " $name$Builder_ = null;\n" - " }\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - - // Field.Builder getFieldBuilder() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public $type$.Builder " - "${$get$capitalized_name$Builder$}$() {\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - " return get$capitalized_name$FieldBuilder().getBuilder();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // FieldOrBuilder getFieldOrBuilder() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public $type$OrBuilder " - "${$get$capitalized_name$OrBuilder$}$() {\n" - " if ($name$Builder_ != null) {\n" - " return $name$Builder_.getMessageOrBuilder();\n" - " } else {\n" - " return $name$_ == null ?\n" - " $type$.getDefaultInstance() : $name$_;\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // SingleFieldBuilder getFieldFieldBuilder - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "private com.google.protobuf.SingleFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder> \n" - " get$capitalized_name$FieldBuilder() {\n" - " if ($name$Builder_ == null) {\n" - " $name$Builder_ = new com.google.protobuf.SingleFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder>(\n" - " get$capitalized_name$(),\n" - " getParentForChildren(),\n" - " isClean());\n" - " $name$_ = null;\n" - " }\n" - " return $name$Builder_;\n" - "}\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"); - - GenerateKotlinOrNull(printer); -} - -void ImmutableMessageFieldGenerator::GenerateKotlinOrNull(io::Printer* printer) const { - if (descriptor_->has_optional_keyword()) { - printer->Print(variables_, - "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n" - " get() = $kt_dsl_builder$.$name$OrNull\n"); - } -} - -void ImmutableMessageFieldGenerator::GenerateFieldBuilderInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "get$capitalized_name$FieldBuilder();\n"); -} - -void ImmutableMessageFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const {} - -void ImmutableMessageFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - // No need to clear the has-bit since we clear the bitField ints all at once. - printer->Print(variables_, - "$name$_ = null;\n" - "if ($name$Builder_ != null) {\n" - " $name$Builder_.dispose();\n" - " $name$Builder_ = null;\n" - "}\n"); -} - -void ImmutableMessageFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - printer->Print(variables_, - "if (other.has$capitalized_name$()) {\n" - " merge$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); -} - -void ImmutableMessageFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($get_has_field_bit_from_local$) {\n" - " result.$name$_ = $name$Builder_ == null\n" - " ? $name$_\n" - " : $name$Builder_.build();\n"); - if (GetNumBitsForMessage() > 0) { - printer->Print(variables_, " $set_has_field_bit_to_local$;\n"); - } - printer->Print("}\n"); -} - -void ImmutableMessageFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { - printer->Print(variables_, - "input.readGroup($number$,\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" - " extensionRegistry);\n" - "$set_has_field_bit_builder$\n"); - } else { - printer->Print(variables_, - "input.readMessage(\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" - " extensionRegistry);\n" - "$set_has_field_bit_builder$\n"); - } -} - -void ImmutableMessageFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($is_field_present_message$) {\n" - " output.write$group_or_message$($number$, get$capitalized_name$());\n" - "}\n"); -} - -void ImmutableMessageFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($is_field_present_message$) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .compute$group_or_message$Size($number$, get$capitalized_name$());\n" - "}\n"); -} - -void ImmutableMessageFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print(variables_, - "if (!get$capitalized_name$()\n" - " .equals(other.get$capitalized_name$())) return false;\n"); -} - -void ImmutableMessageFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print(variables_, - "hash = (37 * hash) + $constant_name$;\n" - "hash = (53 * hash) + get$capitalized_name$().hashCode();\n"); -} - -std::string ImmutableMessageFieldGenerator::GetBoxedType() const { - return name_resolver_->GetImmutableClassName(descriptor_->message_type()); -} - -// =================================================================== - -ImmutableMessageOneofFieldGenerator::ImmutableMessageOneofFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutableMessageFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutableMessageOneofFieldGenerator::~ImmutableMessageOneofFieldGenerator() {} - -void ImmutableMessageOneofFieldGenerator::GenerateMembers( - io::Printer* printer) const { - 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" - " }\n" - " return $type$.getDefaultInstance();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - 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" - " return ($type$) $oneof_name$_;\n" - " }\n" - " return $type$.getDefaultInstance();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // When using nested-builders, the code initially works just like the - // non-nested builder case. It only creates a nested builder lazily on - // demand and then forever delegates to it after creation. - printer->Print(variables_, - // If this builder is non-null, it is used and the other fields - // are ignored. - "private com.google.protobuf.SingleFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder> $name$Builder_;" - "\n"); - - // The comments above the methods below are based on a hypothetical - // field of type "Field" called "Field". - - // 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"); - printer->Annotate("{", "}", descriptor_); - - // Field getField() - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - PrintNestedBuilderFunction( - printer, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$()", - - "if ($has_oneof_case_message$) {\n" - " return ($type$) $oneof_name$_;\n" - "}\n" - "return $type$.getDefaultInstance();\n", - - "if ($has_oneof_case_message$) {\n" - " return $name$Builder_.getMessage();\n" - "}\n" - "return $type$.getDefaultInstance();\n", - - NULL); - - // Field.Builder setField(Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$set$capitalized_name$$}$($type$ value)", - - "if (value == null) {\n" - " throw new NullPointerException();\n" - "}\n" - "$oneof_name$_ = value;\n" - "$on_changed$\n", - - "$name$Builder_.setMessage(value);\n", - - "$set_oneof_case_message$;\n" - "return this;\n"); - - // Field.Builder setField(Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " $type$.Builder builderForValue)", - - "$oneof_name$_ = builderForValue.build();\n" - "$on_changed$\n", - - "$name$Builder_.setMessage(builderForValue.build());\n", - - "$set_oneof_case_message$;\n" - "return this;\n"); - - // Field.Builder mergeField(Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$merge$capitalized_name$$}$($type$ value)", - - "if ($has_oneof_case_message$ &&\n" - " $oneof_name$_ != $type$.getDefaultInstance()) {\n" - " $oneof_name$_ = $type$.newBuilder(($type$) $oneof_name$_)\n" - " .mergeFrom(value).buildPartial();\n" - "} else {\n" - " $oneof_name$_ = value;\n" - "}\n" - "$on_changed$\n", - - "if ($has_oneof_case_message$) {\n" - " $name$Builder_.mergeFrom(value);\n" - "} else {\n" - " $name$Builder_.setMessage(value);\n" - "}\n", - - "$set_oneof_case_message$;\n" - "return this;\n"); - - // Field.Builder clearField() - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, "$deprecation$public Builder ${$clear$capitalized_name$$}$()", - - "if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " $on_changed$\n" - "}\n", - - "if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - "}\n" - "$name$Builder_.clear();\n", - - "return this;\n"); - - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public $type$.Builder " - "${$get$capitalized_name$Builder$}$() {\n" - " return get$capitalized_name$FieldBuilder().getBuilder();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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" - " return $name$Builder_.getMessageOrBuilder();\n" - " } else {\n" - " if ($has_oneof_case_message$) {\n" - " return ($type$) $oneof_name$_;\n" - " }\n" - " return $type$.getDefaultInstance();\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "private com.google.protobuf.SingleFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder> \n" - " ${$get$capitalized_name$FieldBuilder$}$() {\n" - " if ($name$Builder_ == null) {\n" - " if (!($has_oneof_case_message$)) {\n" - " $oneof_name$_ = $type$.getDefaultInstance();\n" - " }\n" - " $name$Builder_ = new com.google.protobuf.SingleFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder>(\n" - " ($type$) $oneof_name$_,\n" - " getParentForChildren(),\n" - " isClean());\n" - " $oneof_name$_ = null;\n" - " }\n" - " $set_oneof_case_message$;\n" - " $on_changed$\n" - " return $name$Builder_;\n" - "}\n"); - 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" - " $name$Builder_ != null) {\n" - " result.$oneof_name$_ = $name$Builder_.build();\n" - "}\n"); -} - -void ImmutableMessageOneofFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - printer->Print(variables_, - "merge$capitalized_name$(other.get$capitalized_name$());\n"); -} - -void ImmutableMessageOneofFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { - printer->Print(variables_, - "input.readGroup($number$,\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" - " extensionRegistry);\n" - "$set_oneof_case_message$;\n"); - } else { - printer->Print(variables_, - "input.readMessage(\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" - " extensionRegistry);\n" - "$set_oneof_case_message$;\n"); - } -} - -void ImmutableMessageOneofFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($has_oneof_case_message$) {\n" - " output.write$group_or_message$($number$, ($type$) $oneof_name$_);\n" - "}\n"); -} - -void ImmutableMessageOneofFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($has_oneof_case_message$) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .compute$group_or_message$Size($number$, ($type$) $oneof_name$_);\n" - "}\n"); -} - -// =================================================================== - -RepeatedImmutableMessageFieldGenerator::RepeatedImmutableMessageFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutableMessageFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) {} - -RepeatedImmutableMessageFieldGenerator:: - ~RepeatedImmutableMessageFieldGenerator() {} - -int RepeatedImmutableMessageFieldGenerator::GetNumBitsForMessage() const { - return 0; -} - -int RepeatedImmutableMessageFieldGenerator::GetNumBitsForBuilder() const { - return 1; -} - -void RepeatedImmutableMessageFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - // TODO(jonp): In the future, consider having methods specific to the - // interface so that builders can choose dynamically to either return a - // message or a nested builder, so that asking for the interface doesn't - // cause a message to ever be built. - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.List<$type$> \n" - " get$capitalized_name$List();\n"); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$$type$ get$capitalized_name$(int index);\n"); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.List \n" - " get$capitalized_name$OrBuilderList();\n"); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$$type$OrBuilder get$capitalized_name$OrBuilder(\n" - " int index);\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "@SuppressWarnings(\"serial\")\n" - "private java.util.List<$type$> $name$_;\n"); - 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 - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // List getFieldOrBuilderList() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.List \n" - " ${$get$capitalized_name$OrBuilderList$}$() {\n" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // int getFieldCount() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field getField(int index) - 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_); - - // FieldOrBuilder getFieldOrBuilder(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$OrBuilder " - "${$get$capitalized_name$OrBuilder$}$(\n" - " int index) {\n" - " return $name$_.get(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void RepeatedImmutableMessageFieldGenerator::PrintNestedBuilderCondition( - io::Printer* printer, const char* regular_case, - const char* nested_builder_case) const { - printer->Print(variables_, "if ($name$Builder_ == null) {\n"); - printer->Indent(); - printer->Print(variables_, regular_case); - printer->Outdent(); - printer->Print("} else {\n"); - printer->Indent(); - printer->Print(variables_, nested_builder_case); - printer->Outdent(); - printer->Print("}\n"); -} - -void RepeatedImmutableMessageFieldGenerator::PrintNestedBuilderFunction( - io::Printer* printer, const char* method_prototype, - const char* regular_case, const char* nested_builder_case, - const char* trailing_code) const { - printer->Print(variables_, method_prototype); - printer->Annotate("{", "}", descriptor_); - printer->Print(" {\n"); - printer->Indent(); - PrintNestedBuilderCondition(printer, regular_case, nested_builder_case); - if (trailing_code != NULL) { - printer->Print(variables_, trailing_code); - } - printer->Outdent(); - printer->Print("}\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // When using nested-builders, the code initially works just like the - // non-nested builder case. It only creates a nested builder lazily on - // demand and then forever delegates to it after creation. - - printer->Print( - variables_, - // Used when the builder is null. - // One field is the list and the other field keeps track of whether the - // 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 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 - // list can never be modified. - "private java.util.List<$type$> $name$_ =\n" - " java.util.Collections.emptyList();\n" - - "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$get_mutable_bit_builder$) {\n" - " $name$_ = new java.util.ArrayList<$type$>($name$_);\n" - " $set_mutable_bit_builder$;\n" - " }\n" - "}\n" - "\n"); - - printer->Print( - variables_, - // If this builder is non-null, it is used and the other fields are - // ignored. - "private com.google.protobuf.RepeatedFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder> $name$Builder_;\n" - "\n"); - - // The comments above the methods below are based on a hypothetical - // repeated field of type "Field" called "RepeatedField". - - // List getRepeatedFieldList() - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public java.util.List<$type$> " - "${$get$capitalized_name$List$}$()", - - "return java.util.Collections.unmodifiableList($name$_);\n", - "return $name$Builder_.getMessageList();\n", - - NULL); - - // int getRepeatedFieldCount() - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, "$deprecation$public int ${$get$capitalized_name$Count$}$()", - - "return $name$_.size();\n", "return $name$Builder_.getCount();\n", - - NULL); - - // Field getRepeatedField(int index) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index)", - - "return $name$_.get(index);\n", - - "return $name$Builder_.getMessage(index);\n", - - NULL); - - // Builder setRepeatedField(int index, Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$ value)", - "if (value == null) {\n" - " throw new NullPointerException();\n" - "}\n" - "ensure$capitalized_name$IsMutable();\n" - "$name$_.set(index, value);\n" - "$on_changed$\n", - "$name$Builder_.setMessage(index, value);\n", "return this;\n"); - - // Builder setRepeatedField(int index, Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$.Builder builderForValue)", - - "ensure$capitalized_name$IsMutable();\n" - "$name$_.set(index, builderForValue.build());\n" - "$on_changed$\n", - - "$name$Builder_.setMessage(index, builderForValue.build());\n", - - "return this;\n"); - - // Builder addRepeatedField(Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$add$capitalized_name$$}$($type$ value)", - - "if (value == null) {\n" - " throw new NullPointerException();\n" - "}\n" - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(value);\n" - - "$on_changed$\n", - - "$name$Builder_.addMessage(value);\n", - - "return this;\n"); - - // Builder addRepeatedField(int index, Field value) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " int index, $type$ value)", - - "if (value == null) {\n" - " throw new NullPointerException();\n" - "}\n" - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(index, value);\n" - "$on_changed$\n", - - "$name$Builder_.addMessage(index, value);\n", - - "return this;\n"); - - // Builder addRepeatedField(Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " $type$.Builder builderForValue)", - - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(builderForValue.build());\n" - "$on_changed$\n", - - "$name$Builder_.addMessage(builderForValue.build());\n", - - "return this;\n"); - - // Builder addRepeatedField(int index, Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " int index, $type$.Builder builderForValue)", - - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(index, builderForValue.build());\n" - "$on_changed$\n", - - "$name$Builder_.addMessage(index, builderForValue.build());\n", - - "return this;\n"); - - // Builder addAllRepeatedField(Iterable values) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values)", - - "ensure$capitalized_name$IsMutable();\n" - "com.google.protobuf.AbstractMessageLite.Builder.addAll(\n" - " values, $name$_);\n" - "$on_changed$\n", - - "$name$Builder_.addAllMessages(values);\n", - - "return this;\n"); - - // Builder clearRepeatedField() - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, "$deprecation$public Builder ${$clear$capitalized_name$$}$()", - - "$name$_ = java.util.Collections.emptyList();\n" - "$clear_mutable_bit_builder$;\n" - "$on_changed$\n", - - "$name$Builder_.clear();\n", - - "return this;\n"); - - // Builder removeRepeatedField(int index) - WriteFieldDocComment(printer, descriptor_); - PrintNestedBuilderFunction( - printer, - "$deprecation$public Builder ${$remove$capitalized_name$$}$(int index)", - - "ensure$capitalized_name$IsMutable();\n" - "$name$_.remove(index);\n" - "$on_changed$\n", - - "$name$Builder_.remove(index);\n", - - "return this;\n"); - - // Field.Builder getRepeatedFieldBuilder(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public $type$.Builder ${$get$capitalized_name$Builder$}$(\n" - " int index) {\n" - " return get$capitalized_name$FieldBuilder().getBuilder(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // FieldOrBuilder getRepeatedFieldOrBuilder(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public $type$OrBuilder " - "${$get$capitalized_name$OrBuilder$}$(\n" - " int index) {\n" - " if ($name$Builder_ == null) {\n" - " return $name$_.get(index);" - " } else {\n" - " return $name$Builder_.getMessageOrBuilder(index);\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // List getRepeatedFieldOrBuilderList() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public java.util.List \n" - " ${$get$capitalized_name$OrBuilderList$}$() {\n" - " if ($name$Builder_ != null) {\n" - " return $name$Builder_.getMessageOrBuilderList();\n" - " } else {\n" - " return java.util.Collections.unmodifiableList($name$_);\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder addRepeatedField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public $type$.Builder " - "${$add$capitalized_name$Builder$}$() {\n" - " return get$capitalized_name$FieldBuilder().addBuilder(\n" - " $type$.getDefaultInstance());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder addRepeatedFieldBuilder(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public $type$.Builder ${$add$capitalized_name$Builder$}$(\n" - " int index) {\n" - " return get$capitalized_name$FieldBuilder().addBuilder(\n" - " index, $type$.getDefaultInstance());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // List getRepeatedFieldBuilderList() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public java.util.List<$type$.Builder> \n" - " ${$get$capitalized_name$BuilderList$}$() {\n" - " return get$capitalized_name$FieldBuilder().getBuilderList();\n" - "}\n" - "private com.google.protobuf.RepeatedFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder> \n" - " get$capitalized_name$FieldBuilder() {\n" - " if ($name$Builder_ == null) {\n" - " $name$Builder_ = new " - "com.google.protobuf.RepeatedFieldBuilder$ver$<\n" - " $type$, $type$.Builder, $type$OrBuilder>(\n" - " $name$_,\n" - " $get_mutable_bit_builder$,\n" - " getParentForChildren(),\n" - " isClean());\n" - " $name$_ = null;\n" - " }\n" - " return $name$Builder_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void RepeatedImmutableMessageFieldGenerator:: - GenerateFieldBuilderInitializationCode(io::Printer* printer) const { - printer->Print(variables_, "get$capitalized_name$FieldBuilder();\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = java.util.Collections.emptyList();\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - PrintNestedBuilderCondition(printer, - "$name$_ = java.util.Collections.emptyList();\n", - - "$name$_ = null;\n" - "$name$Builder_.clear();\n"); - - printer->Print(variables_, "$clear_mutable_bit_builder$;\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - // The code below does two optimizations (non-nested builder case): - // 1. If the other list is empty, there's nothing to do. This ensures we - // don't allocate a new array if we already have an immutable one. - // 2. If the other list is non-empty and our current list is empty, we can - // reuse the other list which is guaranteed to be immutable. - PrintNestedBuilderCondition( - printer, - "if (!other.$name$_.isEmpty()) {\n" - " if ($name$_.isEmpty()) {\n" - " $name$_ = other.$name$_;\n" - " $clear_mutable_bit_builder$;\n" - " } else {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.addAll(other.$name$_);\n" - " }\n" - " $on_changed$\n" - "}\n", - - "if (!other.$name$_.isEmpty()) {\n" - " if ($name$Builder_.isEmpty()) {\n" - " $name$Builder_.dispose();\n" - " $name$Builder_ = null;\n" - " $name$_ = other.$name$_;\n" - " $clear_mutable_bit_builder$;\n" - " $name$Builder_ = \n" - " com.google.protobuf.GeneratedMessage$ver$.alwaysUseFieldBuilders " - "?\n" - " get$capitalized_name$FieldBuilder() : null;\n" - " } else {\n" - " $name$Builder_.addAllMessages(other.$name$_);\n" - " }\n" - "}\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - // The code below (non-nested builder case) ensures that the result has an - // immutable list. If our list is immutable, we can just reuse it. If not, - // we make it immutable. - PrintNestedBuilderCondition( - printer, - "if ($get_mutable_bit_builder$) {\n" - " $name$_ = java.util.Collections.unmodifiableList($name$_);\n" - " $clear_mutable_bit_builder$;\n" - "}\n" - "result.$name$_ = $name$_;\n", - - "result.$name$_ = $name$Builder_.build();\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { - printer->Print(variables_, - "$type$ m =\n" - " input.readGroup($number$,\n" - " $type$.$get_parser$,\n" - " extensionRegistry);\n"); - } else { - printer->Print(variables_, - "$type$ m =\n" - " input.readMessage(\n" - " $type$.$get_parser$,\n" - " extensionRegistry);\n"); - } - PrintNestedBuilderCondition(printer, - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(m);\n", - "$name$Builder_.addMessage(m);\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " output.write$group_or_message$($number$, $name$_.get(i));\n" - "}\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print( - variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .compute$group_or_message$Size($number$, $name$_.get(i));\n" - "}\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if (!get$capitalized_name$List()\n" - " .equals(other.get$capitalized_name$List())) return false;\n"); -} - -void RepeatedImmutableMessageFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if (get$capitalized_name$Count() > 0) {\n" - " hash = (37 * hash) + $constant_name$;\n" - " hash = (53 * hash) + get$capitalized_name$List().hashCode();\n" - "}\n"); -} - -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" - "}\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" - "}\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" - "}\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" - "}\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" - "}\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" - "}\n\n"); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include "google/protobuf/port_undef.inc" diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_field.h b/depends/protobuf/src/google/protobuf/compiler/java/message_field.h deleted file mode 100644 index f16062f09..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_field.h +++ /dev/null @@ -1,187 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__ - -#include -#include - -#include "google/protobuf/compiler/java/field.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator { - public: - explicit ImmutableMessageFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, - Context* context); - ImmutableMessageFieldGenerator(const ImmutableMessageFieldGenerator&) = - delete; - ImmutableMessageFieldGenerator& operator=( - const ImmutableMessageFieldGenerator&) = delete; - ~ImmutableMessageFieldGenerator() override; - - // implements ImmutableFieldGenerator - // --------------------------------------- - int GetMessageBitIndex() const override; - int GetBuilderBitIndex() const override; - 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_; - int message_bit_index_; - int builder_bit_index_; - std::map variables_; - ClassNameResolver* name_resolver_; - Context* context_; - - virtual void PrintNestedBuilderCondition( - io::Printer* printer, const char* regular_case, - const char* nested_builder_case) const; - virtual void PrintNestedBuilderFunction(io::Printer* printer, - const char* method_prototype, - const char* regular_case, - const char* nested_builder_case, - const char* trailing_code) const; - - private: - void GenerateKotlinOrNull(io::Printer* printer) const; -}; - -class ImmutableMessageOneofFieldGenerator - : public ImmutableMessageFieldGenerator { - public: - ImmutableMessageOneofFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - Context* context); - ImmutableMessageOneofFieldGenerator( - const ImmutableMessageOneofFieldGenerator&) = delete; - ImmutableMessageOneofFieldGenerator& operator=( - const ImmutableMessageOneofFieldGenerator&) = delete; - ~ImmutableMessageOneofFieldGenerator() override; - - 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; -}; - -class RepeatedImmutableMessageFieldGenerator - : public ImmutableMessageFieldGenerator { - public: - explicit RepeatedImmutableMessageFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, Context* context); - RepeatedImmutableMessageFieldGenerator( - const RepeatedImmutableMessageFieldGenerator&) = delete; - RepeatedImmutableMessageFieldGenerator& operator=( - const RepeatedImmutableMessageFieldGenerator&) = delete; - ~RepeatedImmutableMessageFieldGenerator() override; - - // implements ImmutableFieldGenerator --------------------------------------- - 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: - void PrintNestedBuilderCondition( - io::Printer* printer, const char* regular_case, - const char* nested_builder_case) const override; - void PrintNestedBuilderFunction(io::Printer* printer, - const char* method_prototype, - const char* regular_case, - const char* nested_builder_case, - const char* trailing_code) const override; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_field_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/message_field_lite.cc deleted file mode 100644 index da96790e0..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_field_lite.cc +++ /dev/null @@ -1,898 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { - -void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, const FieldGeneratorInfo* info, - ClassNameResolver* name_resolver, - std::map* variables) { - SetCommonFieldVariables(descriptor, info, variables); - - (*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"] = - (GetType(descriptor) == FieldDescriptor::TYPE_GROUP) ? "Group" - : "Message"; - // 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 (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_message"] = - GenerateSetBit(messageBitIndex) + ";"; - (*variables)["clear_has_field_bit_message"] = - GenerateClearBit(messageBitIndex) + ";"; - - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_message"] = ""; - (*variables)["clear_has_field_bit_message"] = ""; - - (*variables)["is_field_present_message"] = - (*variables)["name"] + "_ != null"; - } - - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); - - // 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"; -} - -} // namespace - -// =================================================================== - -ImmutableMessageFieldLiteGenerator::ImmutableMessageFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : descriptor_(descriptor), - messageBitIndex_(messageBitIndex), - name_resolver_(context->GetNameResolver()) { - SetMessageVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_); -} - -ImmutableMessageFieldLiteGenerator::~ImmutableMessageFieldLiteGenerator() {} - -int ImmutableMessageFieldLiteGenerator::GetNumBitsForMessage() const { - // 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( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, "$deprecation$$type$ get$capitalized_name$();\n"); -} - -void ImmutableMessageFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - - printer->Print(variables_, "private $type$ $name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - - if (HasHasbit(descriptor_)) { - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } else { - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $name$_ != null;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } - - // Field.Builder setField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void set$capitalized_name$($type$ value) {\n" - " $null_check$" - " $name$_ = value;\n" - " $set_has_field_bit_message$\n" - " }\n"); - - // Field.Builder mergeField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.SuppressWarnings({\"ReferenceEquality\"})\n" - "private void merge$capitalized_name$($type$ value) {\n" - " $null_check$" - " if ($name$_ != null &&\n" - " $name$_ != $type$.getDefaultInstance()) {\n" - " $name$_ =\n" - " $type$.newBuilder($name$_).mergeFrom(value).buildPartial();\n" - " } else {\n" - " $name$_ = value;\n" - " }\n" - " $set_has_field_bit_message$\n" - "}\n"); - - // Field.Builder clearField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void clear$capitalized_name$() {" - " $name$_ = null;\n" - " $clear_has_field_bit_message$\n" - "}\n"); -} - -void ImmutableMessageFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // The comments above the methods below are based on a hypothetical - // field of type "Field" called "Field". - - // boolean hasField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return instance.has$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field getField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder setField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - " }\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder setField(Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " $type$.Builder builderForValue) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(builderForValue.build());\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder mergeField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder " - "${$merge$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.merge$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder clearField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - 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"); - GenerateKotlinOrNull(printer); -} - -void ImmutableMessageFieldLiteGenerator::GenerateKotlinOrNull(io::Printer* printer) const { - if (descriptor_->has_optional_keyword()) { - printer->Print(variables_, - "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n" - " get() = $kt_dsl_builder$.$name$OrNull\n"); - } -} - -void ImmutableMessageFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - if (HasHasbit(descriptor_)) { - WriteIntToUtf16CharSequence(messageBitIndex_, output); - } - printer->Print(variables_, "\"$name$_\",\n"); -} - -void ImmutableMessageFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const {} - -std::string ImmutableMessageFieldLiteGenerator::GetBoxedType() const { - return name_resolver_->GetImmutableClassName(descriptor_->message_type()); -} - -// =================================================================== - -ImmutableMessageOneofFieldLiteGenerator:: - ImmutableMessageOneofFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context) - : ImmutableMessageFieldLiteGenerator(descriptor, messageBitIndex, context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutableMessageOneofFieldLiteGenerator:: - ~ImmutableMessageOneofFieldLiteGenerator() {} - -void ImmutableMessageOneofFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - 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" - " }\n" - " return $type$.getDefaultInstance();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder setField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void set$capitalized_name$($type$ value) {\n" - " $null_check$" - " $oneof_name$_ = value;\n" - " $set_oneof_case_message$;\n" - "}\n"); - - // Field.Builder mergeField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "private void merge$capitalized_name$($type$ value) {\n" - " $null_check$" - " if ($has_oneof_case_message$ &&\n" - " $oneof_name$_ != $type$.getDefaultInstance()) {\n" - " $oneof_name$_ = $type$.newBuilder(($type$) $oneof_name$_)\n" - " .mergeFrom(value).buildPartial();\n" - " } else {\n" - " $oneof_name$_ = value;\n" - " }\n" - " $set_oneof_case_message$;\n" - "}\n"); - - // Field.Builder clearField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " }\n" - "}\n"); -} - -void ImmutableMessageOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - WriteIntToUtf16CharSequence(descriptor_->containing_oneof()->index(), output); - printer->Print(variables_, "$oneof_stored_type$.class,\n"); -} - -void ImmutableMessageOneofFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // The comments above the methods below are based on a hypothetical - // field of type "Field" called "Field". - - // boolean hasField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return instance.has$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field getField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder setField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder setField(Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " $type$.Builder builderForValue) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(builderForValue.build());\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder mergeField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder " - "${$merge$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.merge$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Field.Builder clearField() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -// =================================================================== - -RepeatedImmutableMessageFieldLiteGenerator:: - RepeatedImmutableMessageFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - Context* context) - : descriptor_(descriptor), name_resolver_(context->GetNameResolver()) { - SetMessageVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_); -} - -RepeatedImmutableMessageFieldLiteGenerator:: - ~RepeatedImmutableMessageFieldLiteGenerator() {} - -int RepeatedImmutableMessageFieldLiteGenerator::GetNumBitsForMessage() const { - return 0; -} - -void RepeatedImmutableMessageFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - // TODO(jonp): In the future, consider having methods specific to the - // interface so that builders can choose dynamically to either return a - // message or a nested builder, so that asking for the interface doesn't - // cause a message to ever be built. - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$java.util.List<$type$> \n" - " get$capitalized_name$List();\n"); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$$type$ get$capitalized_name$(int index);\n"); - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); -} - -void RepeatedImmutableMessageFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "private com.google.protobuf.Internal.ProtobufList<$type$> $name$_;\n"); - 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 - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public java.util.List \n" - " ${$get$capitalized_name$OrBuilderList$}$() {\n" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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_, - "$deprecation$public $type$OrBuilder " - "${$get$capitalized_name$OrBuilder$}$(\n" - " int index) {\n" - " return $name$_.get(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - printer->Print( - variables_, - "private void ensure$capitalized_name$IsMutable() {\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(tmp);\n" - " }\n" - "}\n" - "\n"); - - // Builder setRepeatedField(int index, Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void set$capitalized_name$(\n" - " int index, $type$ value) {\n" - " $null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.set(index, value);\n" - "}\n"); - - // Builder addRepeatedField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void add$capitalized_name$($type$ value) {\n" - " $null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value);\n" - "}\n"); - - // Builder addRepeatedField(int index, Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void add$capitalized_name$(\n" - " int index, $type$ value) {\n" - " $null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(index, value);\n" - "}\n"); - - // Builder addAllRepeatedField(Iterable values) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void addAll$capitalized_name$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " com.google.protobuf.AbstractMessageLite.addAll(\n" - " values, $name$_);\n" - "}\n"); - - // Builder clearAllRepeatedField() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $name$_ = emptyProtobufList();\n" - "}\n"); - - // Builder removeRepeatedField(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "private void remove$capitalized_name$(int index) {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.remove(index);\n" - "}\n"); -} - -void RepeatedImmutableMessageFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // The comments above the methods below are based on a hypothetical - // repeated field of type "Field" called "RepeatedField". - - // List getRepeatedFieldList() - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.List<$type$> " - "${$get$capitalized_name$List$}$() {\n" - " return java.util.Collections.unmodifiableList(\n" - " instance.get$capitalized_name$List());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // int getRepeatedFieldCount() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return instance.get$capitalized_name$Count();\n" - "}"); - printer->Annotate("{", "}", descriptor_); - - // Field getRepeatedField(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return instance.get$capitalized_name$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder setRepeatedField(int index, Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(index, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder setRepeatedField(int index, Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$.Builder builderForValue) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(index,\n" - " builderForValue.build());\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder addRepeatedField(Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder addRepeatedField(int index, Field value) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " int index, $type$ value) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(index, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - // Builder addRepeatedField(Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " $type$.Builder builderForValue) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(builderForValue.build());\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder addRepeatedField(int index, Field.Builder builderForValue) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " int index, $type$.Builder builderForValue) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(index,\n" - " builderForValue.build());\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder addAllRepeatedField(Iterable values) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " copyOnWrite();\n" - " instance.addAll$capitalized_name$(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder clearAllRepeatedField() - WriteFieldDocComment(printer, descriptor_); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - // Builder removeRepeatedField(int index) - WriteFieldDocComment(printer, descriptor_); - printer->Print(variables_, - "$deprecation$public Builder " - "${$remove$capitalized_name$$}$(int index) {\n" - " copyOnWrite();\n" - " instance.remove$capitalized_name$(index);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void RepeatedImmutableMessageFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - printer->Print(variables_, - "\"$name$_\",\n" - "$type$.class,\n"); -} - -void RepeatedImmutableMessageFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = emptyProtobufList();\n"); -} - -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" - "}\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" - "}\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" - "}\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" - "}\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" - "}\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" - "}\n"); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_field_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/message_field_lite.h deleted file mode 100644 index 4253acc8b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_field_lite.h +++ /dev/null @@ -1,141 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__ - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator { - public: - explicit ImmutableMessageFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context); - ~ImmutableMessageFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator - // ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - protected: - const FieldDescriptor* descriptor_; - std::map variables_; - const int messageBitIndex_; - ClassNameResolver* name_resolver_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageFieldLiteGenerator); - void GenerateKotlinOrNull(io::Printer* printer) const; -}; - -class ImmutableMessageOneofFieldLiteGenerator - : public ImmutableMessageFieldLiteGenerator { - public: - ImmutableMessageOneofFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context); - ~ImmutableMessageOneofFieldLiteGenerator() override; - - void GenerateMembers(io::Printer* printer) const override; - void GenerateBuilderMembers(io::Printer* printer) const override; - void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldLiteGenerator); -}; - -class RepeatedImmutableMessageFieldLiteGenerator - : public ImmutableFieldLiteGenerator { - public: - explicit RepeatedImmutableMessageFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutableMessageFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - protected: - const FieldDescriptor* descriptor_; - std::map variables_; - ClassNameResolver* name_resolver_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableMessageFieldLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/message_lite.cc deleted file mode 100644 index 9a85734ab..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_lite.cc +++ /dev/null @@ -1,1003 +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: dweis@google.com (Daniel Weis) -// 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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -// =================================================================== -ImmutableMessageLiteGenerator::ImmutableMessageLiteGenerator( - const Descriptor* descriptor, Context* context) - : MessageGenerator(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()), - field_generators_(descriptor, context_) { - 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() {} - -void ImmutableMessageLiteGenerator::GenerateStaticVariables( - io::Printer* printer, int* bytecode_estimate) { - // Generate static members for all nested types. - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // TODO(kenton): Reuse MessageGenerator objects? - ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_) - .GenerateStaticVariables(printer, bytecode_estimate); - } -} - -int ImmutableMessageLiteGenerator::GenerateStaticVariableInitializers( - io::Printer* printer) { - int bytecode_estimate = 0; - // Generate static member initializers for all nested types. - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // TODO(kenton): Reuse MessageGenerator objects? - bytecode_estimate += - ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_) - .GenerateStaticVariableInitializers(printer); - } - return bytecode_estimate; -} - -// =================================================================== - -void ImmutableMessageLiteGenerator::GenerateInterface(io::Printer* printer) { - MaybePrintGeneratedAnnotation(context_, printer, descriptor_, - /* immutable = */ true, "OrBuilder"); - if (descriptor_->extension_range_count() > 0) { - printer->Print( - "$deprecation$public interface ${$$classname$OrBuilder$}$ extends \n" - " $extra_interfaces$\n" - " com.google.protobuf.GeneratedMessageLite.\n" - " ExtendableMessageOrBuilder<\n" - " $classname$, $classname$.Builder> {\n", - "deprecation", - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : "", - "extra_interfaces", ExtraMessageOrBuilderInterfaces(descriptor_), - "classname", descriptor_->name(), "{", "", "}", ""); - } else { - printer->Print( - "$deprecation$public interface ${$$classname$OrBuilder$}$ extends\n" - " $extra_interfaces$\n" - " com.google.protobuf.MessageLiteOrBuilder {\n", - "deprecation", - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : "", - "extra_interfaces", ExtraMessageOrBuilderInterfaces(descriptor_), - "classname", descriptor_->name(), "{", "", "}", ""); - } - printer->Annotate("{", "}", descriptor_); - - printer->Indent(); - for (int i = 0; i < descriptor_->field_count(); i++) { - printer->Print("\n"); - field_generators_.get(descriptor_->field(i)) - .GenerateInterfaceMembers(printer); - } - for (auto oneof : oneofs_) { - printer->Print( - "\n" - "public $classname$.$oneof_capitalized_name$Case " - "get$oneof_capitalized_name$Case();\n", - "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "classname", - context_->GetNameResolver()->GetImmutableClassName(descriptor_)); - } - printer->Outdent(); - - printer->Print("}\n"); -} - -// =================================================================== - -void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { - bool is_own_file = IsOwnFile(descriptor_, /* immutable = */ true); - - std::map variables; - variables["static"] = is_own_file ? " " : " static "; - variables["classname"] = descriptor_->name(); - variables["extra_interfaces"] = ExtraMessageInterfaces(descriptor_); - variables["deprecation"] = - descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""; - - 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) { - printer->Print( - variables, - "$deprecation$public $static$final class $classname$ extends\n" - " com.google.protobuf.GeneratedMessageLite.ExtendableMessage<\n" - " $classname$, $classname$.Builder> implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n"); - builder_type = strings::Substitute( - "com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<$0, ?>", - name_resolver_->GetImmutableClassName(descriptor_)); - } else { - printer->Print( - variables, - "$deprecation$public $static$final class $classname$ extends\n" - " com.google.protobuf.GeneratedMessageLite<\n" - " $classname$, $classname$.Builder> implements\n" - " $extra_interfaces$\n" - " $classname$OrBuilder {\n"); - - builder_type = "com.google.protobuf.GeneratedMessageLite.Builder"; - } - printer->Indent(); - - GenerateConstructor(printer); - - // Nested types - for (int i = 0; i < descriptor_->enum_type_count(); i++) { - EnumLiteGenerator(descriptor_->enum_type(i), true, context_) - .Generate(printer); - } - - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - // Don't generate Java classes for map entry messages. - if (IsMapEntry(descriptor_->nested_type(i))) continue; - ImmutableMessageLiteGenerator messageGenerator(descriptor_->nested_type(i), - context_); - messageGenerator.GenerateInterface(printer); - messageGenerator.Generate(printer); - } - - // Integers for bit fields. - int totalBits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - totalBits += - field_generators_.get(descriptor_->field(i)).GetNumBitsForMessage(); - } - int totalInts = (totalBits + 31) / 32; - for (int i = 0; i < totalInts; i++) { - printer->Print("private int $bit_field_name$;\n", "bit_field_name", - GetBitFieldName(i)); - } - - // oneof - std::map vars; - 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()); - // oneofCase_ and oneof_ - printer->Print(vars, - "private int $oneof_name$Case_ = 0;\n" - "private java.lang.Object $oneof_name$_;\n"); - // 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); - printer->Print("$field_name$($field_number$),\n", "field_name", - ToUpper(field->name()), "field_number", - StrCat(field->number())); - } - printer->Print("$cap_oneof_name$_NOT_SET(0);\n", "cap_oneof_name", - ToUpper(vars["oneof_name"])); - printer->Print(vars, - "private final int value;\n" - "private $oneof_capitalized_name$Case(int value) {\n" - " this.value = value;\n" - "}\n"); - printer->Print( - vars, - "/**\n" - " * @deprecated Use {@link #forNumber(int)} instead.\n" - " */\n" - "@java.lang.Deprecated\n" - "public static $oneof_capitalized_name$Case valueOf(int value) {\n" - " return forNumber(value);\n" - "}\n" - "\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); - printer->Print(" case $field_number$: return $field_name$;\n", - "field_number", StrCat(field->number()), - "field_name", ToUpper(field->name())); - } - printer->Print( - " case 0: return $cap_oneof_name$_NOT_SET;\n" - " default: return null;\n" - " }\n" - "}\n" - // TODO(b/135620659): Rename this to "getFieldNumber" or something to - // disambiguate it from actual proto enums. - "public int getNumber() {\n" - " return this.value;\n" - "}\n", - "cap_oneof_name", ToUpper(vars["oneof_name"])); - printer->Outdent(); - printer->Print("};\n\n"); - // oneofCase() - printer->Print(vars, - "@java.lang.Override\n" - "public $oneof_capitalized_name$Case\n" - "get$oneof_capitalized_name$Case() {\n" - " return $oneof_capitalized_name$Case.forNumber(\n" - " $oneof_name$Case_);\n" - "}\n" - "\n" - "private void clear$oneof_capitalized_name$() {\n" - " $oneof_name$Case_ = 0;\n" - " $oneof_name$_ = null;\n" - "}\n" - "\n"); - } - - // Fields - for (int i = 0; i < descriptor_->field_count(); i++) { - printer->Print("public static final int $constant_name$ = $number$;\n", - "constant_name", FieldConstantName(descriptor_->field(i)), - "number", StrCat(descriptor_->field(i)->number())); - field_generators_.get(descriptor_->field(i)).GenerateMembers(printer); - printer->Print("\n"); - } - - GenerateParseFromMethods(printer); - GenerateBuilder(printer); - - if (HasRequiredFields(descriptor_)) { - // Memoizes whether the protocol buffer is fully initialized (has all - // required fields). 0 means false, 1 means true, and all other values - // mean not yet computed. - printer->Print("private byte memoizedIsInitialized = 2;\n"); - } - - printer->Print( - "@java.lang.Override\n" - "@java.lang.SuppressWarnings({\"unchecked\", \"fallthrough\"})\n" - "protected final java.lang.Object dynamicMethod(\n" - " com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,\n" - " java.lang.Object arg0, java.lang.Object arg1) {\n" - " switch (method) {\n" - " case NEW_MUTABLE_INSTANCE: {\n" - " return new $classname$();\n" - " }\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Indent(); - printer->Indent(); - - printer->Print("case NEW_BUILDER: {\n"); - - printer->Indent(); - GenerateDynamicMethodNewBuilder(printer); - printer->Outdent(); - - printer->Print( - "}\n" - "case BUILD_MESSAGE_INFO: {\n"); - - printer->Indent(); - GenerateDynamicMethodNewBuildMessageInfo(printer); - printer->Outdent(); - - printer->Print( - "}\n" - "// fall through\n" - "case GET_DEFAULT_INSTANCE: {\n" - " return DEFAULT_INSTANCE;\n" - "}\n" - "case GET_PARSER: {\n" - // Generally one would use the lazy initialization holder pattern for - // manipulating static fields but that has exceptional cost on Android as - // it will generate an extra class for every message. Instead, use the - // double-check locking pattern which works just as well. - // - // The "parser" temporary mirrors the "PARSER" field to eliminate a read - // at the final return statement. - " com.google.protobuf.Parser<$classname$> parser = PARSER;\n" - " if (parser == null) {\n" - " synchronized ($classname$.class) {\n" - " parser = PARSER;\n" - " if (parser == null) {\n" - " parser =\n" - " new DefaultInstanceBasedParser<$classname$>(\n" - " DEFAULT_INSTANCE);\n" - " PARSER = parser;\n" - " }\n" - " }\n" - " }\n" - " return parser;\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Outdent(); - - if (HasRequiredFields(descriptor_)) { - printer->Print( - "}\n" - "case GET_MEMOIZED_IS_INITIALIZED: {\n" - " return memoizedIsInitialized;\n" - "}\n" - "case SET_MEMOIZED_IS_INITIALIZED: {\n" - " memoizedIsInitialized = (byte) (arg0 == null ? 0 : 1);\n" - " return null;\n" - "}\n"); - } else { - printer->Print( - "}\n" - "case GET_MEMOIZED_IS_INITIALIZED: {\n" - " return (byte) 1;\n" - "}\n" - "case SET_MEMOIZED_IS_INITIALIZED: {\n" - " return null;\n" - "}\n"); - } - - printer->Outdent(); - printer->Print( - " }\n" - " throw new UnsupportedOperationException();\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Print( - "\n" - "// @@protoc_insertion_point(class_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - // Carefully initialize the default instance in such a way that it doesn't - // conflict with other initialization. - printer->Print("private static final $classname$ DEFAULT_INSTANCE;\n", - "classname", - name_resolver_->GetImmutableClassName(descriptor_)); - - printer->Print( - "static {\n" - " $classname$ defaultInstance = new $classname$();\n" - " // New instances are implicitly immutable so no need to make\n" - " // immutable.\n" - " DEFAULT_INSTANCE = defaultInstance;\n" - // Register the default instance in a map. This map will be used by - // experimental runtime to lookup default instance given a class instance - // without using Java reflection. - " com.google.protobuf.GeneratedMessageLite.registerDefaultInstance(\n" - " $classname$.class, defaultInstance);\n" - "}\n" - "\n", - "classname", descriptor_->name()); - - printer->Print( - "public static $classname$ getDefaultInstance() {\n" - " return DEFAULT_INSTANCE;\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - // 'of' method for Wrappers - if (IsWrappersProtoFile(descriptor_->file())) { - printer->Print( - "public static $classname$ of($field_type$ value) {\n" - " return newBuilder().setValue(value).build();\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "field_type", PrimitiveTypeName(GetJavaType(descriptor_->field(0)))); - } - - GenerateParser(printer); - - // Extensions must be declared after the DEFAULT_INSTANCE is initialized - // because the DEFAULT_INSTANCE is used by the extension to lazily retrieve - // the outer class's FileDescriptor. - for (int i = 0; i < descriptor_->extension_count(); i++) { - ImmutableExtensionLiteGenerator(descriptor_->extension(i), context_) - .Generate(printer); - } - - printer->Outdent(); - printer->Print("}\n\n"); -} - -void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuildMessageInfo( - io::Printer* printer) { - printer->Indent(); - - // 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; - - int flags = 0; - if (IsProto2(descriptor_->file())) { - flags |= 0x1; - } - if (descriptor_->options().message_set_wire_format()) { - flags |= 0x2; - } - WriteIntToUtf16CharSequence(flags, &chars); - WriteIntToUtf16CharSequence(descriptor_->field_count(), &chars); - - if (descriptor_->field_count() == 0) { - printer->Print("java.lang.Object[] objects = null;"); - } else { - // A single array of all fields (including oneof, oneofCase, hasBits). - printer->Print("java.lang.Object[] objects = new java.lang.Object[] {\n"); - printer->Indent(); - - // Record the number of oneofs. - WriteIntToUtf16CharSequence(oneofs_.size(), &chars); - for (auto oneof : oneofs_) { - printer->Print( - "\"$oneof_name$_\",\n" - "\"$oneof_name$Case_\",\n", - "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name); - } - - // Integers for bit fields. - int total_bits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - total_bits += - field_generators_.get(descriptor_->field(i)).GetNumBitsForMessage(); - } - int total_ints = (total_bits + 31) / 32; - for (int i = 0; i < total_ints; i++) { - printer->Print("\"$bit_field_name$\",\n", "bit_field_name", - GetBitFieldName(i)); - } - WriteIntToUtf16CharSequence(total_ints, &chars); - - int map_count = 0; - int repeated_count = 0; - std::unique_ptr sorted_fields( - SortFieldsByNumber(descriptor_)); - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = sorted_fields[i]; - if (field->is_map()) { - map_count++; - } else if (field->is_repeated()) { - repeated_count++; - } - } - - WriteIntToUtf16CharSequence(sorted_fields[0]->number(), &chars); - WriteIntToUtf16CharSequence( - sorted_fields[descriptor_->field_count() - 1]->number(), &chars); - WriteIntToUtf16CharSequence(descriptor_->field_count(), &chars); - WriteIntToUtf16CharSequence(map_count, &chars); - WriteIntToUtf16CharSequence(repeated_count, &chars); - - std::vector fields_for_is_initialized_check; - for (int i = 0; i < descriptor_->field_count(); i++) { - if (descriptor_->field(i)->is_required() || - (GetJavaType(descriptor_->field(i)) == JAVATYPE_MESSAGE && - HasRequiredFields(descriptor_->field(i)->message_type()))) { - fields_for_is_initialized_check.push_back(descriptor_->field(i)); - } - } - WriteIntToUtf16CharSequence(fields_for_is_initialized_check.size(), &chars); - - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = sorted_fields[i]; - field_generators_.get(field).GenerateFieldInfo(printer, &chars); - } - printer->Outdent(); - printer->Print("};\n"); - } - - printer->Print("java.lang.String info =\n"); - std::string line; - for (size_t i = 0; i < chars.size(); i++) { - uint16_t code = chars[i]; - EscapeUtf16ToString(code, &line); - if (line.size() >= 80) { - printer->Print(" \"$string$\" +\n", "string", line); - line.clear(); - } - } - printer->Print(" \"$string$\";\n", "string", line); - - printer->Print("return newMessageInfo(DEFAULT_INSTANCE, info, objects);\n"); - printer->Outdent(); -} - -// =================================================================== - -void ImmutableMessageLiteGenerator::GenerateParseFromMethods( - io::Printer* printer) { - printer->Print( - "public static $classname$ parseFrom(\n" - " java.nio.ByteBuffer data)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, data);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " java.nio.ByteBuffer data,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, data, extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.ByteString data)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, data);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.ByteString data,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, data, extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(byte[] data)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, data);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " byte[] data,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, data, extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(java.io.InputStream input)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, input);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " java.io.InputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, input, extensionRegistry);\n" - "}\n" - "public static $classname$ parseDelimitedFrom(java.io.InputStream " - "input)\n" - " throws java.io.IOException {\n" - " return parseDelimitedFrom(DEFAULT_INSTANCE, input);\n" - "}\n" - "public static $classname$ parseDelimitedFrom(\n" - " java.io.InputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " return parseDelimitedFrom(DEFAULT_INSTANCE, input, " - "extensionRegistry);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.CodedInputStream input)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, input);\n" - "}\n" - "public static $classname$ parseFrom(\n" - " com.google.protobuf.CodedInputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessageLite.parseFrom(\n" - " DEFAULT_INSTANCE, input, extensionRegistry);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); -} - -// =================================================================== - -void ImmutableMessageLiteGenerator::GenerateBuilder(io::Printer* printer) { - printer->Print( - "public static Builder newBuilder() {\n" - " return (Builder) DEFAULT_INSTANCE.createBuilder();\n" - "}\n" - "public static Builder newBuilder($classname$ prototype) {\n" - " return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);\n" - "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - - MessageBuilderLiteGenerator builderGenerator(descriptor_, context_); - builderGenerator.Generate(printer); -} - -// =================================================================== - -void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuilder( - io::Printer* printer) { - printer->Print("return new Builder();\n"); -} - -// =================================================================== - -void ImmutableMessageLiteGenerator::GenerateExtensionRegistrationCode( - io::Printer* printer) { - for (int i = 0; i < descriptor_->extension_count(); i++) { - ImmutableExtensionLiteGenerator(descriptor_->extension(i), context_) - .GenerateRegistrationCode(printer); - } - - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_) - .GenerateExtensionRegistrationCode(printer); - } -} - -// =================================================================== -void ImmutableMessageLiteGenerator::GenerateConstructor(io::Printer* printer) { - printer->Print("private $classname$() {\n", "classname", descriptor_->name()); - printer->Indent(); - - // Initialize all fields to default. - GenerateInitializers(printer); - - printer->Outdent(); - printer->Print("}\n"); -} - -// =================================================================== -void ImmutableMessageLiteGenerator::GenerateParser(io::Printer* printer) { - printer->Print( - "private static volatile com.google.protobuf.Parser<$classname$> " - "PARSER;\n" - "\n" - "public static com.google.protobuf.Parser<$classname$> parser() {\n" - " return DEFAULT_INSTANCE.getParserForType();\n" - "}\n", - "classname", descriptor_->name()); -} - -// =================================================================== -void ImmutableMessageLiteGenerator::GenerateInitializers(io::Printer* printer) { - for (int i = 0; i < descriptor_->field_count(); i++) { - 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.JvmName(\"-initialize$camelcase_name$\")\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\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); - } - - GenerateKotlinOrNull(printer); -} - -void ImmutableMessageLiteGenerator::GenerateKotlinOrNull(io::Printer* printer) const { - // Generate getFieldOrNull getters for all optional message fields. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (field->has_presence() && GetJavaType(field) == JAVATYPE_MESSAGE) { - printer->Print( - "public val $full_classname$OrBuilder.$camelcase_name$OrNull: " - "$full_name$?\n" - " get() = if (has$name$()) get$name$() else null\n\n", - "full_classname", name_resolver_->GetClassName(descriptor_, true), - "camelcase_name", context_->GetFieldGeneratorInfo(field)->name, - "full_name", - name_resolver_->GetImmutableClassName(field->message_type()), "name", - context_->GetFieldGeneratorInfo(field)->capitalized_name); - } - } -} - -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 -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/message_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/message_lite.h deleted file mode 100644 index d1e4b6894..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/message_lite.h +++ /dev/null @@ -1,85 +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: dweis@google.com (Daniel Weis) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableMessageLiteGenerator : public MessageGenerator { - public: - ImmutableMessageLiteGenerator(const Descriptor* descriptor, Context* context); - ~ImmutableMessageLiteGenerator() override; - - 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); - - void GenerateBuilder(io::Printer* printer); - void GenerateDynamicMethodNewBuilder(io::Printer* printer); - void GenerateInitializers(io::Printer* printer); - void GenerateParser(io::Printer* printer); - void GenerateConstructor(io::Printer* printer); - void GenerateDynamicMethodNewBuildMessageInfo(io::Printer* printer); - void GenerateKotlinExtensions(io::Printer* printer) const; - void GenerateKotlinOrNull(io::Printer* printer) const; - - Context* context_; - ClassNameResolver* name_resolver_; - FieldGeneratorMap field_generators_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/name_resolver.cc b/depends/protobuf/src/google/protobuf/compiler/java/name_resolver.cc deleted file mode 100644 index 06a637e3c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/name_resolver.cc +++ /dev/null @@ -1,385 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -namespace { -// A suffix that will be appended to the file's outer class name if the name -// conflicts with some other types defined in the file. -const char* kOuterClassNameSuffix = "OuterClass"; - -// Strip package name from a descriptor's full name. -// For example: -// Full name : foo.Bar.Baz -// Package name: foo -// After strip : Bar.Baz -std::string StripPackageName(const std::string& full_name, - const FileDescriptor* file) { - if (file->package().empty()) { - return full_name; - } else { - // Strip package name - return full_name.substr(file->package().size() + 1); - } -} - -// Get the name of a message's Java class without package name prefix. -std::string ClassNameWithoutPackage(const Descriptor* descriptor, - bool immutable) { - 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) { - // Doesn't append "Mutable" for enum type's name. - const Descriptor* message_descriptor = descriptor->containing_type(); - if (message_descriptor == NULL) { - return descriptor->name(); - } else { - return ClassNameWithoutPackage(message_descriptor, immutable) + "." + - descriptor->name(); - } -} - -// Get the name of a service's Java class without package name prefix. -std::string ClassNameWithoutPackage(const ServiceDescriptor* descriptor, - bool immutable) { - std::string full_name = - StripPackageName(descriptor->full_name(), descriptor->file()); - // We don't allow nested service definitions. - GOOGLE_CHECK(full_name.find('.') == std::string::npos); - return full_name; -} - -// Return true if a and b are equals (case insensitive). -NameEquality CheckNameEquality(const std::string& a, const std::string& b) { - if (ToUpper(a) == ToUpper(b)) { - if (a == b) { - return NameEquality::EXACT_EQUAL; - } - return NameEquality::EQUAL_IGNORE_CASE; - } - return NameEquality::NO_MATCH; -} - -// Check whether a given message or its nested types has the given class name. -bool MessageHasConflictingClassName(const Descriptor* message, - const std::string& classname, - NameEquality equality_mode) { - if (CheckNameEquality(message->name(), classname) == equality_mode) { - return true; - } - for (int i = 0; i < message->nested_type_count(); ++i) { - if (MessageHasConflictingClassName(message->nested_type(i), classname, - equality_mode)) { - return true; - } - } - for (int i = 0; i < message->enum_type_count(); ++i) { - if (CheckNameEquality(message->enum_type(i)->name(), classname) == - equality_mode) { - return true; - } - } - return false; -} - -} // namespace - -ClassNameResolver::ClassNameResolver() {} - -ClassNameResolver::~ClassNameResolver() {} - -std::string ClassNameResolver::GetFileDefaultImmutableClassName( - const FileDescriptor* file) { - std::string basename; - std::string::size_type last_slash = file->name().find_last_of('/'); - if (last_slash == std::string::npos) { - basename = file->name(); - } else { - basename = file->name().substr(last_slash + 1); - } - return UnderscoresToCamelCase(StripProto(basename), true); -} - -std::string ClassNameResolver::GetFileImmutableClassName( - const FileDescriptor* file) { - std::string& class_name = file_immutable_outer_class_names_[file]; - if (class_name.empty()) { - if (file->options().has_java_outer_classname()) { - class_name = file->options().java_outer_classname(); - } else { - class_name = GetFileDefaultImmutableClassName(file); - if (HasConflictingClassName(file, class_name, - NameEquality::EXACT_EQUAL)) { - class_name += kOuterClassNameSuffix; - } - } - } - return class_name; -} - -std::string ClassNameResolver::GetFileClassName(const FileDescriptor* file, - bool 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); - } -} - -// Check whether there is any type defined in the proto file that has -// the given class name. -bool ClassNameResolver::HasConflictingClassName(const FileDescriptor* file, - const std::string& classname, - NameEquality equality_mode) { - for (int i = 0; i < file->enum_type_count(); i++) { - if (CheckNameEquality(file->enum_type(i)->name(), classname) == - equality_mode) { - return true; - } - } - for (int i = 0; i < file->service_count(); i++) { - if (CheckNameEquality(file->service(i)->name(), classname) == - equality_mode) { - return true; - } - } - for (int i = 0; i < file->message_type_count(); i++) { - if (MessageHasConflictingClassName(file->message_type(i), classname, - equality_mode)) { - return true; - } - } - return false; -} - -std::string ClassNameResolver::GetDescriptorClassName( - const FileDescriptor* descriptor) { - return GetFileImmutableClassName(descriptor); -} - -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, kotlin); - return result; -} - -// Get the full name of a Java class by prepending the Java package name -// or outer class name. -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, 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 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 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), 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, kotlin); - if (!result.empty()) result += '$'; - } - result += StringReplace(name_without_package, ".", "$", true); - return result; -} - -std::string ClassNameResolver::GetExtensionIdentifierName( - const FieldDescriptor* descriptor, bool 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), - descriptor->file(), true); -} - -std::string ClassNameResolver::GetJavaImmutableClassName( - const EnumDescriptor* descriptor) { - return GetJavaClassFullName(ClassNameWithoutPackage(descriptor, true), - 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 -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/name_resolver.h b/depends/protobuf/src/google/protobuf/compiler/java/name_resolver.h deleted file mode 100644 index 103cace43..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/name_resolver.h +++ /dev/null @@ -1,159 +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_COMPILER_JAVA_NAME_RESOLVER_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__ - -#include -#include - -#include - -// Must be last. -#include - -namespace google { -namespace protobuf { -class Descriptor; -class EnumDescriptor; -class FieldDescriptor; -class FileDescriptor; -class ServiceDescriptor; - -namespace compiler { -namespace java { - -// Indicates how closely the two class names match. -enum NameEquality { NO_MATCH, EXACT_EQUAL, EQUAL_IGNORE_CASE }; - -// Used to get the Java class related names for a given descriptor. It caches -// the results to avoid redundant calculation across multiple name queries. -// Thread-safety note: This class is *not* thread-safe. -class ClassNameResolver { - public: - ClassNameResolver(); - ~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 - // (converted from the proto file's name). - std::string GetFileDefaultImmutableClassName(const FileDescriptor* file); - - // Check whether there is any type defined in the proto file that has - // the given class name. - bool HasConflictingClassName(const FileDescriptor* file, - const std::string& classname, - NameEquality equality_mode); - - // Gets the name of the outer class that holds descriptor information. - // Descriptors are shared between immutable messages and mutable messages. - // Since both of them are generated optionally, the descriptors need to be - // put in another common place. - std::string GetDescriptorClassName(const FileDescriptor* file); - - // 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) { - return GetClassName(descriptor, true); - } - template - std::string GetMutableClassName(const DescriptorType* descriptor) { - return GetClassName(descriptor, false); - } - - // 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 '.' - // For example: - // 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); - - // 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); - - private: - // 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_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ClassNameResolver); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/names.h b/depends/protobuf/src/google/protobuf/compiler/java/names.h deleted file mode 100644 index 313ace4fe..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/names.h +++ /dev/null @@ -1,100 +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. -// -// Provides a mechanism for mapping a descriptor to the -// fully-qualified name of the corresponding Java class. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__ - -#include - -namespace google { -namespace protobuf { - -class Descriptor; -class EnumDescriptor; -class FileDescriptor; -class FieldDescriptor; -class ServiceDescriptor; - -namespace compiler { -namespace java { - -// Requires: -// descriptor != NULL -// -// Returns: -// The fully-qualified Java class name. -std::string ClassName(const Descriptor* descriptor); - -// Requires: -// descriptor != NULL -// -// Returns: -// The fully-qualified Java class name. -std::string ClassName(const EnumDescriptor* descriptor); - -// Requires: -// descriptor != NULL -// -// Returns: -// The fully-qualified Java class name. -std::string ClassName(const FileDescriptor* descriptor); - -// Requires: -// descriptor != NULL -// -// Returns: -// The fully-qualified Java class name. -std::string ClassName(const ServiceDescriptor* descriptor); - -// Requires: -// descriptor != NULL -// -// Returns: -// Java package name. -std::string FileJavaPackage(const FileDescriptor* descriptor); - -// Requires: -// descriptor != NULL -// Returns: -// Capitalized camel case name field name. -std::string CapitalizedFieldName(const FieldDescriptor* descriptor); - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/options.h b/depends/protobuf/src/google/protobuf/compiler/java/options.h deleted file mode 100644 index 6c29be150..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/options.h +++ /dev/null @@ -1,73 +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_COMPILER_JAVA_OPTIONS_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_OPTIONS_H__ - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -// Generator options -struct Options { - Options() - : generate_immutable_code(false), - generate_mutable_code(false), - generate_shared_code(false), - enforce_lite(false), - annotate_code(false) { - } - - bool generate_immutable_code; - bool generate_mutable_code; - bool generate_shared_code; - // When set, the protoc will generate the current files and all the transitive - // dependencies as lite runtime. - bool enforce_lite; - // If true, we should build .meta files and emit @Generated annotations into - // generated code. - bool annotate_code; - // Name of a file where we will write a list of generated .meta file names, - // one per line. - std::string annotation_list_file; - // Name of a file where we will write a list of generated file names, one - // per line. - std::string output_list_file; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_OPTIONS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field.cc b/depends/protobuf/src/google/protobuf/compiler/java/primitive_field.cc deleted file mode 100644 index 2e3b8eaa5..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field.cc +++ /dev/null @@ -1,1076 +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 "google/protobuf/compiler/java/primitive_field.h" - -#include -#include -#include - -#include "google/protobuf/stubs/logging.h" -#include "google/protobuf/stubs/common.h" -#include "google/protobuf/io/printer.h" -#include "google/protobuf/wire_format.h" -#include "google/protobuf/stubs/strutil.h" -#include "google/protobuf/compiler/java/context.h" -#include "google/protobuf/compiler/java/doc_comment.h" -#include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/name_resolver.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; - -namespace { - -void SetPrimitiveVariables( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, ClassNameResolver* name_resolver, - std::map* variables, - Context* context) { - SetCommonFieldVariables(descriptor, info, variables); - JavaType javaType = GetJavaType(descriptor); - - (*variables)["type"] = PrimitiveTypeName(javaType); - (*variables)["boxed_type"] = BoxedPrimitiveTypeName(javaType); - (*variables)["kt_type"] = KotlinTypeName(javaType); - variables->insert({"field_type", (*variables)["type"]}); - - std::string name = (*variables)["name"]; - if (javaType == JAVATYPE_BOOLEAN || javaType == JAVATYPE_DOUBLE || - javaType == JAVATYPE_FLOAT || javaType == JAVATYPE_INT || - javaType == JAVATYPE_LONG) { - std::string capitalized_type = UnderscoresToCamelCase( - PrimitiveTypeName(javaType), /*cap_first_letter=*/true); - (*variables)["field_list_type"] = - StrCat("com.google.protobuf.Internal.", capitalized_type, "List"); - (*variables)["empty_list"] = - StrCat("empty", capitalized_type, "List()"); - (*variables)["create_list"] = - StrCat("new", capitalized_type, "List()"); - (*variables)["mutable_copy_list"] = - StrCat("mutableCopy(", name, "_)"); - (*variables)["name_make_immutable"] = - StrCat(name, "_.makeImmutable()"); - (*variables)["repeated_get"] = - StrCat(name, "_.get", capitalized_type); - (*variables)["repeated_add"] = - StrCat(name, "_.add", capitalized_type); - (*variables)["repeated_set"] = - StrCat(name, "_.set", capitalized_type); - } else { - std::string boxed_type = (*variables)["boxed_type"]; - (*variables)["field_list_type"] = - StrCat("java.util.List<", boxed_type, ">"); - (*variables)["create_list"] = - StrCat("new java.util.ArrayList<", boxed_type, ">()"); - (*variables)["mutable_copy_list"] = - StrCat("new java.util.ArrayList<", boxed_type, ">(", name, "_)"); - (*variables)["empty_list"] = "java.util.Collections.emptyList()"; - (*variables)["name_make_immutable"] = StrCat( - name, "_ = java.util.Collections.unmodifiableList(", name, "_)"); - (*variables)["repeated_get"] = StrCat(name, "_.get"); - (*variables)["repeated_add"] = StrCat(name, "_.add"); - (*variables)["repeated_set"] = StrCat(name, "_.set"); - } - - (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); - (*variables)["default_init"] = - IsDefaultValueJavaDefault(descriptor) - ? "" - : ("= " + ImmutableDefaultValue(descriptor, name_resolver)); - (*variables)["capitalized_type"] = - GetCapitalizedType(descriptor, /* immutable = */ true); - (*variables)["tag"] = - StrCat(static_cast(WireFormat::MakeTag(descriptor))); - (*variables)["tag_size"] = StrCat( - WireFormat::TagSize(descriptor->number(), GetType(descriptor))); - if (IsReferenceType(GetJavaType(descriptor))) { - (*variables)["null_check"] = - "if (value == null) { throw new NullPointerException(); }"; - } else { - (*variables)["null_check"] = ""; - } - // 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() - ? StrCat("@kotlin.Deprecated(message = \"Field ", name, - " is deprecated\") ") - : ""; - int fixed_size = FixedSize(GetType(descriptor)); - if (fixed_size != -1) { - (*variables)["fixed_size"] = StrCat(fixed_size); - } - (*variables)["on_changed"] = "onChanged();"; - - if (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex) + ";"; - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_to_local"] = ""; - switch (descriptor->type()) { - case FieldDescriptor::TYPE_BYTES: - (*variables)["is_field_present_message"] = - StrCat("!", name, "_.isEmpty()"); - break; - case FieldDescriptor::TYPE_FLOAT: - (*variables)["is_field_present_message"] = - StrCat("java.lang.Float.floatToRawIntBits(", name, "_) != 0"); - break; - case FieldDescriptor::TYPE_DOUBLE: - (*variables)["is_field_present_message"] = StrCat( - "java.lang.Double.doubleToRawLongBits(", name, "_) != 0"); - break; - default: - variables->insert( - {"is_field_present_message", - StrCat(name, "_ != ", (*variables)["default"])}); - break; - } - } - - // 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); - - // Always track the presence of a field explicitly in the builder, regardless - // of syntax. - (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_builder"] = - GenerateSetBit(builderBitIndex) + ";"; - (*variables)["clear_has_field_bit_builder"] = - GenerateClearBit(builderBitIndex) + ";"; -} - -} // namespace - -// =================================================================== - -ImmutablePrimitiveFieldGenerator::ImmutablePrimitiveFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : descriptor_(descriptor), - message_bit_index_(messageBitIndex), - builder_bit_index_(builderBitIndex), - name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, builderBitIndex, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_, context); -} - -ImmutablePrimitiveFieldGenerator::~ImmutablePrimitiveFieldGenerator() {} - -int ImmutablePrimitiveFieldGenerator::GetMessageBitIndex() const { - return message_bit_index_; -} - -int ImmutablePrimitiveFieldGenerator::GetBuilderBitIndex() const { - return builder_bit_index_; -} - -int ImmutablePrimitiveFieldGenerator::GetNumBitsForMessage() const { - return HasHasbit(descriptor_) ? 1 : 0; -} - -int ImmutablePrimitiveFieldGenerator::GetNumBitsForBuilder() const { return 1; } - -void ImmutablePrimitiveFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$boolean has$capitalized_name$();\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, "$deprecation$$type$ get$capitalized_name$();\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "private $field_type$ $name$_ = $default$;\n"); - PrintExtraFieldInfo(variables_, printer); - 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"); - printer->Annotate("{", "}", descriptor_); - } - - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - printer->Print(variables_, "private $field_type$ $name$_ $default_init$;\n"); - - 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"); - printer->Annotate("{", "}", descriptor_); - } - - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " $null_check$\n" - " $name$_ = value;\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " $clear_has_field_bit_builder$\n"); - printer->Annotate("{", "}", descriptor_); - JavaType type = GetJavaType(descriptor_); - if (type == JAVATYPE_STRING || type == JAVATYPE_BYTES) { - // The default value is not a simple literal so we want to avoid executing - // it multiple times. Instead, get the default out of the default instance. - printer->Print( - variables_, - " $name$_ = getDefaultInstance().get$capitalized_name$();\n"); - } else { - printer->Print(variables_, " $name$_ = $default$;\n"); - } - printer->Print(variables_, - " $on_changed$\n" - " return this;\n" - "}\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 -} - -void ImmutablePrimitiveFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - if (!IsDefaultValueJavaDefault(descriptor_)) { - printer->Print(variables_, "$name$_ = $default$;\n"); - } -} - -void ImmutablePrimitiveFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - // No need to clear the has-bit since we clear the bitField ints all at once. - printer->Print(variables_, "$name$_ = $default$;\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - printer->Print(variables_, - "if (other.has$capitalized_name$()) {\n" - " set$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); - } else { - printer->Print(variables_, - "if (other.get$capitalized_name$() != $default$) {\n" - " set$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); - } -} - -void ImmutablePrimitiveFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($get_has_field_bit_from_local$) {\n" - " result.$name$_ = $name$_;\n"); - if (GetNumBitsForMessage() > 0) { - printer->Print(variables_, " $set_has_field_bit_to_local$\n"); - } - printer->Print("}\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - printer->Print(variables_, - "$name$_ = input.read$capitalized_type$();\n" - "$set_has_field_bit_builder$\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($is_field_present_message$) {\n" - " output.write$capitalized_type$($number$, $name$_);\n" - "}\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($is_field_present_message$) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .compute$capitalized_type$Size($number$, $name$_);\n" - "}\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - switch (GetJavaType(descriptor_)) { - case JAVATYPE_INT: - case JAVATYPE_LONG: - case JAVATYPE_BOOLEAN: - printer->Print(variables_, - "if (get$capitalized_name$()\n" - " != other.get$capitalized_name$()) return false;\n"); - break; - - case JAVATYPE_FLOAT: - printer->Print( - variables_, - "if (java.lang.Float.floatToIntBits(get$capitalized_name$())\n" - " != java.lang.Float.floatToIntBits(\n" - " other.get$capitalized_name$())) return false;\n"); - break; - - case JAVATYPE_DOUBLE: - printer->Print( - variables_, - "if (java.lang.Double.doubleToLongBits(get$capitalized_name$())\n" - " != java.lang.Double.doubleToLongBits(\n" - " other.get$capitalized_name$())) return false;\n"); - break; - - case JAVATYPE_STRING: - case JAVATYPE_BYTES: - printer->Print( - variables_, - "if (!get$capitalized_name$()\n" - " .equals(other.get$capitalized_name$())) return false;\n"); - break; - - case JAVATYPE_ENUM: - case JAVATYPE_MESSAGE: - default: - GOOGLE_LOG(FATAL) << "Can't get here."; - break; - } -} - -void ImmutablePrimitiveFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print(variables_, "hash = (37 * hash) + $constant_name$;\n"); - switch (GetJavaType(descriptor_)) { - case JAVATYPE_INT: - printer->Print(variables_, - "hash = (53 * hash) + get$capitalized_name$();\n"); - break; - - case JAVATYPE_LONG: - printer->Print( - variables_, - "hash = (53 * hash) + com.google.protobuf.Internal.hashLong(\n" - " get$capitalized_name$());\n"); - break; - - case JAVATYPE_BOOLEAN: - printer->Print( - variables_, - "hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(\n" - " get$capitalized_name$());\n"); - break; - - case JAVATYPE_FLOAT: - printer->Print(variables_, - "hash = (53 * hash) + java.lang.Float.floatToIntBits(\n" - " get$capitalized_name$());\n"); - break; - - case JAVATYPE_DOUBLE: - printer->Print( - variables_, - "hash = (53 * hash) + com.google.protobuf.Internal.hashLong(\n" - " java.lang.Double.doubleToLongBits(get$capitalized_name$()));\n"); - break; - - case JAVATYPE_STRING: - case JAVATYPE_BYTES: - printer->Print( - variables_, - "hash = (53 * hash) + get$capitalized_name$().hashCode();\n"); - break; - - case JAVATYPE_ENUM: - case JAVATYPE_MESSAGE: - default: - GOOGLE_LOG(FATAL) << "Can't get here."; - break; - } -} - -std::string ImmutablePrimitiveFieldGenerator::GetBoxedType() const { - return BoxedPrimitiveTypeName(GetJavaType(descriptor_)); -} - -// =================================================================== - -ImmutablePrimitiveOneofFieldGenerator::ImmutablePrimitiveOneofFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutablePrimitiveFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutablePrimitiveOneofFieldGenerator:: - ~ImmutablePrimitiveOneofFieldGenerator() {} - -void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - 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" - " }\n" - " return $default$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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_, - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " return ($boxed_type$) $oneof_name$_;\n" - " }\n" - " return $default$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " $null_check$\n" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " $on_changed$\n" - " }\n" - " return this;\n" - "}\n"); - 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 { - // no-op -} - -void ImmutablePrimitiveOneofFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - printer->Print(variables_, - "set$capitalized_name$(other.get$capitalized_name$());\n"); -} - -void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - printer->Print(variables_, - "$oneof_name$_ = input.read$capitalized_type$();\n" - "$set_oneof_case_message$;\n"); -} - -void ImmutablePrimitiveOneofFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($has_oneof_case_message$) {\n" - " output.write$capitalized_type$(\n"); - // $type$ and $boxed_type$ is the same for bytes fields so we don't need to - // do redundant casts. - if (GetJavaType(descriptor_) == JAVATYPE_BYTES) { - printer->Print(variables_, " $number$, ($type$) $oneof_name$_);\n"); - } else { - printer->Print( - variables_, - " $number$, ($type$)(($boxed_type$) $oneof_name$_));\n"); - } - printer->Print("}\n"); -} - -void ImmutablePrimitiveOneofFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($has_oneof_case_message$) {\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .compute$capitalized_type$Size(\n"); - // $type$ and $boxed_type$ is the same for bytes fields so we don't need to - // do redundant casts. - if (GetJavaType(descriptor_) == JAVATYPE_BYTES) { - printer->Print(variables_, " $number$, ($type$) $oneof_name$_);\n"); - } else { - printer->Print( - variables_, - " $number$, ($type$)(($boxed_type$) $oneof_name$_));\n"); - } - printer->Print("}\n"); -} - -// =================================================================== - -RepeatedImmutablePrimitiveFieldGenerator:: - RepeatedImmutablePrimitiveFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, - Context* context) - : ImmutablePrimitiveFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) {} - -RepeatedImmutablePrimitiveFieldGenerator:: - ~RepeatedImmutablePrimitiveFieldGenerator() {} - -int RepeatedImmutablePrimitiveFieldGenerator::GetNumBitsForMessage() const { - return 0; -} - -int RepeatedImmutablePrimitiveFieldGenerator::GetNumBitsForBuilder() const { - return 1; -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$java.util.List<$boxed_type$> " - "get$capitalized_name$List();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$$type$ get$capitalized_name$(int index);\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "@SuppressWarnings(\"serial\")\n" - "private $field_list_type$ $name$_;\n"); - 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 - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return $repeated_get$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (descriptor_->is_packed()) { - printer->Print(variables_, - "private int $name$MemoizedSerializedSize = -1;\n"); - } -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // One field is the list and the bit field keeps track of whether the - // 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 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 - // list can never be modified. - printer->Print(variables_, - "private $field_list_type$ $name$_ = $empty_list$;\n"); - - printer->Print(variables_, - "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$get_mutable_bit_builder$) {\n" - " $name$_ = $mutable_copy_list$;\n" - " $set_mutable_bit_builder$;\n" - " }\n" - "}\n"); - - // Note: We return an unmodifiable list because otherwise the caller - // could hold on to the returned list and modify it after the message - // has been built, thus mutating the message which is supposed to be - // immutable. - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print( - variables_, - "$deprecation$public java.util.List<$boxed_type$>\n" - " ${$get$capitalized_name$List$}$() {\n" - " return $get_mutable_bit_builder$ ?\n" - " java.util.Collections.unmodifiableList($name$_) : $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return $repeated_get$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$ value) {\n" - " $null_check$\n" - " ensure$capitalized_name$IsMutable();\n" - " $repeated_set$(index, value);\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$$}$($type$ value) {\n" - " $null_check$\n" - " ensure$capitalized_name$IsMutable();\n" - " $repeated_add$(value);\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " com.google.protobuf.AbstractMessageLite.Builder.addAll(\n" - " values, $name$_);\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " $name$_ = $empty_list$;\n" - " $clear_mutable_bit_builder$;\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - 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 -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $empty_list$;\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $empty_list$;\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - // The code below does two optimizations: - // 1. If the other list is empty, there's nothing to do. This ensures we - // don't allocate a new array if we already have an immutable one. - // 2. If the other list is non-empty and our current list is empty, we can - // reuse the other list which is guaranteed to be immutable. - printer->Print(variables_, - "if (!other.$name$_.isEmpty()) {\n" - " if ($name$_.isEmpty()) {\n" - " $name$_ = other.$name$_;\n" - " $clear_mutable_bit_builder$;\n" - " } else {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.addAll(other.$name$_);\n" - " }\n" - " $on_changed$\n" - "}\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - // The code below ensures that the result has an immutable list. If our - // list is immutable, we can just reuse it. If not, we make it immutable. - printer->Print(variables_, - "if ($get_mutable_bit_builder$) {\n" - " $name_make_immutable$;\n" - " $clear_mutable_bit_builder$;\n" - "}\n" - "result.$name$_ = $name$_;\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - printer->Print(variables_, - "$type$ v = input.read$capitalized_type$();\n" - "ensure$capitalized_name$IsMutable();\n" - "$repeated_add$(v);\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator:: - GenerateBuilderParsingCodeFromPacked(io::Printer* printer) const { - printer->Print(variables_, - "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( - io::Printer* printer) const { - if (descriptor_->is_packed()) { - // We invoke getSerializedSize in writeTo for messages that have packed - // fields in ImmutableMessageGenerator::GenerateMessageSerializationMethods. - // That makes it safe to rely on the memoized size here. - printer->Print(variables_, - "if (get$capitalized_name$List().size() > 0) {\n" - " output.writeUInt32NoTag($tag$);\n" - " output.writeUInt32NoTag($name$MemoizedSerializedSize);\n" - "}\n" - "for (int i = 0; i < $name$_.size(); i++) {\n" - " output.write$capitalized_type$NoTag($repeated_get$(i));\n" - "}\n"); - } else { - printer->Print( - variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " output.write$capitalized_type$($number$, $repeated_get$(i));\n" - "}\n"); - } -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "{\n" - " int dataSize = 0;\n"); - printer->Indent(); - - if (FixedSize(GetType(descriptor_)) == -1) { - printer->Print( - variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " dataSize += com.google.protobuf.CodedOutputStream\n" - " .compute$capitalized_type$SizeNoTag($repeated_get$(i));\n" - "}\n"); - } else { - printer->Print( - variables_, - "dataSize = $fixed_size$ * get$capitalized_name$List().size();\n"); - } - - printer->Print("size += dataSize;\n"); - - if (descriptor_->is_packed()) { - printer->Print(variables_, - "if (!get$capitalized_name$List().isEmpty()) {\n" - " size += $tag_size$;\n" - " size += com.google.protobuf.CodedOutputStream\n" - " .computeInt32SizeNoTag(dataSize);\n" - "}\n"); - } else { - printer->Print( - variables_, - "size += $tag_size$ * get$capitalized_name$List().size();\n"); - } - - // cache the data size for packed fields. - if (descriptor_->is_packed()) { - printer->Print(variables_, "$name$MemoizedSerializedSize = dataSize;\n"); - } - - printer->Outdent(); - printer->Print("}\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if (!get$capitalized_name$List()\n" - " .equals(other.get$capitalized_name$List())) return false;\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if (get$capitalized_name$Count() > 0) {\n" - " hash = (37 * hash) + $constant_name$;\n" - " hash = (53 * hash) + get$capitalized_name$List().hashCode();\n" - "}\n"); -} - -std::string RepeatedImmutablePrimitiveFieldGenerator::GetBoxedType() const { - return BoxedPrimitiveTypeName(GetJavaType(descriptor_)); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field.h b/depends/protobuf/src/google/protobuf/compiler/java/primitive_field.h deleted file mode 100644 index 9d956559d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field.h +++ /dev/null @@ -1,166 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__ - -#include -#include - -#include "google/protobuf/compiler/java/field.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutablePrimitiveFieldGenerator : public ImmutableFieldGenerator { - public: - explicit ImmutablePrimitiveFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, - Context* context); - ImmutablePrimitiveFieldGenerator(const ImmutablePrimitiveFieldGenerator&) = - delete; - ImmutablePrimitiveFieldGenerator& operator=( - const ImmutablePrimitiveFieldGenerator&) = delete; - ~ImmutablePrimitiveFieldGenerator() override; - - // implements ImmutableFieldGenerator - // --------------------------------------- - int GetMessageBitIndex() const override; - int GetBuilderBitIndex() const override; - 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_; - int message_bit_index_; - int builder_bit_index_; - std::map variables_; - ClassNameResolver* name_resolver_; -}; - -class ImmutablePrimitiveOneofFieldGenerator - : public ImmutablePrimitiveFieldGenerator { - public: - ImmutablePrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, Context* context); - ImmutablePrimitiveOneofFieldGenerator( - const ImmutablePrimitiveOneofFieldGenerator&) = delete; - ImmutablePrimitiveOneofFieldGenerator& operator=( - const ImmutablePrimitiveOneofFieldGenerator&) = delete; - ~ImmutablePrimitiveOneofFieldGenerator() override; - - 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; -}; - -class RepeatedImmutablePrimitiveFieldGenerator - : public ImmutablePrimitiveFieldGenerator { - public: - explicit RepeatedImmutablePrimitiveFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, Context* context); - RepeatedImmutablePrimitiveFieldGenerator( - const RepeatedImmutablePrimitiveFieldGenerator&) = delete; - RepeatedImmutablePrimitiveFieldGenerator& operator=( - const RepeatedImmutablePrimitiveFieldGenerator&) = delete; - ~RepeatedImmutablePrimitiveFieldGenerator() override; - - // implements ImmutableFieldGenerator --------------------------------------- - 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; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/primitive_field_lite.cc deleted file mode 100644 index 28c23d574..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field_lite.cc +++ /dev/null @@ -1,778 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -namespace { -bool EnableExperimentalRuntimeForLite() { -#ifdef PROTOBUF_EXPERIMENT - return PROTOBUF_EXPERIMENT; -#else // PROTOBUF_EXPERIMENT - return false; -#endif // !PROTOBUF_EXPERIMENT -} - -void SetPrimitiveVariables(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, - ClassNameResolver* name_resolver, - std::map* variables) { - SetCommonFieldVariables(descriptor, info, variables); - 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))); - (*variables)["tag_size"] = StrCat( - WireFormat::TagSize(descriptor->number(), GetType(descriptor))); - (*variables)["required"] = descriptor->is_required() ? "true" : "false"; - - std::string capitalized_type = UnderscoresToCamelCase( - PrimitiveTypeName(javaType), true /* cap_next_letter */); - switch (javaType) { - case JAVATYPE_INT: - case JAVATYPE_LONG: - case JAVATYPE_FLOAT: - case JAVATYPE_DOUBLE: - case JAVATYPE_BOOLEAN: - (*variables)["field_list_type"] = - "com.google.protobuf.Internal." + capitalized_type + "List"; - (*variables)["empty_list"] = "empty" + capitalized_type + "List()"; - (*variables)["make_name_unmodifiable"] = - (*variables)["name"] + "_.makeImmutable()"; - (*variables)["repeated_get"] = - (*variables)["name"] + "_.get" + capitalized_type; - (*variables)["repeated_add"] = - (*variables)["name"] + "_.add" + capitalized_type; - (*variables)["repeated_set"] = - (*variables)["name"] + "_.set" + capitalized_type; - (*variables)["visit_type"] = capitalized_type; - (*variables)["visit_type_list"] = "visit" + capitalized_type + "List"; - break; - default: - (*variables)["field_list_type"] = - "com.google.protobuf.Internal.ProtobufList<" + - (*variables)["boxed_type"] + ">"; - (*variables)["empty_list"] = "emptyProtobufList()"; - (*variables)["make_name_unmodifiable"] = - (*variables)["name"] + "_.makeImmutable()"; - (*variables)["repeated_get"] = (*variables)["name"] + "_.get"; - (*variables)["repeated_add"] = (*variables)["name"] + "_.add"; - (*variables)["repeated_set"] = (*variables)["name"] + "_.set"; - (*variables)["visit_type"] = "ByteString"; - (*variables)["visit_type_list"] = "visitList"; - } - - if (javaType == JAVATYPE_BYTES) { - (*variables)["bytes_default"] = - ToUpper((*variables)["name"]) + "_DEFAULT_VALUE"; - } - - 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"] = - " java.lang.Class valueClass = value.getClass();\n"; - } else { - (*variables)["null_check"] = ""; - } - // 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\") " - : ""; - int fixed_size = FixedSize(GetType(descriptor)); - if (fixed_size != -1) { - (*variables)["fixed_size"] = StrCat(fixed_size); - } - - if (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_message"] = - GenerateSetBit(messageBitIndex) + ";"; - (*variables)["clear_has_field_bit_message"] = - GenerateClearBit(messageBitIndex) + ";"; - - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_message"] = ""; - (*variables)["clear_has_field_bit_message"] = ""; - - 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; - } - } - - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); -} - -} // namespace - -// =================================================================== - -ImmutablePrimitiveFieldLiteGenerator::ImmutablePrimitiveFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : descriptor_(descriptor), - messageBitIndex_(messageBitIndex), - name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_); -} - -ImmutablePrimitiveFieldLiteGenerator::~ImmutablePrimitiveFieldLiteGenerator() {} - -int ImmutablePrimitiveFieldLiteGenerator::GetNumBitsForMessage() const { - return HasHasbit(descriptor_) ? 1 : 0; -} - -void ImmutablePrimitiveFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$boolean has$capitalized_name$();\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, "$deprecation$$type$ get$capitalized_name$();\n"); -} - -void ImmutablePrimitiveFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - if (IsByteStringWithCustomDefaultValue(descriptor_)) { - // allocate this once statically since we know ByteStrings are immutable - // values that can be reused. - printer->Print( - variables_, - "private static final $field_type$ $bytes_default$ = $default$;\n"); - } - printer->Print(variables_, "private $field_type$ $name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - 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"); - printer->Annotate("{", "}", descriptor_); - } - - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$($type$ value) {\n" - "$null_check$" - " $set_has_field_bit_message$\n" - " $name$_ = value;\n" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $clear_has_field_bit_message$\n"); - JavaType type = GetJavaType(descriptor_); - if (type == JAVATYPE_STRING || type == JAVATYPE_BYTES) { - // The default value is not a simple literal so we want to avoid executing - // it multiple times. Instead, get the default out of the default instance. - printer->Print( - variables_, - " $name$_ = getDefaultInstance().get$capitalized_name$();\n"); - } else { - printer->Print(variables_, " $name$_ = $default$;\n"); - } - printer->Print(variables_, "}\n"); -} - -void ImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - if (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_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - 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 { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - if (HasHasbit(descriptor_)) { - WriteIntToUtf16CharSequence(messageBitIndex_, output); - } - printer->Print(variables_, "\"$name$_\",\n"); -} - -void ImmutablePrimitiveFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const { - if (IsByteStringWithCustomDefaultValue(descriptor_)) { - printer->Print(variables_, "$name$_ = $bytes_default$;\n"); - } else if (!IsDefaultValueJavaDefault(descriptor_)) { - printer->Print(variables_, "$name$_ = $default$;\n"); - } -} - -std::string ImmutablePrimitiveFieldLiteGenerator::GetBoxedType() const { - return BoxedPrimitiveTypeName(GetJavaType(descriptor_)); -} - -// =================================================================== - -ImmutablePrimitiveOneofFieldLiteGenerator:: - ImmutablePrimitiveOneofFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context) - : ImmutablePrimitiveFieldLiteGenerator(descriptor, messageBitIndex, - context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutablePrimitiveOneofFieldLiteGenerator:: - ~ImmutablePrimitiveOneofFieldLiteGenerator() {} - -void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - 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" - " }\n" - " return $default$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$($type$ value) {\n" - "$null_check$" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " }\n" - "}\n"); -} - -void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - WriteIntToUtf16CharSequence(descriptor_->containing_oneof()->index(), output); -} - -void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$set$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -// =================================================================== - -RepeatedImmutablePrimitiveFieldLiteGenerator:: - RepeatedImmutablePrimitiveFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - Context* context) - : descriptor_(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_); -} - -RepeatedImmutablePrimitiveFieldLiteGenerator:: - ~RepeatedImmutablePrimitiveFieldLiteGenerator() {} - -int RepeatedImmutablePrimitiveFieldLiteGenerator::GetNumBitsForMessage() const { - return 0; -} - -void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$java.util.List<$boxed_type$> " - "get$capitalized_name$List();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$$type$ get$capitalized_name$(int index);\n"); -} - -void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "private $field_list_type$ $name$_;\n"); - 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 - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return $repeated_get$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - if (!EnableExperimentalRuntimeForLite() && descriptor_->is_packed() && - context_->HasGeneratedMethods(descriptor_->containing_type())) { - printer->Print(variables_, - "private int $name$MemoizedSerializedSize = -1;\n"); - } - - printer->Print( - variables_, - "private void ensure$capitalized_name$IsMutable() {\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(tmp);\n" - " }\n" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER); - printer->Print(variables_, - "private void set$capitalized_name$(\n" - " int index, $type$ value) {\n" - "$null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $repeated_set$(index, value);\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER); - printer->Print(variables_, - "private void add$capitalized_name$($type$ value) {\n" - "$null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $repeated_add$(value);\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER); - printer->Print(variables_, - "private void addAll$capitalized_name$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " com.google.protobuf.AbstractMessageLite.addAll(\n" - " values, $name$_);\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $name$_ = $empty_list$;\n" - "}\n"); -} - -void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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 java.util.Collections.unmodifiableList(\n" - " instance.get$capitalized_name$List());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return instance.get$capitalized_name$Count();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return instance.get$capitalized_name$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, $type$ value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(index, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder " - "${$add$capitalized_name$$}$($type$ value) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " copyOnWrite();\n" - " instance.addAll$capitalized_name$(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - 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 { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - printer->Print(variables_, "\"$name$_\",\n"); -} - -void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $empty_list$;\n"); -} - -std::string RepeatedImmutablePrimitiveFieldLiteGenerator::GetBoxedType() const { - return BoxedPrimitiveTypeName(GetJavaType(descriptor_)); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/primitive_field_lite.h deleted file mode 100644 index 2da0cd8f0..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/primitive_field_lite.h +++ /dev/null @@ -1,141 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__ - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutablePrimitiveFieldLiteGenerator - : public ImmutableFieldLiteGenerator { - public: - explicit ImmutablePrimitiveFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutablePrimitiveFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator - // ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - protected: - const FieldDescriptor* descriptor_; - std::map variables_; - const int messageBitIndex_; - ClassNameResolver* name_resolver_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveFieldLiteGenerator); -}; - -class ImmutablePrimitiveOneofFieldLiteGenerator - : public ImmutablePrimitiveFieldLiteGenerator { - public: - ImmutablePrimitiveOneofFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context); - ~ImmutablePrimitiveOneofFieldLiteGenerator() override; - - void GenerateMembers(io::Printer* printer) const override; - void GenerateBuilderMembers(io::Printer* printer) const override; - - void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const override; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldLiteGenerator); -}; - -class RepeatedImmutablePrimitiveFieldLiteGenerator - : public ImmutableFieldLiteGenerator { - public: - explicit RepeatedImmutablePrimitiveFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutablePrimitiveFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - private: - const FieldDescriptor* descriptor_; - std::map variables_; - Context* context_; - ClassNameResolver* name_resolver_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutablePrimitiveFieldLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/service.cc b/depends/protobuf/src/google/protobuf/compiler/java/service.cc deleted file mode 100644 index 9e2062082..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/service.cc +++ /dev/null @@ -1,479 +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 - -// Must be last. -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -ServiceGenerator::ServiceGenerator(const ServiceDescriptor* descriptor) - : descriptor_(descriptor) {} - -ServiceGenerator::~ServiceGenerator() {} - -// =================================================================== -ImmutableServiceGenerator::ImmutableServiceGenerator( - const ServiceDescriptor* descriptor, Context* context) - : ServiceGenerator(descriptor), - context_(context), - name_resolver_(context->GetNameResolver()) {} - -ImmutableServiceGenerator::~ImmutableServiceGenerator() {} - -void ImmutableServiceGenerator::Generate(io::Printer* printer) { - bool is_own_file = IsOwnFile(descriptor_, /* immutable = */ true); - WriteServiceDocComment(printer, descriptor_); - MaybePrintGeneratedAnnotation(context_, printer, descriptor_, - /* immutable = */ true); - printer->Print( - "public $static$ abstract class $classname$\n" - " implements com.google.protobuf.Service {\n", - "static", is_own_file ? "" : "static", "classname", descriptor_->name()); - printer->Indent(); - - printer->Print("protected $classname$() {}\n\n", "classname", - descriptor_->name()); - - GenerateInterface(printer); - - GenerateNewReflectiveServiceMethod(printer); - GenerateNewReflectiveBlockingServiceMethod(printer); - - GenerateAbstractMethods(printer); - - // Generate getDescriptor() and getDescriptorForType(). - printer->Print( - "public static final\n" - " com.google.protobuf.Descriptors.ServiceDescriptor\n" - " getDescriptor() {\n" - " return $file$.getDescriptor().getServices().get($index$);\n" - "}\n", - "file", name_resolver_->GetImmutableClassName(descriptor_->file()), - "index", StrCat(descriptor_->index())); - GenerateGetDescriptorForType(printer); - - // Generate more stuff. - GenerateCallMethod(printer); - GenerateGetPrototype(REQUEST, printer); - GenerateGetPrototype(RESPONSE, printer); - GenerateStub(printer); - GenerateBlockingStub(printer); - - // Add an insertion point. - printer->Print( - "\n" - "// @@protoc_insertion_point(class_scope:$full_name$)\n", - "full_name", descriptor_->full_name()); - - printer->Outdent(); - printer->Print("}\n\n"); -} - -void ImmutableServiceGenerator::GenerateGetDescriptorForType( - io::Printer* printer) { - printer->Print( - "public final com.google.protobuf.Descriptors.ServiceDescriptor\n" - " getDescriptorForType() {\n" - " return getDescriptor();\n" - "}\n"); -} - -void ImmutableServiceGenerator::GenerateInterface(io::Printer* printer) { - printer->Print("public interface Interface {\n"); - printer->Indent(); - GenerateAbstractMethods(printer); - printer->Outdent(); - printer->Print("}\n\n"); -} - -void ImmutableServiceGenerator::GenerateNewReflectiveServiceMethod( - io::Printer* printer) { - printer->Print( - "public static com.google.protobuf.Service newReflectiveService(\n" - " final Interface impl) {\n" - " return new $classname$() {\n", - "classname", descriptor_->name()); - printer->Indent(); - printer->Indent(); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - printer->Print("@java.lang.Override\n"); - GenerateMethodSignature(printer, method, IS_CONCRETE); - printer->Print( - " {\n" - " impl.$method$(controller, request, done);\n" - "}\n\n", - "method", UnderscoresToCamelCase(method)); - } - - printer->Outdent(); - printer->Print("};\n"); - printer->Outdent(); - printer->Print("}\n\n"); -} - -void ImmutableServiceGenerator::GenerateNewReflectiveBlockingServiceMethod( - io::Printer* printer) { - printer->Print( - "public static com.google.protobuf.BlockingService\n" - " newReflectiveBlockingService(final BlockingInterface impl) {\n" - " return new com.google.protobuf.BlockingService() {\n"); - printer->Indent(); - printer->Indent(); - - GenerateGetDescriptorForType(printer); - - GenerateCallBlockingMethod(printer); - GenerateGetPrototype(REQUEST, printer); - GenerateGetPrototype(RESPONSE, printer); - - printer->Outdent(); - printer->Print("};\n"); - printer->Outdent(); - printer->Print("}\n\n"); -} - -void ImmutableServiceGenerator::GenerateAbstractMethods(io::Printer* printer) { - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - WriteMethodDocComment(printer, method); - GenerateMethodSignature(printer, method, IS_ABSTRACT); - printer->Print(";\n\n"); - } -} - -std::string ImmutableServiceGenerator::GetOutput( - const MethodDescriptor* method) { - return name_resolver_->GetImmutableClassName(method->output_type()); -} - -void ImmutableServiceGenerator::GenerateCallMethod(io::Printer* printer) { - printer->Print( - "\n" - "public final void callMethod(\n" - " com.google.protobuf.Descriptors.MethodDescriptor method,\n" - " com.google.protobuf.RpcController controller,\n" - " com.google.protobuf.Message request,\n" - " com.google.protobuf.RpcCallback<\n" - " com.google.protobuf.Message> done) {\n" - " if (method.getService() != getDescriptor()) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"Service.callMethod() given method descriptor for wrong \" +\n" - " \"service type.\");\n" - " }\n" - " switch(method.getIndex()) {\n"); - printer->Indent(); - printer->Indent(); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - std::map vars; - vars["index"] = StrCat(i); - vars["method"] = UnderscoresToCamelCase(method); - vars["input"] = name_resolver_->GetImmutableClassName(method->input_type()); - vars["output"] = GetOutput(method); - printer->Print( - vars, - "case $index$:\n" - " this.$method$(controller, ($input$)request,\n" - " com.google.protobuf.RpcUtil.<$output$>specializeCallback(\n" - " done));\n" - " return;\n"); - } - - printer->Print( - "default:\n" - " throw new java.lang.AssertionError(\"Can't get here.\");\n"); - - printer->Outdent(); - printer->Outdent(); - - printer->Print( - " }\n" - "}\n" - "\n"); -} - -void ImmutableServiceGenerator::GenerateCallBlockingMethod( - io::Printer* printer) { - printer->Print( - "\n" - "public final com.google.protobuf.Message callBlockingMethod(\n" - " com.google.protobuf.Descriptors.MethodDescriptor method,\n" - " com.google.protobuf.RpcController controller,\n" - " com.google.protobuf.Message request)\n" - " throws com.google.protobuf.ServiceException {\n" - " if (method.getService() != getDescriptor()) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"Service.callBlockingMethod() given method descriptor for \" +\n" - " \"wrong service type.\");\n" - " }\n" - " switch(method.getIndex()) {\n"); - printer->Indent(); - printer->Indent(); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - std::map vars; - vars["index"] = StrCat(i); - vars["method"] = UnderscoresToCamelCase(method); - vars["input"] = name_resolver_->GetImmutableClassName(method->input_type()); - vars["output"] = GetOutput(method); - printer->Print(vars, - "case $index$:\n" - " return impl.$method$(controller, ($input$)request);\n"); - } - - printer->Print( - "default:\n" - " throw new java.lang.AssertionError(\"Can't get here.\");\n"); - - printer->Outdent(); - printer->Outdent(); - - printer->Print( - " }\n" - "}\n" - "\n"); -} - -void ImmutableServiceGenerator::GenerateGetPrototype(RequestOrResponse which, - io::Printer* printer) { - /* - * TODO(cpovirk): The exception message says "Service.foo" when it may be - * "BlockingService.foo." Consider fixing. - */ - printer->Print( - "public final com.google.protobuf.Message\n" - " get$request_or_response$Prototype(\n" - " com.google.protobuf.Descriptors.MethodDescriptor method) {\n" - " if (method.getService() != getDescriptor()) {\n" - " throw new java.lang.IllegalArgumentException(\n" - " \"Service.get$request_or_response$Prototype() given method \" +\n" - " \"descriptor for wrong service type.\");\n" - " }\n" - " switch(method.getIndex()) {\n", - "request_or_response", (which == REQUEST) ? "Request" : "Response"); - printer->Indent(); - printer->Indent(); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - std::map vars; - vars["index"] = StrCat(i); - vars["type"] = - (which == REQUEST) - ? name_resolver_->GetImmutableClassName(method->input_type()) - : GetOutput(method); - printer->Print(vars, - "case $index$:\n" - " return $type$.getDefaultInstance();\n"); - } - - printer->Print( - "default:\n" - " throw new java.lang.AssertionError(\"Can't get here.\");\n"); - - printer->Outdent(); - printer->Outdent(); - - printer->Print( - " }\n" - "}\n" - "\n"); -} - -void ImmutableServiceGenerator::GenerateStub(io::Printer* printer) { - printer->Print( - "public static Stub newStub(\n" - " com.google.protobuf.RpcChannel channel) {\n" - " return new Stub(channel);\n" - "}\n" - "\n" - "public static final class Stub extends $classname$ implements Interface " - "{" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); - printer->Indent(); - - printer->Print( - "private Stub(com.google.protobuf.RpcChannel channel) {\n" - " this.channel = channel;\n" - "}\n" - "\n" - "private final com.google.protobuf.RpcChannel channel;\n" - "\n" - "public com.google.protobuf.RpcChannel getChannel() {\n" - " return channel;\n" - "}\n"); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - printer->Print("\n"); - GenerateMethodSignature(printer, method, IS_CONCRETE); - printer->Print(" {\n"); - printer->Indent(); - - std::map vars; - vars["index"] = StrCat(i); - vars["output"] = GetOutput(method); - printer->Print(vars, - "channel.callMethod(\n" - " getDescriptor().getMethods().get($index$),\n" - " controller,\n" - " request,\n" - " $output$.getDefaultInstance(),\n" - " com.google.protobuf.RpcUtil.generalizeCallback(\n" - " done,\n" - " $output$.class,\n" - " $output$.getDefaultInstance()));\n"); - - printer->Outdent(); - printer->Print("}\n"); - } - - printer->Outdent(); - printer->Print( - "}\n" - "\n"); -} - -void ImmutableServiceGenerator::GenerateBlockingStub(io::Printer* printer) { - printer->Print( - "public static BlockingInterface newBlockingStub(\n" - " com.google.protobuf.BlockingRpcChannel channel) {\n" - " return new BlockingStub(channel);\n" - "}\n" - "\n"); - - printer->Print("public interface BlockingInterface {"); - printer->Indent(); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - GenerateBlockingMethodSignature(printer, method); - printer->Print(";\n"); - } - - printer->Outdent(); - printer->Print( - "}\n" - "\n"); - - printer->Print( - "private static final class BlockingStub implements BlockingInterface " - "{\n"); - printer->Indent(); - - printer->Print( - "private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) {\n" - " this.channel = channel;\n" - "}\n" - "\n" - "private final com.google.protobuf.BlockingRpcChannel channel;\n"); - - for (int i = 0; i < descriptor_->method_count(); i++) { - const MethodDescriptor* method = descriptor_->method(i); - GenerateBlockingMethodSignature(printer, method); - printer->Print(" {\n"); - printer->Indent(); - - std::map vars; - vars["index"] = StrCat(i); - vars["output"] = GetOutput(method); - printer->Print(vars, - "return ($output$) channel.callBlockingMethod(\n" - " getDescriptor().getMethods().get($index$),\n" - " controller,\n" - " request,\n" - " $output$.getDefaultInstance());\n"); - - printer->Outdent(); - printer->Print( - "}\n" - "\n"); - } - - printer->Outdent(); - printer->Print("}\n"); -} - -void ImmutableServiceGenerator::GenerateMethodSignature( - io::Printer* printer, const MethodDescriptor* method, - IsAbstract is_abstract) { - std::map vars; - vars["name"] = UnderscoresToCamelCase(method); - vars["input"] = name_resolver_->GetImmutableClassName(method->input_type()); - vars["output"] = GetOutput(method); - vars["abstract"] = (is_abstract == IS_ABSTRACT) ? "abstract" : ""; - printer->Print(vars, - "public $abstract$ void $name$(\n" - " com.google.protobuf.RpcController controller,\n" - " $input$ request,\n" - " com.google.protobuf.RpcCallback<$output$> done)"); -} - -void ImmutableServiceGenerator::GenerateBlockingMethodSignature( - io::Printer* printer, const MethodDescriptor* method) { - std::map vars; - vars["method"] = UnderscoresToCamelCase(method); - vars["input"] = name_resolver_->GetImmutableClassName(method->input_type()); - vars["output"] = GetOutput(method); - printer->Print(vars, - "\n" - "public $output$ $method$(\n" - " com.google.protobuf.RpcController controller,\n" - " $input$ request)\n" - " throws com.google.protobuf.ServiceException"); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include diff --git a/depends/protobuf/src/google/protobuf/compiler/java/service.h b/depends/protobuf/src/google/protobuf/compiler/java/service.h deleted file mode 100644 index 9cb902162..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/service.h +++ /dev/null @@ -1,139 +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. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_SERVICE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_SERVICE_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ServiceGenerator { - public: - explicit ServiceGenerator(const ServiceDescriptor* descriptor); - virtual ~ServiceGenerator(); - - virtual void Generate(io::Printer* printer) = 0; - - enum RequestOrResponse { REQUEST, RESPONSE }; - enum IsAbstract { IS_ABSTRACT, IS_CONCRETE }; - - protected: - const ServiceDescriptor* descriptor_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator); -}; - -class ImmutableServiceGenerator : public ServiceGenerator { - public: - ImmutableServiceGenerator(const ServiceDescriptor* descriptor, - Context* context); - ~ImmutableServiceGenerator() override; - - void Generate(io::Printer* printer) override; - - private: - // Generate the getDescriptorForType() method. - void GenerateGetDescriptorForType(io::Printer* printer); - - // Generate a Java interface for the service. - void GenerateInterface(io::Printer* printer); - - // Generate newReflectiveService() method. - void GenerateNewReflectiveServiceMethod(io::Printer* printer); - - // Generate newReflectiveBlockingService() method. - void GenerateNewReflectiveBlockingServiceMethod(io::Printer* printer); - - // Generate abstract method declarations for all methods. - void GenerateAbstractMethods(io::Printer* printer); - - // Generate the implementation of Service.callMethod(). - void GenerateCallMethod(io::Printer* printer); - - // Generate the implementation of BlockingService.callBlockingMethod(). - void GenerateCallBlockingMethod(io::Printer* printer); - - // Generate the implementations of Service.get{Request,Response}Prototype(). - void GenerateGetPrototype(RequestOrResponse which, io::Printer* printer); - - // Generate a stub implementation of the service. - void GenerateStub(io::Printer* printer); - - // Generate a method signature, possibly abstract, without body or trailing - // semicolon. - void GenerateMethodSignature(io::Printer* printer, - const MethodDescriptor* method, - IsAbstract is_abstract); - - // Generate a blocking stub interface and implementation of the service. - void GenerateBlockingStub(io::Printer* printer); - - // Generate the method signature for one method of a blocking stub. - void GenerateBlockingMethodSignature(io::Printer* printer, - const MethodDescriptor* method); - - // Return the output type of the method. - std::string GetOutput(const MethodDescriptor* method); - - Context* context_; - ClassNameResolver* name_resolver_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableServiceGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // NET_PROTO2_COMPILER_JAVA_SERVICE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc b/depends/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc deleted file mode 100644 index 39b96eec6..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc +++ /dev/null @@ -1,198 +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: xiaofeng@google.com (Feng Xiao) - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -SharedCodeGenerator::SharedCodeGenerator(const FileDescriptor* file, - const Options& options) - : name_resolver_(new ClassNameResolver), file_(file), options_(options) {} - -SharedCodeGenerator::~SharedCodeGenerator() {} - -void SharedCodeGenerator::Generate( - GeneratorContext* context, std::vector* file_list, - std::vector* annotation_file_list) { - std::string java_package = FileJavaPackage(file_); - std::string package_dir = JavaPackageToDir(java_package); - - if (HasDescriptorMethods(file_, options_.enforce_lite)) { - // Generate descriptors. - std::string classname = name_resolver_->GetDescriptorClassName(file_); - std::string filename = package_dir + classname + ".java"; - file_list->push_back(filename); - std::unique_ptr output(context->Open(filename)); - GeneratedCodeInfo annotations; - io::AnnotationProtoCollector annotation_collector( - &annotations); - std::unique_ptr printer( - new io::Printer(output.get(), '$', - options_.annotate_code ? &annotation_collector : NULL)); - std::string info_relative_path = classname + ".java.pb.meta"; - std::string info_full_path = filename + ".pb.meta"; - printer->Print( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "// source: $filename$\n" - "\n", - "filename", file_->name()); - if (!java_package.empty()) { - printer->Print( - "package $package$;\n" - "\n", - "package", java_package); - } - PrintGeneratedAnnotation(printer.get(), '$', - options_.annotate_code ? info_relative_path : ""); - printer->Print( - "public final class $classname$ {\n" - " public static com.google.protobuf.Descriptors.FileDescriptor\n" - " descriptor;\n" - " static {\n", - "classname", classname); - printer->Annotate("classname", file_->name()); - printer->Indent(); - printer->Indent(); - GenerateDescriptors(printer.get()); - printer->Outdent(); - printer->Outdent(); - printer->Print( - " }\n" - "}\n"); - - if (options_.annotate_code) { - std::unique_ptr info_output( - context->Open(info_full_path)); - annotations.SerializeToZeroCopyStream(info_output.get()); - annotation_file_list->push_back(info_full_path); - } - - printer.reset(); - output.reset(); - } -} - -void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) { - // Embed the descriptor. We simply serialize the entire FileDescriptorProto - // and embed it as a string literal, which is parsed and built into real - // descriptors at initialization time. We unfortunately have to put it in - // a string literal, not a byte array, because apparently using a literal - // byte array causes the Java compiler to generate *instructions* to - // initialize each and every byte of the array, e.g. as if you typed: - // b[0] = 123; b[1] = 456; b[2] = 789; - // This makes huge bytecode files and can easily hit the compiler's internal - // code size limits (error "code to large"). String literals are apparently - // embedded raw, which is what we want. - FileDescriptorProto file_proto; - file_->CopyTo(&file_proto); - - std::string file_data; - file_proto.SerializeToString(&file_data); - - printer->Print("java.lang.String[] descriptorData = {\n"); - printer->Indent(); - - // Limit the number of bytes per line. - static const int kBytesPerLine = 40; - // Limit the number of lines per string part. - static const int kLinesPerPart = 400; - // Every block of bytes, start a new string literal, in order to avoid the - // 64k length limit. Note that this value needs to be <64k. - static const int kBytesPerPart = kBytesPerLine * kLinesPerPart; - for (int i = 0; i < file_data.size(); i += kBytesPerLine) { - if (i > 0) { - if (i % kBytesPerPart == 0) { - printer->Print(",\n"); - } else { - printer->Print(" +\n"); - } - } - printer->Print("\"$data$\"", "data", - CEscape(file_data.substr(i, kBytesPerLine))); - } - - printer->Outdent(); - printer->Print("\n};\n"); - - // ----------------------------------------------------------------- - // Find out all dependencies. - std::vector > dependencies; - for (int i = 0; i < file_->dependency_count(); i++) { - std::string filename = file_->dependency(i)->name(); - std::string package = FileJavaPackage(file_->dependency(i)); - std::string classname = - name_resolver_->GetDescriptorClassName(file_->dependency(i)); - std::string full_name; - if (package.empty()) { - full_name = classname; - } else { - full_name = package + "." + classname; - } - dependencies.push_back(std::make_pair(filename, full_name)); - } - - // ----------------------------------------------------------------- - // Invoke internalBuildGeneratedFileFrom() to build the file. - printer->Print( - "descriptor = com.google.protobuf.Descriptors.FileDescriptor\n" - " .internalBuildGeneratedFileFrom(descriptorData,\n"); - printer->Print( - " new com.google.protobuf.Descriptors.FileDescriptor[] {\n"); - - for (int i = 0; i < dependencies.size(); i++) { - const std::string& dependency = dependencies[i].second; - printer->Print(" $dependency$.getDescriptor(),\n", "dependency", - dependency); - } - - printer->Print(" });\n"); -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/shared_code_generator.h b/depends/protobuf/src/google/protobuf/compiler/java/shared_code_generator.h deleted file mode 100644 index b1f6eb3ca..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/shared_code_generator.h +++ /dev/null @@ -1,90 +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: xiaofeng@google.com (Feng Xiao) -// -// Generators that generate shared code between immutable API and mutable API. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__ - -#include -#include -#include - -#include -#include - -namespace google { -namespace protobuf { -class FileDescriptor; // descriptor.h -namespace compiler { -class GeneratorContext; // code_generator.h -namespace java { -class ClassNameResolver; // name_resolver.h -} -} // namespace compiler -namespace io { -class Printer; // printer.h -} -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -// A generator that generates code that are shared between immutable API -// and mutable API. Currently only descriptors are shared. -class SharedCodeGenerator { - public: - SharedCodeGenerator(const FileDescriptor* file, const Options& options); - ~SharedCodeGenerator(); - - void Generate(GeneratorContext* generator_context, - std::vector* file_list, - std::vector* annotation_file_list); - - void GenerateDescriptors(io::Printer* printer); - - private: - std::unique_ptr name_resolver_; - const FileDescriptor* file_; - const Options options_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SharedCodeGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/string_field.cc b/depends/protobuf/src/google/protobuf/compiler/java/string_field.cc deleted file mode 100644 index 5f2079245..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/string_field.cc +++ /dev/null @@ -1,1172 +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) -// Author: jonp@google.com (Jon Perlow) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#include "google/protobuf/compiler/java/string_field.h" - -#include -#include -#include - -#include "google/protobuf/stubs/logging.h" -#include "google/protobuf/stubs/common.h" -#include "google/protobuf/io/printer.h" -#include "google/protobuf/wire_format.h" -#include "google/protobuf/stubs/strutil.h" -#include "google/protobuf/compiler/java/context.h" -#include "google/protobuf/compiler/java/doc_comment.h" -#include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/name_resolver.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -namespace { - -void SetPrimitiveVariables( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, ClassNameResolver* name_resolver, - std::map* variables, - Context* context) { - SetCommonFieldVariables(descriptor, info, variables); - - (*variables)["empty_list"] = "com.google.protobuf.LazyStringArrayList.EMPTY"; - - (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); - (*variables)["default_init"] = - "= " + ImmutableDefaultValue(descriptor, name_resolver); - (*variables)["capitalized_type"] = "String"; - (*variables)["tag"] = - StrCat(static_cast(WireFormat::MakeTag(descriptor))); - (*variables)["tag_size"] = StrCat( - WireFormat::TagSize(descriptor->number(), GetType(descriptor))); - (*variables)["null_check"] = - "if (value == null) { throw new NullPointerException(); }"; - (*variables)["isStringEmpty"] = "com.google.protobuf.GeneratedMessage" + - GeneratedCodeVersionSuffix() + - ".isStringEmpty"; - (*variables)["writeString"] = "com.google.protobuf.GeneratedMessage" + - GeneratedCodeVersionSuffix() + ".writeString"; - (*variables)["computeStringSize"] = "com.google.protobuf.GeneratedMessage" + - GeneratedCodeVersionSuffix() + - ".computeStringSize"; - - // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported - // by the proto compiler - (*variables)["deprecation"] = - descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); - (*variables)["on_changed"] = "onChanged();"; - - 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)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_message"] = - GenerateSetBit(messageBitIndex) + ";"; - - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["get_has_field_bit_message"] = ""; - (*variables)["set_has_field_bit_to_local"] = ""; - (*variables)["set_has_field_bit_message"] = ""; - - variables->insert({"is_field_present_message", - StrCat("!", (*variables)["isStringEmpty"], "(", - (*variables)["name"], "_)")}); - } - - // 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); - - (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_builder"] = - GenerateSetBit(builderBitIndex) + ";"; - (*variables)["clear_has_field_bit_builder"] = - GenerateClearBit(builderBitIndex) + ";"; -} - -} // namespace - -// =================================================================== - -ImmutableStringFieldGenerator::ImmutableStringFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : descriptor_(descriptor), - message_bit_index_(messageBitIndex), - builder_bit_index_(builderBitIndex), - name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, builderBitIndex, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_, context); -} - -ImmutableStringFieldGenerator::~ImmutableStringFieldGenerator() {} - -int ImmutableStringFieldGenerator::GetMessageBitIndex() const { - return message_bit_index_; -} - -int ImmutableStringFieldGenerator::GetBuilderBitIndex() const { - return builder_bit_index_; -} - -int ImmutableStringFieldGenerator::GetNumBitsForMessage() const { - return HasHasbit(descriptor_) ? 1 : 0; -} - -int ImmutableStringFieldGenerator::GetNumBitsForBuilder() const { return 1; } - -// 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 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 -// easily make this mistake without affecting the C++ API. By converting to -// strings immediately, some java code might corrupt these byte arrays as -// it passes through a java server even if the field was never accessed by -// application code. -// -// 2. There's a performance hit to converting between bytes and strings and -// it many cases, the field is never even read by the application code. This -// avoids unnecessary conversions in the common use cases. -// -// So now, the field for String is maintained as an Object reference which can -// either store a String or a ByteString. The code uses an instanceof check -// to see which one it has and converts to the other one if needed. It remembers -// the last value requested (in a thread safe manner) as this is most likely -// the one needed next. The thread safety is such that if two threads both -// convert the field because the changes made by each thread were not visible to -// the other, they may cause a conversion to happen more times than would -// otherwise be necessary. This was deemed better than adding synchronization -// overhead. It will not cause any corruption issues or affect the behavior of -// the API. The instanceof check is also highly optimized in the JVM and we -// decided it was better to reduce the memory overhead by not having two -// separate fields but rather use dynamic type checking. -// -// For single fields, the logic for this is done inside the generated code. For -// repeated fields, the logic is done in LazyStringArrayList and -// UnmodifiableLazyStringList. -void ImmutableStringFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$boolean has$capitalized_name$();\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$java.lang.String get$capitalized_name$();\n"); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$com.google.protobuf.ByteString\n" - " get$capitalized_name$Bytes();\n"); -} - -void ImmutableStringFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, - "@SuppressWarnings(\"serial\")\n" - "private volatile java.lang.Object $name$_ = $default$;\n"); - PrintExtraFieldInfo(variables_, printer); - - 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"); - 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 = $name$_;\n" - " if (ref instanceof java.lang.String) {\n" - " return (java.lang.String) ref;\n" - " } else {\n" - " com.google.protobuf.ByteString bs = \n" - " (com.google.protobuf.ByteString) ref;\n" - " java.lang.String s = bs.toStringUtf8();\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " $name$_ = s;\n"); - } else { - printer->Print(variables_, - " if (bs.isValidUtf8()) {\n" - " $name$_ = s;\n" - " }\n"); - } - printer->Print(variables_, - " return s;\n" - " }\n" - "}\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" - " if (ref instanceof java.lang.String) {\n" - " com.google.protobuf.ByteString b = \n" - " com.google.protobuf.ByteString.copyFromUtf8(\n" - " (java.lang.String) ref);\n" - " $name$_ = b;\n" - " return b;\n" - " } else {\n" - " return (com.google.protobuf.ByteString) ref;\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutableStringFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - printer->Print(variables_, - "private java.lang.Object $name$_ $default_init$;\n"); - 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->Annotate("{", "}", descriptor_); - } - - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print( - variables_, - "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" - " java.lang.Object ref = $name$_;\n" - " if (!(ref instanceof java.lang.String)) {\n" - " com.google.protobuf.ByteString bs =\n" - " (com.google.protobuf.ByteString) ref;\n" - " java.lang.String s = bs.toStringUtf8();\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " $name$_ = s;\n"); - } else { - printer->Print(variables_, - " if (bs.isValidUtf8()) {\n" - " $name$_ = s;\n" - " }\n"); - } - printer->Print(variables_, - " return s;\n" - " } else {\n" - " return (java.lang.String) ref;\n" - " }\n" - "}\n"); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$() {\n" - " java.lang.Object ref = $name$_;\n" - " if (ref instanceof String) {\n" - " com.google.protobuf.ByteString b = \n" - " com.google.protobuf.ByteString.copyFromUtf8(\n" - " (java.lang.String) ref);\n" - " $name$_ = b;\n" - " return b;\n" - " } else {\n" - " return (com.google.protobuf.ByteString) ref;\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - " $null_check$\n" - " $name$_ = value;\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n"); - printer->Annotate("{", "}", descriptor_); - // The default value is not a simple literal so we want to avoid executing - // it multiple times. Instead, get the default out of the default instance. - printer->Print(variables_, - " $name$_ = getDefaultInstance().get$capitalized_name$();\n"); - printer->Print(variables_, - " $clear_has_field_bit_builder$\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n" - " $null_check$\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " checkByteStringIsUtf8(value);\n"); - } - printer->Print(variables_, - " $name$_ = value;\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - " return this;\n" - "}\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 -} - -void ImmutableStringFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $default$;\n"); -} - -void ImmutableStringFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $default$;\n"); -} - -void ImmutableStringFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - 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_, - "if (other.has$capitalized_name$()) {\n" - " $name$_ = other.$name$_;\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - "}\n"); - } else { - printer->Print(variables_, - "if (!other.get$capitalized_name$().isEmpty()) {\n" - " $name$_ = other.$name$_;\n" - " $set_has_field_bit_builder$\n" - " $on_changed$\n" - "}\n"); - } -} - -void ImmutableStringFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($get_has_field_bit_from_local$) {\n" - " result.$name$_ = $name$_;\n"); - if (GetNumBitsForMessage() > 0) { - printer->Print(variables_, " $set_has_field_bit_to_local$;\n"); - } - printer->Print("}\n"); -} - -void ImmutableStringFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, - "$name$_ = input.readStringRequireUtf8();\n" - "$set_has_field_bit_builder$\n"); - } else { - printer->Print(variables_, - "$name$_ = input.readBytes();\n" - "$set_has_field_bit_builder$\n"); - } -} - -void ImmutableStringFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($is_field_present_message$) {\n" - " $writeString$(output, $number$, $name$_);\n" - "}\n"); -} - -void ImmutableStringFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($is_field_present_message$) {\n" - " size += $computeStringSize$($number$, $name$_);\n" - "}\n"); -} - -void ImmutableStringFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print(variables_, - "if (!get$capitalized_name$()\n" - " .equals(other.get$capitalized_name$())) return false;\n"); -} - -void ImmutableStringFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print(variables_, "hash = (37 * hash) + $constant_name$;\n"); - printer->Print(variables_, - "hash = (53 * hash) + get$capitalized_name$().hashCode();\n"); -} - -std::string ImmutableStringFieldGenerator::GetBoxedType() const { - return "java.lang.String"; -} - -// =================================================================== - -ImmutableStringOneofFieldGenerator::ImmutableStringOneofFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutableStringFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutableStringOneofFieldGenerator::~ImmutableStringOneofFieldGenerator() {} - -void ImmutableStringOneofFieldGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - 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_, - "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" - " java.lang.Object ref $default_init$;\n" - " if ($has_oneof_case_message$) {\n" - " ref = $oneof_name$_;\n" - " }\n" - " if (ref instanceof java.lang.String) {\n" - " return (java.lang.String) ref;\n" - " } else {\n" - " com.google.protobuf.ByteString bs = \n" - " (com.google.protobuf.ByteString) ref;\n" - " java.lang.String s = bs.toStringUtf8();\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, - " if ($has_oneof_case_message$) {\n" - " $oneof_name$_ = s;\n" - " }\n"); - } else { - printer->Print(variables_, - " if (bs.isValidUtf8() && ($has_oneof_case_message$)) {\n" - " $oneof_name$_ = s;\n" - " }\n"); - } - printer->Print(variables_, - " return s;\n" - " }\n" - "}\n"); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - - printer->Print(variables_, - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$() {\n" - " java.lang.Object ref $default_init$;\n" - " if ($has_oneof_case_message$) {\n" - " ref = $oneof_name$_;\n" - " }\n" - " if (ref instanceof java.lang.String) {\n" - " com.google.protobuf.ByteString b = \n" - " com.google.protobuf.ByteString.copyFromUtf8(\n" - " (java.lang.String) ref);\n" - " if ($has_oneof_case_message$) {\n" - " $oneof_name$_ = b;\n" - " }\n" - " return b;\n" - " } else {\n" - " return (com.google.protobuf.ByteString) ref;\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void ImmutableStringOneofFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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" - " ref = $oneof_name$_;\n" - " }\n" - " if (!(ref instanceof java.lang.String)) {\n" - " com.google.protobuf.ByteString bs =\n" - " (com.google.protobuf.ByteString) ref;\n" - " java.lang.String s = bs.toStringUtf8();\n" - " if ($has_oneof_case_message$) {\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " $oneof_name$_ = s;\n"); - } else { - printer->Print(variables_, - " if (bs.isValidUtf8()) {\n" - " $oneof_name$_ = s;\n" - " }\n"); - } - printer->Print(variables_, - " }\n" - " return s;\n" - " } else {\n" - " return (java.lang.String) ref;\n" - " }\n" - "}\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 $default_init$;\n" - " if ($has_oneof_case_message$) {\n" - " ref = $oneof_name$_;\n" - " }\n" - " if (ref instanceof String) {\n" - " com.google.protobuf.ByteString b = \n" - " com.google.protobuf.ByteString.copyFromUtf8(\n" - " (java.lang.String) ref);\n" - " if ($has_oneof_case_message$) {\n" - " $oneof_name$_ = b;\n" - " }\n" - " return b;\n" - " } else {\n" - " return (com.google.protobuf.ByteString) ref;\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - " $null_check$\n" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " $on_changed$\n" - " }\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n" - " $null_check$\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " checkByteStringIsUtf8(value);\n"); - } - printer->Print(variables_, - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - " $on_changed$\n" - " return this;\n" - "}\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 - // all string fields to Strings when copying fields from a Message. - printer->Print(variables_, - "$set_oneof_case_message$;\n" - "$oneof_name$_ = other.$oneof_name$_;\n" - "$on_changed$\n"); -} - -void ImmutableStringOneofFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - // No-Op: oneof fields are built by a single statement -} - -void ImmutableStringOneofFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, - "java.lang.String s = input.readStringRequireUtf8();\n" - "$set_oneof_case_message$;\n" - "$oneof_name$_ = s;\n"); - } else { - printer->Print(variables_, - "com.google.protobuf.ByteString bs = input.readBytes();\n" - "$set_oneof_case_message$;\n" - "$oneof_name$_ = bs;\n"); - } -} - -void ImmutableStringOneofFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($has_oneof_case_message$) {\n" - " $writeString$(output, $number$, $oneof_name$_);\n" - "}\n"); -} - -void ImmutableStringOneofFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($has_oneof_case_message$) {\n" - " size += $computeStringSize$($number$, $oneof_name$_);\n" - "}\n"); -} - -// =================================================================== - -RepeatedImmutableStringFieldGenerator::RepeatedImmutableStringFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutableStringFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) {} - -RepeatedImmutableStringFieldGenerator:: - ~RepeatedImmutableStringFieldGenerator() {} - -int RepeatedImmutableStringFieldGenerator::GetNumBitsForMessage() const { - return 0; -} - -int RepeatedImmutableStringFieldGenerator::GetNumBitsForBuilder() const { - return 1; -} - -void RepeatedImmutableStringFieldGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print( - variables_, - // NOTE: the same method in the implementation class actually returns - // com.google.protobuf.ProtocolStringList (a subclass of List). It's - // changed between protobuf 2.5.0 release and protobuf 2.6.1 release. - // To retain binary compatibility with both 2.5.0 and 2.6.1 generated - // code, we make this interface method return List so both methods - // with different return types exist in the compiled byte code. - "$deprecation$java.util.List\n" - " get$capitalized_name$List();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "$deprecation$java.lang.String get$capitalized_name$(int index);\n"); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$com.google.protobuf.ByteString\n" - " get$capitalized_name$Bytes(int index);\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, - "@SuppressWarnings(\"serial\")\n" - "private com.google.protobuf.LazyStringList $name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$public com.google.protobuf.ProtocolStringList\n" - " ${$get$capitalized_name$List$}$() {\n" - " return $name$_;\n" // note: unmodifiable list - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$public java.lang.String " - "${$get$capitalized_name$$}$(int index) {\n" - " return $name$_.get(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$(int index) {\n" - " return $name$_.getByteString(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -void RepeatedImmutableStringFieldGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - // One field is the list and the bit field keeps track of whether the - // 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 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 - // list can never be modified. - printer->Print( - variables_, - "private com.google.protobuf.LazyStringList $name$_ = $empty_list$;\n"); - - printer->Print( - variables_, - "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$get_mutable_bit_builder$) {\n" - " $name$_ = new com.google.protobuf.LazyStringArrayList($name$_);\n" - " $set_mutable_bit_builder$;\n" - " }\n" - "}\n"); - - // Note: We return an unmodifiable list because otherwise the caller - // could hold on to the returned list and modify it after the message - // has been built, thus mutating the message which is supposed to be - // immutable. - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$public com.google.protobuf.ProtocolStringList\n" - " ${$get$capitalized_name$List$}$() {\n" - " return $name$_.getUnmodifiableView();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return $name$_.size();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$public java.lang.String " - "${$get$capitalized_name$$}$(int index) {\n" - " return $name$_.get(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$(int index) {\n" - " return $name$_.getByteString(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, java.lang.String value) {\n" - " $null_check$\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.set(index, value);\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - " $null_check$\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value);\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " com.google.protobuf.AbstractMessageLite.Builder.addAll(\n" - " values, $name$_);\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " $name$_ = $empty_list$;\n" - " $clear_mutable_bit_builder$;\n" - " $on_changed$\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$add$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n" - " $null_check$\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " checkByteStringIsUtf8(value);\n"); - } - printer->Print(variables_, - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value);\n" - " $on_changed$\n" - " return this;\n" - "}\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 -} - -void RepeatedImmutableStringFieldGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $empty_list$;\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateBuilderClearCode( - io::Printer* printer) const { - printer->Print(variables_, - "$name$_ = $empty_list$;\n" - "$clear_mutable_bit_builder$;\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - // The code below does two optimizations: - // 1. If the other list is empty, there's nothing to do. This ensures we - // don't allocate a new array if we already have an immutable one. - // 2. If the other list is non-empty and our current list is empty, we can - // reuse the other list which is guaranteed to be immutable. - printer->Print(variables_, - "if (!other.$name$_.isEmpty()) {\n" - " if ($name$_.isEmpty()) {\n" - " $name$_ = other.$name$_;\n" - " $clear_mutable_bit_builder$;\n" - " } else {\n" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.addAll(other.$name$_);\n" - " }\n" - " $on_changed$\n" - "}\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateBuildingCode( - io::Printer* printer) const { - // The code below ensures that the result has an immutable list. If our - // list is immutable, we can just reuse it. If not, we make it immutable. - - printer->Print(variables_, - "if ($get_mutable_bit_builder$) {\n" - " $name$_ = $name$_.getUnmodifiableView();\n" - " $clear_mutable_bit_builder$;\n" - "}\n" - "result.$name$_ = $name$_;\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateBuilderParsingCode( - io::Printer* printer) const { - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, - "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" - "ensure$capitalized_name$IsMutable();\n" - "$name$_.add(bs);\n"); - } -} - -void RepeatedImmutableStringFieldGenerator::GenerateSerializationCode( - io::Printer* printer) const { - printer->Print(variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " $writeString$(output, $number$, $name$_.getRaw(i));\n" - "}\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateSerializedSizeCode( - io::Printer* printer) const { - printer->Print(variables_, - "{\n" - " int dataSize = 0;\n"); - printer->Indent(); - - printer->Print(variables_, - "for (int i = 0; i < $name$_.size(); i++) {\n" - " dataSize += computeStringSizeNoTag($name$_.getRaw(i));\n" - "}\n"); - - printer->Print("size += dataSize;\n"); - - printer->Print(variables_, - "size += $tag_size$ * get$capitalized_name$List().size();\n"); - - printer->Outdent(); - printer->Print("}\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateEqualsCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if (!get$capitalized_name$List()\n" - " .equals(other.get$capitalized_name$List())) return false;\n"); -} - -void RepeatedImmutableStringFieldGenerator::GenerateHashCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if (get$capitalized_name$Count() > 0) {\n" - " hash = (37 * hash) + $constant_name$;\n" - " hash = (53 * hash) + get$capitalized_name$List().hashCode();\n" - "}\n"); -} - -std::string RepeatedImmutableStringFieldGenerator::GetBoxedType() const { - return "String"; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/string_field.h b/depends/protobuf/src/google/protobuf/compiler/java/string_field.h deleted file mode 100644 index 814ebf21a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/string_field.h +++ /dev/null @@ -1,164 +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) -// Author: jonp@google.com (Jon Perlow) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__ - -#include -#include - -#include "google/protobuf/compiler/java/field.h" - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableStringFieldGenerator : public ImmutableFieldGenerator { - public: - explicit ImmutableStringFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, Context* context); - ImmutableStringFieldGenerator(const ImmutableStringFieldGenerator&) = delete; - ImmutableStringFieldGenerator& operator=( - const ImmutableStringFieldGenerator&) = delete; - ~ImmutableStringFieldGenerator() override; - - // implements ImmutableFieldGenerator - // --------------------------------------- - int GetMessageBitIndex() const override; - int GetBuilderBitIndex() const override; - 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_; - int message_bit_index_; - int builder_bit_index_; - std::map variables_; - ClassNameResolver* name_resolver_; -}; - -class ImmutableStringOneofFieldGenerator - : public ImmutableStringFieldGenerator { - public: - ImmutableStringOneofFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - Context* context); - ImmutableStringOneofFieldGenerator( - const ImmutableStringOneofFieldGenerator&) = delete; - ImmutableStringOneofFieldGenerator& operator=( - const ImmutableStringOneofFieldGenerator&) = delete; - ~ImmutableStringOneofFieldGenerator() override; - - private: - 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; -}; - -class RepeatedImmutableStringFieldGenerator - : public ImmutableStringFieldGenerator { - public: - explicit RepeatedImmutableStringFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, Context* context); - RepeatedImmutableStringFieldGenerator( - const RepeatedImmutableStringFieldGenerator&) = delete; - RepeatedImmutableStringFieldGenerator& operator=( - const RepeatedImmutableStringFieldGenerator&) = delete; - ~RepeatedImmutableStringFieldGenerator() override; - - // implements ImmutableFieldGenerator --------------------------------------- - 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; -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/java/string_field_lite.cc b/depends/protobuf/src/google/protobuf/compiler/java/string_field_lite.cc deleted file mode 100644 index 49f6891d5..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/string_field_lite.cc +++ /dev/null @@ -1,864 +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) -// Author: jonp@google.com (Jon Perlow) -// 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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -using internal::WireFormat; -using internal::WireFormatLite; - -namespace { - -void SetPrimitiveVariables(const FieldDescriptor* descriptor, - int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, - ClassNameResolver* name_resolver, - std::map* variables) { - SetCommonFieldVariables(descriptor, info, variables); - - (*variables)["empty_list"] = - "com.google.protobuf.GeneratedMessageLite.emptyProtobufList()"; - - (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); - (*variables)["default_init"] = - "= " + ImmutableDefaultValue(descriptor, name_resolver); - (*variables)["capitalized_type"] = "java.lang.String"; - (*variables)["tag"] = - 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"] = - " 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 (HasHasbit(descriptor)) { - // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - - // Note that these have a trailing ";". - (*variables)["set_has_field_bit_message"] = - GenerateSetBit(messageBitIndex) + ";"; - (*variables)["clear_has_field_bit_message"] = - GenerateClearBit(messageBitIndex) + ";"; - - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); - } else { - (*variables)["set_has_field_bit_message"] = ""; - (*variables)["clear_has_field_bit_message"] = ""; - - (*variables)["is_field_present_message"] = - "!" + (*variables)["name"] + "_.isEmpty()"; - } - - (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); - (*variables)["set_has_field_bit_to_local"] = - GenerateSetBitToLocal(messageBitIndex); -} - -} // namespace - -// =================================================================== - -ImmutableStringFieldLiteGenerator::ImmutableStringFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : descriptor_(descriptor), - messageBitIndex_(messageBitIndex), - name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_); -} - -ImmutableStringFieldLiteGenerator::~ImmutableStringFieldLiteGenerator() {} - -int ImmutableStringFieldLiteGenerator::GetNumBitsForMessage() const { - 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 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 -// easily make this mistake without affecting the C++ API. By converting to -// strings immediately, some java code might corrupt these byte arrays as -// it passes through a java server even if the field was never accessed by -// application code. -// -// 2. There's a performance hit to converting between bytes and strings and -// it many cases, the field is never even read by the application code. This -// avoids unnecessary conversions in the common use cases. -// -// In the LITE_RUNTIME, we store strings as java.lang.String because we assume -// that the users of this runtime are not subject to proto1 constraints and are -// running code on devices that are user facing. That is, the developers are -// properly incentivized to only fetch the data they need to read and wish to -// reduce the number of allocations incurred when running on a user's device. - -// TODO(dweis): Consider dropping all of the *Bytes() methods. They really -// shouldn't be necessary or used on devices. -void ImmutableStringFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - if (HasHazzer(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "$deprecation$boolean has$capitalized_name$();\n"); - } - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$java.lang.String get$capitalized_name$();\n"); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "$deprecation$com.google.protobuf.ByteString\n" - " get$capitalized_name$Bytes();\n"); -} - -void ImmutableStringFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print(variables_, "private java.lang.String $name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - - 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"); - printer->Annotate("{", "}", descriptor_); - } - - WriteFieldAccessorDocComment(printer, descriptor_, GETTER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" - " return $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$() {\n" - " return com.google.protobuf.ByteString.copyFromUtf8($name$_);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$(\n" - " java.lang.String value) {\n" - "$null_check$" - " $set_has_field_bit_message$\n" - " $name$_ = value;\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $clear_has_field_bit_message$\n" - // The default value is not a simple literal so we want to - // avoid executing it multiple times. Instead, get the default - // out of the default instance. - " $name$_ = getDefaultInstance().get$capitalized_name$();\n" - "}\n"); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void set$capitalized_name$Bytes(\n" - " com.google.protobuf.ByteString value) {\n"); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " checkByteStringIsUtf8(value);\n"); - } - printer->Print(variables_, - " $name$_ = value.toStringUtf8();\n" - " $set_has_field_bit_message$\n" - "}\n"); -} - -void ImmutableStringFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - if (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_, - "@java.lang.Override\n" - "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$() {\n" - " return instance.get$capitalized_name$Bytes();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$Bytes(value);\n" - " return this;\n" - "}\n"); - 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 { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - if (HasHasbit(descriptor_)) { - WriteIntToUtf16CharSequence(messageBitIndex_, output); - } - printer->Print(variables_, "\"$name$_\",\n"); -} - -void ImmutableStringFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $default$;\n"); -} - -std::string ImmutableStringFieldLiteGenerator::GetBoxedType() const { - return "java.lang.String"; -} - -// =================================================================== - -ImmutableStringOneofFieldLiteGenerator::ImmutableStringOneofFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context) - : ImmutableStringFieldLiteGenerator(descriptor, messageBitIndex, context) { - const OneofGeneratorInfo* info = - context->GetOneofGeneratorInfo(descriptor->containing_oneof()); - SetCommonOneofVariables(descriptor, info, &variables_); -} - -ImmutableStringOneofFieldLiteGenerator:: - ~ImmutableStringOneofFieldLiteGenerator() {} - -void ImmutableStringOneofFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - PrintExtraFieldInfo(variables_, printer); - 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.String ref $default_init$;\n" - " if ($has_oneof_case_message$) {\n" - " ref = (java.lang.String) $oneof_name$_;\n" - " }\n" - " return ref;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - 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.String ref $default_init$;\n" - " if ($has_oneof_case_message$) {\n" - " ref = (java.lang.String) $oneof_name$_;\n" - " }\n" - " return com.google.protobuf.ByteString.copyFromUtf8(ref);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void ${$set$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - "$null_check$" - " $set_oneof_case_message$;\n" - " $oneof_name$_ = value;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void ${$clear$capitalized_name$$}$() {\n" - " if ($has_oneof_case_message$) {\n" - " $clear_oneof_case_message$;\n" - " $oneof_name$_ = null;\n" - " }\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER); - printer->Print(variables_, - "private void ${$set$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n"); - printer->Annotate("{", "}", descriptor_); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " checkByteStringIsUtf8(value);\n"); - } - printer->Print(variables_, - " $oneof_name$_ = value.toStringUtf8();\n" - " $set_oneof_case_message$;\n" - "}\n"); -} - -void ImmutableStringOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - WriteIntToUtf16CharSequence(descriptor_->containing_oneof()->index(), output); -} - -void ImmutableStringOneofFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - 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_, - "@java.lang.Override\n" - "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" - " return instance.get$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$() {\n" - " return instance.get$capitalized_name$Bytes();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$Bytes(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); -} - -// =================================================================== - -RepeatedImmutableStringFieldLiteGenerator:: - RepeatedImmutableStringFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context) - : descriptor_(descriptor), name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, 0, - context->GetFieldGeneratorInfo(descriptor), - name_resolver_, &variables_); -} - -RepeatedImmutableStringFieldLiteGenerator:: - ~RepeatedImmutableStringFieldLiteGenerator() {} - -int RepeatedImmutableStringFieldLiteGenerator::GetNumBitsForMessage() const { - return 0; -} - -void RepeatedImmutableStringFieldLiteGenerator::GenerateInterfaceMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "$deprecation$java.util.List\n" - " get$capitalized_name$List();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print(variables_, - "$deprecation$int get$capitalized_name$Count();\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print( - variables_, - "$deprecation$java.lang.String get$capitalized_name$(int index);\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "$deprecation$com.google.protobuf.ByteString\n" - " get$capitalized_name$Bytes(int index);\n"); -} - -void RepeatedImmutableStringFieldLiteGenerator::GenerateMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "private com.google.protobuf.Internal.ProtobufList " - "$name$_;\n"); - PrintExtraFieldInfo(variables_, printer); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.List " - "${$get$capitalized_name$List$}$() {\n" - " return $name$_;\n" // note: unmodifiable list - "}\n"); - printer->Annotate("{", "}", descriptor_); - 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"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.lang.String " - "${$get$capitalized_name$$}$(int index) {\n" - " return $name$_.get(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$(int index) {\n" - " return com.google.protobuf.ByteString.copyFromUtf8(\n" - " $name$_.get(index));\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - printer->Print( - variables_, - "private void ensure$capitalized_name$IsMutable() {\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(tmp);\n" - " }\n" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER); - printer->Print(variables_, - "private void set$capitalized_name$(\n" - " int index, java.lang.String value) {\n" - "$null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.set(index, value);\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER); - printer->Print(variables_, - "private void add$capitalized_name$(\n" - " java.lang.String value) {\n" - "$null_check$" - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value);\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER); - printer->Print(variables_, - "private void addAll$capitalized_name$(\n" - " java.lang.Iterable values) {\n" - " ensure$capitalized_name$IsMutable();\n" - " com.google.protobuf.AbstractMessageLite.addAll(\n" - " values, $name$_);\n" - "}\n"); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER); - printer->Print(variables_, - "private void clear$capitalized_name$() {\n" - " $name$_ = $empty_list$;\n" - "}\n"); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, LIST_ADDER); - printer->Print(variables_, - "private void add$capitalized_name$Bytes(\n" - " com.google.protobuf.ByteString value) {\n"); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, " checkByteStringIsUtf8(value);\n"); - } - printer->Print(variables_, - " ensure$capitalized_name$IsMutable();\n" - " $name$_.add(value.toStringUtf8());\n" - "}\n"); -} - -void RepeatedImmutableStringFieldLiteGenerator::GenerateBuilderMembers( - io::Printer* printer) const { - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.util.List\n" - " ${$get$capitalized_name$List$}$() {\n" - " return java.util.Collections.unmodifiableList(\n" - " instance.get$capitalized_name$List());\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" - " return instance.get$capitalized_name$Count();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public java.lang.String " - "${$get$capitalized_name$$}$(int index) {\n" - " return instance.get$capitalized_name$(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, - LIST_INDEXED_GETTER); - printer->Print(variables_, - "@java.lang.Override\n" - "$deprecation$public com.google.protobuf.ByteString\n" - " ${$get$capitalized_name$Bytes$}$(int index) {\n" - " return instance.get$capitalized_name$Bytes(index);\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$set$capitalized_name$$}$(\n" - " int index, java.lang.String value) {\n" - " copyOnWrite();\n" - " instance.set$capitalized_name$(index, value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$add$capitalized_name$$}$(\n" - " java.lang.String value) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$(value);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - /* builder */ true); - printer->Print(variables_, - "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n" - " java.lang.Iterable values) {\n" - " copyOnWrite();\n" - " instance.addAll$capitalized_name$(values);\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n" - " copyOnWrite();\n" - " instance.clear$capitalized_name$();\n" - " return this;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, LIST_ADDER, - /* builder */ true); - printer->Print( - variables_, - "$deprecation$public Builder ${$add$capitalized_name$Bytes$}$(\n" - " com.google.protobuf.ByteString value) {\n" - " copyOnWrite();\n" - " instance.add$capitalized_name$Bytes(value);\n" - " return this;\n" - "}\n"); - 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 { - WriteIntToUtf16CharSequence(descriptor_->number(), output); - WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), - output); - printer->Print(variables_, "\"$name$_\",\n"); -} - -void RepeatedImmutableStringFieldLiteGenerator::GenerateInitializationCode( - io::Printer* printer) const { - printer->Print(variables_, "$name$_ = $empty_list$;\n"); -} - -std::string RepeatedImmutableStringFieldLiteGenerator::GetBoxedType() const { - return "java.lang.String"; -} - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/java/string_field_lite.h b/depends/protobuf/src/google/protobuf/compiler/java/string_field_lite.h deleted file mode 100644 index b6ad1ea83..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/java/string_field_lite.h +++ /dev/null @@ -1,139 +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) -// Author: jonp@google.com (Jon Perlow) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__ -#define GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__ - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { -class Context; // context.h -class ClassNameResolver; // name_resolver.h -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { -namespace compiler { -namespace java { - -class ImmutableStringFieldLiteGenerator : public ImmutableFieldLiteGenerator { - public: - explicit ImmutableStringFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - Context* context); - ~ImmutableStringFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator - // ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - protected: - const FieldDescriptor* descriptor_; - std::map variables_; - const int messageBitIndex_; - ClassNameResolver* name_resolver_; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringFieldLiteGenerator); -}; - -class ImmutableStringOneofFieldLiteGenerator - : public ImmutableStringFieldLiteGenerator { - public: - ImmutableStringOneofFieldLiteGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, Context* context); - ~ImmutableStringOneofFieldLiteGenerator() override; - - private: - void GenerateMembers(io::Printer* printer) const override; - void GenerateBuilderMembers(io::Printer* printer) const override; - void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const override; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldLiteGenerator); -}; - -class RepeatedImmutableStringFieldLiteGenerator - : public ImmutableFieldLiteGenerator { - public: - explicit RepeatedImmutableStringFieldLiteGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutableStringFieldLiteGenerator() override; - - // implements ImmutableFieldLiteGenerator ------------------------------------ - 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 override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; - - std::string GetBoxedType() const override; - - private: - const FieldDescriptor* descriptor_; - std::map variables_; - ClassNameResolver* name_resolver_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedImmutableStringFieldLiteGenerator); -}; - -} // namespace java -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/main.cc b/depends/protobuf/src/google/protobuf/compiler/main.cc deleted file mode 100644 index 39609468a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/main.cc +++ /dev/null @@ -1,113 +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 -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace compiler { - -int ProtobufMain(int argc, char* argv[]) { - - CommandLineInterface cli; - cli.AllowPlugins("protoc-"); - - // Proto2 C++ - cpp::CppGenerator cpp_generator; - cli.RegisterGenerator("--cpp_out", "--cpp_opt", &cpp_generator, - "Generate C++ header and source."); - -#ifdef GOOGLE_PROTOBUF_RUNTIME_INCLUDE_BASE - cpp_generator.set_opensource_runtime(true); - cpp_generator.set_runtime_include_base(GOOGLE_PROTOBUF_RUNTIME_INCLUDE_BASE); -#endif - - // 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", "--python_opt", &py_generator, - "Generate Python source file."); - // Python pyi - python::PyiGenerator pyi_generator; - cli.RegisterGenerator("--pyi_out", &pyi_generator, - "Generate python pyi stub."); - - // PHP - php::Generator php_generator; - cli.RegisterGenerator("--php_out", "--php_opt", &php_generator, - "Generate PHP source file."); - - // Ruby - ruby::Generator rb_generator; - cli.RegisterGenerator("--ruby_out", "--ruby_opt", &rb_generator, - "Generate Ruby source file."); - - // CSharp - csharp::Generator csharp_generator; - cli.RegisterGenerator("--csharp_out", "--csharp_opt", &csharp_generator, - "Generate C# source file."); - - // Objective-C - objectivec::ObjectiveCGenerator objc_generator; - cli.RegisterGenerator("--objc_out", "--objc_opt", &objc_generator, - "Generate Objective-C header and source."); - - return cli.Run(argc, argv); -} - -} // namespace compiler -} // namespace protobuf -} // namespace google - -int main(int argc, char* argv[]) { - return PROTOBUF_NAMESPACE_ID::compiler::ProtobufMain(argc, argv); -} diff --git a/depends/protobuf/src/google/protobuf/compiler/mock_code_generator.cc b/depends/protobuf/src/google/protobuf/compiler/mock_code_generator.cc deleted file mode 100644 index 4d0451142..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +++ /dev/null @@ -1,384 +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) - -#include - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef major -#undef major -#endif -#ifdef minor -#undef minor -#endif - -namespace google { -namespace protobuf { -namespace compiler { - -// Returns the list of the names of files in all_files in the form of a -// comma-separated string. -std::string CommaSeparatedList( - const std::vector& all_files) { - std::vector names; - for (size_t i = 0; i < all_files.size(); i++) { - names.push_back(all_files[i]->name()); - } - return Join(names, ","); -} - -static const char* kFirstInsertionPointName = "first_mock_insertion_point"; -static const char* kSecondInsertionPointName = "second_mock_insertion_point"; -static const char* kFirstInsertionPoint = - "# @@protoc_insertion_point(first_mock_insertion_point) is here\n"; -static const char* kSecondInsertionPoint = - " # @@protoc_insertion_point(second_mock_insertion_point) is here\n"; - -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, - const std::string& first_message_name, - const std::string& first_parsed_file_name, - const std::string& output_directory) { - std::string content; - GOOGLE_CHECK_OK( - File::GetContents(output_directory + "/" + GetOutputFileName(name, file), - &content, true)); - - std::vector lines = - Split(content, "\n", true); - - while (!lines.empty() && lines.back().empty()) { - lines.pop_back(); - } - for (size_t i = 0; i < lines.size(); i++) { - lines[i] += "\n"; - } - - std::vector insertion_list; - if (!insertions.empty()) { - insertion_list = Split(insertions, ",", true); - } - - EXPECT_EQ(lines.size(), 3 + insertion_list.size() * 2); - EXPECT_EQ(GetOutputFileContent(name, parameter, file, first_parsed_file_name, - first_message_name), - lines[0]); - - EXPECT_EQ(kFirstInsertionPoint, lines[1 + insertion_list.size()]); - EXPECT_EQ(kSecondInsertionPoint, lines[2 + insertion_list.size() * 2]); - - for (size_t i = 0; i < insertion_list.size(); i++) { - EXPECT_EQ(GetOutputFileContent(insertion_list[i], "first_insert", file, - file, first_message_name), - lines[1 + i]); - // Second insertion point is indented, so the inserted text should - // automatically be indented too. - EXPECT_EQ(" " + GetOutputFileContent(insertion_list[i], "second_insert", - file, file, first_message_name), - lines[2 + insertion_list.size() + i]); - } -} - -namespace { -void CheckSingleAnnotation(const std::string& expected_file, - const std::string& expected_text, - const std::string& file_content, - const GeneratedCodeInfo::Annotation& annotation) { - EXPECT_EQ(expected_file, annotation.source_file()); - ASSERT_GE(file_content.size(), annotation.begin()); - ASSERT_GE(file_content.size(), annotation.end()); - ASSERT_LE(annotation.begin(), annotation.end()); - EXPECT_EQ(expected_text.size(), annotation.end() - annotation.begin()); - EXPECT_EQ(expected_text, - file_content.substr(annotation.begin(), expected_text.size())); -} -} // anonymous namespace - -void MockCodeGenerator::CheckGeneratedAnnotations( - const std::string& name, const std::string& file, - const std::string& output_directory) { - std::string file_content; - GOOGLE_CHECK_OK( - File::GetContents(output_directory + "/" + GetOutputFileName(name, file), - &file_content, true)); - std::string meta_content; - GOOGLE_CHECK_OK(File::GetContents( - output_directory + "/" + GetOutputFileName(name, file) + ".pb.meta", - &meta_content, true)); - GeneratedCodeInfo annotations; - GOOGLE_CHECK(TextFormat::ParseFromString(meta_content, &annotations)); - 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(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(6)); -} - -bool MockCodeGenerator::Generate(const FileDescriptor* file, - const std::string& parameter, - GeneratorContext* context, - std::string* error) const { - bool annotate = false; - for (int i = 0; i < file->message_type_count(); i++) { - if (HasPrefixString(file->message_type(i)->name(), "MockCodeGenerator_")) { - std::string command = StripPrefixString( - file->message_type(i)->name(), "MockCodeGenerator_"); - if (command == "Error") { - *error = "Saw message type MockCodeGenerator_Error."; - return false; - } else if (command == "Exit") { - std::cerr << "Saw message type MockCodeGenerator_Exit." << std::endl; - exit(123); - } else if (command == "Abort") { - std::cerr << "Saw message type MockCodeGenerator_Abort." << std::endl; - abort(); - } else if (command == "HasSourceCodeInfo") { - FileDescriptorProto file_descriptor_proto; - file->CopySourceCodeInfoTo(&file_descriptor_proto); - bool has_source_code_info = - file_descriptor_proto.has_source_code_info() && - file_descriptor_proto.source_code_info().location_size() > 0; - std::cerr << "Saw message type MockCodeGenerator_HasSourceCodeInfo: " - << has_source_code_info << "." << std::endl; - abort(); - } else if (command == "HasJsonName") { - FieldDescriptorProto field_descriptor_proto; - file->message_type(i)->field(0)->CopyTo(&field_descriptor_proto); - std::cerr << "Saw json_name: " << field_descriptor_proto.has_json_name() - << std::endl; - abort(); - } else if (command == "Annotate") { - annotate = true; - } else if (command == "ShowVersionNumber") { - Version compiler_version; - context->GetCompilerVersion(&compiler_version); - std::cerr << "Saw compiler_version: " - << compiler_version.major() * 1000000 + - compiler_version.minor() * 1000 + - compiler_version.patch() - << " " << compiler_version.suffix() << std::endl; - abort(); - } else { - GOOGLE_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command; - } - } - } - - 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++) { - { - 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(content); - if (printer.failed()) { - *error = "MockCodeGenerator detected write error."; - return false; - } - } - - { - 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->OpenForInsertWithGeneratedCodeInfo( - GetOutputFileName(insert_into[i], file), - kSecondInsertionPointName, info)); - io::Printer printer(output.get(), '$'); - printer.PrintRaw(content); - if (printer.failed()) { - *error = "MockCodeGenerator detected write error."; - return false; - } - } - } - } else { - std::unique_ptr output( - context->Open(GetOutputFileName(name_, file))); - - GeneratedCodeInfo annotations; - io::AnnotationProtoCollector annotation_collector( - &annotations); - io::Printer printer(output.get(), '$', - annotate ? &annotation_collector : nullptr); - printer.PrintRaw(GetOutputFileContent(name_, parameter, file, context)); - std::string annotate_suffix = "_annotation"; - if (annotate) { - printer.Print("$p$\n", "p", "first"); - printer.Annotate("p", "first" + annotate_suffix); - } - printer.PrintRaw(kFirstInsertionPoint); - if (annotate) { - printer.Print("$p$\n", "p", "second"); - printer.Annotate("p", "second" + annotate_suffix); - } - printer.PrintRaw(kSecondInsertionPoint); - if (annotate) { - printer.Print("$p$\n", "p", "third"); - printer.Annotate("p", "third" + annotate_suffix); - } - - if (printer.failed()) { - *error = "MockCodeGenerator detected write error."; - return false; - } - if (annotate) { - std::unique_ptr meta_output( - context->Open(GetOutputFileName(name_, file) + ".pb.meta")); - if (!TextFormat::Print(annotations, meta_output.get())) { - *error = "MockCodeGenerator couldn't write .pb.meta"; - return false; - } - } - } - - return true; -} - -std::string MockCodeGenerator::GetOutputFileName( - const std::string& generator_name, const FileDescriptor* file) { - return GetOutputFileName(generator_name, file->name()); -} - -std::string MockCodeGenerator::GetOutputFileName( - const std::string& generator_name, const std::string& file) { - return file + ".MockCodeGenerator." + generator_name; -} - -std::string MockCodeGenerator::GetOutputFileContent( - const std::string& generator_name, const std::string& parameter, - const FileDescriptor* file, GeneratorContext* context) { - std::vector all_files; - context->ListParsedFiles(&all_files); - return GetOutputFileContent( - generator_name, parameter, file->name(), CommaSeparatedList(all_files), - file->message_type_count() > 0 ? file->message_type(0)->name() - : "(none)"); -} - -std::string MockCodeGenerator::GetOutputFileContent( - const std::string& generator_name, const std::string& parameter, - 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); -} - -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc deleted file mode 100644 index ea8f394eb..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc +++ /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. - -#include -#include - -#include -#include -#include -#include -#include // std::find() - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor) - : descriptor_(descriptor), - name_(EnumName(descriptor_)) { - // Track the names for the enum values, and if an alias overlaps a base - // value, skip making a name for it. Likewise if two alias overlap, the - // first one wins. - // The one gap in this logic is if two base values overlap, but for that - // to happen you have to have "Foo" and "FOO" or "FOO_BAR" and "FooBar", - // and if an enum has that, it is already going to be confusing and a - // compile error is just fine. - // The values are still tracked to support the reflection apis and - // TextFormat handing since they are different there. - std::set value_names; - - for (int i = 0; i < descriptor_->value_count(); i++) { - const EnumValueDescriptor* value = descriptor_->value(i); - const EnumValueDescriptor* canonical_value = - descriptor_->FindValueByNumber(value->number()); - - if (value == canonical_value) { - base_values_.push_back(value); - value_names.insert(EnumValueName(value)); - } else { - std::string value_name(EnumValueName(value)); - if (value_names.find(value_name) != value_names.end()) { - alias_values_to_skip_.insert(value); - } else { - value_names.insert(value_name); - } - } - all_values_.push_back(value); - } -} - -EnumGenerator::~EnumGenerator() {} - -void EnumGenerator::GenerateHeader(io::Printer* printer) { - std::string enum_comments; - SourceLocation location; - if (descriptor_->GetSourceLocation(&location)) { - enum_comments = BuildCommentsString(location, true); - } else { - enum_comments = ""; - } - - printer->Print( - "#pragma mark - Enum $name$\n" - "\n", - "name", name_); - - // Swift 5 included SE0192 "Handling Future Enum Cases" - // https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md - // Since a .proto file can get new values added to an enum at any time, they - // are effectively "non-frozen". Even in a proto3 syntax file where there is - // support for the unknown value, an edit to the file can always add a new - // value moving something from unknown to known. Since Swift is now ABI - // stable, it also means a binary could contain Swift compiled against one - // version of the .pbobjc.h file, but finally linked against an enum with - // more cases. So the Swift code will always have to treat ObjC Proto Enums - // as "non-frozen". The default behavior in SE0192 is for all objc enums to - // be "non-frozen" unless marked as otherwise, so this means this generation - // doesn't have to bother with the `enum_extensibility` attribute, as the - // default will be what is needed. - - printer->Print("$comments$typedef$deprecated_attribute$ GPB_ENUM($name$) {\n", - "comments", enum_comments, - "deprecated_attribute", GetOptionalDeprecatedAttribute(descriptor_, descriptor_->file()), - "name", name_); - printer->Indent(); - - if (HasPreservingUnknownEnumSemantics(descriptor_->file())) { - // Include the unknown value. - printer->Print( - "/**\n" - " * Value used if any message's field encounters a value that is not defined\n" - " * by this enum. The message will also have C functions to get/set the rawValue\n" - " * of the field.\n" - " **/\n" - "$name$_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue,\n", - "name", name_); - } - for (int i = 0; i < all_values_.size(); i++) { - if (alias_values_to_skip_.find(all_values_[i]) != alias_values_to_skip_.end()) { - continue; - } - if (all_values_[i]->GetSourceLocation(&location)) { - std::string comments = BuildCommentsString(location, true).c_str(); - if (comments.length() > 0) { - if (i > 0) { - printer->Print("\n"); - } - printer->Print(comments.c_str()); - } - } - - printer->Print( - "$name$$deprecated_attribute$ = $value$,\n", - "name", EnumValueName(all_values_[i]), - "deprecated_attribute", GetOptionalDeprecatedAttribute(all_values_[i]), - "value", StrCat(all_values_[i]->number())); - } - printer->Outdent(); - printer->Print( - "};\n" - "\n" - "GPBEnumDescriptor *$name$_EnumDescriptor(void);\n" - "\n" - "/**\n" - " * Checks to see if the given value is defined by the enum or was not known at\n" - " * the time this source was generated.\n" - " **/\n" - "BOOL $name$_IsValidValue(int32_t value);\n" - "\n", - "name", name_); -} - -void EnumGenerator::GenerateSource(io::Printer* printer) { - printer->Print( - "#pragma mark - Enum $name$\n" - "\n", - "name", name_); - - // Note: For the TextFormat decode info, we can't use the enum value as - // the key because protocol buffer enums have 'allow_alias', which lets - // a value be used more than once. Instead, the index into the list of - // enum value descriptions is used. Note: start with -1 so the first one - // will be zero. - TextFormatDecodeData text_format_decode_data; - int enum_value_description_key = -1; - std::string text_blob; - - for (int i = 0; i < all_values_.size(); i++) { - ++enum_value_description_key; - 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, - all_values_[i]->name()); - } - } - - printer->Print( - "GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n" - " static _Atomic(GPBEnumDescriptor*) descriptor = nil;\n" - " if (!descriptor) {\n", - "name", name_); - - static const int kBytesPerLine = 40; // allow for escaping - printer->Print( - " static const char *valueNames ="); - for (int i = 0; i < text_blob.size(); i += kBytesPerLine) { - printer->Print( - "\n \"$data$\"", - "data", EscapeTrigraphs(CEscape(text_blob.substr(i, kBytesPerLine)))); - } - printer->Print( - ";\n" - " static const int32_t values[] = {\n"); - for (int i = 0; i < all_values_.size(); i++) { - printer->Print(" $name$,\n", "name", EnumValueName(all_values_[i])); - } - printer->Print(" };\n"); - - if (text_format_decode_data.num_entries() == 0) { - printer->Print( - " GPBEnumDescriptor *worker =\n" - " [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n" - " valueNames:valueNames\n" - " values:values\n" - " count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n" - " enumVerifier:$name$_IsValidValue];\n", - "name", name_); - } else { - printer->Print( - " static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n" - " GPBEnumDescriptor *worker =\n" - " [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n" - " valueNames:valueNames\n" - " values:values\n" - " count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n" - " enumVerifier:$name$_IsValidValue\n" - " extraTextFormatInfo:extraTextFormatInfo];\n", - "name", name_, - "extraTextFormatInfo", CEscape(text_format_decode_data.Data())); - } - printer->Print( - " GPBEnumDescriptor *expected = nil;\n" - " if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {\n" - " [worker release];\n" - " }\n" - " }\n" - " return descriptor;\n" - "}\n\n"); - - printer->Print( - "BOOL $name$_IsValidValue(int32_t value__) {\n" - " switch (value__) {\n", - "name", name_); - - for (int i = 0; i < base_values_.size(); i++) { - printer->Print( - " case $name$:\n", - "name", EnumValueName(base_values_[i])); - } - - printer->Print( - " return YES;\n" - " default:\n" - " return NO;\n" - " }\n" - "}\n\n"); -} -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.h deleted file mode 100644 index 1d5741a53..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.h +++ /dev/null @@ -1,71 +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_COMPILER_OBJECTIVEC_ENUM_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__ - -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class EnumGenerator { - public: - explicit EnumGenerator(const EnumDescriptor* descriptor); - ~EnumGenerator(); - - EnumGenerator(const EnumGenerator&) = delete; - EnumGenerator& operator=(const EnumGenerator&) = delete; - - void GenerateHeader(io::Printer* printer); - void GenerateSource(io::Printer* printer); - - 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 std::string name_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc deleted file mode 100644 index 6e0d69bcd..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc +++ /dev/null @@ -1,151 +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 compiler { -namespace objectivec { - -namespace { - -void SetEnumVariables(const FieldDescriptor* descriptor, - 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 - // the forward declaration of the enums. - if (!descriptor->is_repeated() && - (descriptor->file() != descriptor->enum_type()->file())) { - (*variables)["property_type"] = "enum " + type; - } - (*variables)["enum_verifier"] = type + "_IsValidValue"; - (*variables)["enum_desc_func"] = type + "_EnumDescriptor"; - - (*variables)["dataTypeSpecific_name"] = "enumDescFunc"; - (*variables)["dataTypeSpecific_value"] = (*variables)["enum_desc_func"]; - - const Descriptor* msg_descriptor = descriptor->containing_type(); - (*variables)["owning_message_class"] = ClassName(msg_descriptor); -} -} // namespace - -EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor) - : SingleFieldGenerator(descriptor) { - SetEnumVariables(descriptor, &variables_); -} - -EnumFieldGenerator::~EnumFieldGenerator() {} - -void EnumFieldGenerator::GenerateCFunctionDeclarations( - io::Printer* printer) const { - if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) { - return; - } - - printer->Print( - variables_, - "/**\n" - " * Fetches the raw value of a @c $owning_message_class$'s @c $name$ property, even\n" - " * if the value was not defined by the enum at the time the code was generated.\n" - " **/\n" - "int32_t $owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message);\n" - "/**\n" - " * Sets the raw value of an @c $owning_message_class$'s @c $name$ property, allowing\n" - " * it to be set to a value that was not defined by the enum at the time the code\n" - " * was generated.\n" - " **/\n" - "void Set$owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message, int32_t value);\n" - "\n"); -} - -void EnumFieldGenerator::GenerateCFunctionImplementations( - io::Printer* printer) const { - if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) return; - - printer->Print( - variables_, - "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 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" - " GPBSetMessageRawEnumField(message, field, value);\n" - "}\n" - "\n"); -} - -void EnumFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const { - SingleFieldGenerator::DetermineForwardDeclarations( - fwd_decls, include_external_types); - // If it is an enum defined in a different file (and not a WKT), 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 (include_external_types && - descriptor_->file() != descriptor_->enum_type()->file() && - !IsProtobufLibraryBundledProtoFile(descriptor_->enum_type()->file())) { - // Enum name is already in "storage_type". - const std::string& name = variable("storage_type"); - fwd_decls->insert("GPB_ENUM_FWD_DECLARE(" + name + ")"); - } -} - -RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( - const FieldDescriptor* descriptor) - : RepeatedFieldGenerator(descriptor) { - SetEnumVariables(descriptor, &variables_); - variables_["array_storage_type"] = "GPBEnumArray"; -} - -RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() {} - -void RepeatedEnumFieldGenerator::FinishInitialization(void) { - RepeatedFieldGenerator::FinishInitialization(); - variables_["array_comment"] = - "// |" + variables_["name"] + "| contains |" + variables_["storage_type"] + "|\n"; -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h deleted file mode 100644 index f0d685c3d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h +++ /dev/null @@ -1,78 +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_COMPILER_OBJECTIVEC_ENUM_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_FIELD_H__ - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class EnumFieldGenerator : public SingleFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - EnumFieldGenerator(const EnumFieldGenerator&) = delete; - EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete; - - public: - virtual void GenerateCFunctionDeclarations( - io::Printer* printer) const override; - virtual void GenerateCFunctionImplementations( - io::Printer* printer) const override; - virtual void DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const override; - - protected: - explicit EnumFieldGenerator(const FieldDescriptor* descriptor); - virtual ~EnumFieldGenerator(); -}; - -class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - public: - virtual void FinishInitialization() override; - - protected: - explicit RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor); - virtual ~RepeatedEnumFieldGenerator(); -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc deleted file mode 100644 index 9cebcb22a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc +++ /dev/null @@ -1,156 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -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_), - descriptor_(descriptor) { - if (descriptor->is_map()) { - // 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 errors. - std::cerr << "error: Extension is a map<>!" - << " That used to be blocked by the compiler." << std::endl; - std::cerr.flush(); - abort(); - } -} - -ExtensionGenerator::~ExtensionGenerator() {} - -void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { - std::map vars; - vars["method_name"] = method_name_; - if (IsRetainedName(method_name_)) { - vars["storage_attribute"] = " NS_RETURNS_NOT_RETAINED"; - } else { - vars["storage_attribute"] = ""; - } - SourceLocation location; - if (descriptor_->GetSourceLocation(&location)) { - vars["comments"] = BuildCommentsString(location, true); - } else { - vars["comments"] = ""; - } - // Unlike normal message fields, check if the file for the extension was - // deprecated. - vars["deprecated_attribute"] = GetOptionalDeprecatedAttribute(descriptor_, descriptor_->file()); - printer->Print(vars, - "$comments$" - "+ (GPBExtensionDescriptor *)$method_name$$storage_attribute$$deprecated_attribute$;\n"); -} - -void ExtensionGenerator::GenerateStaticVariablesInitialization( - io::Printer* printer) { - std::map vars; - vars["root_class_and_method_name"] = root_class_and_method_name_; - const std::string containing_type = ClassName(descriptor_->containing_type()); - vars["extended_type"] = ObjCClass(containing_type); - vars["number"] = StrCat(descriptor_->number()); - - 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()) { - options.push_back("GPBExtensionSetWireFormat"); - } - vars["options"] = BuildFlagsString(FLAGTYPE_EXTENSION, options); - - ObjectiveCType objc_type = GetObjectiveCType(descriptor_); - if (objc_type == OBJECTIVECTYPE_MESSAGE) { - std::string message_type = ClassName(descriptor_->message_type()); - vars["type"] = ObjCClass(message_type); - } else { - vars["type"] = "Nil"; - } - - vars["default_name"] = GPBGenericValueFieldName(descriptor_); - if (descriptor_->is_repeated()) { - vars["default"] = "nil"; - } else { - vars["default"] = DefaultValue(descriptor_); - } - std::string type = GetCapitalizedType(descriptor_); - vars["extension_type"] = std::string("GPBDataType") + type; - - if (objc_type == OBJECTIVECTYPE_ENUM) { - vars["enum_desc_func_name"] = - EnumName(descriptor_->enum_type()) + "_EnumDescriptor"; - } else { - vars["enum_desc_func_name"] = "NULL"; - } - - printer->Print(vars, - "{\n" - " .defaultValue.$default_name$ = $default$,\n" - " .singletonName = GPBStringifySymbol($root_class_and_method_name$),\n" - " .extendedClass.clazz = $extended_type$,\n" - " .messageOrGroupClass.clazz = $type$,\n" - " .enumDescriptorFunc = $enum_desc_func_name$,\n" - " .fieldNumber = $number$,\n" - " .dataType = $extension_type$,\n" - " .options = $options$,\n" - "},\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 -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.h deleted file mode 100644 index d412f4a9f..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.h +++ /dev/null @@ -1,67 +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_COMPILER_OBJECTIVEC_EXTENSION_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__ - -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class ExtensionGenerator { - public: - ExtensionGenerator(const std::string& root_class_name, - const FieldDescriptor* descriptor); - ~ExtensionGenerator(); - - ExtensionGenerator(const ExtensionGenerator&) = delete; - ExtensionGenerator& operator=(const ExtensionGenerator&) = delete; - - void GenerateMembersHeader(io::Printer* printer); - void GenerateStaticVariablesInitialization(io::Printer* printer); - void GenerateRegistrationSource(io::Printer* printer); - void DetermineObjectiveCClassDefinitions(std::set* fwd_decls); - - private: - std::string method_name_; - std::string root_class_and_method_name_; - const FieldDescriptor* descriptor_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc deleted file mode 100644 index 004ea19fb..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ /dev/null @@ -1,470 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -namespace { - -void SetCommonFieldVariables(const FieldDescriptor* descriptor, - 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 std::string un_camel_case_name( - UnCamelCaseFieldName(camel_case_name, descriptor)); - const bool needs_custom_name = (raw_field_name != un_camel_case_name); - - SourceLocation location; - if (descriptor->GetSourceLocation(&location)) { - (*variables)["comments"] = BuildCommentsString(location, true); - } else { - (*variables)["comments"] = "\n"; - } - const std::string& classname = ClassName(descriptor->containing_type()); - (*variables)["classname"] = classname; - (*variables)["name"] = camel_case_name; - const std::string& capitalized_name = FieldNameCapitalized(descriptor); - (*variables)["capitalized_name"] = capitalized_name; - (*variables)["raw_field_name"] = raw_field_name; - (*variables)["field_number_name"] = - classname + "_FieldNumber_" + capitalized_name; - (*variables)["field_number"] = StrCat(descriptor->number()); - (*variables)["field_type"] = GetCapitalizedType(descriptor); - (*variables)["deprecated_attribute"] = GetOptionalDeprecatedAttribute(descriptor); - 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"); - if (descriptor->is_packed()) field_flags.push_back("GPBFieldPacked"); - - // ObjC custom flags. - if (descriptor->has_default_value()) - field_flags.push_back("GPBFieldHasDefaultValue"); - if (needs_custom_name) field_flags.push_back("GPBFieldTextFormatNameCustom"); - 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"] = "clazz"; - (*variables)["dataTypeSpecific_value"] = "Nil"; - - (*variables)["storage_offset_value"] = - "(uint32_t)offsetof(" + classname + "__storage_, " + camel_case_name + ")"; - (*variables)["storage_offset_comment"] = ""; - - // Clear some common things so they can be set just when needed. - (*variables)["storage_attribute"] = ""; -} - -} // namespace - -FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field) { - FieldGenerator* result = NULL; - if (field->is_repeated()) { - switch (GetObjectiveCType(field)) { - case OBJECTIVECTYPE_MESSAGE: { - if (field->is_map()) { - result = new MapFieldGenerator(field); - } else { - result = new RepeatedMessageFieldGenerator(field); - } - break; - } - case OBJECTIVECTYPE_ENUM: - result = new RepeatedEnumFieldGenerator(field); - break; - default: - result = new RepeatedPrimitiveFieldGenerator(field); - break; - } - } else { - switch (GetObjectiveCType(field)) { - case OBJECTIVECTYPE_MESSAGE: { - result = new MessageFieldGenerator(field); - break; - } - case OBJECTIVECTYPE_ENUM: - result = new EnumFieldGenerator(field); - break; - default: - if (IsReferenceType(field)) { - result = new PrimitiveObjFieldGenerator(field); - } else { - result = new PrimitiveFieldGenerator(field); - } - break; - } - } - result->FinishInitialization(); - return result; -} - -FieldGenerator::FieldGenerator(const FieldDescriptor* descriptor) - : descriptor_(descriptor) { - SetCommonFieldVariables(descriptor, &variables_); -} - -FieldGenerator::~FieldGenerator() {} - -void FieldGenerator::GenerateFieldNumberConstant(io::Printer* printer) const { - printer->Print( - variables_, - "$field_number_name$ = $field_number$,\n"); -} - -void FieldGenerator::GenerateCFunctionDeclarations( - io::Printer* printer) const { - // Nothing -} - -void FieldGenerator::GenerateCFunctionImplementations( - io::Printer* printer) const { - // Nothing -} - -void FieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const { - // Nothing -} - -void FieldGenerator::DetermineObjectiveCClassDefinitions( - std::set* fwd_decls) const { - // Nothing -} - -void FieldGenerator::GenerateFieldDescription( - io::Printer* printer, bool include_default) const { - // Printed in the same order as the structure decl. - if (include_default) { - printer->Print( - variables_, - "{\n" - " .defaultValue.$default_name$ = $default$,\n" - " .core.name = \"$name$\",\n" - " .core.dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n" - " .core.number = $field_number_name$,\n" - " .core.hasIndex = $has_index$,\n" - " .core.offset = $storage_offset_value$,$storage_offset_comment$\n" - " .core.flags = $fieldflags$,\n" - " .core.dataType = GPBDataType$field_type$,\n" - "},\n"); - } else { - printer->Print( - variables_, - "{\n" - " .name = \"$name$\",\n" - " .dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n" - " .number = $field_number_name$,\n" - " .hasIndex = $has_index$,\n" - " .offset = $storage_offset_value$,$storage_offset_comment$\n" - " .flags = $fieldflags$,\n" - " .dataType = GPBDataType$field_type$,\n" - "},\n"); - } -} - -void FieldGenerator::SetRuntimeHasBit(int has_index) { - variables_["has_index"] = StrCat(has_index); -} - -void FieldGenerator::SetNoHasBit(void) { - variables_["has_index"] = "GPBNoHasBit"; -} - -int FieldGenerator::ExtraRuntimeHasBitsNeeded(void) const { - return 0; -} - -void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) { - // 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 errors. - std::cerr << "Error: should have overridden SetExtraRuntimeHasBitsBase()." << std::endl; - std::cerr.flush(); - abort(); -} - -void FieldGenerator::SetOneofIndexBase(int 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()) && - (variables_.find("storage_type") != variables_.end())) { - variables_["property_type"] = variable("storage_type"); - } -} - -SingleFieldGenerator::SingleFieldGenerator(const FieldDescriptor* descriptor) - : FieldGenerator(descriptor) { - // Nothing -} - -SingleFieldGenerator::~SingleFieldGenerator() {} - -void SingleFieldGenerator::GenerateFieldStorageDeclaration( - io::Printer* printer) const { - printer->Print(variables_, "$storage_type$ $name$;\n"); -} - -void SingleFieldGenerator::GeneratePropertyDeclaration( - io::Printer* printer) const { - printer->Print(variables_, "$comments$"); - printer->Print( - variables_, - "@property(nonatomic, readwrite) $property_type$ $name$$deprecated_attribute$;\n" - "\n"); - if (WantsHasProperty()) { - printer->Print( - variables_, - "@property(nonatomic, readwrite) BOOL has$capitalized_name$$deprecated_attribute$;\n"); - } -} - -void SingleFieldGenerator::GeneratePropertyImplementation( - io::Printer* printer) const { - if (WantsHasProperty()) { - printer->Print(variables_, "@dynamic has$capitalized_name$, $name$;\n"); - } else { - printer->Print(variables_, "@dynamic $name$;\n"); - } -} - -bool SingleFieldGenerator::RuntimeUsesHasBit(void) const { - if (descriptor_->real_containing_oneof()) { - // The oneof tracks what is set instead. - return false; - } - return true; -} - -ObjCObjFieldGenerator::ObjCObjFieldGenerator(const FieldDescriptor* descriptor) - : SingleFieldGenerator(descriptor) { - variables_["property_storage_attribute"] = "strong"; - if (IsRetainedName(variables_["name"])) { - variables_["storage_attribute"] = " NS_RETURNS_NOT_RETAINED"; - } -} - -ObjCObjFieldGenerator::~ObjCObjFieldGenerator() {} - -void ObjCObjFieldGenerator::GenerateFieldStorageDeclaration( - io::Printer* printer) const { - printer->Print(variables_, "$storage_type$ *$name$;\n"); -} - -void ObjCObjFieldGenerator::GeneratePropertyDeclaration( - io::Printer* printer) const { - - // Differs from SingleFieldGenerator::GeneratePropertyDeclaration() in that - // it uses pointers and deals with Objective C's rules around storage name - // conventions (init*, new*, etc.) - - printer->Print(variables_, "$comments$"); - printer->Print( - variables_, - "@property(nonatomic, readwrite, $property_storage_attribute$, null_resettable) $property_type$ *$name$$storage_attribute$$deprecated_attribute$;\n"); - if (WantsHasProperty()) { - printer->Print( - variables_, - "/** Test to see if @c $name$ has been set. */\n" - "@property(nonatomic, readwrite) BOOL has$capitalized_name$$deprecated_attribute$;\n"); - } - if (IsInitName(variables_.find("name")->second)) { - // If property name starts with init we need to annotate it to get past ARC. - // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 - printer->Print(variables_, - "- ($property_type$ *)$name$ GPB_METHOD_FAMILY_NONE$deprecated_attribute$;\n"); - } - printer->Print("\n"); -} - -RepeatedFieldGenerator::RepeatedFieldGenerator( - const FieldDescriptor* descriptor) - : ObjCObjFieldGenerator(descriptor) { - // Default to no comment and let the cases needing it fill it in. - variables_["array_comment"] = ""; -} - -RepeatedFieldGenerator::~RepeatedFieldGenerator() {} - -void RepeatedFieldGenerator::FinishInitialization(void) { - FieldGenerator::FinishInitialization(); - if (variables_.find("array_property_type") == variables_.end()) { - variables_["array_property_type"] = variable("array_storage_type"); - } -} - -void RepeatedFieldGenerator::GenerateFieldStorageDeclaration( - io::Printer* printer) const { - printer->Print(variables_, "$array_storage_type$ *$name$;\n"); -} - -void RepeatedFieldGenerator::GeneratePropertyImplementation( - io::Printer* printer) const { - printer->Print(variables_, "@dynamic $name$, $name$_Count;\n"); -} - -void RepeatedFieldGenerator::GeneratePropertyDeclaration( - io::Printer* printer) const { - - // Repeated fields don't need the has* properties, but they do expose a - // *Count (to check without autocreation). So for the field property we need - // the same logic as ObjCObjFieldGenerator::GeneratePropertyDeclaration() for - // dealing with needing Objective C's rules around storage name conventions - // (init*, new*, etc.) - - printer->Print( - variables_, - "$comments$" - "$array_comment$" - "@property(nonatomic, readwrite, strong, null_resettable) $array_property_type$ *$name$$storage_attribute$$deprecated_attribute$;\n" - "/** The number of items in @c $name$ without causing the array to be created. */\n" - "@property(nonatomic, readonly) NSUInteger $name$_Count$deprecated_attribute$;\n"); - if (IsInitName(variables_.find("name")->second)) { - // If property name starts with init we need to annotate it to get past ARC. - // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 - printer->Print(variables_, - "- ($array_property_type$ *)$name$ GPB_METHOD_FAMILY_NONE$deprecated_attribute$;\n"); - } - printer->Print("\n"); -} - -bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const { - return false; // The array (or map/dict) having anything is what is used. -} - -FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor) - : descriptor_(descriptor), - field_generators_(descriptor->field_count()), - extension_generators_(descriptor->extension_count()) { - // Construct all the FieldGenerators. - for (int i = 0; i < descriptor->field_count(); i++) { - field_generators_[i].reset( - FieldGenerator::Make(descriptor->field(i))); - } - for (int i = 0; i < descriptor->extension_count(); i++) { - extension_generators_[i].reset( - FieldGenerator::Make(descriptor->extension(i))); - } -} - -FieldGeneratorMap::~FieldGeneratorMap() {} - -const FieldGenerator& FieldGeneratorMap::get( - const FieldDescriptor* field) const { - GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); - return *field_generators_[field->index()]; -} - -const FieldGenerator& FieldGeneratorMap::get_extension(int index) const { - return *extension_generators_[index]; -} - -int FieldGeneratorMap::CalculateHasBits(void) { - int total_bits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - if (field_generators_[i]->RuntimeUsesHasBit()) { - field_generators_[i]->SetRuntimeHasBit(total_bits); - ++total_bits; - } else { - field_generators_[i]->SetNoHasBit(); - } - int extra_bits = field_generators_[i]->ExtraRuntimeHasBitsNeeded(); - if (extra_bits) { - field_generators_[i]->SetExtraRuntimeHasBitsBase(total_bits); - total_bits += extra_bits; - } - } - return total_bits; -} - -void FieldGeneratorMap::SetOneofIndexBase(int index_base) { - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_[i]->SetOneofIndexBase(index_base); - } -} - -bool FieldGeneratorMap::DoesAnyFieldHaveNonZeroDefault(void) const { - for (int i = 0; i < descriptor_->field_count(); i++) { - if (HasNonZeroDefaultValue(descriptor_->field(i))) { - return true; - } - } - - return false; -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h deleted file mode 100644 index 759ef808d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ /dev/null @@ -1,190 +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_COMPILER_OBJECTIVEC_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FIELD_H__ - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class FieldGenerator { - public: - static FieldGenerator* Make(const FieldDescriptor* field); - - virtual ~FieldGenerator(); - - FieldGenerator(const FieldGenerator&) = delete; - FieldGenerator& operator=(const FieldGenerator&) = delete; - - // Exposed for subclasses to fill in. - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const = 0; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const = 0; - virtual void GeneratePropertyImplementation(io::Printer* printer) const = 0; - - // Called by GenerateFieldDescription, exposed for classes that need custom - // generation. - - // Exposed for subclasses to extend, base does nothing. - virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; - 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, - bool include_external_types) const; - virtual void DetermineObjectiveCClassDefinitions( - std::set* fwd_decls) const; - - // Used during generation, not intended to be extended by subclasses. - void GenerateFieldDescription( - io::Printer* printer, bool include_default) const; - void GenerateFieldNumberConstant(io::Printer* printer) const; - - // Exposed to get and set the has bits information. - virtual bool RuntimeUsesHasBit(void) const = 0; - void SetRuntimeHasBit(int has_index); - void SetNoHasBit(void); - virtual int ExtraRuntimeHasBitsNeeded(void) const; - virtual void SetExtraRuntimeHasBitsBase(int index_base); - void SetOneofIndexBase(int index_base); - - std::string variable(const char* key) const { - return variables_.find(key)->second; - } - - bool needs_textformat_name_support() const { - const std::string& field_flags = variable("fieldflags"); - return field_flags.find("GPBFieldTextFormatNameCustom") != - std::string::npos; - } - std::string generated_objc_name() const { return variable("name"); } - std::string raw_field_name() const { return variable("raw_field_name"); } - - protected: - explicit FieldGenerator(const FieldDescriptor* descriptor); - - virtual void FinishInitialization(void); - bool WantsHasProperty(void) const; - - const FieldDescriptor* descriptor_; - std::map variables_; -}; - -class SingleFieldGenerator : public FieldGenerator { - public: - virtual ~SingleFieldGenerator(); - - SingleFieldGenerator(const SingleFieldGenerator&) = delete; - SingleFieldGenerator& operator=(const SingleFieldGenerator&) = delete; - - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - - virtual void GeneratePropertyImplementation(io::Printer* printer) const override; - - virtual bool RuntimeUsesHasBit(void) const override; - - protected: - explicit SingleFieldGenerator(const FieldDescriptor* descriptor); -}; - -// Subclass with common support for when the field ends up as an ObjC Object. -class ObjCObjFieldGenerator : public SingleFieldGenerator { - public: - virtual ~ObjCObjFieldGenerator(); - - ObjCObjFieldGenerator(const ObjCObjFieldGenerator&) = delete; - ObjCObjFieldGenerator& operator=(const ObjCObjFieldGenerator&) = delete; - - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - - protected: - explicit ObjCObjFieldGenerator(const FieldDescriptor* descriptor); -}; - -class RepeatedFieldGenerator : public ObjCObjFieldGenerator { - public: - virtual ~RepeatedFieldGenerator(); - - RepeatedFieldGenerator(const RepeatedFieldGenerator&) = delete; - RepeatedFieldGenerator& operator=(const RepeatedFieldGenerator&) = delete; - - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - - virtual void GeneratePropertyImplementation(io::Printer* printer) const override; - - virtual bool RuntimeUsesHasBit(void) const override; - - protected: - explicit RepeatedFieldGenerator(const FieldDescriptor* descriptor); - virtual void FinishInitialization(void) override; -}; - -// Convenience class which constructs FieldGenerators for a Descriptor. -class FieldGeneratorMap { - public: - explicit FieldGeneratorMap(const Descriptor* descriptor); - ~FieldGeneratorMap(); - - FieldGeneratorMap(const FieldGeneratorMap&) = delete; - FieldGeneratorMap& operator=(const FieldGeneratorMap&) = delete; - - const FieldGenerator& get(const FieldDescriptor* field) const; - const FieldGenerator& get_extension(int index) const; - - // Assigns the has bits and returns the number of bits needed. - int CalculateHasBits(void); - - void SetOneofIndexBase(int index_base); - - // Check if any field of this message has a non zero default. - bool DoesAnyFieldHaveNonZeroDefault(void) const; - - private: - const Descriptor* descriptor_; - std::vector> field_generators_; - std::vector> extension_generators_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc deleted file mode 100644 index 50b4285ad..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ /dev/null @@ -1,681 +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 -#include -#include // std::find() -#include -#include - -// 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 errors. - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -namespace { - -// This is also found in GPBBootstrap.h, and needs to be kept in sync. -const int32_t GOOGLE_PROTOBUF_OBJC_VERSION = 30004; - -const char* kHeaderExtension = ".pbobjc.h"; - -std::string BundledFileName(const FileDescriptor* file) { - return "GPB" + FilePathBasename(file) + kHeaderExtension; -} - -// Checks if a message contains any enums definitions (on the message or -// a nested message under it). -bool MessageContainsEnums(const Descriptor* message) { - if (message->enum_type_count() > 0) { - return true; - } - for (int i = 0; i < message->nested_type_count(); i++) { - if (MessageContainsEnums(message->nested_type(i))) { - return true; - } - } - return false; -} - -// Checks if a message contains any extension definitions (on the message or -// a nested message under it). -bool MessageContainsExtensions(const Descriptor* message) { - if (message->extension_count() > 0) { - return true; - } - for (int i = 0; i < message->nested_type_count(); i++) { - if (MessageContainsExtensions(message->nested_type(i))) { - return true; - } - } - return false; -} - -// Checks if the file contains any enum definitions (at the root or -// nested under a message). -bool FileContainsEnums(const FileDescriptor* file) { - if (file->enum_type_count() > 0) { - return true; - } - for (int i = 0; i < file->message_type_count(); i++) { - if (MessageContainsEnums(file->message_type(i))) { - return true; - } - } - return false; -} - -// Checks if the file contains any extensions definitions (at the root or -// nested under a message). -bool FileContainsExtensions(const FileDescriptor* file) { - if (file->extension_count() > 0) { - return true; - } - for (int i = 0; i < file->message_type_count(); i++) { - if (MessageContainsExtensions(file->message_type(i))) { - return true; - } - } - return false; -} - -bool IsDirectDependency(const FileDescriptor* dep, const FileDescriptor* file) { - for (int i = 0; i < file->dependency_count(); i++) { - if (dep == file->dependency(i)) { - return true; - } - } - return false; -} - -struct FileDescriptorsOrderedByName { - inline bool operator()(const FileDescriptor* a, - const FileDescriptor* b) const { - return a->name() < b->name(); - } -}; - -} // namespace - -FileGenerator::CommonState::CommonState() { } - -const FileGenerator::CommonState::MinDepsEntry& -FileGenerator::CommonState::CollectMinimalFileDepsContainingExtensionsInternal( - const FileDescriptor* file) { - auto it = deps_info_cache_.find(file); - if (it != deps_info_cache_.end()) { - return it->second; - } - - std::set min_deps_collector; - std::set covered_deps_collector; - std::set to_prune; - for (int i = 0; i < file->dependency_count(); i++) { - const FileDescriptor* dep = file->dependency(i); - MinDepsEntry dep_info = - CollectMinimalFileDepsContainingExtensionsInternal(dep); - - // Everything the dep covered, this file will also cover. - covered_deps_collector.insert(dep_info.covered_deps.begin(), dep_info.covered_deps.end()); - // Prune everything from the dep's covered list in case another dep lists it - // as a min dep. - to_prune.insert(dep_info.covered_deps.begin(), dep_info.covered_deps.end()); - - // Does the dep have any extensions... - if (dep_info.has_extensions) { - // Yes -> Add this file, prune its min_deps and add them to the covered deps. - min_deps_collector.insert(dep); - to_prune.insert(dep_info.min_deps.begin(), dep_info.min_deps.end()); - covered_deps_collector.insert(dep_info.min_deps.begin(), dep_info.min_deps.end()); - } else { - // No -> Just use its min_deps. - min_deps_collector.insert(dep_info.min_deps.begin(), dep_info.min_deps.end()); - } - } - - const bool file_has_exts = FileContainsExtensions(file); - - // Fast path: if nothing to prune or there was only one dep, the prune work is - // a waste, skip it. - if (to_prune.empty() || file->dependency_count() == 1) { - return deps_info_cache_.insert( - {file, {file_has_exts, min_deps_collector, covered_deps_collector}}).first->second; - } - - std::set min_deps; - std::copy_if(min_deps_collector.begin(), min_deps_collector.end(), - std::inserter(min_deps, min_deps.end()), - [&](const FileDescriptor* value){ - return to_prune.find(value) == to_prune.end(); - }); - return deps_info_cache_.insert( - {file, {file_has_exts, min_deps, covered_deps_collector}}).first->second; -} - -// Collect the deps of the given file that contain extensions. This can be used to -// create the chain of roots that need to be wired together. -// -// NOTE: If any changes are made to this and the supporting functions, you will -// need to manually validate what the generated code is for the test files: -// objectivec/Tests/unittest_extension_chain_*.proto -// There are comments about what the expected code should be line and limited -// testing objectivec/Tests/GPBUnittestProtos2.m around compilation (#imports -// specifically). -const std::vector -FileGenerator::CommonState::CollectMinimalFileDepsContainingExtensions( - const FileDescriptor* file) { - std::set min_deps = - CollectMinimalFileDepsContainingExtensionsInternal(file).min_deps; - // Sort the list since pointer order isn't stable across runs. - std::vector result(min_deps.begin(), min_deps.end()); - std::sort(result.begin(), result.end(), FileDescriptorsOrderedByName()); - return result; -} - -FileGenerator::FileGenerator(const FileDescriptor* file, - const GenerationOptions& generation_options, - CommonState& common_state) - : file_(file), - generation_options_(generation_options), - common_state_(common_state), - root_class_name_(FileClassName(file)), - is_bundled_proto_(IsProtobufLibraryBundledProtoFile(file)) { - for (int i = 0; i < file_->enum_type_count(); 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 = - new MessageGenerator(root_class_name_, file_->message_type(i)); - message_generators_.emplace_back(generator); - } - for (int i = 0; i < file_->extension_count(); i++) { - ExtensionGenerator* generator = - new ExtensionGenerator(root_class_name_, file_->extension(i)); - extension_generators_.emplace_back(generator); - } -} - -FileGenerator::~FileGenerator() {} - -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.push_back("GPBDescriptor.h"); - headers.push_back("GPBMessage.h"); - headers.push_back("GPBRootObject.h"); - for (int i = 0; i < file_->dependency_count(); i++) { - const std::string header_name = BundledFileName(file_->dependency(i)); - headers.push_back(header_name); - } - } else { - headers.push_back("GPBProtocolBuffers.h"); - } - PrintFileRuntimePreamble(printer, headers); - - // Add some verification that the generated code matches the source the - // code is being compiled with. - // NOTE: This captures the raw numeric values at the time the generator was - // compiled, since that will be the versions for the ObjC runtime at that - // time. The constants in the generated code will then get their values at - // at compile time (so checking against the headers being used to compile). - printer->Print( - "#if GOOGLE_PROTOBUF_OBJC_VERSION < $google_protobuf_objc_version$\n" - "#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.\n" - "#endif\n" - "#if $google_protobuf_objc_version$ < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION\n" - "#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.\n" - "#endif\n" - "\n", - "google_protobuf_objc_version", StrCat(GOOGLE_PROTOBUF_OBJC_VERSION)); - - // The bundled protos (WKTs) don't use of forward declarations. - bool headers_use_forward_declarations = - generation_options_.headers_use_forward_declarations && !is_bundled_proto_; - - { - ImportWriter import_writer( - generation_options_.generate_for_named_framework, - generation_options_.named_framework_to_proto_path_mappings_path, - generation_options_.runtime_import_prefix, - /* include_wkt_imports = */ false); - const std::string header_extension(kHeaderExtension); - if (headers_use_forward_declarations) { - // #import any headers for "public imports" in the proto file. - for (int i = 0; i < file_->public_dependency_count(); i++) { - import_writer.AddFile(file_->public_dependency(i), header_extension); - } - } else { - for (int i = 0; i < file_->dependency_count(); i++) { - import_writer.AddFile(file_->dependency(i), header_extension); - } - } - import_writer.Print(printer); - } - - // 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. - printer->Print( - "// @@protoc_insertion_point(imports)\n" - "\n" - "#pragma clang diagnostic push\n" - "#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n" - "\n" - "CF_EXTERN_C_BEGIN\n" - "\n"); - - std::set fwd_decls; - for (const auto& generator : message_generators_) { - generator->DetermineForwardDeclarations( - &fwd_decls, - /* include_external_types = */ headers_use_forward_declarations); - } - for (std::set::const_iterator i(fwd_decls.begin()); - i != fwd_decls.end(); ++i) { - printer->Print("$value$;\n", "value", *i); - } - if (fwd_decls.begin() != fwd_decls.end()) { - printer->Print("\n"); - } - - printer->Print( - "NS_ASSUME_NONNULL_BEGIN\n" - "\n"); - - // need to write out all enums first - for (const auto& generator : enum_generators_) { - generator->GenerateHeader(printer); - } - - for (const auto& generator : message_generators_) { - generator->GenerateEnumHeader(printer); - } - - // For extensions to chain together, the Root gets created even if there - // are no extensions. - printer->Print( - "#pragma mark - $root_class_name$\n" - "\n" - "/**\n" - " * Exposes the extension registry for this file.\n" - " *\n" - " * The base class provides:\n" - " * @code\n" - " * + (GPBExtensionRegistry *)extensionRegistry;\n" - " * @endcode\n" - " * which is a @c GPBExtensionRegistry that includes all the extensions defined by\n" - " * this file and all files that it depends on.\n" - " **/\n" - "GPB_FINAL @interface $root_class_name$ : GPBRootObject\n" - "@end\n" - "\n", - "root_class_name", root_class_name_); - - if (!extension_generators_.empty()) { - // The dynamic methods block is only needed if there are extensions. - printer->Print( - "@interface $root_class_name$ (DynamicMethods)\n", - "root_class_name", root_class_name_); - - for (const auto& generator : extension_generators_) { - generator->GenerateMembersHeader(printer); - } - - printer->Print("@end\n\n"); - } // !extension_generators_.empty() - - for (const auto& generator : message_generators_) { - generator->GenerateMessageHeader(printer); - } - - printer->Print( - "NS_ASSUME_NONNULL_END\n" - "\n" - "CF_EXTERN_C_END\n" - "\n" - "#pragma clang diagnostic pop\n" - "\n" - "// @@protoc_insertion_point(global_scope)\n"); -} - -void FileGenerator::GenerateSource(io::Printer* printer) { - // #import the runtime support. - std::vector headers; - headers.push_back("GPBProtocolBuffers_RuntimeSupport.h"); - if (is_bundled_proto_) { - headers.push_back(BundledFileName(file_)); - } - PrintFileRuntimePreamble(printer, headers); - - // Enums use atomic in the generated code, so add the system import as needed. - if (FileContainsEnums(file_)) { - printer->Print( - "#import \n" - "\n"); - } - - std::vector deps_with_extensions = - common_state_.CollectMinimalFileDepsContainingExtensions(file_); - - // The bundled protos (WKTs) don't use of forward declarations. - bool headers_use_forward_declarations = - generation_options_.headers_use_forward_declarations && !is_bundled_proto_; - - { - ImportWriter import_writer( - generation_options_.generate_for_named_framework, - generation_options_.named_framework_to_proto_path_mappings_path, - generation_options_.runtime_import_prefix, - /* include_wkt_imports = */ false); - const std::string header_extension(kHeaderExtension); - - // #import the header for this proto file. - import_writer.AddFile(file_, header_extension); - - if (headers_use_forward_declarations) { - // #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; - for (int i = 0; i < file_->public_dependency_count(); i++) { - public_import_names.insert(file_->public_dependency(i)->name()); - } - for (int i = 0; i < file_->dependency_count(); i++) { - const FileDescriptor *dep = file_->dependency(i); - bool public_import = (public_import_names.count(dep->name()) != 0); - if (!public_import) { - import_writer.AddFile(dep, header_extension); - } - } - } - - // If any indirect dependency provided extensions, it needs to be directly - // 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 = - deps_with_extensions.begin(); - iter != deps_with_extensions.end(); ++iter) { - if (!IsDirectDependency(*iter, file_)) { - import_writer.AddFile(*iter, header_extension); - } - } - - import_writer.Print(printer); - } - - bool includes_oneof = false; - for (const auto& generator : message_generators_) { - if (generator->IncludesOneOfDefinition()) { - includes_oneof = true; - break; - } - } - - 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" - "#pragma clang diagnostic push\n" - "#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n"); - if (includes_oneof) { - // The generated code for oneof's uses direct ivar access, suppress 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( - "#pragma mark - $root_class_name$\n" - "\n" - "@implementation $root_class_name$\n\n", - "root_class_name", root_class_name_); - - const bool file_contains_extensions = FileContainsExtensions(file_); - - // If there were any extensions or this file has any dependencies, output - // a registry to override to create the file specific registry. - if (file_contains_extensions || !deps_with_extensions.empty()) { - printer->Print( - "+ (GPBExtensionRegistry*)extensionRegistry {\n" - " // This is called by +initialize so there is no need to worry\n" - " // about thread safety and initialization of registry.\n" - " static GPBExtensionRegistry* registry = nil;\n" - " if (!registry) {\n" - " GPB_DEBUG_CHECK_RUNTIME_VERSIONS();\n" - " registry = [[GPBExtensionRegistry alloc] init];\n"); - - printer->Indent(); - printer->Indent(); - - if (file_contains_extensions) { - printer->Print( - "static GPBExtensionDescription descriptions[] = {\n"); - printer->Indent(); - for (const auto& generator : extension_generators_) { - generator->GenerateStaticVariablesInitialization(printer); - } - for (const auto& generator : message_generators_) { - generator->GenerateStaticVariablesInitialization(printer); - } - printer->Outdent(); - printer->Print( - "};\n" - "for (size_t i = 0; i < sizeof(descriptions) / sizeof(descriptions[0]); ++i) {\n" - " GPBExtensionDescriptor *extension =\n" - " [[GPBExtensionDescriptor alloc] initWithExtensionDescription:&descriptions[i]\n" - " usesClassRefs:YES];\n" - " [registry addExtension:extension];\n" - " [self globallyRegisterExtension:extension];\n" - " [extension release];\n" - "}\n"); - } - - if (deps_with_extensions.empty()) { - printer->Print( - "// None of the imports (direct or indirect) defined extensions, so no need to add\n" - "// them to this registry.\n"); - } else { - printer->Print( - "// Merge in the imports (direct or indirect) that defined extensions.\n"); - for (std::vector::iterator iter = - deps_with_extensions.begin(); - iter != deps_with_extensions.end(); ++iter) { - const std::string root_class_name(FileClassName((*iter))); - printer->Print( - "[registry addExtensions:[$dependency$ extensionRegistry]];\n", - "dependency", root_class_name); - } - } - - printer->Outdent(); - printer->Outdent(); - - printer->Print( - " }\n" - " return registry;\n" - "}\n"); - } else { - if (file_->dependency_count() > 0) { - printer->Print( - "// No extensions in the file and none of the imports (direct or indirect)\n" - "// defined extensions, so no need to generate +extensionRegistry.\n"); - } else { - printer->Print( - "// No extensions in the file and no imports, so no need to generate\n" - "// +extensionRegistry.\n"); - } - } - - printer->Print("\n@end\n\n"); - - // File descriptor only needed if there are messages to use it. - if (!message_generators_.empty()) { - std::map vars; - vars["root_class_name"] = root_class_name_; - vars["package"] = file_->package(); - vars["objc_prefix"] = FileClassPrefix(file_); - switch (file_->syntax()) { - case FileDescriptor::SYNTAX_UNKNOWN: - vars["syntax"] = "GPBFileSyntaxUnknown"; - break; - case FileDescriptor::SYNTAX_PROTO2: - vars["syntax"] = "GPBFileSyntaxProto2"; - break; - case FileDescriptor::SYNTAX_PROTO3: - vars["syntax"] = "GPBFileSyntaxProto3"; - break; - } - printer->Print(vars, - "#pragma mark - $root_class_name$_FileDescriptor\n" - "\n" - "static GPBFileDescriptor *$root_class_name$_FileDescriptor(void) {\n" - " // This is called by +initialize so there is no need to worry\n" - " // about thread safety of the singleton.\n" - " static GPBFileDescriptor *descriptor = NULL;\n" - " if (!descriptor) {\n" - " GPB_DEBUG_CHECK_RUNTIME_VERSIONS();\n"); - if (!vars["objc_prefix"].empty()) { - printer->Print( - vars, - " descriptor = [[GPBFileDescriptor alloc] initWithPackage:@\"$package$\"\n" - " objcPrefix:@\"$objc_prefix$\"\n" - " syntax:$syntax$];\n"); - } else { - printer->Print( - vars, - " descriptor = [[GPBFileDescriptor alloc] initWithPackage:@\"$package$\"\n" - " syntax:$syntax$];\n"); - } - printer->Print( - " }\n" - " return descriptor;\n" - "}\n" - "\n"); - } - - for (const auto& generator : enum_generators_) { - generator->GenerateSource(printer); - } - for (const auto& generator : message_generators_) { - generator->GenerateSource(printer); - } - - printer->Print( - "\n" - "#pragma clang diagnostic pop\n" - "\n" - "// @@protoc_insertion_point(global_scope)\n"); -} - -// Helper to print the import of the runtime support at the top of generated -// 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::vector& headers_to_import) const { - printer->Print( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "// source: $filename$\n" - "\n", - "filename", file_->name()); - - if (is_bundled_proto_) { - // This is basically a clone of ImportWriter::PrintRuntimeImports() but - // without the CPP symbol gate, since within the bundled files, that isn't - // needed. - std::string import_prefix = generation_options_.runtime_import_prefix; - if (!import_prefix.empty()) { - import_prefix += "/"; - } - for (const auto& header : headers_to_import) { - printer->Print( - "#import \"$import_prefix$$header$\"\n", - "import_prefix", import_prefix, - "header", header); - } - } else { - ImportWriter::PrintRuntimeImports( - printer, headers_to_import, generation_options_.runtime_import_prefix, true); - } - - printer->Print("\n"); -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h deleted file mode 100644 index ef49cf8a7..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h +++ /dev/null @@ -1,115 +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_COMPILER_OBJECTIVEC_FILE_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ - -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class EnumGenerator; -class ExtensionGenerator; -class MessageGenerator; - -class FileGenerator { - public: - struct GenerationOptions { - GenerationOptions() - // TODO(thomasvl): Eventually flip this default to false for better - // interop with Swift if proto usages span modules made from ObjC sources. - : headers_use_forward_declarations(true) {} - std::string generate_for_named_framework; - std::string named_framework_to_proto_path_mappings_path; - std::string runtime_import_prefix; - bool headers_use_forward_declarations; - }; - - // Wrapper for some common state that is shared between file generations to - // improve performance when more than one file is generated at a time. - struct CommonState { - CommonState(); - - const std::vector - CollectMinimalFileDepsContainingExtensions(const FileDescriptor* file); - - private: - struct MinDepsEntry { - bool has_extensions; - std::set min_deps; - // `covered_deps` are the transtive deps of `min_deps_w_exts` that also - // have extensions. - std::set covered_deps; - }; - const MinDepsEntry& CollectMinimalFileDepsContainingExtensionsInternal(const FileDescriptor* file); - std::map deps_info_cache_; - }; - - FileGenerator(const FileDescriptor* file, - const GenerationOptions& generation_options, - CommonState& common_state); - ~FileGenerator(); - - FileGenerator(const FileGenerator&) = delete; - FileGenerator& operator=(const FileGenerator&) = delete; - - void GenerateSource(io::Printer* printer); - void GenerateHeader(io::Printer* printer); - - private: - const FileDescriptor* file_; - const GenerationOptions& generation_options_; - CommonState& common_state_; - std::string root_class_name_; - bool is_bundled_proto_; - - std::vector> enum_generators_; - std::vector> message_generators_; - std::vector> extension_generators_; - - void PrintFileRuntimePreamble( - io::Printer* printer, - const std::vector& headers_to_import) const; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc deleted file mode 100644 index 9dccf149a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc +++ /dev/null @@ -1,301 +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 -#include - -namespace google { -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() {} - -bool ObjectiveCGenerator::HasGenerateAll() const { - return true; -} - -bool ObjectiveCGenerator::Generate(const FileDescriptor* file, - const std::string& parameter, - GeneratorContext* context, - std::string* error) const { - *error = "Unimplemented Generate() method. Call GenerateAll() instead."; - return false; -} - -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 - // options along with their values. If the option appears multiple times, only - // the last value will be considered. - // - // e.g. protoc ... --objc_opt=expected_prefixes=file.txt,generate_for_named_framework=MyFramework - - Options validation_options; - FileGenerator::GenerationOptions generation_options; - - std::vector > options; - ParseGeneratorParameter(parameter, &options); - for (int i = 0; i < options.size(); i++) { - if (options[i].first == "expected_prefixes_path") { - // Path to find a file containing the expected prefixes - // (objc_class_prefix "PREFIX") for proto packages (package NAME). The - // generator will then issue warnings/errors if in the proto files being - // generated the option is not listed/wrong/etc in the file. - // - // The format of the file is: - // - An entry is a line of "package=prefix". - // - Comments start with "#". - // - A comment can go on a line after a expected package/prefix pair. - // (i.e. - "package=prefix # comment") - // - For files that do NOT have a proto package (not recommended), an - // entry can be made as "no_package:PATH=prefix", where PATH is the - // path for the .proto file. - // - // There is no validation that the prefixes are good prefixes, it is - // assumed that they are when you create the file. - validation_options.expected_prefixes_path = options[i].second; - } else if (options[i].first == "expected_prefixes_suppressions") { - // 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. - for (StringPiece split_piece : Split( - options[i].second, ";", true)) { - validation_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, - &validation_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, - &validation_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 - // name (i.e. - "#import ). - // - // NOTE: If this option is used with - // named_framework_to_proto_path_mappings_path, then this is effectively - // the "default" framework name used for everything that wasn't mapped by - // the mapping file. - generation_options.generate_for_named_framework = options[i].second; - } else if (options[i].first == "named_framework_to_proto_path_mappings_path") { - // Path to find a file containing the list of framework names and proto - // files. The generator uses this to decide if a proto file - // referenced should use a framework style import vs. a user level import - // (#import vs #import "dir/file.pbobjc.h"). - // - // The format of the file is: - // - An entry is a line of "frameworkName: file.proto, dir/file2.proto". - // - Comments start with "#". - // - A comment can go on a line after a expected package/prefix pair. - // (i.e. - "frameworkName: file.proto # comment") - // - // Any number of files can be listed for a framework, just separate them - // with commas. - // - // 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 == "package_to_prefix_mappings_path") { - // Path to use for when loading the objc class prefix mappings to use. - // The `objc_class_prefix` file option is always honored first if one is present. - // This option also has precedent over the use_package_as_prefix option. - // - // The format of the file is: - // - An entry is a line of "package=prefix". - // - Comments start with "#". - // - A comment can go on a line after a expected package/prefix pair. - // (i.e. - "package=prefix # comment") - // - For files that do NOT have a proto package (not recommended), an - // entry can be made as "no_package:PATH=prefix", where PATH is the - // path for the .proto file. - // - SetPackageToPrefixMappingsPath(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 if (options[i].first == "headers_use_forward_declarations") { - if (!StringToBool(options[i].second, - &generation_options.headers_use_forward_declarations)) { - *error = "error: Unknown value for headers_use_forward_declarations: " + options[i].second; - return false; - } - } else { - *error = "error: Unknown generator option: " + options[i].first; - return false; - } - } - - // ----------------------------------------------------------------- - - // 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, validation_options, error)) { - // *error will have been filled in. - return false; - } - - FileGenerator::CommonState state; - for (int i = 0; i < files.size(); i++) { - const FileDescriptor* file = files[i]; - FileGenerator file_generator(file, generation_options, state); - std::string filepath = FilePath(file); - - // Generate header. - { - std::unique_ptr output( - context->Open(filepath + ".pbobjc.h")); - io::Printer printer(output.get(), '$'); - file_generator.GenerateHeader(&printer); - } - - // 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(), '$'); - file_generator.GenerateSource(&printer); - } - } - - return true; -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.h deleted file mode 100644 index 1dbc666af..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.h +++ /dev/null @@ -1,79 +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. - -// Generates ObjectiveC code for a given .proto file. - -#ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__ - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -// CodeGenerator implementation which generates a ObjectiveC source file and -// header. If you create your own protocol compiler binary and you want it to -// support ObjectiveC output, you can do so by registering an instance of this -// CodeGenerator with the CommandLineInterface in your main() function. -class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator { - public: - ObjectiveCGenerator(); - ~ObjectiveCGenerator(); - - ObjectiveCGenerator(const ObjectiveCGenerator&) = delete; - ObjectiveCGenerator& operator=(const ObjectiveCGenerator&) = delete; - - // implements CodeGenerator ---------------------------------------- - 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 std::string& parameter, GeneratorContext* context, - std::string* error) const override; - - uint64_t GetSupportedFeatures() const override { - return FEATURE_PROTO3_OPTIONAL; - } -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc deleted file mode 100644 index b15f58095..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ /dev/null @@ -1,2043 +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 _MSC_VER -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 errors. - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -// is transitively included in this file. Import the functions explicitly -// in this port namespace to avoid ambiguous definition. -namespace posix { -#ifdef _WIN32 -using ::google::protobuf::io::win32::open; -#else -using ::open; -#endif -} // namespace port - -namespace { - -bool BoolFromEnvVar(const char* env_var, bool default_value) { - const char* value = getenv(env_var); - if (value) { - return std::string("YES") == ToUpper(value); - } - return default_value; -} - -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 PackageToPrefixesCollector : public LineConsumer { - public: - PackageToPrefixesCollector(const std::string &usage, - std::map* inout_package_to_prefix_map) - : usage_(usage), prefix_map_(inout_package_to_prefix_map) {} - - virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override; - - private: - const std::string usage_; - std::map* prefix_map_; -}; - -class PrefixModeStorage { - public: - PrefixModeStorage(); - - const std::string package_to_prefix_mappings_path() const { return package_to_prefix_mappings_path_; } - void set_package_to_prefix_mappings_path(const std::string& path) { - package_to_prefix_mappings_path_ = path; - package_to_prefix_map_.clear(); - } - - std::string prefix_from_proto_package_mappings(const FileDescriptor* file); - - 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); - - // When using a proto package as the prefix, this should be added as the - // prefix in front of it. - const std::string& forced_package_prefix() const { return forced_prefix_; } - - private: - bool use_package_name_; - std::map package_to_prefix_map_; - std::string package_to_prefix_mappings_path_; - std::string exception_path_; - std::string forced_prefix_; - 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. - - use_package_name_ = BoolFromEnvVar("GPB_OBJC_USE_PACKAGE_AS_PREFIX", false); - - const char* exception_path = getenv("GPB_OBJC_PACKAGE_PREFIX_EXCEPTIONS_PATH"); - if (exception_path) { - exception_path_ = exception_path; - } - - // This one is a not expected to be common, so it doesn't get a generation - // option, just the env var. - const char* prefix = getenv("GPB_OBJC_USE_PACKAGE_AS_PREFIX_PREFIX"); - if (prefix) { - forced_prefix_ = prefix; - } -} - -std::string PrefixModeStorage::prefix_from_proto_package_mappings(const FileDescriptor* file) { - if (!file) { - return ""; - } - - if (package_to_prefix_map_.empty() && !package_to_prefix_mappings_path_.empty()) { - std::string error_str; - // Re use the same collector as we use for expected_prefixes_path since the file - // format is the same. - PackageToPrefixesCollector collector("Package to prefixes", &package_to_prefix_map_); - if (!ParseSimpleFile(package_to_prefix_mappings_path_, &collector, &error_str)) { - if (error_str.empty()) { - error_str = std::string("protoc:0: warning: Failed to parse") - + std::string(" prefix to proto package mappings file: ") - + package_to_prefix_mappings_path_; - } - std::cerr << error_str << std::endl; - std::cerr.flush(); - package_to_prefix_map_.clear(); - } - } - - const std::string package = file->package(); - // For files without packages, the can be registered as "no_package:PATH", - // allowing the expected prefixes file. - static const std::string no_package_prefix("no_package:"); - const std::string lookup_key = package.empty() ? no_package_prefix + file->name() : package; - - std::map::const_iterator prefix_lookup = - package_to_prefix_map_.find(lookup_key); - - if (prefix_lookup != package_to_prefix_map_.end()) { - return prefix_lookup->second; - } - - return ""; -} - -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 - -std::string GetPackageToPrefixMappingsPath() { - return g_prefix_mode.package_to_prefix_mappings_path(); -} - -void SetPackageToPrefixMappingsPath(const std::string& file_path) { - g_prefix_mode.set_package_to_prefix_mappings_path(file_path); -} - -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() { - // While there are generator options, also support env variables to help with - // build systems where it isn't as easy to hook in for add the generation - // options when invoking protoc. - const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); - if (file_path) { - expected_prefixes_path = file_path; - } - const char* suppressions = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES_SUPPRESSIONS"); - if (suppressions) { - expected_prefixes_suppressions = - Split(suppressions, ";", true); - } - prefixes_must_be_registered = - BoolFromEnvVar("GPB_OBJC_PREFIXES_MUST_BE_REGISTERED", false); - require_prefixes = BoolFromEnvVar("GPB_OBJC_REQUIRE_PREFIXES", false); -} - -namespace { - -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]); - } - return result; -} - -const char* const kUpperSegmentsList[] = {"url", "http", "https"}; - -std::unordered_set kUpperSegments = - MakeWordsMap(kUpperSegmentsList, GOOGLE_ARRAYSIZE(kUpperSegmentsList)); - -bool ascii_isnewline(char c) { - return c == '\n' || c == '\r'; -} - -// 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. -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; - bool last_char_was_upper = false; - for (int i = 0; i < input.size(); i++) { - char c = input[i]; - if (ascii_isdigit(c)) { - if (!last_char_was_number) { - values.push_back(current); - current = ""; - } - current += c; - last_char_was_number = last_char_was_lower = last_char_was_upper = false; - last_char_was_number = true; - } else if (ascii_islower(c)) { - // lowercase letter can follow a lowercase or uppercase letter - if (!last_char_was_lower && !last_char_was_upper) { - values.push_back(current); - current = ""; - } - current += c; // already lower - last_char_was_number = last_char_was_lower = last_char_was_upper = false; - last_char_was_lower = true; - } else if (ascii_isupper(c)) { - if (!last_char_was_upper) { - values.push_back(current); - current = ""; - } - current += ascii_tolower(c); - last_char_was_number = last_char_was_lower = last_char_was_upper = false; - last_char_was_upper = true; - } else { - last_char_was_number = last_char_was_lower = last_char_was_upper = false; - } - } - values.push_back(current); - - std::string result; - bool first_segment_forces_upper = false; - 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; - } - for (int j = 0; j < value.length(); j++) { - if (j == 0 || all_upper) { - value[j] = ascii_toupper(value[j]); - } else { - // Nothing, already in lower. - } - } - result += value; - } - if ((result.length() != 0) && - !first_capitalized && - !first_segment_forces_upper) { - result[0] = ascii_tolower(result[0]); - } - return result; -} - -const char* const kReservedWordList[] = { - // Note NSObject Methods: - // These are brought in from objectivec_nsobject_methods.h that is generated - // using method_dump.sh. See kNSObjectMethods below. - - // Objective C "keywords" that aren't in C - // From - // http://stackoverflow.com/questions/1873630/reserved-keywords-in-objective-c - // with some others added on. - "id", "_cmd", "super", "in", "out", "inout", "bycopy", "byref", "oneway", - "self", "instancetype", "nullable", "nonnull", "nil", "Nil", - "YES", "NO", "weak", - - // C/C++ keywords (Incl C++ 0x11) - // From http://en.cppreference.com/w/cpp/keywords - "and", "and_eq", "alignas", "alignof", "asm", "auto", "bitand", "bitor", - "bool", "break", "case", "catch", "char", "char16_t", "char32_t", "class", - "compl", "const", "constexpr", "const_cast", "continue", "decltype", - "default", "delete", "double", "dynamic_cast", "else", "enum", "explicit", - "export", "extern ", "false", "float", "for", "friend", "goto", "if", - "inline", "int", "long", "mutable", "namespace", "new", "noexcept", "not", - "not_eq", "nullptr", "operator", "or", "or_eq", "private", "protected", - "public", "register", "reinterpret_cast", "return", "short", "signed", - "sizeof", "static", "static_assert", "static_cast", "struct", "switch", - "template", "this", "thread_local", "throw", "true", "try", "typedef", - "typeid", "typename", "union", "unsigned", "using", "virtual", "void", - "volatile", "wchar_t", "while", "xor", "xor_eq", - - // C99 keywords - // From - // http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fkeyw.htm - "restrict", - - // GCC/Clang extension - "typeof", - - // 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", - - // GPBMessage Methods - // Only need to add instance methods that may conflict with - // method declared in protos. The main cases are methods - // that take no arguments, or setFoo:/hasFoo: type methods. - "clear", "data", "delimitedData", "descriptor", "extensionRegistry", - "extensionsCurrentlySet", "initialized", "isInitialized", "serializedSize", - "sortedExtensionsInUse", "unknownFields", - - // MacTypes.h names - "Fixed", "Fract", "Size", "LogicalAddress", "PhysicalAddress", "ByteCount", - "ByteOffset", "Duration", "AbsoluteTime", "OptionBits", "ItemCount", - "PBVersion", "ScriptCode", "LangCode", "RegionCode", "OSType", - "ProcessSerialNumber", "Point", "Rect", "FixedPoint", "FixedRect", "Style", - "StyleParameter", "StyleField", "TimeScale", "TimeBase", "TimeRecord", -}; - -// returns true is input starts with __ or _[A-Z] which are reserved identifiers -// in C/ C++. All calls should go through UnderscoresToCamelCase before getting here -// 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 std::string& input) { - if (input.length() > 2) { - if (input.at(0) == '_') { - if (isupper(input.at(1)) || input.at(1) == '_') { - return true; - } - } - } - return false; -} - -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 = - MakeWordsMap(kNSObjectMethodsList, GOOGLE_ARRAYSIZE(kNSObjectMethodsList)); - 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 - // b) Isn't equivalent to the prefix or - // c) Has the prefix, but the letter after the prefix is lowercase - if (HasPrefixString(input, prefix)) { - if (input.length() == prefix.length() || !ascii_isupper(input[prefix.length()])) { - sanitized = prefix + input; - } else { - sanitized = input; - } - } else { - sanitized = prefix + input; - } - if (IsReservedCIdentifier(sanitized) || - (kReservedWords.count(sanitized) > 0) || - (kNSObjectMethods.count(sanitized) > 0)) { - if (out_suffix_added) *out_suffix_added = extension; - return sanitized + extension; - } - if (out_suffix_added) out_suffix_added->clear(); - return sanitized; -} - -std::string NameFromFieldDescriptor(const FieldDescriptor* field) { - if (field->type() == FieldDescriptor::TYPE_GROUP) { - return field->message_type()->name(); - } else { - return field->name(); - } -} - -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 = ""; - } - if (basename) { - *basename = path; - } - } else { - if (directory) { - *directory = path.substr(0, last_slash); - } - if (basename) { - *basename = path.substr(last_slash + 1); - } - } -} - -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(); - if (name.compare(0, length, special_names[i]) == 0) { - if (name.length() > length) { - // If name is longer than the retained_name[i] that it matches - // the next character must be not lower case (newton vs newTon vs - // new_ton). - return !ascii_islower(name[length]); - } else { - return true; - } - } - } - return false; -} - -std::string GetZeroEnumNameForFlagType(const FlagType flag_type) { - switch(flag_type) { - case FLAGTYPE_DESCRIPTOR_INITIALIZATION: - return "GPBDescriptorInitializationFlag_None"; - case FLAGTYPE_EXTENSION: - return "GPBExtensionNone"; - case FLAGTYPE_FIELD: - return "GPBFieldNone"; - default: - GOOGLE_LOG(FATAL) << "Can't get here."; - return "0"; - } -} - -std::string GetEnumNameForFlagType(const FlagType flag_type) { - switch(flag_type) { - case FLAGTYPE_DESCRIPTOR_INITIALIZATION: - return "GPBDescriptorInitializationFlags"; - case FLAGTYPE_EXTENSION: - return "GPBExtensionOptions"; - case FLAGTYPE_FIELD: - return "GPBFieldFlags"; - default: - GOOGLE_LOG(FATAL) << "Can't get here."; - 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 \? -std::string EscapeTrigraphs(const std::string& to_escape) { - return StringReplace(to_escape, "?", "\\?", true); -} - -void TrimWhitespace(StringPiece* input) { - while (!input->empty() && ascii_isspace(*input->data())) { - input->remove_prefix(1); - } - while (!input->empty() && ascii_isspace((*input)[input->length() - 1])) { - input->remove_suffix(1); - } -} - -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 std::string retained_names[] = {"new", "alloc", "copy", - "mutableCopy"}; - return IsSpecialName(name, retained_names, - sizeof(retained_names) / sizeof(retained_names[0])); -} - -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])); -} - -std::string BaseFileName(const FileDescriptor* file) { - std::string basename; - PathSplit(file->name(), NULL, &basename); - return basename; -} - -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 is specified in an prefix to proto mappings file then use that. - std::string objc_class_prefix = g_prefix_mode.prefix_from_proto_package_mappings(file); - if (!objc_class_prefix.empty()) { - return objc_class_prefix; - } - - // If package prefix isn't enabled, done. - if (!g_prefix_mode.use_package_name()) { - 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 g_prefix_mode.forced_package_prefix() + result; -} - -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 + "/"; - } - basename = StripProto(basename); - - // CamelCase to be more ObjC friendly. - basename = UnderscoresToCamelCase(basename, true); - - output += basename; - return output; -} - -std::string FilePathBasename(const FileDescriptor* file) { - std::string output; - std::string basename; - std::string directory; - PathSplit(file->name(), &directory, &basename); - basename = StripProto(basename); - - // CamelCase to be more ObjC friendly. - output = UnderscoresToCamelCase(basename, true); - - return output; -} - -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); -} - -std::string ClassNameWorker(const Descriptor* descriptor) { - std::string name; - if (descriptor->containing_type() != NULL) { - name = ClassNameWorker(descriptor->containing_type()); - name += "_"; - } - return name + descriptor->name(); -} - -std::string ClassNameWorker(const EnumDescriptor* descriptor) { - std::string name; - if (descriptor->containing_type() != NULL) { - name = ClassNameWorker(descriptor->containing_type()); - name += "_"; - } - return name + descriptor->name(); -} - -std::string ClassName(const Descriptor* descriptor) { - return ClassName(descriptor, NULL); -} - -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 std::string prefix = FileClassPrefix(descriptor->file()); - const std::string name = ClassNameWorker(descriptor); - return SanitizeNameForObjC(prefix, name, "_Class", out_suffix_added); -} - -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 { - // message Size {...} - // enum Mumble {...} - // ... - // } - // yields Fixed_Class, Fixed_Size. - const std::string prefix = FileClassPrefix(descriptor->file()); - const std::string name = ClassNameWorker(descriptor); - return SanitizeNameForObjC(prefix, name, "_Enum", NULL); -} - -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 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); -} - -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. - // The "short name" is intended to be the final leaf, the value name; but - // you can't simply send that off to sanitize as that could result in it - // getting modified when the full name didn't. For example enum - // "StorageModes" has a value "retain". So the full name is - // "StorageModes_Retain", but if we sanitize "retain" it would become - // "RetainValue". - // 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 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); -} - -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)) { - result += '_'; - } - result += ascii_toupper(c); - } - return result; -} - -std::string ExtensionMethodName(const FieldDescriptor* descriptor) { - const std::string name = NameFromFieldDescriptor(descriptor); - const std::string result = UnderscoresToCamelCase(name, false); - return SanitizeNameForObjC("", result, "_Extension", NULL); -} - -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"; - } else { - // If it wasn't repeated, but ends in "Array", force on the _p suffix. - if (HasSuffixString(result, "Array")) { - result += "_p"; - } - } - return SanitizeNameForObjC("", result, "_p", NULL); -} - -std::string FieldNameCapitalized(const FieldDescriptor* field) { - // Want the same suffix handling, so upcase the first letter of the other - // name. - std::string result = FieldName(field); - if (result.length() > 0) { - result[0] = ascii_toupper(result[0]); - } - return result; -} - -std::string OneofEnumName(const OneofDescriptor* descriptor) { - const Descriptor* fieldDescriptor = descriptor->containing_type(); - 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; -} - -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; -} - -std::string OneofNameCapitalized(const OneofDescriptor* descriptor) { - // Use the common handling and then up-case the first letter. - std::string result = OneofName(descriptor); - if (result.length() > 0) { - result[0] = ascii_toupper(result[0]); - } - return result; -} - -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"); - } - if (field->is_repeated() && HasSuffixString(worker, "Array")) { - worker = StripSuffixString(worker, "Array"); - } - if (field->type() == FieldDescriptor::TYPE_GROUP) { - if (worker.length() > 0) { - if (ascii_islower(worker[0])) { - worker[0] = ascii_toupper(worker[0]); - } - } - return worker; - } else { - std::string result; - for (int i = 0; i < worker.size(); i++) { - char c = worker[i]; - if (ascii_isupper(c)) { - if (i > 0) { - result += '_'; - } - result += ascii_tolower(c); - } else { - result += c; - } - } - return result; - } -} - -std::string GetCapitalizedType(const FieldDescriptor* field) { - switch (field->type()) { - case FieldDescriptor::TYPE_INT32: - return "Int32"; - case FieldDescriptor::TYPE_UINT32: - return "UInt32"; - case FieldDescriptor::TYPE_SINT32: - return "SInt32"; - case FieldDescriptor::TYPE_FIXED32: - return "Fixed32"; - case FieldDescriptor::TYPE_SFIXED32: - return "SFixed32"; - case FieldDescriptor::TYPE_INT64: - return "Int64"; - case FieldDescriptor::TYPE_UINT64: - return "UInt64"; - case FieldDescriptor::TYPE_SINT64: - return "SInt64"; - case FieldDescriptor::TYPE_FIXED64: - return "Fixed64"; - case FieldDescriptor::TYPE_SFIXED64: - return "SFixed64"; - case FieldDescriptor::TYPE_FLOAT: - return "Float"; - case FieldDescriptor::TYPE_DOUBLE: - return "Double"; - case FieldDescriptor::TYPE_BOOL: - return "Bool"; - case FieldDescriptor::TYPE_STRING: - return "String"; - case FieldDescriptor::TYPE_BYTES: - return "Bytes"; - case FieldDescriptor::TYPE_ENUM: - return "Enum"; - case FieldDescriptor::TYPE_GROUP: - return "Group"; - case FieldDescriptor::TYPE_MESSAGE: - return "Message"; - } - - // 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 std::string(); -} - -ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) { - switch (field_type) { - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_SFIXED32: - return OBJECTIVECTYPE_INT32; - - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_FIXED32: - return OBJECTIVECTYPE_UINT32; - - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_SFIXED64: - return OBJECTIVECTYPE_INT64; - - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_FIXED64: - return OBJECTIVECTYPE_UINT64; - - case FieldDescriptor::TYPE_FLOAT: - return OBJECTIVECTYPE_FLOAT; - - case FieldDescriptor::TYPE_DOUBLE: - return OBJECTIVECTYPE_DOUBLE; - - case FieldDescriptor::TYPE_BOOL: - return OBJECTIVECTYPE_BOOLEAN; - - case FieldDescriptor::TYPE_STRING: - return OBJECTIVECTYPE_STRING; - - case FieldDescriptor::TYPE_BYTES: - return OBJECTIVECTYPE_DATA; - - case FieldDescriptor::TYPE_ENUM: - return OBJECTIVECTYPE_ENUM; - - case FieldDescriptor::TYPE_GROUP: - case FieldDescriptor::TYPE_MESSAGE: - return OBJECTIVECTYPE_MESSAGE; - } - - // 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 OBJECTIVECTYPE_INT32; -} - -bool IsPrimitiveType(const FieldDescriptor* field) { - ObjectiveCType type = GetObjectiveCType(field); - switch (type) { - case OBJECTIVECTYPE_INT32: - case OBJECTIVECTYPE_UINT32: - case OBJECTIVECTYPE_INT64: - case OBJECTIVECTYPE_UINT64: - case OBJECTIVECTYPE_FLOAT: - case OBJECTIVECTYPE_DOUBLE: - case OBJECTIVECTYPE_BOOLEAN: - case OBJECTIVECTYPE_ENUM: - return true; - break; - default: - return false; - } -} - -bool IsReferenceType(const FieldDescriptor* field) { - return !IsPrimitiveType(field); -} - -static std::string HandleExtremeFloatingPoint(std::string val, - bool add_float_suffix) { - if (val == "nan") { - return "NAN"; - } else if (val == "inf") { - return "INFINITY"; - } else if (val == "-inf") { - return "-INFINITY"; - } else { - // float strings with ., e or E need to have f appended - 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; - } -} - -std::string GPBGenericValueFieldName(const FieldDescriptor* field) { - // Returns the field within the GPBGenericValue union to use for the given - // field. - if (field->is_repeated()) { - return "valueMessage"; - } - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return "valueInt32"; - case FieldDescriptor::CPPTYPE_UINT32: - return "valueUInt32"; - case FieldDescriptor::CPPTYPE_INT64: - return "valueInt64"; - case FieldDescriptor::CPPTYPE_UINT64: - return "valueUInt64"; - case FieldDescriptor::CPPTYPE_FLOAT: - return "valueFloat"; - case FieldDescriptor::CPPTYPE_DOUBLE: - return "valueDouble"; - case FieldDescriptor::CPPTYPE_BOOL: - return "valueBool"; - case FieldDescriptor::CPPTYPE_STRING: - if (field->type() == FieldDescriptor::TYPE_BYTES) { - return "valueData"; - } else { - return "valueString"; - } - case FieldDescriptor::CPPTYPE_ENUM: - return "valueEnum"; - case FieldDescriptor::CPPTYPE_MESSAGE: - return "valueMessage"; - } - - // 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 std::string(); -} - - -std::string DefaultValue(const FieldDescriptor* field) { - // Repeated fields don't have defaults. - if (field->is_repeated()) { - return "nil"; - } - - // Switch on cpp_type since we need to know which default_value_* method - // of FieldDescriptor to call. - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - // gcc and llvm reject the decimal form of kint32min and kint64min. - if (field->default_value_int32() == INT_MIN) { - return "-0x80000000"; - } - return StrCat(field->default_value_int32()); - case FieldDescriptor::CPPTYPE_UINT32: - return StrCat(field->default_value_uint32()) + "U"; - case FieldDescriptor::CPPTYPE_INT64: - // gcc and llvm reject the decimal form of kint32min and kint64min. - if (field->default_value_int64() == LLONG_MIN) { - return "-0x8000000000000000LL"; - } - return StrCat(field->default_value_int64()) + "LL"; - case FieldDescriptor::CPPTYPE_UINT64: - return StrCat(field->default_value_uint64()) + "ULL"; - case FieldDescriptor::CPPTYPE_DOUBLE: - return HandleExtremeFloatingPoint( - SimpleDtoa(field->default_value_double()), false); - case FieldDescriptor::CPPTYPE_FLOAT: - return HandleExtremeFloatingPoint( - SimpleFtoa(field->default_value_float()), true); - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool() ? "YES" : "NO"; - case FieldDescriptor::CPPTYPE_STRING: { - const bool has_default_value = field->has_default_value(); - 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 - // default for both strings and data. - return "nil"; - } - if (field->type() == FieldDescriptor::TYPE_BYTES) { - // We want constant fields in our data structures so we can - // declare them as static. To achieve this we cheat and stuff - // a escaped c string (prefixed with a length) into the data - // field, and cast it to an (NSData*) so it will compile. - // The runtime library knows how to handle it. - - // Must convert to a standard byte order for packing length into - // a cstring. - 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 { - return "@\"" + EscapeTrigraphs(CEscape(default_string)) + "\""; - } - } - case FieldDescriptor::CPPTYPE_ENUM: - return EnumValueName(field->default_value_enum()); - case FieldDescriptor::CPPTYPE_MESSAGE: - return "nil"; - } - - // 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 std::string(); -} - -bool HasNonZeroDefaultValue(const FieldDescriptor* field) { - // Repeated fields don't have defaults. - if (field->is_repeated()) { - return false; - } - - // As much as checking field->has_default_value() seems useful, it isn't - // because of enums. proto2 syntax allows the first item in an enum (the - // default) to be non zero. So checking field->has_default_value() would - // result in missing this non zero default. See MessageWithOneBasedEnum in - // objectivec/Tests/unittest_objc.proto for a test Message to confirm this. - - // Some proto file set the default to the zero value, so make sure the value - // isn't the zero case. - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return field->default_value_int32() != 0; - case FieldDescriptor::CPPTYPE_UINT32: - return field->default_value_uint32() != 0U; - case FieldDescriptor::CPPTYPE_INT64: - return field->default_value_int64() != 0LL; - case FieldDescriptor::CPPTYPE_UINT64: - return field->default_value_uint64() != 0ULL; - case FieldDescriptor::CPPTYPE_DOUBLE: - return field->default_value_double() != 0.0; - case FieldDescriptor::CPPTYPE_FLOAT: - return field->default_value_float() != 0.0f; - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool(); - case FieldDescriptor::CPPTYPE_STRING: { - const std::string& default_string = field->default_value_string(); - return default_string.length() != 0; - } - case FieldDescriptor::CPPTYPE_ENUM: - return field->default_value_enum()->number() != 0; - case FieldDescriptor::CPPTYPE_MESSAGE: - return false; - } - - // 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 false; -} - -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]; - } - std::string string("(" + GetEnumNameForFlagType(flag_type) + ")("); - for (size_t i = 0; i != strings.size(); ++i) { - if (i > 0) { - string.append(" | "); - } - string.append(strings[i]); - } - string.append(")"); - return string; -} - -std::string BuildCommentsString(const SourceLocation& location, - bool prefer_single_line) { - const std::string& comments = location.leading_comments.empty() - ? location.trailing_comments - : location.leading_comments; - 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.empty()) { - return ""; - } - - std::string prefix; - std::string suffix; - std::string final_comments; - std::string epilogue; - - bool add_leading_space = false; - - if (prefer_single_line && lines.size() == 1) { - prefix = "/** "; - suffix = " */\n"; - } else { - prefix = "* "; - suffix = "\n"; - final_comments += "/**\n"; - epilogue = " **/\n"; - add_leading_space = true; - } - - for (int i = 0; i < lines.size(); i++) { - std::string line = StripPrefixString(lines[i], " "); - // HeaderDoc and appledoc use '\' and '@' for markers; escape them. - line = StringReplace(line, "\\", "\\\\", true); - line = StringReplace(line, "@", "\\@", true); - // Decouple / from * to not have inline comments inside comments. - line = StringReplace(line, "/*", "/\\*", true); - line = StringReplace(line, "*/", "*\\/", true); - line = prefix + line; - StripWhitespace(&line); - // If not a one line, need to add the first space before *, as - // StripWhitespace would have removed it. - line = (add_leading_space ? " " : "") + line; - final_comments += line + suffix; - } - final_comments += epilogue; - return final_comments; -} - -// Making these a generator option for folks that don't use CocoaPods, but do -// 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"; - -std::string ProtobufFrameworkImportSymbol(const std::string& framework_name) { - // GPB_USE_[framework_name]_FRAMEWORK_IMPORTS - std::string result = std::string("GPB_USE_"); - result += ToUpper(framework_name); - result += "_FRAMEWORK_IMPORTS"; - return result; -} - -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 std::string name = file->name(); - if (name == "google/protobuf/any.proto" || - name == "google/protobuf/api.proto" || - name == "google/protobuf/duration.proto" || - name == "google/protobuf/empty.proto" || - name == "google/protobuf/field_mask.proto" || - name == "google/protobuf/source_context.proto" || - name == "google/protobuf/struct.proto" || - name == "google/protobuf/timestamp.proto" || - name == "google/protobuf/type.proto" || - name == "google/protobuf/wrappers.proto") { - return true; - } - return false; -} - -bool ReadLine(StringPiece* input, StringPiece* line) { - for (int len = 0; len < input->size(); ++len) { - if (ascii_isnewline((*input)[len])) { - *line = StringPiece(input->data(), len); - ++len; // advance over the newline - *input = StringPiece(input->data() + len, input->size() - len); - return true; - } - } - return false; // Ran out of input with no newline. -} - -void RemoveComment(StringPiece* input) { - int offset = input->find('#'); - if (offset != StringPiece::npos) { - input->remove_suffix(input->length() - offset); - } -} - -namespace { - -bool PackageToPrefixesCollector::ConsumeLine( - const StringPiece& line, std::string* out_error) { - int offset = line.find('='); - if (offset == StringPiece::npos) { - *out_error = usage_ + " file line without equal sign: '" + StrCat(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_)[std::string(package)] = std::string(prefix); - return true; -} - -bool LoadExpectedPackagePrefixes(const std::string& expected_prefixes_path, - std::map* prefix_map, - std::string* out_error) { - if (expected_prefixes_path.empty()) { - return true; - } - - PackageToPrefixesCollector collector("Expected prefixes", prefix_map); - return ParseSimpleFile( - expected_prefixes_path, &collector, out_error); -} - -bool ValidateObjCClassPrefix( - 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(); - // For files without packages, the can be registered as "no_package:PATH", - // allowing the expected prefixes file. - static const std::string no_package_prefix("no_package:"); - const std::string lookup_key = - package.empty() ? no_package_prefix + file->name() : 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 = - expected_package_prefixes.find(lookup_key); - if (package_match != expected_package_prefixes.end()) { - // There was an entry, and... - if (has_prefix && package_match->second == prefix) { - // ...it matches. All good, out of here! - return true; - } else { - // ...it didn't match! - *out_error = "error: Expected 'option objc_class_prefix = \"" + - package_match->second + "\";'"; - if (!package.empty()) { - *out_error += " for package '" + package + "'"; - } - *out_error += " in '" + file->name() + "'"; - if (has_prefix) { - *out_error += "; but found '" + prefix + "' instead"; - } - *out_error += "."; - return false; - } - } - - // If there was no prefix option, we're done at this point. - 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; - // Stop on the first real package listing, if it was a no_package file - // specific entry, keep looking to try and find a package one. - if (!HasPrefixString(other_package_for_prefix, no_package_prefix)) { - break; - } - } - } - - // 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 "; - if (HasPrefixString(other_package_for_prefix, no_package_prefix)) { - *out_error += "file '" + - StripPrefixString(other_package_for_prefix, no_package_prefix) + - "'."; - } else { - *out_error += "'package " + other_package_for_prefix + ";'."; - } - *out_error += - " It can only be reused by adding '" + lookup_key + " = " + prefix + - "' to the expected prefixes file (" + expected_prefixes_path + ")."; - return false; // Only report first usage of the prefix. - } - } // !prefix.empty() && have_expected_prefix_file - - // 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 (!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.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 - << "protoc:0: warning: Invalid 'option objc_class_prefix = \"" - << prefix << "\";' in '" << file->name() << "';" - << " Apple recommends they should be at least 3 characters long." - << 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 '" + lookup_key + " = " + - (prefix.empty() ? "\"\"" : prefix) + - "' to the expected prefixes file (" + expected_prefixes_path + ")."; - return false; - } - - std::cerr - << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \"" - << prefix << "\";' in '" << file->name() << "'; consider adding '" - << lookup_key << " = " << (prefix.empty() ? "\"\"" : prefix) - << "' to the expected prefixes file (" << expected_prefixes_path - << ")." << std::endl; - std::cerr.flush(); - } - - return true; -} - -} // namespace - -bool ValidateObjCClassPrefixes(const std::vector& files, - std::string* out_error) { - // Options's ctor load from the environment. - Options options; - return ValidateObjCClassPrefixes(files, options, out_error); -} - -bool ValidateObjCClassPrefixes(const std::vector& files, - const Options& generation_options, - 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; - if (!LoadExpectedPackagePrefixes(generation_options.expected_prefixes_path, - &expected_package_prefixes, - out_error)) { - return false; - } - - for (int i = 0; i < files.size(); i++) { - bool should_skip = - (std::find(generation_options.expected_prefixes_suppressions.begin(), - generation_options.expected_prefixes_suppressions.end(), - files[i]->name()) - != generation_options.expected_prefixes_suppressions.end()); - if (should_skip) { - continue; - } - - bool is_valid = - 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; - } - } - return true; -} - -TextFormatDecodeData::TextFormatDecodeData() { } - -TextFormatDecodeData::~TextFormatDecodeData() { } - -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) { - std::cerr << "error: duplicate key (" << key - << ") making TextFormat data, input: \"" << input_for_decode - << "\", desired: \"" << desired_output << "\"." << std::endl; - std::cerr.flush(); - abort(); - } - } - - const std::string& data = TextFormatDecodeData::DecodeDataForString( - input_for_decode, desired_output); - entries_.push_back(DataEntry(key, data)); -} - -std::string TextFormatDecodeData::Data() const { - std::ostringstream data_stringstream; - - if (num_entries() > 0) { - io::OstreamOutputStream data_outputstream(&data_stringstream); - io::CodedOutputStream output_stream(&data_outputstream); - - output_stream.WriteVarint32(num_entries()); - for (std::vector::const_iterator i = entries_.begin(); - i != entries_.end(); ++i) { - output_stream.WriteVarint32(i->first); - output_stream.WriteString(i->second); - } - } - - data_stringstream.flush(); - return data_stringstream.str(); -} - -namespace { - -// Helper to build up the decode data for a string. -class DecodeDataBuilder { - public: - DecodeDataBuilder() { Reset(); } - - bool AddCharacter(const char desired, const char input); - void AddUnderscore() { - Push(); - need_underscore_ = true; - } - std::string Finish() { - Push(); - return decode_data_; - } - - private: - static constexpr uint8_t kAddUnderscore = 0x80; - - 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 constexpr int kMaxSegmentLen = 0x1f; - - void AddChar(const char desired) { - ++segment_len_; - is_all_upper_ &= ascii_isupper(desired); - } - - void Push() { - uint8_t op = (op_ | segment_len_); - if (need_underscore_) op |= kAddUnderscore; - if (op != 0) { - decode_data_ += (char)op; - } - Reset(); - } - - bool AddFirst(const char desired, const char input) { - if (desired == input) { - op_ = kOpAsIs; - } else if (desired == ascii_toupper(input)) { - op_ = kOpFirstUpper; - } else if (desired == ascii_tolower(input)) { - op_ = kOpFirstLower; - } else { - // Can't be transformed to match. - return false; - } - AddChar(desired); - return true; - } - - void Reset() { - need_underscore_ = false; - op_ = 0; - segment_len_ = 0; - is_all_upper_ = true; - } - - bool need_underscore_; - bool is_all_upper_; - uint8_t op_; - int segment_len_; - - std::string decode_data_; -}; - -bool DecodeDataBuilder::AddCharacter(const char desired, const char input) { - // If we've hit the max size, push to start a new segment. - if (segment_len_ == kMaxSegmentLen) { - Push(); - } - if (segment_len_ == 0) { - return AddFirst(desired, input); - } - - // Desired and input match... - if (desired == input) { - // If we aren't transforming it, or we're upper casing it and it is - // supposed to be uppercase; just add it to the segment. - if ((op_ != kOpAllUpper) || ascii_isupper(desired)) { - AddChar(desired); - return true; - } - - // Add the current segment, and start the next one. - Push(); - return AddFirst(desired, input); - } - - // If we need to uppercase, and everything so far has been uppercase, - // promote op to AllUpper. - if ((desired == ascii_toupper(input)) && is_all_upper_) { - op_ = kOpAllUpper; - AddChar(desired); - return true; - } - - // Give up, push and start a new segment. - Push(); - return AddFirst(desired, input); -} - -// If decode data can't be generated, a directive for the raw string -// is used instead. -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. - return result; -} - -} // namespace - -// static -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') != 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; - std::cerr.flush(); - abort(); - } - - DecodeDataBuilder builder; - - // Walk the output building it from the input. - int x = 0; - for (int y = 0; y < desired_output.size(); y++) { - const char d = desired_output[y]; - if (d == '_') { - builder.AddUnderscore(); - continue; - } - - if (x >= input_for_decode.size()) { - // Out of input, no way to encode it, just return a full decode. - return DirectDecodeString(desired_output); - } - if (builder.AddCharacter(d, input_for_decode[x])) { - ++x; // Consumed one input - } else { - // Couldn't transform for the next character, just return a full decode. - return DirectDecodeString(desired_output); - } - } - - if (x != input_for_decode.size()) { - // Extra input (suffix from name sanitizing?), just return a full decode. - return DirectDecodeString(desired_output); - } - - // Add the end marker. - return builder.Finish() + (char)'\0'; -} - -namespace { - -class Parser { - public: - Parser(LineConsumer* line_consumer) - : line_consumer_(line_consumer), line_(0) {} - - // 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 - // 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_; } - - private: - LineConsumer* line_consumer_; - int line_; - std::string leftover_; -}; - -bool Parser::ParseChunk(StringPiece chunk, std::string* out_error) { - StringPiece full_chunk; - if (!leftover_.empty()) { - leftover_ += std::string(chunk); - full_chunk = StringPiece(leftover_); - } else { - full_chunk = chunk; - } - - 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_ = std::string(full_chunk); - } - 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; - } - // 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 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 - -LineConsumer::LineConsumer() {} - -LineConsumer::~LineConsumer() {} - -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 = 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 (input_stream.Next(&buf, &buf_len)) { - if (buf_len == 0) { - continue; - } - - if (!parser.ParseChunk(StringPiece(static_cast(buf), buf_len), - &local_error)) { - *out_error = FullErrorString(stream_name, parser.last_line(), local_error); - return false; - } - } - if (!parser.Finish(&local_error)) { - *out_error = FullErrorString(stream_name, parser.last_line(), local_error); - return false; - } - return true; -} - -ImportWriter::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) - : 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) {} - -ImportWriter::~ImportWriter() {} - -void ImportWriter::AddFile(const FileDescriptor* 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_) { - const std::string header_name = - "GPB" + FilePathBasename(file) + header_extension; - protobuf_imports_.push_back(header_name); - } - return; - } - - // Lazy parse any mappings. - if (need_to_parse_mapping_file_) { - ParseFrameworkMappings(); - } - - 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( - proto_lookup->second + "/" + - FilePathBasename(file) + header_extension); - return; - } - - if (!generate_for_named_framework_.empty()) { - other_framework_imports_.push_back( - generate_for_named_framework_ + "/" + - FilePathBasename(file) + header_extension); - return; - } - - other_imports_.push_back(FilePath(file) + header_extension); -} - -void ImportWriter::Print(io::Printer* printer) const { - bool add_blank_line = false; - - if (!protobuf_imports_.empty()) { - PrintRuntimeImports(printer, protobuf_imports_, runtime_import_prefix_); - add_blank_line = true; - } - - if (!other_framework_imports_.empty()) { - if (add_blank_line) { - printer->Print("\n"); - } - - for (std::vector::const_iterator iter = - other_framework_imports_.begin(); - iter != other_framework_imports_.end(); ++iter) { - printer->Print( - "#import <$header$>\n", - "header", *iter); - } - - add_blank_line = true; - } - - if (!other_imports_.empty()) { - if (add_blank_line) { - printer->Print("\n"); - } - - for (std::vector::const_iterator iter = other_imports_.begin(); - iter != other_imports_.end(); ++iter) { - printer->Print( - "#import \"$header$\"\n", - "header", *iter); - } - } -} - -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()) { - return; // Nothing to do. - } - - ProtoFrameworkCollector collector(&proto_file_to_framework_name_); - 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_ - << " : " << parse_error << std::endl; - std::cerr.flush(); - } -} - -bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( - const StringPiece& line, std::string* out_error) { - int offset = line.find(':'); - if (offset == StringPiece::npos) { - *out_error = - std::string("Framework/proto file mapping line without colon sign: '") + - std::string(line) + "'."; - return false; - } - StringPiece framework_name = line.substr(0, offset); - StringPiece proto_file_list = line.substr(offset + 1); - TrimWhitespace(&framework_name); - - int start = 0; - while (start < proto_file_list.length()) { - offset = proto_file_list.find(',', start); - if (offset == StringPiece::npos) { - offset = proto_file_list.length(); - } - - StringPiece proto_file = proto_file_list.substr(start, offset - start); - TrimWhitespace(&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 '" - << std::string(proto_file) << "' with '" << std::string(framework_name) - << "' (was '" << existing_entry->second << "')." << std::endl; - std::cerr.flush(); - } - - 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: '" - << std::string(proto_file) << "'" << std::endl; - std::cerr.flush(); - } - - (*map_)[std::string(proto_file)] = std::string(framework_name); - } - - start = offset + 1; - } - - return true; -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h deleted file mode 100644 index d21fed215..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ /dev/null @@ -1,353 +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. - -// Helper functions for generating ObjectiveC code. - -#ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_HELPERS_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_HELPERS_H__ - -#include -#include - -#include -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -// Get/Set the path to a file to load for objc class prefix lookups. -std::string PROTOC_EXPORT GetPackageToPrefixMappingsPath(); -void PROTOC_EXPORT SetPackageToPrefixMappingsPath( - const std::string& file_path); -// 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 -// `UseProtoPackageAsDefaultPrefix()` is `true`. An empty string means there -// should be no exceptions. -std::string PROTOC_EXPORT GetProtoPackagePrefixExceptionList(); -void PROTOC_EXPORT SetProtoPackagePrefixExceptionList( - const std::string& file_path); - -// Generator Prefix Validation Options (see objectivec_generator.cc for a -// description of each): -struct Options { - Options(); - std::string expected_prefixes_path; - std::vector expected_prefixes_suppressions; - bool prefixes_must_be_registered; - bool require_prefixes; -}; - -// Escape C++ trigraphs by escaping question marks to "\?". -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 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 std::string& name); - -// 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. -std::string PROTOC_EXPORT FilePath(const FileDescriptor* file); - -// Just like FilePath(), but without the directory part. -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 -std::string PROTOC_EXPORT FileClassName(const FileDescriptor* file); - -// These return the fully-qualified class name corresponding to the given -// 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. -std::string PROTOC_EXPORT EnumValueName(const EnumValueDescriptor* descriptor); - -// Returns the name of the enum value corresponding to the descriptor. -std::string PROTOC_EXPORT EnumValueShortName(const EnumValueDescriptor* descriptor); - -// Reverse what an enum does. -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). -std::string PROTOC_EXPORT ExtensionMethodName(const FieldDescriptor* descriptor); - -// Returns the transformed field name. -std::string PROTOC_EXPORT FieldName(const FieldDescriptor* field); -std::string PROTOC_EXPORT FieldNameCapitalized(const FieldDescriptor* field); - -// Returns the transformed oneof name. -std::string PROTOC_EXPORT OneofEnumName(const OneofDescriptor* descriptor); -std::string PROTOC_EXPORT OneofName(const OneofDescriptor* descriptor); -std::string PROTOC_EXPORT OneofNameCapitalized(const OneofDescriptor* descriptor); - -// 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; -} - -inline bool IsMapEntryMessage(const Descriptor* descriptor) { - return descriptor->options().map_entry(); -} - -// Reverse of the above. -std::string PROTOC_EXPORT UnCamelCaseFieldName(const std::string& name, - const FieldDescriptor* field); - -enum ObjectiveCType { - OBJECTIVECTYPE_INT32, - OBJECTIVECTYPE_UINT32, - OBJECTIVECTYPE_INT64, - OBJECTIVECTYPE_UINT64, - OBJECTIVECTYPE_FLOAT, - OBJECTIVECTYPE_DOUBLE, - OBJECTIVECTYPE_BOOLEAN, - OBJECTIVECTYPE_STRING, - OBJECTIVECTYPE_DATA, - OBJECTIVECTYPE_ENUM, - OBJECTIVECTYPE_MESSAGE -}; - -enum FlagType { - FLAGTYPE_DESCRIPTOR_INITIALIZATION, - FLAGTYPE_EXTENSION, - FLAGTYPE_FIELD -}; - -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 - // field or enum value with when the file is deprecated. - bool isFileLevelDeprecation = false; - if (!isDeprecated && file) { - isFileLevelDeprecation = file->options().deprecated(); - isDeprecated = isFileLevelDeprecation; - } - if (isDeprecated) { - std::string message; - const FileDescriptor* sourceFile = descriptor->file(); - if (isFileLevelDeprecation) { - message = sourceFile->name() + " is deprecated."; - } else { - message = descriptor->full_name() + " is deprecated (see " + - sourceFile->name() + ")."; - } - - std::string result = std::string("GPB_DEPRECATED_MSG(\"") + message + "\")"; - if (preSpace) { - result.insert(0, " "); - } - if (postNewline) { - result.append("\n"); - } - return result; - } else { - return ""; - } -} - -std::string PROTOC_EXPORT GetCapitalizedType(const FieldDescriptor* field); - -ObjectiveCType PROTOC_EXPORT -GetObjectiveCType(FieldDescriptor::Type field_type); - -inline ObjectiveCType GetObjectiveCType(const FieldDescriptor* field) { - return GetObjectiveCType(field->type()); -} - -bool PROTOC_EXPORT IsPrimitiveType(const FieldDescriptor* field); -bool PROTOC_EXPORT IsReferenceType(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); - -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. -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. -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 -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& validation_options, std::string* out_error); -// Same was the other ValidateObjCClassPrefixes() calls, but the options all -// come from the environment variables. -bool PROTOC_EXPORT ValidateObjCClassPrefixes( - const std::vector& files, std::string* out_error); - -// Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform -// the input into the expected output. -class PROTOC_EXPORT TextFormatDecodeData { - public: - TextFormatDecodeData(); - ~TextFormatDecodeData(); - - TextFormatDecodeData(const TextFormatDecodeData&) = delete; - TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete; - - void AddString(int32_t key, const std::string& input_for_decode, - const std::string& desired_output); - size_t num_entries() const { return entries_.size(); } - std::string Data() const; - - static std::string DecodeDataForString(const std::string& input_for_decode, - const std::string& desired_output); - - private: - typedef std::pair DataEntry; - std::vector entries_; -}; - -// Helper for parsing simple files. -class PROTOC_EXPORT LineConsumer { - public: - LineConsumer(); - virtual ~LineConsumer(); - virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) = 0; -}; - -bool PROTOC_EXPORT ParseSimpleFile(const std::string& path, - LineConsumer* line_consumer, - 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 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 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) - : map_(inout_proto_file_to_framework_name) {} - - virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override; - - private: - std::map* map_; - }; - - void ParseFrameworkMappings(); - - 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_; - bool need_to_parse_mapping_file_; - - std::vector protobuf_imports_; - std::vector other_framework_imports_; - std::vector other_imports_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_HELPERS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc deleted file mode 100644 index 99d758153..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc +++ /dev/null @@ -1,196 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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 compiler { -namespace objectivec { - -// MapFieldGenerator uses RepeatedFieldGenerator as the parent because it -// provides a bunch of things (no has* methods, comments for contained type, -// etc.). - -namespace { - -const char* MapEntryTypeName(const FieldDescriptor* descriptor, bool isKey) { - ObjectiveCType type = GetObjectiveCType(descriptor); - switch (type) { - case OBJECTIVECTYPE_INT32: - return "Int32"; - case OBJECTIVECTYPE_UINT32: - return "UInt32"; - case OBJECTIVECTYPE_INT64: - return "Int64"; - case OBJECTIVECTYPE_UINT64: - return "UInt64"; - case OBJECTIVECTYPE_FLOAT: - return "Float"; - case OBJECTIVECTYPE_DOUBLE: - return "Double"; - case OBJECTIVECTYPE_BOOLEAN: - return "Bool"; - case OBJECTIVECTYPE_STRING: - return (isKey ? "String" : "Object"); - case OBJECTIVECTYPE_DATA: - return "Object"; - case OBJECTIVECTYPE_ENUM: - return "Enum"; - case OBJECTIVECTYPE_MESSAGE: - return "Object"; - } - - // 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 NULL; -} - -} // namespace - -MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor) - : RepeatedFieldGenerator(descriptor) { - const FieldDescriptor* key_descriptor = - descriptor->message_type()->map_key(); - const FieldDescriptor* value_descriptor = - descriptor->message_type()->map_value(); - value_field_generator_.reset(FieldGenerator::Make(value_descriptor)); - - // Pull over some variables_ from the value. - variables_["field_type"] = value_field_generator_->variable("field_type"); - variables_["default"] = value_field_generator_->variable("default"); - variables_["default_name"] = value_field_generator_->variable("default_name"); - - // Build custom 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") != - std::string::npos) { - field_flags.push_back("GPBFieldTextFormatNameCustom"); - } - // Pull over some info from the value's flags. - const std::string& value_field_flags = - value_field_generator_->variable("fieldflags"); - if (value_field_flags.find("GPBFieldHasDefaultValue") != std::string::npos) { - field_flags.push_back("GPBFieldHasDefaultValue"); - } - 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); - const bool value_is_object_type = - ((value_objc_type == OBJECTIVECTYPE_STRING) || - (value_objc_type == OBJECTIVECTYPE_DATA) || - (value_objc_type == OBJECTIVECTYPE_MESSAGE)); - if ((GetObjectiveCType(key_descriptor) == OBJECTIVECTYPE_STRING) && - value_is_object_type) { - variables_["array_storage_type"] = "NSMutableDictionary"; - variables_["array_property_type"] = - "NSMutableDictionaryvariable("storage_type") + "*>"; - } else { - std::string class_name("GPB"); - class_name += MapEntryTypeName(key_descriptor, true); - class_name += MapEntryTypeName(value_descriptor, false); - class_name += "Dictionary"; - variables_["array_storage_type"] = class_name; - if (value_is_object_type) { - variables_["array_property_type"] = - class_name + "<" + - value_field_generator_->variable("storage_type") + "*>"; - } - } - - variables_["dataTypeSpecific_name"] = - value_field_generator_->variable("dataTypeSpecific_name"); - variables_["dataTypeSpecific_value"] = - value_field_generator_->variable("dataTypeSpecific_value"); -} - -MapFieldGenerator::~MapFieldGenerator() {} - -void MapFieldGenerator::FinishInitialization(void) { - RepeatedFieldGenerator::FinishInitialization(); - // Use the array_comment support in RepeatedFieldGenerator to output what the - // values in the map are. - const FieldDescriptor* value_descriptor = - descriptor_->message_type()->map_value(); - if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_ENUM) { - variables_["array_comment"] = - "// |" + variables_["name"] + "| values are |" + value_field_generator_->variable("storage_type") + "|\n"; - } -} - -void MapFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const { - RepeatedFieldGenerator::DetermineForwardDeclarations( - fwd_decls, include_external_types); - const FieldDescriptor* value_descriptor = - descriptor_->message_type()->map_value(); - // Within a file there is no requirement on the order of the messages, so - // local references need a forward declaration. External files (not WKTs), - // need one when requested. - if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_MESSAGE && - ((include_external_types && - !IsProtobufLibraryBundledProtoFile(value_descriptor->file())) || - descriptor_->file() == value_descriptor->file())) { - 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()->map_value(); - if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_MESSAGE) { - fwd_decls->insert(ObjCClassDeclaration( - value_field_generator_->variable("storage_type"))); - } -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h deleted file mode 100644 index d9aa38716..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h +++ /dev/null @@ -1,71 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2015 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_OBJECTIVEC_MAP_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MAP_FIELD_H__ - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class MapFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - public: - virtual void FinishInitialization(void) override; - - MapFieldGenerator(const MapFieldGenerator&) = delete; - MapFieldGenerator& operator=(const MapFieldGenerator&) = delete; - - protected: - explicit MapFieldGenerator(const FieldDescriptor* descriptor); - virtual ~MapFieldGenerator(); - - virtual void DetermineObjectiveCClassDefinitions( - std::set* fwd_decls) const override; - virtual void DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const override; - - private: - std::unique_ptr value_field_generator_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MAP_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc deleted file mode 100644 index 4ebb75c2c..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc +++ /dev/null @@ -1,633 +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 -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -namespace { -struct FieldOrderingByNumber { - inline bool operator()(const FieldDescriptor* a, - const FieldDescriptor* b) const { - return a->number() < b->number(); - } -}; - -int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) { - // The first item in the object structure is our uint32[] for has bits. - // We then want to order things to make the instances as small as - // possible. So we follow the has bits with: - // 1. Anything always 4 bytes - float, *32, enums - // 2. Anything that is always a pointer (they will be 8 bytes on 64 bit - // builds and 4 bytes on 32bit builds. - // 3. Anything always 8 bytes - double, *64 - // - // NOTE: Bools aren't listed, they were stored in the has bits. - // - // Why? Using 64bit builds as an example, this means worse case, we have - // enough bools that we overflow 1 byte from 4 byte alignment, so 3 bytes - // are wasted before the 4 byte values. Then if we have an odd number of - // those 4 byte values, the 8 byte values will be pushed down by 32bits to - // keep them aligned. But the structure will end 8 byte aligned, so no - // waste on the end. If you did the reverse order, you could waste 4 bytes - // before the first 8 byte value (after the has array), then a single - // bool on the end would need 7 bytes of padding to make the overall - // structure 8 byte aligned; so 11 bytes, wasted total. - - // Anything repeated is a GPB*Array/NSArray, so pointer. - if (descriptor->is_repeated()) { - return 3; - } - - switch (descriptor->type()) { - // All always 8 bytes. - case FieldDescriptor::TYPE_DOUBLE: - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_SFIXED64: - case FieldDescriptor::TYPE_FIXED64: - return 4; - - // Pointers (string and bytes are NSString and NSData); 8 or 4 bytes - // depending on the build architecture. - case FieldDescriptor::TYPE_GROUP: - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: - return 3; - - // All always 4 bytes (enums are int32s). - case FieldDescriptor::TYPE_FLOAT: - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_ENUM: - return 2; - - // 0 bytes. Stored in the has bits. - case FieldDescriptor::TYPE_BOOL: - return 99; // End of the list (doesn't really matter). - } - - // 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 0; -} - -struct FieldOrderingByStorageSize { - inline bool operator()(const FieldDescriptor* a, - const FieldDescriptor* b) const { - // Order by grouping. - const int order_group_a = OrderGroupForFieldDescriptor(a); - const int order_group_b = OrderGroupForFieldDescriptor(b); - if (order_group_a != order_group_b) { - return order_group_a < order_group_b; - } - // Within the group, order by field number (provides stable ordering). - return a->number() < b->number(); - } -}; - -struct ExtensionRangeOrdering { - bool operator()(const Descriptor::ExtensionRange* a, - const Descriptor::ExtensionRange* b) const { - return a->start < b->start; - } -}; - -// Sort the fields of the given Descriptor by number into a new[]'d array -// and return it. -const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor) { - const FieldDescriptor** fields = - new const FieldDescriptor* [descriptor->field_count()]; - for (int i = 0; i < descriptor->field_count(); i++) { - fields[i] = descriptor->field(i); - } - std::sort(fields, fields + descriptor->field_count(), FieldOrderingByNumber()); - return fields; -} - -// Sort the fields of the given Descriptor by storage size into a new[]'d -// array and return it. -const FieldDescriptor** SortFieldsByStorageSize(const Descriptor* descriptor) { - const FieldDescriptor** fields = - new const FieldDescriptor* [descriptor->field_count()]; - for (int i = 0; i < descriptor->field_count(); i++) { - fields[i] = descriptor->field(i); - } - std::sort(fields, fields + descriptor->field_count(), - FieldOrderingByStorageSize()); - return fields; -} -} // namespace - -MessageGenerator::MessageGenerator(const std::string& root_classname, - const Descriptor* descriptor) - : root_classname_(root_classname), - descriptor_(descriptor), - field_generators_(descriptor), - class_name_(ClassName(descriptor_)), - 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_->real_oneof_decl_count(); i++) { - OneofGenerator* generator = new OneofGenerator(descriptor_->oneof_decl(i)); - oneof_generators_.emplace_back(generator); - } - - for (int i = 0; i < descriptor_->enum_type_count(); i++) { - EnumGenerator* generator = new EnumGenerator(descriptor_->enum_type(i)); - enum_generators_.emplace_back(generator); - } - - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - MessageGenerator* generator = - new MessageGenerator(root_classname_, - descriptor_->nested_type(i)); - nested_message_generators_.emplace_back(generator); - } -} - -MessageGenerator::~MessageGenerator() {} - -void MessageGenerator::GenerateStaticVariablesInitialization( - io::Printer* printer) { - for (const auto& generator : extension_generators_) { - generator->GenerateStaticVariablesInitialization(printer); - } - - for (const auto& generator : nested_message_generators_) { - generator->GenerateStaticVariablesInitialization(printer); - } -} - -void MessageGenerator::DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) { - if (!IsMapEntryMessage(descriptor_)) { - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* fieldDescriptor = descriptor_->field(i); - field_generators_.get(fieldDescriptor) - .DetermineForwardDeclarations(fwd_decls, include_external_types); - } - } - - for (const auto& generator : nested_message_generators_) { - generator->DetermineForwardDeclarations(fwd_decls, include_external_types); - } -} - -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; - } - - for (const auto& generator : nested_message_generators_) { - if (generator->IncludesOneOfDefinition()) { - return true; - } - } - - return false; -} - -void MessageGenerator::GenerateEnumHeader(io::Printer* printer) { - for (const auto& generator : enum_generators_) { - generator->GenerateHeader(printer); - } - - for (const auto& generator : nested_message_generators_) { - generator->GenerateEnumHeader(printer); - } -} - -void MessageGenerator::GenerateExtensionRegistrationSource( - io::Printer* printer) { - for (const auto& generator : extension_generators_) { - generator->GenerateRegistrationSource(printer); - } - - for (const auto& generator : nested_message_generators_) { - generator->GenerateExtensionRegistrationSource(printer); - } -} - -void MessageGenerator::GenerateMessageHeader(io::Printer* printer) { - // This a a map entry message, just recurse and do nothing directly. - if (IsMapEntryMessage(descriptor_)) { - for (const auto& generator : nested_message_generators_) { - generator->GenerateMessageHeader(printer); - } - return; - } - - printer->Print( - "#pragma mark - $classname$\n" - "\n", - "classname", class_name_); - - if (descriptor_->field_count()) { - std::unique_ptr sorted_fields( - SortFieldsByNumber(descriptor_)); - - printer->Print("typedef GPB_ENUM($classname$_FieldNumber) {\n", - "classname", class_name_); - printer->Indent(); - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(sorted_fields[i]) - .GenerateFieldNumberConstant(printer); - } - - printer->Outdent(); - printer->Print("};\n\n"); - } - - for (const auto& generator : oneof_generators_) { - generator->GenerateCaseEnum(printer); - } - - std::string message_comments; - SourceLocation location; - if (descriptor_->GetSourceLocation(&location)) { - message_comments = BuildCommentsString(location, false); - } else { - message_comments = ""; - } - - printer->Print( - "$comments$$deprecated_attribute$GPB_FINAL @interface $classname$ : GPBMessage\n\n", - "classname", class_name_, - "deprecated_attribute", deprecated_attribute_, - "comments", message_comments); - - std::vector seen_oneofs(oneof_generators_.size(), 0); - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - 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( - printer); - } - } - field_generators_.get(field).GeneratePropertyDeclaration(printer); - } - - printer->Print("@end\n\n"); - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(descriptor_->field(i)) - .GenerateCFunctionDeclarations(printer); - } - - if (!oneof_generators_.empty()) { - for (const auto& generator : oneof_generators_) { - generator->GenerateClearFunctionDeclaration(printer); - } - printer->Print("\n"); - } - - if (descriptor_->extension_count() > 0) { - printer->Print("@interface $classname$ (DynamicMethods)\n\n", - "classname", class_name_); - for (const auto& generator : extension_generators_) { - generator->GenerateMembersHeader(printer); - } - printer->Print("@end\n\n"); - } - - for (const auto& generator : nested_message_generators_) { - generator->GenerateMessageHeader(printer); - } -} - -void MessageGenerator::GenerateSource(io::Printer* printer) { - if (!IsMapEntryMessage(descriptor_)) { - printer->Print( - "#pragma mark - $classname$\n" - "\n", - "classname", class_name_); - - if (!deprecated_attribute_.empty()) { - // No warnings when compiling the impl of this deprecated class. - printer->Print( - "#pragma clang diagnostic push\n" - "#pragma clang diagnostic ignored \"-Wdeprecated-implementations\"\n" - "\n"); - } - - printer->Print("@implementation $classname$\n\n", - "classname", class_name_); - - for (const auto& generator : oneof_generators_) { - generator->GeneratePropertyImplementation(printer); - } - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(descriptor_->field(i)) - .GeneratePropertyImplementation(printer); - } - - std::unique_ptr sorted_fields( - SortFieldsByNumber(descriptor_)); - std::unique_ptr size_order_fields( - 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)); - } - - std::sort(sorted_extensions.begin(), sorted_extensions.end(), - ExtensionRangeOrdering()); - - // Assign has bits: - // 1. FieldGeneratorMap::CalculateHasBits() loops through the fields seeing - // who needs has bits and assigning them. - // 2. FieldGenerator::SetOneofIndexBase() overrides has_bit with a negative - // index that groups all the elements in the oneof. - size_t num_has_bits = field_generators_.CalculateHasBits(); - size_t sizeof_has_storage = (num_has_bits + 31) / 32; - if (sizeof_has_storage == 0) { - // In the case where no field needs has bits, don't let the _has_storage_ - // end up as zero length (zero length arrays are sort of a grey area - // since it has to be at the start of the struct). This also ensures a - // field with only oneofs keeps the required negative indices they need. - sizeof_has_storage = 1; - } - // Tell all the fields the oneof base. - for (const auto& generator : oneof_generators_) { - generator->SetOneofIndexBase(sizeof_has_storage); - } - 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 += oneof_generators_.size(); - - printer->Print( - "\n" - "typedef struct $classname$__storage_ {\n" - " uint32_t _has_storage_[$sizeof_has_storage$];\n", - "classname", class_name_, - "sizeof_has_storage", StrCat(sizeof_has_storage)); - printer->Indent(); - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(size_order_fields[i]) - .GenerateFieldStorageDeclaration(printer); - } - printer->Outdent(); - - printer->Print("} $classname$__storage_;\n\n", "classname", class_name_); - - - printer->Print( - "// This method is threadsafe because it is initially called\n" - "// in +initialize for each subclass.\n" - "+ (GPBDescriptor *)descriptor {\n" - " static GPBDescriptor *descriptor = nil;\n" - " if (!descriptor) {\n"); - - TextFormatDecodeData text_format_decode_data; - bool has_fields = descriptor_->field_count() > 0; - bool need_defaults = field_generators_.DoesAnyFieldHaveNonZeroDefault(); - std::string field_description_type; - if (need_defaults) { - field_description_type = "GPBMessageFieldDescriptionWithDefault"; - } else { - field_description_type = "GPBMessageFieldDescription"; - } - if (has_fields) { - 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 = - field_generators_.get(sorted_fields[i]); - field_generator.GenerateFieldDescription(printer, need_defaults); - if (field_generator.needs_textformat_name_support()) { - text_format_decode_data.AddString(sorted_fields[i]->number(), - field_generator.generated_objc_name(), - field_generator.raw_field_name()); - } - } - printer->Outdent(); - printer->Print( - "};\n"); - printer->Outdent(); - printer->Outdent(); - } - - std::map vars; - vars["classname"] = class_name_; - vars["rootclassname"] = root_classname_; - vars["fields"] = has_fields ? "fields" : "NULL"; - if (has_fields) { - vars["fields_count"] = - "(uint32_t)(sizeof(fields) / sizeof(" + field_description_type + "))"; - } else { - vars["fields_count"] = "0"; - } - - 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"); - } - if (descriptor_->options().message_set_wire_format()) { - init_flags.push_back("GPBDescriptorInitializationFlag_WireFormat"); - } - vars["init_flags"] = BuildFlagsString(FLAGTYPE_DESCRIPTOR_INITIALIZATION, - init_flags); - - printer->Print( - vars, - " GPBDescriptor *localDescriptor =\n" - " [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n" - " rootClass:[$rootclassname$ class]\n" - " file:$rootclassname$_FileDescriptor()\n" - " fields:$fields$\n" - " fieldCount:$fields_count$\n" - " storageSize:sizeof($classname$__storage_)\n" - " flags:$init_flags$];\n"); - if (!oneof_generators_.empty()) { - printer->Print( - " static const char *oneofs[] = {\n"); - for (const auto& generator : oneof_generators_) { - printer->Print(" \"$name$\",\n", "name", - generator->DescriptorName()); - } - printer->Print( - " };\n" - " [localDescriptor setupOneofs:oneofs\n" - " count:(uint32_t)(sizeof(oneofs) / sizeof(char*))\n" - " firstHasIndex:$first_has_index$];\n", - "first_has_index", oneof_generators_[0]->HasIndexAsString()); - } - if (text_format_decode_data.num_entries() != 0) { - 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 ="); - static const int kBytesPerLine = 40; // allow for escaping - for (int i = 0; i < text_format_data_str.size(); i += kBytesPerLine) { - printer->Print( - "\n \"$data$\"", - "data", EscapeTrigraphs( - CEscape(text_format_data_str.substr(i, kBytesPerLine)))); - } - printer->Print( - ";\n" - " [localDescriptor setupExtraTextInfo:extraTextFormatInfo];\n" - "#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n"); - } - if (!sorted_extensions.empty()) { - printer->Print( - " static const GPBExtensionRange ranges[] = {\n"); - for (int i = 0; i < sorted_extensions.size(); i++) { - printer->Print(" { .start = $start$, .end = $end$ },\n", - "start", StrCat(sorted_extensions[i]->start), - "end", StrCat(sorted_extensions[i]->end)); - } - printer->Print( - " };\n" - " [localDescriptor setupExtensionRanges:ranges\n" - " count:(uint32_t)(sizeof(ranges) / sizeof(GPBExtensionRange))];\n"); - } - if (descriptor_->containing_type() != NULL) { - std::string containing_class = ClassName(descriptor_->containing_type()); - std::string parent_class_ref = ObjCClass(containing_class); - printer->Print( - " [localDescriptor setupContainingMessageClass:$parent_class_ref$];\n", - "parent_class_ref", parent_class_ref); - } - std::string suffix_added; - ClassName(descriptor_, &suffix_added); - if (!suffix_added.empty()) { - printer->Print( - " [localDescriptor setupMessageClassNameSuffix:@\"$suffix$\"];\n", - "suffix", suffix_added); - } - printer->Print( - " #if defined(DEBUG) && DEBUG\n" - " NSAssert(descriptor == nil, @\"Startup recursed!\");\n" - " #endif // DEBUG\n" - " descriptor = localDescriptor;\n" - " }\n" - " return descriptor;\n" - "}\n\n" - "@end\n\n"); - - if (!deprecated_attribute_.empty()) { - printer->Print( - "#pragma clang diagnostic pop\n" - "\n"); - } - - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(descriptor_->field(i)) - .GenerateCFunctionImplementations(printer); - } - - for (const auto& generator : oneof_generators_) { - generator->GenerateClearFunctionImplementation(printer); - } - } - - for (const auto& generator : enum_generators_) { - generator->GenerateSource(printer); - } - - for (const auto& generator : nested_message_generators_) { - generator->GenerateSource(printer); - } -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h deleted file mode 100644 index 9d1443098..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h +++ /dev/null @@ -1,99 +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_COMPILER_OBJECTIVEC_MESSAGE_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ - -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class ExtensionGenerator; -class EnumGenerator; - -class MessageGenerator { - public: - MessageGenerator(const std::string& root_classname, - const Descriptor* descriptor); - ~MessageGenerator(); - - MessageGenerator(const MessageGenerator&) = delete; - MessageGenerator& operator=(const MessageGenerator&) = delete; - - void GenerateStaticVariablesInitialization(io::Printer* printer); - void GenerateEnumHeader(io::Printer* printer); - void GenerateMessageHeader(io::Printer* printer); - void GenerateSource(io::Printer* printer); - void GenerateExtensionRegistrationSource(io::Printer* printer); - void DetermineObjectiveCClassDefinitions(std::set* fwd_decls); - void DetermineForwardDeclarations(std::set* fwd_decls, - bool include_external_types); - - // Checks if the message or a nested message includes a oneof definition. - bool IncludesOneOfDefinition() const; - - private: - void GenerateParseFromMethodsHeader(io::Printer* printer); - - void GenerateSerializeOneFieldSource(io::Printer* printer, - const FieldDescriptor* field); - void GenerateSerializeOneExtensionRangeSource( - io::Printer* printer, const Descriptor::ExtensionRange* range); - - void GenerateMessageDescriptionSource(io::Printer* printer); - void GenerateDescriptionOneFieldSource(io::Printer* printer, - const FieldDescriptor* field); - - const std::string root_classname_; - const Descriptor* descriptor_; - FieldGeneratorMap field_generators_; - const std::string class_name_; - const std::string deprecated_attribute_; - std::vector> extension_generators_; - std::vector> enum_generators_; - std::vector> nested_message_generators_; - std::vector> oneof_generators_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc deleted file mode 100644 index 2ff0b44a6..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc +++ /dev/null @@ -1,123 +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 compiler { -namespace objectivec { - -namespace { - -void SetMessageVariables(const FieldDescriptor* descriptor, - 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"] = containing_class; - (*variables)["storage_type"] = message_type; - (*variables)["group_or_message"] = - (descriptor->type() == FieldDescriptor::TYPE_GROUP) ? "Group" : "Message"; - (*variables)["dataTypeSpecific_value"] = ObjCClass(message_type); -} - -} // namespace - -MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor) - : ObjCObjFieldGenerator(descriptor) { - SetMessageVariables(descriptor, &variables_); -} - -MessageFieldGenerator::~MessageFieldGenerator() {} - -void MessageFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const { - ObjCObjFieldGenerator::DetermineForwardDeclarations( - fwd_decls, include_external_types); - // Within a file there is no requirement on the order of the messages, so - // local references need a forward declaration. External files (not WKTs), - // need one when requested. - if ((include_external_types && - !IsProtobufLibraryBundledProtoFile(descriptor_->message_type()->file())) || - descriptor_->file() == descriptor_->message_type()->file()) { - // Class name is already in "storage_type". - fwd_decls->insert("@class " + variable("storage_type")); - } -} - -void MessageFieldGenerator::DetermineObjectiveCClassDefinitions( - std::set* fwd_decls) const { - fwd_decls->insert(ObjCClassDeclaration(variable("storage_type"))); -} - -RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( - const FieldDescriptor* descriptor) - : RepeatedFieldGenerator(descriptor) { - SetMessageVariables(descriptor, &variables_); - variables_["array_storage_type"] = "NSMutableArray"; - variables_["array_property_type"] = - "NSMutableArray<" + variables_["storage_type"] + "*>"; -} - -RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} - -void RepeatedMessageFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const { - RepeatedFieldGenerator::DetermineForwardDeclarations( - fwd_decls, include_external_types); - // Within a file there is no requirement on the order of the messages, so - // local references need a forward declaration. External files (not WKTs), - // need one when requested. - if ((include_external_types && - !IsProtobufLibraryBundledProtoFile(descriptor_->message_type()->file())) || - descriptor_->file() == descriptor_->message_type()->file()) { - // 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 -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h deleted file mode 100644 index 49a84fbd1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h +++ /dev/null @@ -1,85 +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_COMPILER_OBJECTIVEC_MESSAGE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_FIELD_H__ - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class MessageFieldGenerator : public ObjCObjFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - protected: - explicit MessageFieldGenerator(const FieldDescriptor* descriptor); - - MessageFieldGenerator(const MessageFieldGenerator&) = delete; - MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete; - - virtual ~MessageFieldGenerator(); - - public: - virtual void DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const override; - virtual void DetermineObjectiveCClassDefinitions( - std::set* fwd_decls) const override; -}; - -class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - protected: - explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor); - virtual ~RepeatedMessageFieldGenerator(); - - RepeatedMessageFieldGenerator(const RepeatedMessageFieldGenerator&) = delete; - RepeatedMessageFieldGenerator operator=(const RepeatedMessageFieldGenerator&) = delete; - - public: - virtual void DetermineForwardDeclarations( - std::set* fwd_decls, - bool include_external_types) const override; - virtual void DetermineObjectiveCClassDefinitions( - std::set* fwd_decls) const override; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h deleted file mode 100644 index 163304665..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h +++ /dev/null @@ -1,197 +0,0 @@ -// NSObject methods -// Autogenerated by method_dump.sh. Do not edit by hand. -// Date: Thu Nov 1 14:12:16 PDT 2018 -// macOS: MacOSX10.14.sdk -// iOS: iPhoneSimulator12.1.sdk - -const char* const kNSObjectMethodsList[] = { - "CAMLType", - "CA_copyRenderValue", - "CA_prepareRenderValue", - "NS_copyCGImage", - "NS_tiledLayerVisibleRect", - "___tryRetain_OA", - "__autorelease_OA", - "__dealloc_zombie", - "__release_OA", - "__retain_OA", - "_accessibilityFinalize", - "_accessibilityIsTableViewDescendant", - "_accessibilityUIElementSpecifier", - "_accessibilityUseConvenienceAPI", - "_allowsDirectEncoding", - "_asScriptTerminologyNameArray", - "_asScriptTerminologyNameString", - "_bindingAdaptor", - "_cfTypeID", - "_copyDescription", - "_destroyObserverList", - "_didEndKeyValueObserving", - "_implicitObservationInfo", - "_internalAccessibilityAttributedHint", - "_internalAccessibilityAttributedLabel", - "_internalAccessibilityAttributedValue", - "_isAXConnector", - "_isAccessibilityContainerSectionCandidate", - "_isAccessibilityContentNavigatorSectionCandidate", - "_isAccessibilityContentSectionCandidate", - "_isAccessibilityTopLevelNavigatorSectionCandidate", - "_isDeallocating", - "_isKVOA", - "_isToManyChangeInformation", - "_ivarDescription", - "_localClassNameForClass", - "_methodDescription", - "_observerStorage", - "_overrideUseFastBlockObservers", - "_propertyDescription", - "_releaseBindingAdaptor", - "_scriptingCount", - "_scriptingCountNonrecursively", - "_scriptingDebugDescription", - "_scriptingExists", - "_scriptingShouldCheckObjectIndexes", - "_shortMethodDescription", - "_shouldSearchChildrenForSection", - "_traitStorageList", - "_tryRetain", - "_ui_descriptionBuilder", - "_uikit_variesByTraitCollections", - "_web_description", - "_webkit_invokeOnMainThread", - "_willBeginKeyValueObserving", - "accessibilityActivate", - "accessibilityActivationPoint", - "accessibilityAllowsOverriddenAttributesWhenIgnored", - "accessibilityAssistiveTechnologyFocusedIdentifiers", - "accessibilityAttributedHint", - "accessibilityAttributedLabel", - "accessibilityAttributedValue", - "accessibilityContainer", - "accessibilityContainerType", - "accessibilityCustomActions", - "accessibilityCustomRotors", - "accessibilityDecrement", - "accessibilityDragSourceDescriptors", - "accessibilityDropPointDescriptors", - "accessibilityElementCount", - "accessibilityElementDidBecomeFocused", - "accessibilityElementDidLoseFocus", - "accessibilityElementIsFocused", - "accessibilityElements", - "accessibilityElementsHidden", - "accessibilityFrame", - "accessibilityHeaderElements", - "accessibilityHint", - "accessibilityIdentification", - "accessibilityIdentifier", - "accessibilityIncrement", - "accessibilityLabel", - "accessibilityLanguage", - "accessibilityLocalizedStringKey", - "accessibilityNavigationStyle", - "accessibilityOverriddenAttributes", - "accessibilityParameterizedAttributeNames", - "accessibilityPath", - "accessibilityPerformEscape", - "accessibilityPerformMagicTap", - "accessibilityPresenterProcessIdentifier", - "accessibilityShouldUseUniqueId", - "accessibilitySupportsNotifications", - "accessibilitySupportsOverriddenAttributes", - "accessibilityTemporaryChildren", - "accessibilityTraits", - "accessibilityValue", - "accessibilityViewIsModal", - "accessibilityVisibleArea", - "allPropertyKeys", - "allowsWeakReference", - "attributeKeys", - "autoContentAccessingProxy", - "autorelease", - "awakeFromNib", - "boolValueSafe", - "bs_encoded", - "bs_isPlistableType", - "bs_secureEncoded", - "cl_json_serializeKey", - "class", - "classCode", - "classDescription", - "classForArchiver", - "classForCoder", - "classForKeyedArchiver", - "classForPortCoder", - "className", - "clearProperties", - "copy", - "dealloc", - "debugDescription", - "defaultAccessibilityTraits", - "description", - "doubleValueSafe", - "entityName", - "exposedBindings", - "finalize", - "finishObserving", - "flushKeyBindings", - "hash", - "init", - "int64ValueSafe", - "isAccessibilityElement", - "isAccessibilityElementByDefault", - "isElementAccessibilityExposedToInterfaceBuilder", - "isFault", - "isNSArray__", - "isNSCFConstantString__", - "isNSData__", - "isNSDate__", - "isNSDictionary__", - "isNSNumber__", - "isNSObject__", - "isNSOrderedSet__", - "isNSSet__", - "isNSString__", - "isNSTimeZone__", - "isNSValue__", - "isProxy", - "mutableCopy", - "nilValueForKey", - "objectSpecifier", - "observationInfo", - "pep_onDetachedThread", - "pep_onMainThread", - "pep_onMainThreadIfNecessary", - "prepareForInterfaceBuilder", - "release", - "releaseOnMainThread", - "retain", - "retainCount", - "retainWeakReference", - "scriptingProperties", - "self", - "shouldGroupAccessibilityChildren", - "storedAccessibilityActivationPoint", - "storedAccessibilityContainerType", - "storedAccessibilityElementsHidden", - "storedAccessibilityFrame", - "storedAccessibilityNavigationStyle", - "storedAccessibilityTraits", - "storedAccessibilityViewIsModal", - "storedIsAccessibilityElement", - "storedShouldGroupAccessibilityChildren", - "stringValueSafe", - "superclass", - "toManyRelationshipKeys", - "toOneRelationshipKeys", - "traitStorageList", - "un_safeBoolValue", - "userInterfaceItemIdentifier", - "utf8ValueSafe", - "valuesForKeysWithDictionary", - "zone", -// Protocol: CAAnimatableValue -// Protocol: CARenderValue -// Protocol: NSObject -// Protocol: ROCKRemoteInvocationInterface -}; diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc deleted file mode 100644 index 1bef293e2..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc +++ /dev/null @@ -1,140 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor) - : descriptor_(descriptor) { - variables_["enum_name"] = OneofEnumName(descriptor_); - variables_["name"] = OneofName(descriptor_); - variables_["capitalized_name"] = OneofNameCapitalized(descriptor_); - variables_["raw_index"] = StrCat(descriptor_->index()); - const Descriptor* msg_descriptor = descriptor_->containing_type(); - variables_["owning_message_class"] = ClassName(msg_descriptor); - - std::string comments; - SourceLocation location; - if (descriptor_->GetSourceLocation(&location)) { - comments = BuildCommentsString(location, true); - } else { - comments = ""; - } - variables_["comments"] = comments; -} - -OneofGenerator::~OneofGenerator() {} - -void OneofGenerator::SetOneofIndexBase(int index_base) { - int index = descriptor_->index() + index_base; - // Flip the sign to mark it as a oneof. - variables_["index"] = StrCat(-index); -} - -void OneofGenerator::GenerateCaseEnum(io::Printer* printer) { - printer->Print( - variables_, - "typedef GPB_ENUM($enum_name$) {\n"); - printer->Indent(); - printer->Print( - variables_, - "$enum_name$_GPBUnsetOneOfCase = 0,\n"); - std::string enum_name = variables_["enum_name"]; - for (int j = 0; j < descriptor_->field_count(); j++) { - const FieldDescriptor* field = descriptor_->field(j); - std::string field_name = FieldNameCapitalized(field); - printer->Print( - "$enum_name$_$field_name$ = $field_number$,\n", - "enum_name", enum_name, - "field_name", field_name, - "field_number", StrCat(field->number())); - } - printer->Outdent(); - printer->Print( - "};\n" - "\n"); -} - -void OneofGenerator::GeneratePublicCasePropertyDeclaration( - io::Printer* printer) { - printer->Print( - variables_, - "$comments$" - "@property(nonatomic, readonly) $enum_name$ $name$OneOfCase;\n" - "\n"); -} - -void OneofGenerator::GenerateClearFunctionDeclaration(io::Printer* printer) { - printer->Print( - variables_, - "/**\n" - " * Clears whatever value was set for the oneof '$name$'.\n" - " **/\n" - "void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message);\n"); -} - -void OneofGenerator::GeneratePropertyImplementation(io::Printer* printer) { - printer->Print( - variables_, - "@dynamic $name$OneOfCase;\n"); -} - -void OneofGenerator::GenerateClearFunctionImplementation(io::Printer* printer) { - printer->Print( - variables_, - "void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n" - " GPBDescriptor *descriptor = [$owning_message_class$ descriptor];\n" - " GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:$raw_index$];\n" - " GPBClearOneof(message, oneof);\n" - "}\n"); -} - -std::string OneofGenerator::DescriptorName(void) const { - return variables_.find("name")->second; -} - -std::string OneofGenerator::HasIndexAsString(void) const { - return variables_.find("index")->second; -} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h deleted file mode 100644 index 034f07fb3..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h +++ /dev/null @@ -1,76 +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_COMPILER_OBJECTIVEC_ONEOF_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__ - -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class OneofGenerator { - public: - explicit OneofGenerator(const OneofDescriptor* descriptor); - ~OneofGenerator(); - - OneofGenerator(const OneofGenerator&) = delete; - OneofGenerator& operator=(const OneofGenerator&) = delete; - - void SetOneofIndexBase(int index_base); - - void GenerateCaseEnum(io::Printer* printer); - - void GeneratePublicCasePropertyDeclaration(io::Printer* printer); - void GenerateClearFunctionDeclaration(io::Printer* printer); - - void GeneratePropertyImplementation(io::Printer* printer); - void GenerateClearFunctionImplementation(io::Printer* printer); - - std::string DescriptorName(void) const; - std::string HasIndexAsString(void) const; - - private: - const OneofDescriptor* descriptor_; - std::map variables_; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc deleted file mode 100644 index 1fefde5fe..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc +++ /dev/null @@ -1,188 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -using internal::WireFormat; -using internal::WireFormatLite; - -namespace { - -const char* PrimitiveTypeName(const FieldDescriptor* descriptor) { - ObjectiveCType type = GetObjectiveCType(descriptor); - switch (type) { - case OBJECTIVECTYPE_INT32: - return "int32_t"; - case OBJECTIVECTYPE_UINT32: - return "uint32_t"; - case OBJECTIVECTYPE_INT64: - return "int64_t"; - case OBJECTIVECTYPE_UINT64: - return "uint64_t"; - case OBJECTIVECTYPE_FLOAT: - return "float"; - case OBJECTIVECTYPE_DOUBLE: - return "double"; - case OBJECTIVECTYPE_BOOLEAN: - return "BOOL"; - case OBJECTIVECTYPE_STRING: - return "NSString"; - case OBJECTIVECTYPE_DATA: - return "NSData"; - case OBJECTIVECTYPE_ENUM: - return "int32_t"; - case OBJECTIVECTYPE_MESSAGE: - return NULL; // Messages go through objectivec_message_field.cc|h. - } - - // 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 NULL; -} - -const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) { - ObjectiveCType type = GetObjectiveCType(descriptor); - switch (type) { - case OBJECTIVECTYPE_INT32: - return "Int32"; - case OBJECTIVECTYPE_UINT32: - return "UInt32"; - case OBJECTIVECTYPE_INT64: - return "Int64"; - case OBJECTIVECTYPE_UINT64: - return "UInt64"; - case OBJECTIVECTYPE_FLOAT: - return "Float"; - case OBJECTIVECTYPE_DOUBLE: - return "Double"; - case OBJECTIVECTYPE_BOOLEAN: - return "Bool"; - case OBJECTIVECTYPE_STRING: - return ""; // Want NSArray - case OBJECTIVECTYPE_DATA: - return ""; // Want NSArray - case OBJECTIVECTYPE_ENUM: - return "Enum"; - case OBJECTIVECTYPE_MESSAGE: - // Want NSArray (but goes through objectivec_message_field.cc|h). - return ""; - } - - // 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 NULL; -} - -void SetPrimitiveVariables(const FieldDescriptor* descriptor, - std::map* variables) { - std::string primitive_name = PrimitiveTypeName(descriptor); - (*variables)["type"] = primitive_name; - (*variables)["storage_type"] = primitive_name; -} - -} // namespace - -PrimitiveFieldGenerator::PrimitiveFieldGenerator( - const FieldDescriptor* descriptor) - : SingleFieldGenerator(descriptor) { - SetPrimitiveVariables(descriptor, &variables_); -} - -PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {} - -void PrimitiveFieldGenerator::GenerateFieldStorageDeclaration( - io::Printer* printer) const { - if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { - // Nothing, BOOLs are stored in the has bits. - } else { - SingleFieldGenerator::GenerateFieldStorageDeclaration(printer); - } -} - -int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded(void) const { - if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { - // Reserve a bit for the storage of the boolean. - return 1; - } - return 0; -} - -void PrimitiveFieldGenerator::SetExtraRuntimeHasBitsBase(int has_base) { - if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { - // Set into the offset the has bit to use for the actual value. - variables_["storage_offset_value"] = StrCat(has_base); - variables_["storage_offset_comment"] = - " // Stored in _has_storage_ to save space."; - } -} - -PrimitiveObjFieldGenerator::PrimitiveObjFieldGenerator( - const FieldDescriptor* descriptor) - : ObjCObjFieldGenerator(descriptor) { - SetPrimitiveVariables(descriptor, &variables_); - variables_["property_storage_attribute"] = "copy"; -} - -PrimitiveObjFieldGenerator::~PrimitiveObjFieldGenerator() {} - -RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( - const FieldDescriptor* descriptor) - : RepeatedFieldGenerator(descriptor) { - SetPrimitiveVariables(descriptor, &variables_); - - std::string base_name = PrimitiveArrayTypeName(descriptor); - if (base_name.length()) { - variables_["array_storage_type"] = "GPB" + base_name + "Array"; - } else { - variables_["array_storage_type"] = "NSMutableArray"; - variables_["array_property_type"] = - "NSMutableArray<" + variables_["storage_type"] + "*>"; - } -} - -RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() {} - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h b/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h deleted file mode 100644 index 06a1528a8..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h +++ /dev/null @@ -1,87 +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_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__ -#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__ - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace objectivec { - -class PrimitiveFieldGenerator : public SingleFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - protected: - explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor); - virtual ~PrimitiveFieldGenerator(); - - PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; - PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; - - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; - - virtual int ExtraRuntimeHasBitsNeeded(void) const override; - virtual void SetExtraRuntimeHasBitsBase(int index_base) override; -}; - -class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - protected: - explicit PrimitiveObjFieldGenerator(const FieldDescriptor* descriptor); - virtual ~PrimitiveObjFieldGenerator(); - - PrimitiveObjFieldGenerator(const PrimitiveObjFieldGenerator&) = delete; - PrimitiveObjFieldGenerator& operator=(const PrimitiveObjFieldGenerator&) = - delete; -}; - -class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); - - protected: - explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor); - virtual ~RepeatedPrimitiveFieldGenerator(); - - RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) = - delete; - RepeatedPrimitiveFieldGenerator& operator=( - const RepeatedPrimitiveFieldGenerator&) = delete; -}; - -} // namespace objectivec -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/parser.cc b/depends/protobuf/src/google/protobuf/compiler/parser.cc deleted file mode 100644 index 5bd37d147..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/parser.cc +++ /dev/null @@ -1,2446 +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. -// -// Recursive descent FTW. - -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { - -using internal::WireFormat; - -namespace { - -typedef std::unordered_map TypeNameMap; - -const TypeNameMap& GetTypeNameTable() { - static auto* table = new auto([]() { - TypeNameMap result; - - result["double"] = FieldDescriptorProto::TYPE_DOUBLE; - result["float"] = FieldDescriptorProto::TYPE_FLOAT; - result["uint64"] = FieldDescriptorProto::TYPE_UINT64; - result["fixed64"] = FieldDescriptorProto::TYPE_FIXED64; - result["fixed32"] = FieldDescriptorProto::TYPE_FIXED32; - result["bool"] = FieldDescriptorProto::TYPE_BOOL; - result["string"] = FieldDescriptorProto::TYPE_STRING; - result["group"] = FieldDescriptorProto::TYPE_GROUP; - - result["bytes"] = FieldDescriptorProto::TYPE_BYTES; - result["uint32"] = FieldDescriptorProto::TYPE_UINT32; - result["sfixed32"] = FieldDescriptorProto::TYPE_SFIXED32; - result["sfixed64"] = FieldDescriptorProto::TYPE_SFIXED64; - result["int32"] = FieldDescriptorProto::TYPE_INT32; - result["int64"] = FieldDescriptorProto::TYPE_INT64; - result["sint32"] = FieldDescriptorProto::TYPE_SINT32; - result["sint64"] = FieldDescriptorProto::TYPE_SINT64; - - return result; - }()); - return *table; -} - -// Camel-case the field name and append "Entry" for generated map entry name. -// e.g. map foo_map => FooMapEntry -std::string MapEntryName(const std::string& field_name) { - std::string result; - static const char kSuffix[] = "Entry"; - result.reserve(field_name.size() + sizeof(kSuffix)); - bool cap_next = true; - 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_char && field_name_char <= 'z') { - result.push_back(field_name_char - 'a' + 'A'); - } else { - result.push_back(field_name_char); - } - cap_next = false; - } else { - result.push_back(field_name_char); - } - } - result.append(kSuffix); - return result; -} - -bool IsUppercase(char c) { return c >= 'A' && c <= 'Z'; } - -bool IsLowercase(char c) { return c >= 'a' && c <= 'z'; } - -bool IsNumber(char c) { return c >= '0' && c <= '9'; } - -bool IsUpperCamelCase(const std::string& name) { - if (name.empty()) { - return true; - } - // Name must start with an upper case character. - if (!IsUppercase(name[0])) { - return false; - } - // Must not contains underscore. - for (const char c : name) { - if (c == '_') { - return false; - } - } - return true; -} - -bool IsUpperUnderscore(const std::string& name) { - for (const char c : name) { - if (!IsUppercase(c) && c != '_' && !IsNumber(c)) { - return false; - } - } - return true; -} - -bool IsLowerUnderscore(const std::string& name) { - for (const char c : name) { - if (!IsLowercase(c) && c != '_' && !IsNumber(c)) { - return false; - } - } - return true; -} - -bool IsNumberFollowUnderscore(const std::string& name) { - for (int i = 1; i < name.length(); i++) { - const char c = name[i]; - if (IsNumber(c) && name[i - 1] == '_') { - return true; - } - } - return false; -} - -} // anonymous namespace - -// Makes code slightly more readable. The meaning of "DO(foo)" is -// "Execute foo and fail if it fails.", where failure is indicated by -// returning false. -#define DO(STATEMENT) \ - if (STATEMENT) { \ - } else \ - return false - -// =================================================================== - -Parser::Parser() - : input_(nullptr), - error_collector_(nullptr), - source_location_table_(nullptr), - had_errors_(false), - require_syntax_identifier_(false), - stop_after_syntax_identifier_(false) { -} - -Parser::~Parser() {} - -// =================================================================== - -inline bool Parser::LookingAt(const char* text) { - return input_->current().text == text; -} - -inline bool Parser::LookingAtType(io::Tokenizer::TokenType token_type) { - return input_->current().type == token_type; -} - -inline bool Parser::AtEnd() { return LookingAtType(io::Tokenizer::TYPE_END); } - -bool Parser::TryConsume(const char* text) { - if (LookingAt(text)) { - input_->Next(); - return true; - } else { - return false; - } -} - -bool Parser::Consume(const char* text, const char* error) { - if (TryConsume(text)) { - return true; - } else { - AddError(error); - return false; - } -} - -bool Parser::Consume(const char* text) { - std::string error = "Expected \"" + std::string(text) + "\"."; - return Consume(text, error.c_str()); -} - -bool Parser::ConsumeIdentifier(std::string* output, const char* error) { - if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { - *output = input_->current().text; - input_->Next(); - return true; - } else { - AddError(error); - return false; - } -} - -bool Parser::ConsumeInteger(int* output, const char* error) { - if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { - 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. - } - *output = value; - input_->Next(); - return true; - } else { - AddError(error); - return false; - } -} - -bool Parser::ConsumeSignedInteger(int* output, const char* error) { - bool is_negative = false; - uint64_t max_value = std::numeric_limits::max(); - if (TryConsume("-")) { - is_negative = true; - max_value += 1; - } - uint64_t value = 0; - DO(ConsumeInteger64(max_value, &value, error)); - if (is_negative) value *= -1; - *output = value; - return true; -} - -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, - output)) { - AddError("Integer out of range."); - // We still return true because we did, in fact, parse an integer. - *output = 0; - } - input_->Next(); - return true; - } else { - AddError(error); - return false; - } -} - -bool Parser::ConsumeNumber(double* output, const char* error) { - if (LookingAtType(io::Tokenizer::TYPE_FLOAT)) { - *output = io::Tokenizer::ParseFloat(input_->current().text); - input_->Next(); - return true; - } else if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { - // Also accept integers. - 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. - } - *output = value; - input_->Next(); - return true; - } else if (LookingAt("inf")) { - *output = std::numeric_limits::infinity(); - input_->Next(); - return true; - } else if (LookingAt("nan")) { - *output = std::numeric_limits::quiet_NaN(); - input_->Next(); - return true; - } else { - AddError(error); - return false; - } -} - -bool Parser::ConsumeString(std::string* output, const char* error) { - if (LookingAtType(io::Tokenizer::TYPE_STRING)) { - io::Tokenizer::ParseString(input_->current().text, output); - input_->Next(); - // Allow C++ like concatenation of adjacent string tokens. - while (LookingAtType(io::Tokenizer::TYPE_STRING)) { - io::Tokenizer::ParseStringAppend(input_->current().text, output); - input_->Next(); - } - return true; - } else { - AddError(error); - return false; - } -} - -bool Parser::TryConsumeEndOfDeclaration(const char* text, - const LocationRecorder* location) { - if (LookingAt(text)) { - std::string leading, trailing; - std::vector detached; - input_->NextWithComments(&trailing, &detached, &leading); - - // Save the leading comments for next time, and recall the leading comments - // from last time. - leading.swap(upcoming_doc_comments_); - - if (location != nullptr) { - upcoming_detached_comments_.swap(detached); - location->AttachComments(&leading, &trailing, &detached); - } else if (strcmp(text, "}") == 0) { - // If the current location is null and we are finishing the current scope, - // drop pending upcoming detached comments. - upcoming_detached_comments_.swap(detached); - } else { - // Otherwise, append the new detached comments to the existing upcoming - // detached comments. - upcoming_detached_comments_.insert(upcoming_detached_comments_.end(), - detached.begin(), detached.end()); - } - - return true; - } else { - return false; - } -} - -bool Parser::ConsumeEndOfDeclaration(const char* text, - const LocationRecorder* location) { - if (TryConsumeEndOfDeclaration(text, location)) { - return true; - } else { - AddError("Expected \"" + std::string(text) + "\"."); - return false; - } -} - -// ------------------------------------------------------------------- - -void Parser::AddError(int line, int column, const std::string& error) { - if (error_collector_ != nullptr) { - error_collector_->AddError(line, column, error); - } - had_errors_ = true; -} - -void Parser::AddError(const std::string& error) { - AddError(input_->current().line, input_->current().column, error); -} - -void Parser::AddWarning(const std::string& warning) { - if (error_collector_ != nullptr) { - error_collector_->AddWarning(input_->current().line, - input_->current().column, warning); - } -} - -// ------------------------------------------------------------------- - -Parser::LocationRecorder::LocationRecorder(Parser* parser) - : parser_(parser), - source_code_info_(parser->source_code_info_), - location_(parser_->source_code_info_->add_location()) { - location_->add_span(parser_->input_->current().line); - location_->add_span(parser_->input_->current().column); -} - -Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent) { - Init(parent, parent.source_code_info_); -} - -Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent, - int path1, - SourceCodeInfo* source_code_info) { - Init(parent, source_code_info); - AddPath(path1); -} - -Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent, - int path1) { - Init(parent, parent.source_code_info_); - AddPath(path1); -} - -Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent, - int path1, int path2) { - Init(parent, parent.source_code_info_); - AddPath(path1); - AddPath(path2); -} - -void Parser::LocationRecorder::Init(const LocationRecorder& parent, - SourceCodeInfo* source_code_info) { - parser_ = parent.parser_; - source_code_info_ = source_code_info; - - location_ = source_code_info_->add_location(); - location_->mutable_path()->CopyFrom(parent.location_->path()); - - location_->add_span(parser_->input_->current().line); - location_->add_span(parser_->input_->current().column); -} - -Parser::LocationRecorder::~LocationRecorder() { - if (location_->span_size() <= 2) { - EndAt(parser_->input_->previous()); - } -} - -void Parser::LocationRecorder::AddPath(int path_component) { - location_->add_path(path_component); -} - -void Parser::LocationRecorder::StartAt(const io::Tokenizer::Token& token) { - location_->set_span(0, token.line); - location_->set_span(1, token.column); -} - -void Parser::LocationRecorder::StartAt(const LocationRecorder& other) { - location_->set_span(0, other.location_->span(0)); - location_->set_span(1, other.location_->span(1)); -} - -void Parser::LocationRecorder::EndAt(const io::Tokenizer::Token& token) { - if (token.line != location_->span(0)) { - location_->add_span(token.line); - } - location_->add_span(token.end_column); -} - -void Parser::LocationRecorder::RecordLegacyLocation( - const Message* descriptor, - DescriptorPool::ErrorCollector::ErrorLocation location) { - if (parser_->source_location_table_ != nullptr) { - parser_->source_location_table_->Add( - descriptor, location, location_->span(0), location_->span(1)); - } -} - -void Parser::LocationRecorder::RecordLegacyImportLocation( - const Message* descriptor, const std::string& name) { - if (parser_->source_location_table_ != nullptr) { - parser_->source_location_table_->AddImport( - descriptor, name, location_->span(0), location_->span(1)); - } -} - -int Parser::LocationRecorder::CurrentPathSize() const { - return location_->path_size(); -} - -void Parser::LocationRecorder::AttachComments( - std::string* leading, std::string* trailing, - std::vector* detached_comments) const { - GOOGLE_CHECK(!location_->has_leading_comments()); - GOOGLE_CHECK(!location_->has_trailing_comments()); - - if (!leading->empty()) { - location_->mutable_leading_comments()->swap(*leading); - } - if (!trailing->empty()) { - location_->mutable_trailing_comments()->swap(*trailing); - } - for (int i = 0; i < detached_comments->size(); ++i) { - location_->add_leading_detached_comments()->swap((*detached_comments)[i]); - } - detached_comments->clear(); -} - -// ------------------------------------------------------------------- - -void Parser::SkipStatement() { - while (true) { - if (AtEnd()) { - return; - } else if (LookingAtType(io::Tokenizer::TYPE_SYMBOL)) { - if (TryConsumeEndOfDeclaration(";", nullptr)) { - return; - } else if (TryConsume("{")) { - SkipRestOfBlock(); - return; - } else if (LookingAt("}")) { - return; - } - } - input_->Next(); - } -} - -void Parser::SkipRestOfBlock() { - while (true) { - if (AtEnd()) { - return; - } else if (LookingAtType(io::Tokenizer::TYPE_SYMBOL)) { - if (TryConsumeEndOfDeclaration("}", nullptr)) { - return; - } else if (TryConsume("{")) { - SkipRestOfBlock(); - } - } - input_->Next(); - } -} - -// =================================================================== - -bool Parser::ValidateEnum(const EnumDescriptorProto* proto) { - bool has_allow_alias = false; - bool allow_alias = false; - - for (int i = 0; i < proto->options().uninterpreted_option_size(); i++) { - const UninterpretedOption option = proto->options().uninterpreted_option(i); - if (option.name_size() > 1) { - continue; - } - if (!option.name(0).is_extension() && - option.name(0).name_part() == "allow_alias") { - has_allow_alias = true; - if (option.identifier_value() == "true") { - allow_alias = true; - } - break; - } - } - - if (has_allow_alias && !allow_alias) { - std::string error = - "\"" + proto->name() + - "\" declares 'option allow_alias = false;' which has no effect. " - "Please remove the declaration."; - // This needlessly clutters declarations with nops. - AddError(error); - return false; - } - - std::set used_values; - bool has_duplicates = false; - for (int i = 0; i < proto->value_size(); ++i) { - const EnumValueDescriptorProto& enum_value = proto->value(i); - if (used_values.find(enum_value.number()) != used_values.end()) { - has_duplicates = true; - break; - } else { - used_values.insert(enum_value.number()); - } - } - if (allow_alias && !has_duplicates) { - std::string error = - "\"" + proto->name() + - "\" declares support for enum aliases but no enum values share field " - "numbers. Please remove the unnecessary 'option allow_alias = true;' " - "declaration."; - // Generate an error if an enum declares support for duplicate enum values - // and does not use it protect future authors. - AddError(error); - return false; - } - - // Enforce that enum constants must be UPPER_CASE except in case of - // enum_alias. - if (!allow_alias) { - for (const auto& enum_value : proto->value()) { - if (!IsUpperUnderscore(enum_value.name())) { - AddWarning( - "Enum constant should be in UPPER_CASE. Found: " + - enum_value.name() + - ". See https://developers.google.com/protocol-buffers/docs/style"); - } - } - } - - return true; -} - -bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { - input_ = input; - had_errors_ = false; - syntax_identifier_.clear(); - - // Note that |file| could be NULL at this point if - // stop_after_syntax_identifier_ is true. So, we conservatively allocate - // SourceCodeInfo on the stack, then swap it into the FileDescriptorProto - // later on. - SourceCodeInfo source_code_info; - source_code_info_ = &source_code_info; - - if (LookingAtType(io::Tokenizer::TYPE_START)) { - // Advance to first token. - input_->NextWithComments(nullptr, &upcoming_detached_comments_, - &upcoming_doc_comments_); - } - - { - LocationRecorder root_location(this); - root_location.RecordLegacyLocation(file, - DescriptorPool::ErrorCollector::OTHER); - - if (require_syntax_identifier_ || LookingAt("syntax")) { - if (!ParseSyntaxIdentifier(root_location)) { - // Don't attempt to parse the file if we didn't recognize the syntax - // identifier. - return false; - } - // Store the syntax into the file. - if (file != nullptr) file->set_syntax(syntax_identifier_); - } else if (!stop_after_syntax_identifier_) { - GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " << file->name() - << ". Please use 'syntax = \"proto2\";' " - << "or 'syntax = \"proto3\";' to specify a syntax " - << "version. (Defaulted to proto2 syntax.)"; - syntax_identifier_ = "proto2"; - } - - if (stop_after_syntax_identifier_) return !had_errors_; - - // Repeatedly parse statements until we reach the end of the file. - while (!AtEnd()) { - if (!ParseTopLevelStatement(file, root_location)) { - // This statement failed to parse. Skip it, but keep looping to parse - // other statements. - SkipStatement(); - - if (LookingAt("}")) { - AddError("Unmatched \"}\"."); - input_->NextWithComments(nullptr, &upcoming_detached_comments_, - &upcoming_doc_comments_); - } - } - } - } - - input_ = nullptr; - source_code_info_ = nullptr; - assert(file != nullptr); - source_code_info.Swap(file->mutable_source_code_info()); - return !had_errors_; -} - -bool Parser::ParseSyntaxIdentifier(const LocationRecorder& parent) { - LocationRecorder syntax_location(parent, - FileDescriptorProto::kSyntaxFieldNumber); - DO(Consume( - "syntax", - "File must begin with a syntax statement, e.g. 'syntax = \"proto2\";'.")); - DO(Consume("=")); - io::Tokenizer::Token syntax_token = input_->current(); - std::string syntax; - DO(ConsumeString(&syntax, "Expected syntax identifier.")); - DO(ConsumeEndOfDeclaration(";", &syntax_location)); - - syntax_identifier_ = syntax; - - if (syntax != "proto2" && syntax != "proto3" && - !stop_after_syntax_identifier_) { - AddError(syntax_token.line, syntax_token.column, - "Unrecognized syntax identifier \"" + syntax + - "\". This parser " - "only recognizes \"proto2\" and \"proto3\"."); - return false; - } - - return true; -} - -bool Parser::ParseTopLevelStatement(FileDescriptorProto* file, - const LocationRecorder& root_location) { - if (TryConsumeEndOfDeclaration(";", nullptr)) { - // empty statement; ignore - return true; - } else if (LookingAt("message")) { - LocationRecorder location(root_location, - FileDescriptorProto::kMessageTypeFieldNumber, - file->message_type_size()); - return ParseMessageDefinition(file->add_message_type(), location, file); - } else if (LookingAt("enum")) { - LocationRecorder location(root_location, - FileDescriptorProto::kEnumTypeFieldNumber, - file->enum_type_size()); - return ParseEnumDefinition(file->add_enum_type(), location, file); - } else if (LookingAt("service")) { - LocationRecorder location(root_location, - FileDescriptorProto::kServiceFieldNumber, - file->service_size()); - return ParseServiceDefinition(file->add_service(), location, file); - } else if (LookingAt("extend")) { - LocationRecorder location(root_location, - FileDescriptorProto::kExtensionFieldNumber); - return ParseExtend( - file->mutable_extension(), file->mutable_message_type(), root_location, - FileDescriptorProto::kMessageTypeFieldNumber, location, file); - } else if (LookingAt("import")) { - return ParseImport(file->mutable_dependency(), - file->mutable_public_dependency(), - file->mutable_weak_dependency(), root_location, file); - } else if (LookingAt("package")) { - return ParsePackage(file, root_location, file); - } else if (LookingAt("option")) { - LocationRecorder location(root_location, - FileDescriptorProto::kOptionsFieldNumber); - return ParseOption(file->mutable_options(), location, file, - OPTION_STATEMENT); - } else { - AddError("Expected top-level statement (e.g. \"message\")."); - return false; - } -} - -// ------------------------------------------------------------------- -// Messages - -bool Parser::ParseMessageDefinition( - DescriptorProto* message, const LocationRecorder& message_location, - const FileDescriptorProto* containing_file) { - DO(Consume("message")); - { - LocationRecorder location(message_location, - DescriptorProto::kNameFieldNumber); - location.RecordLegacyLocation(message, - DescriptorPool::ErrorCollector::NAME); - DO(ConsumeIdentifier(message->mutable_name(), "Expected message name.")); - if (!IsUpperCamelCase(message->name())) { - AddWarning( - "Message name should be in UpperCamelCase. Found: " + - message->name() + - ". See https://developers.google.com/protocol-buffers/docs/style"); - } - } - 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; -} - -namespace { - -const int kMaxRangeSentinel = -1; - -bool IsMessageSetWireFormatMessage(const DescriptorProto& message) { - const MessageOptions& options = message.options(); - for (int i = 0; i < options.uninterpreted_option_size(); ++i) { - const UninterpretedOption& uninterpreted = options.uninterpreted_option(i); - if (uninterpreted.name_size() == 1 && - uninterpreted.name(0).name_part() == "message_set_wire_format" && - uninterpreted.identifier_value() == "true") { - return true; - } - } - return false; -} - -// Modifies any extension ranges that specified 'max' as the end of the -// extension range, and sets them to the type-specific maximum. The actual max -// 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 - ? 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); - } - } -} - -// Modifies any reserved ranges that specified 'max' as the end of the -// reserved range, and sets them to the type-specific maximum. The actual max -// 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 - ? 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); - } - } -} - -} // namespace - -bool Parser::ParseMessageBlock(DescriptorProto* message, - const LocationRecorder& message_location, - const FileDescriptorProto* containing_file) { - DO(ConsumeEndOfDeclaration("{", &message_location)); - - while (!TryConsumeEndOfDeclaration("}", nullptr)) { - if (AtEnd()) { - AddError("Reached end of input in message definition (missing '}')."); - return false; - } - - if (!ParseMessageStatement(message, message_location, containing_file)) { - // This statement failed to parse. Skip it, but keep looping to parse - // other statements. - SkipStatement(); - } - } - - if (message->extension_range_size() > 0) { - AdjustExtensionRangesWithMaxEndNumber(message); - } - if (message->reserved_range_size() > 0) { - AdjustReservedRangesWithMaxEndNumber(message); - } - return true; -} - -bool Parser::ParseMessageStatement(DescriptorProto* message, - const LocationRecorder& message_location, - const FileDescriptorProto* containing_file) { - if (TryConsumeEndOfDeclaration(";", nullptr)) { - // empty statement; ignore - return true; - } else if (LookingAt("message")) { - LocationRecorder location(message_location, - DescriptorProto::kNestedTypeFieldNumber, - message->nested_type_size()); - return ParseMessageDefinition(message->add_nested_type(), location, - containing_file); - } else if (LookingAt("enum")) { - LocationRecorder location(message_location, - DescriptorProto::kEnumTypeFieldNumber, - message->enum_type_size()); - return ParseEnumDefinition(message->add_enum_type(), location, - containing_file); - } else if (LookingAt("extensions")) { - LocationRecorder location(message_location, - DescriptorProto::kExtensionRangeFieldNumber); - return ParseExtensions(message, location, containing_file); - } else if (LookingAt("reserved")) { - return ParseReserved(message, message_location); - } else if (LookingAt("extend")) { - LocationRecorder location(message_location, - DescriptorProto::kExtensionFieldNumber); - return ParseExtend(message->mutable_extension(), - message->mutable_nested_type(), message_location, - DescriptorProto::kNestedTypeFieldNumber, location, - containing_file); - } else if (LookingAt("option")) { - LocationRecorder location(message_location, - DescriptorProto::kOptionsFieldNumber); - return ParseOption(message->mutable_options(), location, containing_file, - OPTION_STATEMENT); - } else if (LookingAt("oneof")) { - int oneof_index = message->oneof_decl_size(); - LocationRecorder oneof_location( - message_location, DescriptorProto::kOneofDeclFieldNumber, oneof_index); - - return ParseOneof(message->add_oneof_decl(), message, oneof_index, - oneof_location, message_location, containing_file); - } else { - LocationRecorder location(message_location, - DescriptorProto::kFieldFieldNumber, - message->field_size()); - return ParseMessageField( - message->add_field(), message->mutable_nested_type(), message_location, - DescriptorProto::kNestedTypeFieldNumber, location, containing_file); - } -} - -bool Parser::ParseMessageField(FieldDescriptorProto* field, - RepeatedPtrField* messages, - const LocationRecorder& parent_location, - int location_field_number_for_nested_type, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file) { - { - FieldDescriptorProto::Label label; - if (ParseLabel(&label, field_location)) { - field->set_label(label); - if (label == FieldDescriptorProto::LABEL_OPTIONAL && - syntax_identifier_ == "proto3") { - field->set_proto3_optional(true); - } - } - } - - return ParseMessageFieldNoLabel(field, messages, parent_location, - location_field_number_for_nested_type, - field_location, containing_file); -} - -bool Parser::ParseMessageFieldNoLabel( - FieldDescriptorProto* field, RepeatedPtrField* messages, - const LocationRecorder& parent_location, - int location_field_number_for_nested_type, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file) { - MapField map_field; - // Parse type. - { - LocationRecorder location(field_location); // add path later - location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::TYPE); - - bool type_parsed = false; - FieldDescriptorProto::Type type = FieldDescriptorProto::TYPE_INT32; - std::string type_name; - - // Special case map field. We only treat the field as a map field if the - // field type name starts with the word "map" with a following "<". - if (TryConsume("map")) { - if (LookingAt("<")) { - map_field.is_map_field = true; - DO(ParseMapType(&map_field, field, location)); - } else { - // False positive - type_parsed = true; - type_name = "map"; - } - } - if (!map_field.is_map_field) { - // Handle the case where no explicit label is given for a non-map field. - if (!field->has_label() && DefaultToOptionalFields()) { - field->set_label(FieldDescriptorProto::LABEL_OPTIONAL); - } - if (!field->has_label()) { - AddError("Expected \"required\", \"optional\", or \"repeated\"."); - // We can actually reasonably recover here by just assuming the user - // forgot the label altogether. - field->set_label(FieldDescriptorProto::LABEL_OPTIONAL); - } - - // Handle the case where the actual type is a message or enum named - // "map", which we already consumed in the code above. - if (!type_parsed) { - DO(ParseType(&type, &type_name)); - } - if (type_name.empty()) { - location.AddPath(FieldDescriptorProto::kTypeFieldNumber); - field->set_type(type); - } else { - location.AddPath(FieldDescriptorProto::kTypeNameFieldNumber); - field->set_type_name(type_name); - } - } - } - - // Parse name and '='. - io::Tokenizer::Token name_token = input_->current(); - { - LocationRecorder location(field_location, - FieldDescriptorProto::kNameFieldNumber); - location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::NAME); - DO(ConsumeIdentifier(field->mutable_name(), "Expected field name.")); - - if (!IsLowerUnderscore(field->name())) { - AddWarning( - "Field name should be lowercase. Found: " + field->name() + - ". See: https://developers.google.com/protocol-buffers/docs/style"); - } - if (IsNumberFollowUnderscore(field->name())) { - AddWarning( - "Number should not come right after an underscore. Found: " + - field->name() + - ". See: https://developers.google.com/protocol-buffers/docs/style"); - } - } - DO(Consume("=", "Missing field number.")); - - // Parse field number. - { - LocationRecorder location(field_location, - FieldDescriptorProto::kNumberFieldNumber); - location.RecordLegacyLocation(field, - DescriptorPool::ErrorCollector::NUMBER); - int number; - DO(ConsumeInteger(&number, "Expected field number.")); - field->set_number(number); - } - - // Parse options. - DO(ParseFieldOptions(field, field_location, containing_file)); - - // Deal with groups. - if (field->has_type() && field->type() == FieldDescriptorProto::TYPE_GROUP) { - // Awkward: Since a group declares both a message type and a field, we - // have to create overlapping locations. - LocationRecorder group_location(parent_location); - group_location.StartAt(field_location); - group_location.AddPath(location_field_number_for_nested_type); - group_location.AddPath(messages->size()); - - DescriptorProto* group = messages->Add(); - group->set_name(field->name()); - - // Record name location to match the field name's location. - { - LocationRecorder location(group_location, - DescriptorProto::kNameFieldNumber); - location.StartAt(name_token); - location.EndAt(name_token); - location.RecordLegacyLocation(group, - DescriptorPool::ErrorCollector::NAME); - } - - // The field's type_name also comes from the name. Confusing! - { - LocationRecorder location(field_location, - FieldDescriptorProto::kTypeNameFieldNumber); - location.StartAt(name_token); - location.EndAt(name_token); - } - - // As a hack for backwards-compatibility, we force the group name to start - // with a capital letter and lower-case the field name. New code should - // not use groups; it should use nested messages. - if (group->name()[0] < 'A' || 'Z' < group->name()[0]) { - AddError(name_token.line, name_token.column, - "Group names must start with a capital letter."); - } - LowerString(field->mutable_name()); - - field->set_type_name(group->name()); - if (LookingAt("{")) { - DO(ParseMessageBlock(group, group_location, containing_file)); - } else { - AddError("Missing group body."); - return false; - } - } else { - DO(ConsumeEndOfDeclaration(";", &field_location)); - } - - // Create a map entry type if this is a map field. - if (map_field.is_map_field) { - GenerateMapEntry(map_field, field, messages); - } - - return true; -} - -bool Parser::ParseMapType(MapField* map_field, FieldDescriptorProto* field, - LocationRecorder& type_name_location) { - if (field->has_oneof_index()) { - AddError("Map fields are not allowed in oneofs."); - return false; - } - if (field->has_label()) { - AddError( - "Field labels (required/optional/repeated) are not allowed on " - "map fields."); - return false; - } - if (field->has_extendee()) { - AddError("Map fields are not allowed to be extensions."); - return false; - } - field->set_label(FieldDescriptorProto::LABEL_REPEATED); - DO(Consume("<")); - DO(ParseType(&map_field->key_type, &map_field->key_type_name)); - DO(Consume(",")); - DO(ParseType(&map_field->value_type, &map_field->value_type_name)); - DO(Consume(">")); - // Defer setting of the type name of the map field until the - // field name is parsed. Add the source location though. - type_name_location.AddPath(FieldDescriptorProto::kTypeNameFieldNumber); - return true; -} - -void Parser::GenerateMapEntry(const MapField& map_field, - FieldDescriptorProto* field, - RepeatedPtrField* messages) { - DescriptorProto* entry = messages->Add(); - std::string entry_name = MapEntryName(field->name()); - field->set_type_name(entry_name); - entry->set_name(entry_name); - entry->mutable_options()->set_map_entry(true); - FieldDescriptorProto* key_field = entry->add_field(); - key_field->set_name("key"); - key_field->set_label(FieldDescriptorProto::LABEL_OPTIONAL); - key_field->set_number(1); - if (map_field.key_type_name.empty()) { - key_field->set_type(map_field.key_type); - } else { - key_field->set_type_name(map_field.key_type_name); - } - FieldDescriptorProto* value_field = entry->add_field(); - value_field->set_name("value"); - value_field->set_label(FieldDescriptorProto::LABEL_OPTIONAL); - value_field->set_number(2); - if (map_field.value_type_name.empty()) { - value_field->set_type(map_field.value_type); - } else { - value_field->set_type_name(map_field.value_type_name); - } - // Propagate the "enforce_utf8" option to key and value fields if they - // are strings. This helps simplify the implementation of code generators - // and also reflection-based parsing code. - // - // The following definition: - // message Foo { - // map value = 1 [enforce_utf8 = false]; - // } - // will be interpreted as: - // message Foo { - // message ValueEntry { - // option map_entry = true; - // string key = 1 [enforce_utf8 = false]; - // string value = 2 [enforce_utf8 = false]; - // } - // repeated ValueEntry value = 1 [enforce_utf8 = false]; - // } - // - // TODO(xiaofeng): Remove this when the "enforce_utf8" option is removed - // from protocol compiler. - for (int i = 0; i < field->options().uninterpreted_option_size(); ++i) { - const UninterpretedOption& option = - field->options().uninterpreted_option(i); - if (option.name_size() == 1 && - option.name(0).name_part() == "enforce_utf8" && - !option.name(0).is_extension()) { - if (key_field->type() == FieldDescriptorProto::TYPE_STRING) { - key_field->mutable_options()->add_uninterpreted_option()->CopyFrom( - option); - } - if (value_field->type() == FieldDescriptorProto::TYPE_STRING) { - value_field->mutable_options()->add_uninterpreted_option()->CopyFrom( - option); - } - } - } -} - -bool Parser::ParseFieldOptions(FieldDescriptorProto* field, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file) { - if (!LookingAt("[")) return true; - - LocationRecorder location(field_location, - FieldDescriptorProto::kOptionsFieldNumber); - - DO(Consume("[")); - - // Parse field options. - do { - if (LookingAt("default")) { - // We intentionally pass field_location rather than location here, since - // the default value is not actually an option. - DO(ParseDefaultAssignment(field, field_location, containing_file)); - } else if (LookingAt("json_name")) { - // Like default value, this "json_name" is not an actual option. - DO(ParseJsonName(field, field_location, containing_file)); - } else { - DO(ParseOption(field->mutable_options(), location, containing_file, - OPTION_ASSIGNMENT)); - } - } while (TryConsume(",")); - - DO(Consume("]")); - return true; -} - -bool Parser::ParseDefaultAssignment( - FieldDescriptorProto* field, const LocationRecorder& field_location, - const FileDescriptorProto* containing_file) { - if (field->has_default_value()) { - AddError("Already set option \"default\"."); - field->clear_default_value(); - } - - DO(Consume("default")); - DO(Consume("=")); - - LocationRecorder location(field_location, - FieldDescriptorProto::kDefaultValueFieldNumber); - location.RecordLegacyLocation(field, - DescriptorPool::ErrorCollector::DEFAULT_VALUE); - std::string* default_value = field->mutable_default_value(); - - if (!field->has_type()) { - // The field has a type name, but we don't know if it is a message or an - // enum yet. (If it were a primitive type, |field| would have a type set - // already.) In this case, simply take the current string as the default - // value; we will catch the error later if it is not a valid enum value. - // (N.B. that we do not check whether the current token is an identifier: - // doing so throws strange errors when the user mistypes a primitive - // typename and we assume it's an enum. E.g.: "optional int foo = 1 [default - // = 42]". In such a case the fundamental error is really that "int" is not - // a type, not that "42" is not an identifier. See b/12533582.) - *default_value = input_->current().text; - input_->Next(); - return true; - } - - switch (field->type()) { - case FieldDescriptorProto::TYPE_INT32: - case FieldDescriptorProto::TYPE_INT64: - case FieldDescriptorProto::TYPE_SINT32: - case FieldDescriptorProto::TYPE_SINT64: - case FieldDescriptorProto::TYPE_SFIXED32: - case FieldDescriptorProto::TYPE_SFIXED64: { - 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 = std::numeric_limits::max(); - } - - // These types can be negative. - if (TryConsume("-")) { - default_value->append("-"); - // Two's complement always has one more negative value than positive. - ++max_value; - } - // Parse the integer to verify that it is not out-of-range. - uint64_t value; - DO(ConsumeInteger64(max_value, &value, - "Expected integer for field default value.")); - // And stringify it again. - default_value->append(StrCat(value)); - break; - } - - case FieldDescriptorProto::TYPE_UINT32: - case FieldDescriptorProto::TYPE_UINT64: - case FieldDescriptorProto::TYPE_FIXED32: - case FieldDescriptorProto::TYPE_FIXED64: { - uint64_t max_value = std::numeric_limits::max(); - if (field->type() == FieldDescriptorProto::TYPE_UINT32 || - field->type() == FieldDescriptorProto::TYPE_FIXED32) { - max_value = std::numeric_limits::max(); - } - - // Numeric, not negative. - if (TryConsume("-")) { - AddError("Unsigned field can't have negative default value."); - } - // Parse the integer to verify that it is not out-of-range. - uint64_t value; - DO(ConsumeInteger64(max_value, &value, - "Expected integer for field default value.")); - // And stringify it again. - default_value->append(StrCat(value)); - break; - } - - case FieldDescriptorProto::TYPE_FLOAT: - case FieldDescriptorProto::TYPE_DOUBLE: - // These types can be negative. - if (TryConsume("-")) { - default_value->append("-"); - } - // Parse the integer because we have to convert hex integers to decimal - // floats. - double value; - DO(ConsumeNumber(&value, "Expected number.")); - // And stringify it again. - default_value->append(SimpleDtoa(value)); - break; - - case FieldDescriptorProto::TYPE_BOOL: - if (TryConsume("true")) { - default_value->assign("true"); - } else if (TryConsume("false")) { - default_value->assign("false"); - } else { - AddError("Expected \"true\" or \"false\"."); - return false; - } - break; - - case FieldDescriptorProto::TYPE_STRING: - // 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, - "Expected string for field default " - "value.")); - break; - - case FieldDescriptorProto::TYPE_BYTES: - DO(ConsumeString(default_value, "Expected string.")); - *default_value = CEscape(*default_value); - break; - - case FieldDescriptorProto::TYPE_ENUM: - DO(ConsumeIdentifier(default_value, - "Expected enum identifier for field " - "default value.")); - break; - - case FieldDescriptorProto::TYPE_MESSAGE: - case FieldDescriptorProto::TYPE_GROUP: - AddError("Messages can't have default values."); - return false; - } - - return true; -} - -bool Parser::ParseJsonName(FieldDescriptorProto* field, - const LocationRecorder& field_location, - const FileDescriptorProto* containing_file) { - if (field->has_json_name()) { - AddError("Already set option \"json_name\"."); - field->clear_json_name(); - } - - LocationRecorder location(field_location, - FieldDescriptorProto::kJsonNameFieldNumber); - location.RecordLegacyLocation(field, - DescriptorPool::ErrorCollector::OPTION_NAME); - - DO(Consume("json_name")); - DO(Consume("=")); - - LocationRecorder value_location(location); - value_location.RecordLegacyLocation( - field, DescriptorPool::ErrorCollector::OPTION_VALUE); - - DO(ConsumeString(field->mutable_json_name(), - "Expected string for JSON name.")); - return true; -} - -bool Parser::ParseOptionNamePart(UninterpretedOption* uninterpreted_option, - const LocationRecorder& part_location, - const FileDescriptorProto* containing_file) { - UninterpretedOption::NamePart* name = uninterpreted_option->add_name(); - std::string identifier; // We parse identifiers into this string. - if (LookingAt("(")) { // This is an extension. - DO(Consume("(")); - - { - LocationRecorder location( - part_location, UninterpretedOption::NamePart::kNamePartFieldNumber); - // An extension name consists of dot-separated identifiers, and may begin - // with a dot. - if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) { - DO(ConsumeIdentifier(&identifier, "Expected identifier.")); - name->mutable_name_part()->append(identifier); - } - while (LookingAt(".")) { - DO(Consume(".")); - name->mutable_name_part()->append("."); - DO(ConsumeIdentifier(&identifier, "Expected identifier.")); - name->mutable_name_part()->append(identifier); - } - } - - DO(Consume(")")); - name->set_is_extension(true); - } else { // This is a regular field. - LocationRecorder location( - part_location, UninterpretedOption::NamePart::kNamePartFieldNumber); - DO(ConsumeIdentifier(&identifier, "Expected identifier.")); - name->mutable_name_part()->append(identifier); - name->set_is_extension(false); - } - return true; -} - -bool Parser::ParseUninterpretedBlock(std::string* value) { - // Note that enclosing braces are not added to *value. - // We do NOT use ConsumeEndOfStatement for this brace because it's delimiting - // an expression, not a block of statements. - DO(Consume("{")); - int brace_depth = 1; - while (!AtEnd()) { - if (LookingAt("{")) { - brace_depth++; - } else if (LookingAt("}")) { - brace_depth--; - if (brace_depth == 0) { - input_->Next(); - return true; - } - } - // TODO(sanjay): Interpret line/column numbers to preserve formatting - if (!value->empty()) value->push_back(' '); - value->append(input_->current().text); - input_->Next(); - } - AddError("Unexpected end of stream while parsing aggregate value."); - return false; -} - -// We don't interpret the option here. Instead we store it in an -// UninterpretedOption, to be interpreted later. -bool Parser::ParseOption(Message* options, - const LocationRecorder& options_location, - const FileDescriptorProto* containing_file, - OptionStyle style) { - // Create an entry in the uninterpreted_option field. - const FieldDescriptor* uninterpreted_option_field = - options->GetDescriptor()->FindFieldByName("uninterpreted_option"); - GOOGLE_CHECK(uninterpreted_option_field != nullptr) - << "No field named \"uninterpreted_option\" in the Options proto."; - - const Reflection* reflection = options->GetReflection(); - - LocationRecorder location( - options_location, uninterpreted_option_field->number(), - reflection->FieldSize(*options, uninterpreted_option_field)); - - if (style == OPTION_STATEMENT) { - DO(Consume("option")); - } - - UninterpretedOption* uninterpreted_option = - down_cast(options->GetReflection()->AddMessage( - options, uninterpreted_option_field)); - - // Parse dot-separated name. - { - LocationRecorder name_location(location, - UninterpretedOption::kNameFieldNumber); - name_location.RecordLegacyLocation( - uninterpreted_option, DescriptorPool::ErrorCollector::OPTION_NAME); - - { - LocationRecorder part_location(name_location, - uninterpreted_option->name_size()); - DO(ParseOptionNamePart(uninterpreted_option, part_location, - containing_file)); - } - - while (LookingAt(".")) { - DO(Consume(".")); - LocationRecorder part_location(name_location, - uninterpreted_option->name_size()); - DO(ParseOptionNamePart(uninterpreted_option, part_location, - containing_file)); - } - } - - DO(Consume("=")); - - { - LocationRecorder value_location(location); - value_location.RecordLegacyLocation( - uninterpreted_option, DescriptorPool::ErrorCollector::OPTION_VALUE); - - // All values are a single token, except for negative numbers, which consist - // of a single '-' symbol, followed by a positive number. - bool is_negative = TryConsume("-"); - - switch (input_->current().type) { - case io::Tokenizer::TYPE_START: - GOOGLE_LOG(FATAL) << "Trying to read value before any tokens have been read."; - return false; - - case io::Tokenizer::TYPE_END: - 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); - if (is_negative) { - AddError("Invalid '-' symbol before identifier."); - return false; - } - std::string value; - DO(ConsumeIdentifier(&value, "Expected identifier.")); - uninterpreted_option->set_identifier_value(value); - break; - } - - case io::Tokenizer::TYPE_INTEGER: { - 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(0 - value)); - } else { - value_location.AddPath( - UninterpretedOption::kPositiveIntValueFieldNumber); - uninterpreted_option->set_positive_int_value(value); - } - break; - } - - case io::Tokenizer::TYPE_FLOAT: { - value_location.AddPath(UninterpretedOption::kDoubleValueFieldNumber); - double value; - DO(ConsumeNumber(&value, "Expected number.")); - uninterpreted_option->set_double_value(is_negative ? -value : value); - break; - } - - case io::Tokenizer::TYPE_STRING: { - value_location.AddPath(UninterpretedOption::kStringValueFieldNumber); - if (is_negative) { - AddError("Invalid '-' symbol before string."); - return false; - } - std::string value; - DO(ConsumeString(&value, "Expected string.")); - uninterpreted_option->set_string_value(value); - break; - } - - case io::Tokenizer::TYPE_SYMBOL: - if (LookingAt("{")) { - value_location.AddPath( - UninterpretedOption::kAggregateValueFieldNumber); - DO(ParseUninterpretedBlock( - uninterpreted_option->mutable_aggregate_value())); - } else { - AddError("Expected option value."); - return false; - } - break; - } - } - - if (style == OPTION_STATEMENT) { - DO(ConsumeEndOfDeclaration(";", &location)); - } - - return true; -} - -bool Parser::ParseExtensions(DescriptorProto* message, - const LocationRecorder& extensions_location, - const FileDescriptorProto* containing_file) { - // Parse the declaration. - DO(Consume("extensions")); - - int old_range_size = message->extension_range_size(); - - do { - // Note that kExtensionRangeFieldNumber was already pushed by the parent. - LocationRecorder location(extensions_location, - message->extension_range_size()); - - DescriptorProto::ExtensionRange* range = message->add_extension_range(); - location.RecordLegacyLocation(range, - DescriptorPool::ErrorCollector::NUMBER); - - int start, end; - io::Tokenizer::Token start_token; - - { - LocationRecorder start_location( - location, DescriptorProto::ExtensionRange::kStartFieldNumber); - start_token = input_->current(); - DO(ConsumeInteger(&start, "Expected field number range.")); - } - - if (TryConsume("to")) { - LocationRecorder end_location( - location, DescriptorProto::ExtensionRange::kEndFieldNumber); - if (TryConsume("max")) { - // Set to the sentinel value - 1 since we increment the value below. - // The actual value of the end of the range should be set with - // AdjustExtensionRangesWithMaxEndNumber. - end = kMaxRangeSentinel - 1; - } else { - DO(ConsumeInteger(&end, "Expected integer.")); - } - } else { - LocationRecorder end_location( - location, DescriptorProto::ExtensionRange::kEndFieldNumber); - end_location.StartAt(start_token); - end_location.EndAt(start_token); - end = start; - } - - // Users like to specify inclusive ranges, but in code we like the end - // number to be exclusive. - ++end; - - range->set_start(start); - range->set_end(end); - } while (TryConsume(",")); - - if (LookingAt("[")) { - int range_number_index = extensions_location.CurrentPathSize(); - SourceCodeInfo info; - - // Parse extension range options in the first range. - ExtensionRangeOptions* options = - message->mutable_extension_range(old_range_size)->mutable_options(); - - { - LocationRecorder index_location( - extensions_location, 0 /* we fill this in w/ actual index below */, - &info); - LocationRecorder location( - index_location, DescriptorProto::ExtensionRange::kOptionsFieldNumber); - DO(Consume("[")); - - do { - DO(ParseOption(options, location, containing_file, OPTION_ASSIGNMENT)); - } while (TryConsume(",")); - - DO(Consume("]")); - } - - // Then copy the extension range options to all of the other ranges we've - // parsed. - for (int i = old_range_size + 1; i < message->extension_range_size(); i++) { - message->mutable_extension_range(i)->mutable_options()->CopyFrom( - *options); - } - // and copy source locations to the other ranges, too - for (int i = old_range_size; i < message->extension_range_size(); i++) { - for (int j = 0; j < info.location_size(); j++) { - if (info.location(j).path_size() == range_number_index + 1) { - // this location's path is up to the extension range index, but - // doesn't include options; so it's redundant with location above - continue; - } - SourceCodeInfo_Location* dest = source_code_info_->add_location(); - *dest = info.location(j); - dest->set_path(range_number_index, i); - } - } - } - - DO(ConsumeEndOfDeclaration(";", &extensions_location)); - return true; -} - -// This is similar to extension range parsing, except that it accepts field -// name literals. -bool Parser::ParseReserved(DescriptorProto* message, - const LocationRecorder& message_location) { - io::Tokenizer::Token start_token = input_->current(); - // Parse the declaration. - DO(Consume("reserved")); - if (LookingAtType(io::Tokenizer::TYPE_STRING)) { - LocationRecorder location(message_location, - DescriptorProto::kReservedNameFieldNumber); - location.StartAt(start_token); - return ParseReservedNames(message, location); - } else { - LocationRecorder location(message_location, - DescriptorProto::kReservedRangeFieldNumber); - location.StartAt(start_token); - return ParseReservedNumbers(message, location); - } -} - -bool Parser::ParseReservedNames(DescriptorProto* message, - const LocationRecorder& parent_location) { - do { - LocationRecorder location(parent_location, message->reserved_name_size()); - DO(ConsumeString(message->add_reserved_name(), "Expected field name.")); - } while (TryConsume(",")); - DO(ConsumeEndOfDeclaration(";", &parent_location)); - return true; -} - -bool Parser::ParseReservedNumbers(DescriptorProto* message, - const LocationRecorder& parent_location) { - bool first = true; - do { - LocationRecorder location(parent_location, message->reserved_range_size()); - - DescriptorProto::ReservedRange* range = message->add_reserved_range(); - int start, end; - io::Tokenizer::Token start_token; - { - LocationRecorder start_location( - location, DescriptorProto::ReservedRange::kStartFieldNumber); - start_token = input_->current(); - DO(ConsumeInteger(&start, (first ? "Expected field name or number range." - : "Expected field number range."))); - } - - if (TryConsume("to")) { - LocationRecorder end_location( - location, DescriptorProto::ReservedRange::kEndFieldNumber); - if (TryConsume("max")) { - // Set to the sentinel value - 1 since we increment the value below. - // The actual value of the end of the range should be set with - // AdjustExtensionRangesWithMaxEndNumber. - end = kMaxRangeSentinel - 1; - } else { - DO(ConsumeInteger(&end, "Expected integer.")); - } - } else { - LocationRecorder end_location( - location, DescriptorProto::ReservedRange::kEndFieldNumber); - end_location.StartAt(start_token); - end_location.EndAt(start_token); - end = start; - } - - // Users like to specify inclusive ranges, but in code we like the end - // number to be exclusive. - ++end; - - range->set_start(start); - range->set_end(end); - first = false; - } while (TryConsume(",")); - - DO(ConsumeEndOfDeclaration(";", &parent_location)); - return true; -} - -bool Parser::ParseReserved(EnumDescriptorProto* message, - const LocationRecorder& message_location) { - io::Tokenizer::Token start_token = input_->current(); - // Parse the declaration. - DO(Consume("reserved")); - if (LookingAtType(io::Tokenizer::TYPE_STRING)) { - LocationRecorder location(message_location, - EnumDescriptorProto::kReservedNameFieldNumber); - location.StartAt(start_token); - return ParseReservedNames(message, location); - } else { - LocationRecorder location(message_location, - EnumDescriptorProto::kReservedRangeFieldNumber); - location.StartAt(start_token); - return ParseReservedNumbers(message, location); - } -} - -bool Parser::ParseReservedNames(EnumDescriptorProto* message, - const LocationRecorder& parent_location) { - do { - LocationRecorder location(parent_location, message->reserved_name_size()); - DO(ConsumeString(message->add_reserved_name(), "Expected enum value.")); - } while (TryConsume(",")); - DO(ConsumeEndOfDeclaration(";", &parent_location)); - return true; -} - -bool Parser::ParseReservedNumbers(EnumDescriptorProto* message, - const LocationRecorder& parent_location) { - bool first = true; - do { - LocationRecorder location(parent_location, message->reserved_range_size()); - - EnumDescriptorProto::EnumReservedRange* range = - message->add_reserved_range(); - int start, end; - io::Tokenizer::Token start_token; - { - LocationRecorder start_location( - location, EnumDescriptorProto::EnumReservedRange::kStartFieldNumber); - start_token = input_->current(); - DO(ConsumeSignedInteger(&start, - (first ? "Expected enum value or number range." - : "Expected enum number range."))); - } - - if (TryConsume("to")) { - LocationRecorder end_location( - location, EnumDescriptorProto::EnumReservedRange::kEndFieldNumber); - if (TryConsume("max")) { - // This is in the enum descriptor path, which doesn't have the message - // set duality to fix up, so it doesn't integrate with the sentinel. - end = INT_MAX; - } else { - DO(ConsumeSignedInteger(&end, "Expected integer.")); - } - } else { - LocationRecorder end_location( - location, EnumDescriptorProto::EnumReservedRange::kEndFieldNumber); - end_location.StartAt(start_token); - end_location.EndAt(start_token); - end = start; - } - - range->set_start(start); - range->set_end(end); - first = false; - } while (TryConsume(",")); - - DO(ConsumeEndOfDeclaration(";", &parent_location)); - return true; -} - -bool Parser::ParseExtend(RepeatedPtrField* extensions, - RepeatedPtrField* messages, - const LocationRecorder& parent_location, - int location_field_number_for_nested_type, - const LocationRecorder& extend_location, - const FileDescriptorProto* containing_file) { - DO(Consume("extend")); - - // Parse the extendee type. - io::Tokenizer::Token extendee_start = input_->current(); - std::string extendee; - DO(ParseUserDefinedType(&extendee)); - io::Tokenizer::Token extendee_end = input_->previous(); - - // Parse the block. - DO(ConsumeEndOfDeclaration("{", &extend_location)); - - bool is_first = true; - - do { - if (AtEnd()) { - AddError("Reached end of input in extend definition (missing '}')."); - return false; - } - - // Note that kExtensionFieldNumber was already pushed by the parent. - LocationRecorder location(extend_location, extensions->size()); - - FieldDescriptorProto* field = extensions->Add(); - - { - LocationRecorder extendee_location( - location, FieldDescriptorProto::kExtendeeFieldNumber); - extendee_location.StartAt(extendee_start); - extendee_location.EndAt(extendee_end); - - if (is_first) { - extendee_location.RecordLegacyLocation( - field, DescriptorPool::ErrorCollector::EXTENDEE); - is_first = false; - } - } - - field->set_extendee(extendee); - - if (!ParseMessageField(field, messages, parent_location, - location_field_number_for_nested_type, location, - containing_file)) { - // This statement failed to parse. Skip it, but keep looping to parse - // other statements. - SkipStatement(); - } - } while (!TryConsumeEndOfDeclaration("}", nullptr)); - - return true; -} - -bool Parser::ParseOneof(OneofDescriptorProto* oneof_decl, - DescriptorProto* containing_type, int oneof_index, - const LocationRecorder& oneof_location, - const LocationRecorder& containing_type_location, - const FileDescriptorProto* containing_file) { - DO(Consume("oneof")); - - { - LocationRecorder name_location(oneof_location, - OneofDescriptorProto::kNameFieldNumber); - DO(ConsumeIdentifier(oneof_decl->mutable_name(), "Expected oneof name.")); - } - - DO(ConsumeEndOfDeclaration("{", &oneof_location)); - - do { - if (AtEnd()) { - AddError("Reached end of input in oneof definition (missing '}')."); - return false; - } - - if (LookingAt("option")) { - LocationRecorder option_location( - oneof_location, OneofDescriptorProto::kOptionsFieldNumber); - if (!ParseOption(oneof_decl->mutable_options(), option_location, - containing_file, OPTION_STATEMENT)) { - return false; - } - continue; - } - - // Print a nice error if the user accidentally tries to place a label - // on an individual member of a oneof. - if (LookingAt("required") || LookingAt("optional") || - LookingAt("repeated")) { - AddError( - "Fields in oneofs must not have labels (required / optional " - "/ repeated)."); - // We can continue parsing here because we understand what the user - // meant. The error report will still make parsing fail overall. - input_->Next(); - } - - LocationRecorder field_location(containing_type_location, - DescriptorProto::kFieldFieldNumber, - containing_type->field_size()); - - FieldDescriptorProto* field = containing_type->add_field(); - field->set_label(FieldDescriptorProto::LABEL_OPTIONAL); - field->set_oneof_index(oneof_index); - - if (!ParseMessageFieldNoLabel(field, containing_type->mutable_nested_type(), - containing_type_location, - DescriptorProto::kNestedTypeFieldNumber, - field_location, containing_file)) { - // This statement failed to parse. Skip it, but keep looping to parse - // other statements. - SkipStatement(); - } - } while (!TryConsumeEndOfDeclaration("}", nullptr)); - - return true; -} - -// ------------------------------------------------------------------- -// Enums - -bool Parser::ParseEnumDefinition(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location, - const FileDescriptorProto* containing_file) { - DO(Consume("enum")); - - { - LocationRecorder location(enum_location, - EnumDescriptorProto::kNameFieldNumber); - location.RecordLegacyLocation(enum_type, - DescriptorPool::ErrorCollector::NAME); - DO(ConsumeIdentifier(enum_type->mutable_name(), "Expected enum name.")); - } - - DO(ParseEnumBlock(enum_type, enum_location, containing_file)); - - DO(ValidateEnum(enum_type)); - - return true; -} - -bool Parser::ParseEnumBlock(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location, - const FileDescriptorProto* containing_file) { - DO(ConsumeEndOfDeclaration("{", &enum_location)); - - while (!TryConsumeEndOfDeclaration("}", nullptr)) { - if (AtEnd()) { - AddError("Reached end of input in enum definition (missing '}')."); - return false; - } - - if (!ParseEnumStatement(enum_type, enum_location, containing_file)) { - // This statement failed to parse. Skip it, but keep looping to parse - // other statements. - SkipStatement(); - } - } - - return true; -} - -bool Parser::ParseEnumStatement(EnumDescriptorProto* enum_type, - const LocationRecorder& enum_location, - const FileDescriptorProto* containing_file) { - if (TryConsumeEndOfDeclaration(";", nullptr)) { - // empty statement; ignore - return true; - } else if (LookingAt("option")) { - LocationRecorder location(enum_location, - EnumDescriptorProto::kOptionsFieldNumber); - return ParseOption(enum_type->mutable_options(), location, containing_file, - OPTION_STATEMENT); - } else if (LookingAt("reserved")) { - return ParseReserved(enum_type, enum_location); - } else { - LocationRecorder location(enum_location, - EnumDescriptorProto::kValueFieldNumber, - enum_type->value_size()); - return ParseEnumConstant(enum_type->add_value(), location, containing_file); - } -} - -bool Parser::ParseEnumConstant(EnumValueDescriptorProto* enum_value, - const LocationRecorder& enum_value_location, - const FileDescriptorProto* containing_file) { - // Parse name. - { - LocationRecorder location(enum_value_location, - EnumValueDescriptorProto::kNameFieldNumber); - location.RecordLegacyLocation(enum_value, - DescriptorPool::ErrorCollector::NAME); - DO(ConsumeIdentifier(enum_value->mutable_name(), - "Expected enum constant name.")); - } - - DO(Consume("=", "Missing numeric value for enum constant.")); - - // Parse value. - { - LocationRecorder location(enum_value_location, - EnumValueDescriptorProto::kNumberFieldNumber); - location.RecordLegacyLocation(enum_value, - DescriptorPool::ErrorCollector::NUMBER); - - int number; - DO(ConsumeSignedInteger(&number, "Expected integer.")); - enum_value->set_number(number); - } - - DO(ParseEnumConstantOptions(enum_value, enum_value_location, - containing_file)); - - DO(ConsumeEndOfDeclaration(";", &enum_value_location)); - - return true; -} - -bool Parser::ParseEnumConstantOptions( - EnumValueDescriptorProto* value, - const LocationRecorder& enum_value_location, - const FileDescriptorProto* containing_file) { - if (!LookingAt("[")) return true; - - LocationRecorder location(enum_value_location, - EnumValueDescriptorProto::kOptionsFieldNumber); - - DO(Consume("[")); - - do { - DO(ParseOption(value->mutable_options(), location, containing_file, - OPTION_ASSIGNMENT)); - } while (TryConsume(",")); - - DO(Consume("]")); - return true; -} - -// ------------------------------------------------------------------- -// Services - -bool Parser::ParseServiceDefinition( - ServiceDescriptorProto* service, const LocationRecorder& service_location, - const FileDescriptorProto* containing_file) { - DO(Consume("service")); - - { - LocationRecorder location(service_location, - ServiceDescriptorProto::kNameFieldNumber); - location.RecordLegacyLocation(service, - DescriptorPool::ErrorCollector::NAME); - DO(ConsumeIdentifier(service->mutable_name(), "Expected service name.")); - } - - DO(ParseServiceBlock(service, service_location, containing_file)); - return true; -} - -bool Parser::ParseServiceBlock(ServiceDescriptorProto* service, - const LocationRecorder& service_location, - const FileDescriptorProto* containing_file) { - DO(ConsumeEndOfDeclaration("{", &service_location)); - - while (!TryConsumeEndOfDeclaration("}", nullptr)) { - if (AtEnd()) { - AddError("Reached end of input in service definition (missing '}')."); - return false; - } - - if (!ParseServiceStatement(service, service_location, containing_file)) { - // This statement failed to parse. Skip it, but keep looping to parse - // other statements. - SkipStatement(); - } - } - - return true; -} - -bool Parser::ParseServiceStatement(ServiceDescriptorProto* service, - const LocationRecorder& service_location, - const FileDescriptorProto* containing_file) { - if (TryConsumeEndOfDeclaration(";", nullptr)) { - // empty statement; ignore - return true; - } else if (LookingAt("option")) { - LocationRecorder location(service_location, - ServiceDescriptorProto::kOptionsFieldNumber); - return ParseOption(service->mutable_options(), location, containing_file, - OPTION_STATEMENT); - } else { - LocationRecorder location(service_location, - ServiceDescriptorProto::kMethodFieldNumber, - service->method_size()); - return ParseServiceMethod(service->add_method(), location, containing_file); - } -} - -bool Parser::ParseServiceMethod(MethodDescriptorProto* method, - const LocationRecorder& method_location, - const FileDescriptorProto* containing_file) { - DO(Consume("rpc")); - - { - LocationRecorder location(method_location, - MethodDescriptorProto::kNameFieldNumber); - location.RecordLegacyLocation(method, DescriptorPool::ErrorCollector::NAME); - DO(ConsumeIdentifier(method->mutable_name(), "Expected method name.")); - } - - // Parse input type. - DO(Consume("(")); - { - if (LookingAt("stream")) { - LocationRecorder location( - method_location, MethodDescriptorProto::kClientStreamingFieldNumber); - location.RecordLegacyLocation(method, - DescriptorPool::ErrorCollector::OTHER); - method->set_client_streaming(true); - DO(Consume("stream")); - } - LocationRecorder location(method_location, - MethodDescriptorProto::kInputTypeFieldNumber); - location.RecordLegacyLocation(method, - DescriptorPool::ErrorCollector::INPUT_TYPE); - DO(ParseUserDefinedType(method->mutable_input_type())); - } - DO(Consume(")")); - - // Parse output type. - DO(Consume("returns")); - DO(Consume("(")); - { - if (LookingAt("stream")) { - LocationRecorder location( - method_location, MethodDescriptorProto::kServerStreamingFieldNumber); - location.RecordLegacyLocation(method, - DescriptorPool::ErrorCollector::OTHER); - DO(Consume("stream")); - method->set_server_streaming(true); - } - LocationRecorder location(method_location, - MethodDescriptorProto::kOutputTypeFieldNumber); - location.RecordLegacyLocation(method, - DescriptorPool::ErrorCollector::OUTPUT_TYPE); - DO(ParseUserDefinedType(method->mutable_output_type())); - } - DO(Consume(")")); - - if (LookingAt("{")) { - // Options! - DO(ParseMethodOptions(method_location, containing_file, - MethodDescriptorProto::kOptionsFieldNumber, - method->mutable_options())); - } else { - DO(ConsumeEndOfDeclaration(";", &method_location)); - } - - return true; -} - -bool Parser::ParseMethodOptions(const LocationRecorder& parent_location, - const FileDescriptorProto* containing_file, - const int optionsFieldNumber, - Message* mutable_options) { - // Options! - ConsumeEndOfDeclaration("{", &parent_location); - while (!TryConsumeEndOfDeclaration("}", nullptr)) { - if (AtEnd()) { - AddError("Reached end of input in method options (missing '}')."); - return false; - } - - if (TryConsumeEndOfDeclaration(";", nullptr)) { - // empty statement; ignore - } else { - LocationRecorder location(parent_location, optionsFieldNumber); - if (!ParseOption(mutable_options, location, containing_file, - OPTION_STATEMENT)) { - // This statement failed to parse. Skip it, but keep looping to - // parse other statements. - SkipStatement(); - } - } - } - - return true; -} - -// ------------------------------------------------------------------- - -bool Parser::ParseLabel(FieldDescriptorProto::Label* label, - const LocationRecorder& field_location) { - if (!LookingAt("optional") && !LookingAt("repeated") && - !LookingAt("required")) { - return false; - } - LocationRecorder location(field_location, - FieldDescriptorProto::kLabelFieldNumber); - if (TryConsume("optional")) { - *label = FieldDescriptorProto::LABEL_OPTIONAL; - } else if (TryConsume("repeated")) { - *label = FieldDescriptorProto::LABEL_REPEATED; - } else { - Consume("required"); - *label = FieldDescriptorProto::LABEL_REQUIRED; - } - return true; -} - -bool Parser::ParseType(FieldDescriptorProto::Type* type, - std::string* type_name) { - const auto& type_names_table = GetTypeNameTable(); - auto iter = type_names_table.find(input_->current().text); - if (iter != type_names_table.end()) { - *type = iter->second; - input_->Next(); - } else { - DO(ParseUserDefinedType(type_name)); - } - return true; -} - -bool Parser::ParseUserDefinedType(std::string* type_name) { - type_name->clear(); - - const auto& type_names_table = GetTypeNameTable(); - auto iter = type_names_table.find(input_->current().text); - if (iter != type_names_table.end()) { - // Note: The only place enum types are allowed is for field types, but - // if we are parsing a field type then we would not get here because - // primitives are allowed there as well. So this error message doesn't - // need to account for enums. - AddError("Expected message type."); - - // Pretend to accept this type so that we can go on parsing. - *type_name = input_->current().text; - input_->Next(); - return true; - } - - // A leading "." means the name is fully-qualified. - if (TryConsume(".")) type_name->append("."); - - // Consume the first part of the name. - std::string identifier; - DO(ConsumeIdentifier(&identifier, "Expected type name.")); - type_name->append(identifier); - - // Consume more parts. - while (TryConsume(".")) { - type_name->append("."); - DO(ConsumeIdentifier(&identifier, "Expected identifier.")); - type_name->append(identifier); - } - - return true; -} - -// =================================================================== - -bool Parser::ParsePackage(FileDescriptorProto* file, - const LocationRecorder& root_location, - const FileDescriptorProto* containing_file) { - if (file->has_package()) { - AddError("Multiple package definitions."); - // Don't append the new package to the old one. Just replace it. Not - // that it really matters since this is an error anyway. - file->clear_package(); - } - - LocationRecorder location(root_location, - FileDescriptorProto::kPackageFieldNumber); - location.RecordLegacyLocation(file, DescriptorPool::ErrorCollector::NAME); - - DO(Consume("package")); - - while (true) { - std::string identifier; - DO(ConsumeIdentifier(&identifier, "Expected identifier.")); - file->mutable_package()->append(identifier); - if (!TryConsume(".")) break; - file->mutable_package()->append("."); - } - - DO(ConsumeEndOfDeclaration(";", &location)); - - return true; -} - -bool Parser::ParseImport(RepeatedPtrField* dependency, - RepeatedField* public_dependency, - RepeatedField* weak_dependency, - const LocationRecorder& root_location, - const FileDescriptorProto* containing_file) { - LocationRecorder location(root_location, - FileDescriptorProto::kDependencyFieldNumber, - dependency->size()); - - DO(Consume("import")); - - if (LookingAt("public")) { - LocationRecorder public_location( - root_location, FileDescriptorProto::kPublicDependencyFieldNumber, - public_dependency->size()); - DO(Consume("public")); - *public_dependency->Add() = dependency->size(); - } else if (LookingAt("weak")) { - LocationRecorder weak_location( - root_location, FileDescriptorProto::kWeakDependencyFieldNumber, - weak_dependency->size()); - weak_location.RecordLegacyImportLocation(containing_file, "weak"); - DO(Consume("weak")); - *weak_dependency->Add() = dependency->size(); - } - - std::string import_file; - DO(ConsumeString(&import_file, - "Expected a string naming the file to import.")); - *dependency->Add() = import_file; - location.RecordLegacyImportLocation(containing_file, import_file); - - DO(ConsumeEndOfDeclaration(";", &location)); - - return true; -} - -// =================================================================== - -SourceLocationTable::SourceLocationTable() {} -SourceLocationTable::~SourceLocationTable() {} - -bool SourceLocationTable::Find( - const Message* descriptor, - DescriptorPool::ErrorCollector::ErrorLocation location, int* line, - int* column) const { - const std::pair* result = - FindOrNull(location_map_, std::make_pair(descriptor, location)); - if (result == nullptr) { - *line = -1; - *column = 0; - return false; - } else { - *line = result->first; - *column = result->second; - return true; - } -} - -bool SourceLocationTable::FindImport(const Message* descriptor, - const std::string& name, int* line, - int* column) const { - const std::pair* result = - FindOrNull(import_location_map_, std::make_pair(descriptor, name)); - if (result == nullptr) { - *line = -1; - *column = 0; - return false; - } else { - *line = result->first; - *column = result->second; - return true; - } -} - -void SourceLocationTable::Add( - const Message* descriptor, - DescriptorPool::ErrorCollector::ErrorLocation location, int line, - int column) { - location_map_[std::make_pair(descriptor, location)] = - std::make_pair(line, column); -} - -void SourceLocationTable::AddImport(const Message* descriptor, - const std::string& name, int line, - int column) { - import_location_map_[std::make_pair(descriptor, name)] = - std::make_pair(line, column); -} - -void SourceLocationTable::Clear() { location_map_.clear(); } - -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/php/php_generator.cc b/depends/protobuf/src/google/protobuf/compiler/php/php_generator.cc deleted file mode 100644 index f3aa92f14..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/php/php_generator.cc +++ /dev/null @@ -1,2426 +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 - -const std::string kDescriptorFile = "google/protobuf/descriptor.proto"; -const std::string kEmptyFile = "google/protobuf/empty.proto"; -const std::string kEmptyMetadataFile = "GPBMetadata/Google/Protobuf/GPBEmpty.php"; -const std::string kDescriptorMetadataFile = - "GPBMetadata/Google/Protobuf/Internal/Descriptor.php"; -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", - "finally", "fn", "for", "foreach", "function", - "global", "goto", "if", "implements", "include", - "include_once", "instanceof", "insteadof", "interface", "isset", - "list", "match", "namespace", "new", "or", - "parent", "print", "private", "protected", "public", - "readonly", "require", "require_once", "return", "self", - "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", "parent", - "self", "readonly" -}; -const int kReservedNamesSize = 80; -const int kValidConstantNamesSize = 12; -const int kFieldSetter = 1; -const int kFieldGetter = 2; -const int kFieldProperty = 3; - -namespace google { -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, const Options& options); -std::string IntToString(int32_t value); -std::string FilenameToClassname(const std::string& filename); -std::string GeneratedMetadataFileName(const FileDescriptor* file, - 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 Options& options, - io::Printer* printer); -void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message, - const Options& options); -void GenerateMessageConstructorDocComment(io::Printer* printer, - const Descriptor* message, - const Options& options); -void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, - 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_, - const Options& options); -void GenerateEnumValueDocComment(io::Printer* printer, - const EnumValueDescriptor* value); -void GenerateServiceDocComment(io::Printer* printer, - const ServiceDescriptor* service); -void GenerateServiceMethodDocComment(io::Printer* printer, - const MethodDescriptor* method); - -std::string ReservedNamePrefix(const std::string& classname, - const FileDescriptor* file) { - bool is_reserved = false; - - std::string lower = classname; - std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); - - for (int i = 0; i < kReservedNamesSize; i++) { - if (lower == kReservedNames[i]) { - is_reserved = true; - break; - } - } - - if (is_reserved) { - if (file->package() == "google.protobuf") { - return "GPB"; - } else { - return "PB"; - } - } - - return ""; -} - -template -std::string DescriptorFullName(const DescriptorType* desc, bool is_internal) { - if (is_internal) { - return StringReplace(desc->full_name(), - "google.protobuf", - "google.protobuf.internal", false); - } else { - return desc->full_name(); - } -} - -template -std::string ClassNamePrefix(const std::string& classname, - const DescriptorType* desc) { - const std::string& prefix = (desc->file()->options()).php_class_prefix(); - if (!prefix.empty()) { - return prefix; - } - - return ReservedNamePrefix(classname, desc->file()); -} - -template -std::string GeneratedClassNameImpl(const DescriptorType* desc) { - std::string classname = ClassNamePrefix(desc->name(), desc) + desc->name(); - const Descriptor* containing = desc->containing_type(); - while (containing != NULL) { - classname = ClassNamePrefix(containing->name(), desc) + containing->name() - + '\\' + classname; - containing = containing->containing_type(); - } - return classname; -} - -std::string GeneratedClassNameImpl(const ServiceDescriptor* desc) { - std::string classname = desc->name(); - return ClassNamePrefix(classname, desc) + classname; -} - -template -std::string LegacyGeneratedClassName(const DescriptorType* desc) { - std::string classname = desc->name(); - const Descriptor* containing = desc->containing_type(); - while (containing != NULL) { - classname = containing->name() + '_' + classname; - containing = containing->containing_type(); - } - return ClassNamePrefix(classname, desc) + classname; -} - -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]) { - return "PB"; - } - } - - return ""; -} - -std::string ConstantNamePrefix(const std::string& classname) { - bool is_reserved = false; - - std::string lower = classname; - std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); - - for (int i = 0; i < kReservedNamesSize; i++) { - if (lower == kReservedNames[i]) { - is_reserved = true; - break; - } - } - - for (int i = 0; i < kValidConstantNamesSize; i++) { - if (lower == kValidConstantNames[i]) { - is_reserved = false; - break; - } - } - - if (is_reserved) { - return "PB"; - } - - return ""; -} - -template -std::string RootPhpNamespace(const DescriptorType* desc, - const Options& options) { - if (desc->file()->options().has_php_namespace()) { - const std::string& php_namespace = desc->file()->options().php_namespace(); - if (!php_namespace.empty()) { - return php_namespace; - } - return ""; - } - - if (!desc->file()->package().empty()) { - return PhpName(desc->file()->package(), options); - } - return ""; -} - -template -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; - } - return classname; -} - -template -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, const Options& options) { - if (options.is_descriptor) { - return kDescriptorPackageName; - } - - std::string segment; - std::string result; - bool cap_next_letter = true; - for (int i = 0; i < full_name.size(); i++) { - if ('a' <= full_name[i] && full_name[i] <= 'z' && cap_next_letter) { - segment += full_name[i] + ('A' - 'a'); - cap_next_letter = false; - } else if (full_name[i] == '.') { - result += ClassNamePrefix(segment) + segment + '\\'; - segment = ""; - cap_next_letter = true; - } else { - segment += full_name[i]; - cap_next_letter = false; - } - } - result += ClassNamePrefix(segment) + segment; - return result; -} - -std::string DefaultForField(const FieldDescriptor* field) { - switch (field->type()) { - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_SFIXED64: - case FieldDescriptor::TYPE_ENUM: return "0"; - case FieldDescriptor::TYPE_DOUBLE: - case FieldDescriptor::TYPE_FLOAT: return "0.0"; - case FieldDescriptor::TYPE_BOOL: return "false"; - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: return "''"; - case FieldDescriptor::TYPE_MESSAGE: - case FieldDescriptor::TYPE_GROUP: return "null"; - default: assert(false); return ""; - } -} - -std::string GeneratedMetadataFileName(const FileDescriptor* file, - 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 = ""; - std::string segment = ""; - - if (proto_file == kEmptyFile) { - return kEmptyMetadataFile; - } - if (options.is_descriptor) { - return kDescriptorMetadataFile; - } - - // Append directory name. - std::string file_no_suffix; - int lastindex = proto_file.find_last_of("."); - if (proto_file == kEmptyFile) { - return kEmptyMetadataFile; - } else { - file_no_suffix = proto_file.substr(0, lastindex); - } - - if (file->options().has_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; - std::replace(result.begin(), result.end(), '\\', '/'); - if (result.at(result.size() - 1) != '/') { - result += "/"; - } - } - } else { - result += "GPBMetadata/"; - while (first_index != std::string::npos) { - segment = UnderscoresToCamelCase( - file_no_suffix.substr(start_index, first_index - start_index), true); - result += ReservedNamePrefix(segment, file) + segment + "/"; - start_index = first_index + 1; - first_index = file_no_suffix.find_first_of("/", start_index); - } - } - - // Append file name. - int file_name_start = file_no_suffix.find_last_of("/"); - if (file_name_start == std::string::npos) { - file_name_start = 0; - } else { - file_name_start += 1; - } - segment = UnderscoresToCamelCase( - file_no_suffix.substr(file_name_start, first_index - file_name_start), true); - - 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, - const Options& options) { - std::string result = FullClassName(desc, options); - for (int i = 0; i < result.size(); i++) { - if (result[i] == '\\') { - result[i] = '/'; - } - } - return result + ".php"; -} - -template -std::string LegacyGeneratedClassFileName(const DescriptorType* desc, - const Options& options) { - std::string result = LegacyFullClassName(desc, options); - - for (int i = 0; i < result.size(); i++) { - if (result[i] == '\\') { - result[i] = '/'; - } - } - return result + ".php"; -} - -template -std::string LegacyReadOnlyGeneratedClassFileName(std::string php_namespace, - const DescriptorType* desc) { - if (!php_namespace.empty()) { - for (int i = 0; i < php_namespace.size(); i++) { - if (php_namespace[i] == '\\') { - php_namespace[i] = '/'; - } - } - return php_namespace + "/" + desc->name() + ".php"; - } - - return desc->name() + ".php"; -} - -std::string GeneratedServiceFileName(const ServiceDescriptor* service, - const Options& options) { - std::string result = FullClassName(service, options) + "Interface"; - for (int i = 0; i < result.size(); i++) { - if (result[i] == '\\') { - result[i] = '/'; - } - } - return result + ".php"; -} - -std::string IntToString(int32_t value) { - std::ostringstream os; - os << value; - return os.str(); -} - -std::string LabelForField(const FieldDescriptor* field) { - switch (field->label()) { - case FieldDescriptor::LABEL_OPTIONAL: return "optional"; - case FieldDescriptor::LABEL_REQUIRED: return "required"; - case FieldDescriptor::LABEL_REPEATED: return "repeated"; - default: assert(false); return ""; - } -} - -std::string PhpSetterTypeName(const FieldDescriptor* field, - const Options& options) { - if (field->is_map()) { - return "array|\\Google\\Protobuf\\Internal\\MapField"; - } - std::string type; - switch (field->type()) { - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_ENUM: - type = "int"; - break; - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_SFIXED64: - type = "int|string"; - break; - case FieldDescriptor::TYPE_DOUBLE: - case FieldDescriptor::TYPE_FLOAT: - type = "float"; - break; - case FieldDescriptor::TYPE_BOOL: - type = "bool"; - break; - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: - type = "string"; - break; - case FieldDescriptor::TYPE_MESSAGE: - type = "\\" + FullClassName(field->message_type(), options); - break; - case FieldDescriptor::TYPE_GROUP: - return "null"; - default: assert(false); return ""; - } - if (field->is_repeated()) { - // accommodate for edge case with multiple types. - size_t start_pos = type.find("|"); - if (start_pos != std::string::npos) { - type.replace(start_pos, 1, ">|array<"); - } - type = "array<" + type + ">|\\Google\\Protobuf\\Internal\\RepeatedField"; - } - return type; -} - -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"; - } - if (field->is_repeated()) { - return "\\Google\\Protobuf\\Internal\\RepeatedField"; - } - switch (field->type()) { - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_FIXED32: - case FieldDescriptor::TYPE_SFIXED32: - case FieldDescriptor::TYPE_ENUM: return "int"; - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_FIXED64: - case FieldDescriptor::TYPE_SFIXED64: return "int|string"; - case FieldDescriptor::TYPE_DOUBLE: - case FieldDescriptor::TYPE_FLOAT: return "float"; - case FieldDescriptor::TYPE_BOOL: return "bool"; - case FieldDescriptor::TYPE_STRING: - case FieldDescriptor::TYPE_BYTES: return "string"; - case FieldDescriptor::TYPE_MESSAGE: - return "\\" + FullClassName(field->message_type(), options); - case FieldDescriptor::TYPE_GROUP: return "null"; - default: assert(false); return ""; - } -} - -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(), options.is_descriptor) + - "'"; - } - if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - 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 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') { - if (cap_first_letter) { - result += name[i] + ('A' - 'a'); - } else { - result += name[i]; - } - cap_first_letter = false; - } else if ('A' <= name[i] && name[i] <= 'Z') { - if (i == 0 && !cap_first_letter) { - // Force first letter to lower-case unless explicitly told to - // capitalize it. - result += name[i] + ('a' - 'A'); - } else { - // Capital letters after the first are left as-is. - result += name[i]; - } - cap_first_letter = false; - } else if ('0' <= name[i] && name[i] <= '9') { - result += name[i]; - cap_first_letter = true; - } else { - cap_first_letter = true; - } - } - // Add a trailing "_" if the name should be altered. - if (name[name.size() - 1] == '#') { - result += '_'; - } - return result; -} - -void Indent(io::Printer* printer) { - printer->Indent(); - printer->Indent(); -} -void Outdent(io::Printer* printer) { - printer->Outdent(); - printer->Outdent(); -} - -void GenerateField(const FieldDescriptor* field, io::Printer* printer, - const Options& options) { - if (field->is_repeated()) { - GenerateFieldDocComment(printer, field, options, kFieldProperty); - printer->Print( - "private $^name^;\n", - "name", field->name()); - } else if (field->real_containing_oneof()) { - // Oneof fields are handled by GenerateOneofField. - return; - } else { - std::string initial_value = - field->has_presence() ? "null" : DefaultForField(field); - GenerateFieldDocComment(printer, field, options, kFieldProperty); - printer->Print( - "protected $^name^ = ^initial_value^;\n", - "name", field->name(), - "initial_value", initial_value); - } -} - -void GenerateOneofField(const OneofDescriptor* oneof, io::Printer* printer) { - // Oneof property needs to be protected in order to be accessed by parent - // class in implementation. - printer->Print( - "protected $^name^;\n", - "name", oneof->name()); -} - -void GenerateFieldAccessor(const FieldDescriptor* field, const Options& options, - io::Printer* printer) { - 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) { - printer->Print( - "public function get^camel_name^()\n" - "{\n" - " ^deprecation_trigger^return $this->readOneof(^number^);\n" - "}\n\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), - "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 { - printer->Print( - "public function get^camel_name^()\n" - "{\n" - " ^deprecation_trigger^return $this->^name^;\n" - "}\n\n", - "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 - if (!field->is_map() && - !field->is_repeated() && - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - IsWrapperType(field)) { - GenerateWrapperFieldGetterDocComment(printer, field); - printer->Print( - "public function get^camel_name^Unwrapped()\n" - "{\n" - " ^deprecation_trigger^return $this->readWrapperValue(\"^field_name^\");\n" - "}\n\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), - "field_name", field->name(), - "deprecation_trigger", deprecation_trigger); - } - - // Generate setter. - GenerateFieldDocComment(printer, field, options, kFieldSetter); - printer->Print( - "public function set^camel_name^($var)\n" - "{\n", - "camel_name", UnderscoresToCamelCase(field->name(), true)); - - 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(); - const FieldDescriptor* key = map_entry->map_key(); - const FieldDescriptor* value = map_entry->map_value(); - printer->Print( - "$arr = GPBUtil::checkMapField($var, " - "\\Google\\Protobuf\\Internal\\GPBType::^key_type^, " - "\\Google\\Protobuf\\Internal\\GPBType::^value_type^", - "key_type", ToUpper(key->type_name()), - "value_type", ToUpper(value->type_name())); - if (value->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print( - ", \\^class_name^);\n", - "class_name", - 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(), options) + "::class"); - } else { - printer->Print(");\n"); - } - } else if (field->is_repeated()) { - printer->Print( - "$arr = GPBUtil::checkRepeatedField($var, " - "\\Google\\Protobuf\\Internal\\GPBType::^type^", - "type", ToUpper(field->type_name())); - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print( - ", \\^class_name^);\n", - "class_name", - 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(), 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", FullClassName(field->message_type(), options)); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - printer->Print( - "GPBUtil::checkEnum($var, \\^class_name^::class);\n", - "class_name", FullClassName(field->enum_type(), options)); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { - printer->Print( - "GPBUtil::checkString($var, ^utf8^);\n", - "utf8", - field->type() == FieldDescriptor::TYPE_STRING ? "True": "False"); - } else { - printer->Print( - "GPBUtil::check^type^($var);\n", - "type", UnderscoresToCamelCase(field->cpp_type_name(), true)); - } - - if (oneof != NULL) { - printer->Print( - "$this->writeOneof(^number^, $var);\n", - "number", IntToString(field->number())); - } else if (field->is_repeated()) { - printer->Print( - "$this->^name^ = $arr;\n", - "name", field->name()); - } else { - printer->Print( - "$this->^name^ = $var;\n", - "name", field->name()); - } - - printer->Print("\nreturn $this;\n"); - - Outdent(printer); - - printer->Print( - "}\n\n"); - - // For wrapper types, generate an additional setXXXValue getter - if (!field->is_map() && - !field->is_repeated() && - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - IsWrapperType(field)) { - GenerateWrapperFieldSetterDocComment(printer, field); - printer->Print( - "public function set^camel_name^Unwrapped($var)\n" - "{\n" - " $this->writeWrapperValue(\"^field_name^\", $var);\n" - " return $this;" - "}\n\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), - "field_name", field->name()); - } -} - -void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) { - printer->Print( - "$pool->addEnum('^name^', " - "\\Google\\Protobuf\\Internal\\^class_name^::class)\n", - "name", DescriptorFullName(en, true), - "class_name", en->name()); - Indent(printer); - - for (int i = 0; i < en->value_count(); i++) { - const EnumValueDescriptor* value = en->value(i); - printer->Print( - "->value(\"^name^\", ^number^)\n", - "name", ConstantNamePrefix(value->name()) + value->name(), - "number", IntToString(value->number())); - } - printer->Print("->finalizeToPool();\n\n"); - Outdent(printer); -} - -void GenerateServiceMethod(const MethodDescriptor* method, - io::Printer* printer) { - printer->Print( - "public function ^camel_name^(\\^request_name^ $request);\n\n", - "camel_name", UnderscoresToCamelCase(method->name(), false), - "request_name", FullClassName( - method->input_type(), false) - ); -} - -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; - } - std::string class_name = - (name_prefix.empty() ? "" : name_prefix + "\\") + - ReservedNamePrefix(message->name(), message->file()) + message->name(); - - printer->Print( - "$pool->addMessage('^message^', " - "\\Google\\Protobuf\\Internal\\^class_name^::class)\n", - "message", DescriptorFullName(message, true), - "class_name", class_name); - - Indent(printer); - - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - if (field->is_map()) { - const FieldDescriptor* key = - field->message_type()->map_key(); - const FieldDescriptor* val = - field->message_type()->map_value(); - printer->Print( - "->map('^field^', \\Google\\Protobuf\\Internal\\GPBType::^key^, " - "\\Google\\Protobuf\\Internal\\GPBType::^value^, ^number^^other^)\n", - "field", field->name(), - "key", ToUpper(key->type_name()), - "value", ToUpper(val->type_name()), - "number", StrCat(field->number()), - "other", EnumOrMessageSuffix(val, true)); - } else if (!field->real_containing_oneof()) { - printer->Print( - "->^label^('^field^', " - "\\Google\\Protobuf\\Internal\\GPBType::^type^, ^number^^other^)\n", - "field", field->name(), - "label", LabelForField(field), - "type", ToUpper(field->type_name()), - "number", StrCat(field->number()), - "other", EnumOrMessageSuffix(field, true)); - } - } - - // oneofs. - 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()); - Indent(printer); - for (int index = 0; index < oneof->field_count(); index++) { - const FieldDescriptor* field = oneof->field(index); - printer->Print( - "->value('^field^', " - "\\Google\\Protobuf\\Internal\\GPBType::^type^, ^number^^other^)\n", - "field", field->name(), - "type", ToUpper(field->type_name()), - "number", StrCat(field->number()), - "other", EnumOrMessageSuffix(field, true)); - } - printer->Print("->finish()\n"); - Outdent(printer); - } - - printer->Print( - "->finalizeToPool();\n"); - - Outdent(printer); - - printer->Print( - "\n"); - - for (int i = 0; i < message->nested_type_count(); i++) { - GenerateMessageToPool(class_name, message->nested_type(i), printer); - } - for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnumToPool(message->enum_type(i), 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 (options.aggregate_metadata) { - GenerateAddFilesToPool(file, options, printer); - } else { - printer->Print( - "$pool = \\Google\\Protobuf\\Internal\\" - "DescriptorPool::getGeneratedPool();\n\n" - "if (static::$is_initialized == true) {\n" - " return;\n" - "}\n"); - - if (options.is_descriptor) { - for (int i = 0; i < file->message_type_count(); i++) { - GenerateMessageToPool("", file->message_type(i), printer); - } - for (int i = 0; i < file->enum_type_count(); i++) { - GenerateEnumToPool(file->enum_type(i), printer); - } - - printer->Print( - "$pool->finish();\n"); - } else { - for (int i = 0; i < file->dependency_count(); i++) { - const std::string& name = file->dependency(i)->name(); - // Currently, descriptor.proto is not ready for external usage. Skip to - // import it for now, so that its dependencies can still work as long as - // they don't use protos defined in descriptor.proto. - if (name == kDescriptorFile) { - continue; - } - std::string dependency_filename = - GeneratedMetadataFileName(file->dependency(i), options); - printer->Print( - "\\^name^::initOnce();\n", - "name", FilenameToClassname(dependency_filename)); - } - - // Add messages and enums to descriptor pool. - FileDescriptorSet files; - FileDescriptorProto* file_proto = files.add_file(); - 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(); - it != dependency->end(); ++it) { - if (*it != kDescriptorFile) { - dependency->erase(it); - break; - } - } - - // Filter out all extensions, since we do not support extension yet. - file_proto->clear_extension(); - RepeatedPtrField* message_type = - file_proto->mutable_message_type(); - for (RepeatedPtrField::iterator it = message_type->begin(); - it != message_type->end(); ++it) { - it->clear_extension(); - } - - std::string files_data; - files.SerializeToString(&files_data); - - 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("'\n"); - Outdent(printer); - printer->Print( - ", true);\n\n"); - } - printer->Print( - "static::$is_initialized = true;\n"); - } - - Outdent(printer); - printer->Print("}\n"); -} - -static void AnalyzeDependencyForFile( - const FileDescriptor* file, - std::set* nodes_without_dependency, - std::map>* deps, - std::map* dependency_count) { - int count = file->dependency_count(); - for (int i = 0; i < file->dependency_count(); i++) { - const FileDescriptor* dependency = file->dependency(i); - if (dependency->name() == kDescriptorFile) { - count--; - break; - } - } - - if (count == 0) { - nodes_without_dependency->insert(file); - } else { - (*dependency_count)[file] = count; - for (int i = 0; i < file->dependency_count(); i++) { - const FileDescriptor* dependency = file->dependency(i); - if (dependency->name() == kDescriptorFile) { - continue; - } - if (deps->find(dependency) == deps->end()) { - (*deps)[dependency] = std::set(); - } - (*deps)[dependency].insert(file); - AnalyzeDependencyForFile( - dependency, nodes_without_dependency, deps, dependency_count); - } - } -} - -static bool NeedsUnwrapping(const FileDescriptor* file, - const Options& options) { - bool has_aggregate_metadata_prefix = false; - if (options.aggregate_metadata_prefixes.empty()) { - has_aggregate_metadata_prefix = true; - } else { - for (const auto& prefix : options.aggregate_metadata_prefixes) { - if (HasPrefixString(file->package(), prefix)) { - has_aggregate_metadata_prefix = true; - break; - } - } - } - - return has_aggregate_metadata_prefix; -} - -void GenerateAddFilesToPool(const FileDescriptor* file, const Options& options, - io::Printer* printer) { - printer->Print( - "$pool = \\Google\\Protobuf\\Internal\\" - "DescriptorPool::getGeneratedPool();\n" - "if (static::$is_initialized == true) {\n" - " return;\n" - "}\n"); - - // Sort files according to dependency - std::map> deps; - std::map dependency_count; - std::set nodes_without_dependency; - FileDescriptorSet sorted_file_set; - - AnalyzeDependencyForFile( - file, &nodes_without_dependency, &deps, &dependency_count); - - while (!nodes_without_dependency.empty()) { - 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); - } else { - dependency_count[dependent] -= 1; - } - } - - bool needs_aggregate = NeedsUnwrapping(file_node, options); - - if (needs_aggregate) { - auto file_proto = sorted_file_set.add_file(); - 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(); - it != dependency->end(); ++it) { - if (*it != kDescriptorFile) { - dependency->erase(it); - break; - } - } - - // Filter out all extensions, since we do not support extension yet. - file_proto->clear_extension(); - RepeatedPtrField* message_type = - file_proto->mutable_message_type(); - for (RepeatedPtrField::iterator it = message_type->begin(); - it != message_type->end(); ++it) { - it->clear_extension(); - } - } else { - std::string dependency_filename = GeneratedMetadataFileName(file_node, false); - printer->Print( - "\\^name^::initOnce();\n", - "name", FilenameToClassname(dependency_filename)); - } - } - - std::string files_data; - sorted_file_set.SerializeToString(&files_data); - - 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("'\n"); - Outdent(printer); - printer->Print( - ", true);\n"); - - printer->Print( - "static::$is_initialized = true;\n"); -} - -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" - "use Google\\Protobuf\\Internal\\GPBUtil;\n\n"); - } else { - printer->Print( - "use Google\\Protobuf\\Internal\\GPBType;\n" - "use Google\\Protobuf\\Internal\\GPBWire;\n" - "use Google\\Protobuf\\Internal\\RepeatedField;\n" - "use Google\\Protobuf\\Internal\\InputStream;\n" - "use Google\\Protobuf\\Internal\\GPBUtil;\n\n"); - } -} - -void GenerateHead(const FileDescriptor* file, io::Printer* printer) { - printer->Print( - "name()); -} - -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++) { - if (result[i] == '/') { - result[i] = '\\'; - } - } - return result; -} - -void GenerateMetadataFile(const FileDescriptor* file, const Options& options, - GeneratorContext* generator_context) { - std::string filename = GeneratedMetadataFileName(file, options); - std::unique_ptr output( - generator_context->Open(filename)); - io::Printer printer(output.get(), '^'); - - GenerateHead(file, &printer); - - std::string fullname = FilenameToClassname(filename); - int lastindex = fullname.find_last_of("\\"); - - if (lastindex != std::string::npos) { - printer.Print( - "namespace ^name^;\n\n", - "name", fullname.substr(0, lastindex)); - - printer.Print( - "class ^name^\n" - "{\n", - "name", fullname.substr(lastindex + 1)); - } else { - printer.Print( - "class ^name^\n" - "{\n", - "name", fullname); - } - Indent(&printer); - - GenerateAddFileToPool(file, options, &printer); - - Outdent(&printer); - printer.Print("}\n\n"); -} - -template -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, options); - if (!php_namespace.empty()) { - printer.Print( - "namespace ^name^;\n\n", - "name", php_namespace); - } - std::string newname = FullClassName(desc, options); - printer.Print("if (false) {\n"); - Indent(&printer); - printer.Print("/**\n"); - printer.Print(" * This class is deprecated. Use ^new^ instead.\n", - "new", newname); - printer.Print(" * @deprecated\n"); - printer.Print(" */\n"); - printer.Print("class ^old^ {}\n", - "old", LegacyGeneratedClassName(desc)); - Outdent(&printer); - printer.Print("}\n"); - printer.Print("class_exists(^new^::class);\n", - "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, options), - "fullname", newname); -} - -template -void LegacyReadOnlyGenerateClassFile(const FileDescriptor* file, - const DescriptorType* desc, const Options& options, - GeneratorContext* generator_context) { - std::string fullname = FullClassName(desc, options); - std::string php_namespace; - std::string classname; - int lastindex = fullname.find_last_of("\\"); - - if (lastindex != std::string::npos) { - php_namespace = fullname.substr(0, lastindex); - classname = fullname.substr(lastindex + 1); - } else { - php_namespace = ""; - classname = fullname; - } - - std::string filename = LegacyReadOnlyGeneratedClassFileName(php_namespace, desc); - std::unique_ptr output( - generator_context->Open(filename)); - io::Printer printer(output.get(), '^'); - - GenerateHead(file, &printer); - - if (!php_namespace.empty()) { - printer.Print( - "namespace ^name^;\n\n", - "name", php_namespace); - } - - printer.Print("class_exists(^new^::class); // autoload the new class, which " - "will also create an alias to the deprecated class\n", - "new", classname); - printer.Print("@trigger_error(__NAMESPACE__ . '\\^old^ is deprecated and will be removed in " - "the next major release. Use ^fullname^ instead', E_USER_DEPRECATED);\n\n", - "old", desc->name(), - "fullname", classname); -} - -void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, - 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(), '^'); - - GenerateHead(file, &printer); - - std::string fullname = FilenameToClassname(filename); - int lastindex = fullname.find_last_of("\\"); - - if (lastindex != std::string::npos) { - printer.Print( - "namespace ^name^;\n\n", - "name", fullname.substr(0, lastindex)); - - // We only need this 'use' statement if the enum has a namespace. - // Otherwise, we get a warning that the use statement has no effect. - printer.Print("use UnexpectedValueException;\n\n"); - } - - GenerateEnumDocComment(&printer, en, options); - - if (lastindex != std::string::npos) { - fullname = fullname.substr(lastindex + 1); - } - - printer.Print( - "class ^name^\n" - "{\n", - "name", fullname); - Indent(&printer); - - bool hasReserved = false; - for (int i = 0; i < en->value_count(); i++) { - const EnumValueDescriptor* value = en->value(i); - GenerateEnumValueDocComment(&printer, value); - - std::string prefix = ConstantNamePrefix(value->name()); - if (!prefix.empty()) { - hasReserved = true; - } - - printer.Print("const ^name^ = ^number^;\n", - "name", prefix + value->name(), - "number", IntToString(value->number())); - } - - printer.Print("\nprivate static $valueToName = [\n"); - Indent(&printer); - for (int i = 0; i < en->value_count(); i++) { - const EnumValueDescriptor* value = en->value(i); - printer.Print("self::^constant^ => '^name^',\n", - "constant", ConstantNamePrefix(value->name()) + value->name(), - "name", value->name()); - } - Outdent(&printer); - printer.Print("];\n"); - - printer.Print( - "\npublic static function name($value)\n" - "{\n"); - Indent(&printer); - printer.Print("if (!isset(self::$valueToName[$value])) {\n"); - Indent(&printer); - printer.Print("throw new UnexpectedValueException(sprintf(\n"); - Indent(&printer); - Indent(&printer); - printer.Print("'Enum %s has no name defined for value %s', __CLASS__, $value));\n"); - Outdent(&printer); - Outdent(&printer); - Outdent(&printer); - printer.Print("}\n" - "return self::$valueToName[$value];\n"); - Outdent(&printer); - printer.Print("}\n\n"); - - printer.Print( - "\npublic static function value($name)\n" - "{\n"); - Indent(&printer); - printer.Print("$const = __CLASS__ . '::' . strtoupper($name);\n" - "if (!defined($const)) {\n"); - Indent(&printer); - if (hasReserved) { - printer.Print("$pbconst = __CLASS__. '::PB' . strtoupper($name);\n" - "if (!defined($pbconst)) {\n"); - Indent(&printer); - } - printer.Print("throw new UnexpectedValueException(sprintf(\n"); - Indent(&printer); - Indent(&printer); - printer.Print("'Enum %s has no value defined for name %s', __CLASS__, $name));\n"); - Outdent(&printer); - Outdent(&printer); - if (hasReserved) { - Outdent(&printer); - printer.Print("}\n" - "return constant($pbconst);\n"); - } - Outdent(&printer); - printer.Print("}\n" - "return constant($const);\n"); - Outdent(&printer); - printer.Print("}\n"); - - Outdent(&printer); - printer.Print("}\n\n"); - - // 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, options)); - LegacyGenerateClassFile(file, en, options, generator_context); - } - - // Write legacy file for backwards compatibility with "readonly" keywword - std::string lower = en->name(); - std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); - if (lower == "readonly") { - printer.Print( - "// Adding a class alias for backwards compatibility with the \"readonly\" keyword.\n"); - printer.Print( - "class_alias(^new^::class, __NAMESPACE__ . '\\^old^');\n\n", - "new", fullname, - "old", en->name()); - LegacyReadOnlyGenerateClassFile(file, en, options, generator_context); - } -} - -void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, - const Options& options, - GeneratorContext* generator_context) { - // Don't generate MapEntry messages -- we use the PHP extension's native - // support for map fields instead. - if (message->options().map_entry()) { - return; - } - - std::string filename = GeneratedClassFileName(message, options); - std::unique_ptr output( - generator_context->Open(filename)); - io::Printer printer(output.get(), '^'); - - GenerateHead(file, &printer); - - std::string fullname = FilenameToClassname(filename); - int lastindex = fullname.find_last_of("\\"); - - if (lastindex != std::string::npos) { - printer.Print( - "namespace ^name^;\n\n", - "name", fullname.substr(0, lastindex)); - } - - GenerateUseDeclaration(options, &printer); - - 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 ^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, options); - } - 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, options); - printer.Print( - "public function __construct($data = NULL) {\n"); - Indent(&printer); - - std::string metadata_filename = GeneratedMetadataFileName(file, options); - std::string metadata_fullname = FilenameToClassname(metadata_filename); - printer.Print( - "\\^fullname^::initOnce();\n", - "fullname", metadata_fullname); - - printer.Print( - "parent::__construct($data);\n"); - - Outdent(&printer); - printer.Print("}\n\n"); - - // Field and oneof accessors. - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - GenerateFieldAccessor(field, options, &printer); - } - for (int i = 0; i < message->real_oneof_decl_count(); i++) { - const OneofDescriptor* oneof = message->oneof_decl(i); - printer.Print( - "/**\n" - " * @return string\n" - " */\n" - "public function get^camel_name^()\n" - "{\n" - " return $this->whichOneof(\"^name^\");\n" - "}\n\n", - "camel_name", UnderscoresToCamelCase(oneof->name(), true), "name", - oneof->name()); - } - - Outdent(&printer); - printer.Print("}\n\n"); - - // 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, options)); - LegacyGenerateClassFile(file, message, options, generator_context); - } - - // Write legacy file for backwards compatibility with "readonly" keywword - std::string lower = message->name(); - std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); - if (lower == "readonly") { - printer.Print( - "// Adding a class alias for backwards compatibility with the \"readonly\" keyword.\n"); - printer.Print( - "class_alias(^new^::class, __NAMESPACE__ . '\\^old^');\n\n", - "new", fullname, - "old", message->name()); - LegacyReadOnlyGenerateClassFile(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), options, - generator_context); - } - for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnumFile(file, message->enum_type(i), options, generator_context); - } -} - -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(), '^'); - - GenerateHead(file, &printer); - - std::string fullname = FilenameToClassname(filename); - int lastindex = fullname.find_last_of("\\"); - - if (!file->options().php_namespace().empty() || - (!file->options().has_php_namespace() && !file->package().empty()) || - lastindex != std::string::npos) { - printer.Print( - "namespace ^name^;\n\n", - "name", fullname.substr(0, lastindex)); - } - - GenerateServiceDocComment(&printer, service); - - if (lastindex != std::string::npos) { - printer.Print( - "interface ^name^\n" - "{\n", - "name", fullname.substr(lastindex + 1)); - } else { - printer.Print( - "interface ^name^\n" - "{\n", - "name", fullname); - } - - Indent(&printer); - - for (int i = 0; i < service->method_count(); i++) { - const MethodDescriptor* method = service->method(i); - GenerateServiceMethodDocComment(&printer, method); - GenerateServiceMethod(method, &printer); - } - - Outdent(&printer); - printer.Print("}\n\n"); -} - -void GenerateFile(const FileDescriptor* file, const Options& options, - GeneratorContext* generator_context) { - GenerateMetadataFile(file, options, generator_context); - - for (int i = 0; i < file->message_type_count(); i++) { - 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), options, generator_context); - } - if (file->options().php_generic_services()) { - for (int i = 0; i < file->service_count(); i++) { - GenerateServiceFile(file, file->service(i), options, generator_context); - } - } -} - -static std::string EscapePhpdoc(const std::string& input) { - std::string result; - result.reserve(input.size() * 2); - - char prev = '*'; - - for (std::string::size_type i = 0; i < input.size(); i++) { - char c = input[i]; - switch (c) { - case '*': - // Avoid "/*". - if (prev == '/') { - result.append("*"); - } else { - result.push_back(c); - } - break; - case '/': - // Avoid "*/". - if (prev == '*') { - result.append("/"); - } else { - result.push_back(c); - } - break; - case '@': - // '@' starts phpdoc tags including the @deprecated tag, which will - // cause a compile-time error if inserted before a declaration that - // does not have a corresponding @Deprecated annotation. - result.append("@"); - break; - default: - result.push_back(c); - break; - } - - prev = c; - } - - return result; -} - -static void GenerateDocCommentBodyForLocation( - io::Printer* printer, const SourceLocation& location, bool trailingNewline, - int indentCount) { - 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 - // we just use the proto comments unchanged. - - // If the comment itself contains block comment start or end markers, - // HTML-escape them so that they don't accidentally close the doc comment. - comments = EscapePhpdoc(comments); - - std::vector lines = Split(comments, "\n", true); - while (!lines.empty() && lines.back().empty()) { - lines.pop_back(); - } - - for (int i = 0; i < lines.size(); i++) { - // Most lines should start with a space. Watch out for lines that start - // with a /, since putting that right after the leading asterisk will - // close the comment. - if (indentCount == 0 && !lines[i].empty() && lines[i][0] == '/') { - printer->Print(" * ^line^\n", "line", lines[i]); - } else { - std::string indent = std::string(indentCount, ' '); - printer->Print(" *^ind^^line^\n", "ind", indent, "line", lines[i]); - } - } - if (trailingNewline) { - printer->Print(" *\n"); - } - } -} - -template -static void GenerateDocCommentBody( - io::Printer* printer, const DescriptorType* descriptor) { - SourceLocation location; - if (descriptor->GetSourceLocation(&location)) { - GenerateDocCommentBodyForLocation(printer, location, true, 0); - } -} - -static std::string FirstLineOf(const std::string& value) { - std::string result = value; - - 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, - const Options& options) { - printer->Print("/**\n"); - GenerateDocCommentBody(printer, message); - printer->Print( - " * Generated from protobuf message ^messagename^\n" - " */\n", - "fullname", EscapePhpdoc(FullClassName(message, options)), - "messagename", EscapePhpdoc(message->full_name())); -} - -void GenerateMessageConstructorDocComment(io::Printer* printer, - const Descriptor* message, - 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. - - // We start the comment with the main body based on the comments from the - // .proto file (if present). We then end with the field declaration, e.g.: - // optional string foo = 5; - // If the field is a group, the debug string might end with {. - printer->Print("/**\n"); - printer->Print(" * Constructor.\n"); - printer->Print(" *\n"); - printer->Print(" * @param array $data {\n"); - printer->Print(" * Optional. Data for populating the Message object.\n"); - printer->Print(" *\n"); - 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, options), - "var", field->name()); - SourceLocation location; - if (field->GetSourceLocation(&location)) { - GenerateDocCommentBodyForLocation(printer, location, false, 10); - } - } - printer->Print(" * }\n"); - printer->Print(" */\n"); -} - -void GenerateServiceDocComment(io::Printer* printer, - const ServiceDescriptor* service) { - printer->Print("/**\n"); - GenerateDocCommentBody(printer, service); - printer->Print( - " * Protobuf type ^fullname^\n" - " */\n", - "fullname", EscapePhpdoc(service->full_name())); -} - -void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, - 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. - - // We start the comment with the main body based on the comments from the - // .proto file (if present). We then end with the field declaration, e.g.: - // optional string foo = 5; - // If the field is a group, the debug string might end with {. - printer->Print("/**\n"); - GenerateDocCommentBody(printer, field); - printer->Print( - " * Generated from protobuf field ^def^\n", - "def", EscapePhpdoc(FirstLineOf(field->DebugString()))); - if (function_type == kFieldSetter) { - printer->Print(" * @param ^php_type^ $var\n", - "php_type", PhpSetterTypeName(field, options)); - printer->Print(" * @return $this\n"); - } else if (function_type == kFieldGetter) { - 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"); -} - -void GenerateWrapperFieldGetterDocComment(io::Printer* printer, const FieldDescriptor* field) { - // Generate a doc comment for the special getXXXValue methods that are - // generated for wrapper types. - const FieldDescriptor* primitiveField = field->message_type()->FindFieldByName("value"); - printer->Print("/**\n"); - printer->Print( - " * Returns the unboxed value from get^camel_name^()\n\n", - "camel_name", UnderscoresToCamelCase(field->name(), true)); - GenerateDocCommentBody(printer, field); - printer->Print( - " * Generated from protobuf field ^def^\n", - "def", EscapePhpdoc(FirstLineOf(field->DebugString()))); - printer->Print(" * @return ^php_type^|null\n", - "php_type", PhpGetterTypeName(primitiveField, false)); - printer->Print(" */\n"); -} - -void GenerateWrapperFieldSetterDocComment(io::Printer* printer, const FieldDescriptor* field) { - // Generate a doc comment for the special setXXXValue methods that are - // generated for wrapper types. - const FieldDescriptor* primitiveField = field->message_type()->FindFieldByName("value"); - printer->Print("/**\n"); - printer->Print( - " * Sets the field by wrapping a primitive type in a ^message_name^ object.\n\n", - "message_name", FullClassName(field->message_type(), false)); - GenerateDocCommentBody(printer, field); - printer->Print( - " * Generated from protobuf field ^def^\n", - "def", EscapePhpdoc(FirstLineOf(field->DebugString()))); - printer->Print(" * @param ^php_type^|null $var\n", - "php_type", PhpSetterTypeName(primitiveField, false)); - printer->Print(" * @return $this\n"); - printer->Print(" */\n"); -} - -void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, - const Options& options) { - printer->Print("/**\n"); - GenerateDocCommentBody(printer, enum_); - printer->Print( - " * Protobuf type ^fullname^\n" - " */\n", - "fullname", EscapePhpdoc(enum_->full_name())); -} - -void GenerateEnumValueDocComment(io::Printer* printer, - const EnumValueDescriptor* value) { - printer->Print("/**\n"); - GenerateDocCommentBody(printer, value); - printer->Print( - " * Generated from protobuf enum ^def^\n" - " */\n", - "def", EscapePhpdoc(FirstLineOf(value->DebugString()))); -} - -void GenerateServiceMethodDocComment(io::Printer* printer, - const MethodDescriptor* method) { - printer->Print("/**\n"); - GenerateDocCommentBody(printer, method); - printer->Print( - " * Method ^method_name^\n" - " *\n", - "method_name", EscapePhpdoc(UnderscoresToCamelCase(method->name(), false))); - printer->Print( - " * @param \\^input_type^ $request\n", - "input_type", EscapePhpdoc(FullClassName(method->input_type(), false))); - printer->Print( - " * @return \\^return_type^\n" - " */\n", - "return_type", EscapePhpdoc(FullClassName(method->output_type(), false))); -} - -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_DefPool *symtab = DescriptorPool_GetSymbolTable();\n" - " const upb_EnumDef *e = upb_DefPool_FindEnumByName(symtab, \"$name$\");\n" - " zend_long value;\n" - " if (zend_parse_parameters(ZEND_NUM_ARGS(), \"l\", &value) ==\n" - " FAILURE) {\n" - " return;\n" - " }\n" - " const upb_EnumValueDef* ev =\n" - " upb_EnumDef_FindValueByNumber(e, value);\n" - " if (!ev) {\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(upb_EnumValueDef_Name(ev));\n" - "}\n" - "\n" - "PHP_METHOD($c_name$, value) {\n" - " $file_c_name$_AddDescriptor();\n" - " const upb_DefPool *symtab = DescriptorPool_GetSymbolTable();\n" - " const upb_EnumDef *e = upb_DefPool_FindEnumByName(symtab, \"$name$\");\n" - " char *name = NULL;\n" - " size_t name_len;\n" - " if (zend_parse_parameters(ZEND_NUM_ARGS(), \"s\", &name,\n" - " &name_len) == FAILURE) {\n" - " return;\n" - " }\n" - " const upb_EnumValueDef* ev = upb_EnumDef_FindValueByNameWithSize(\n" - " e, name, name_len);\n" - " if (!ev) {\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(upb_EnumValueDef_Number(ev));\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_MessageDef_FindFieldByName(\n" - " intern->desc->msgdef, \"$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_MessageDef_FindFieldByName(\n" - " intern->desc->msgdef, \"$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_MessageDef_FindOneofByName(\n" - " intern->desc->msgdef, \"$name$\");\n" - " const upb_FieldDef *field = \n" - " upb_Message_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, - std::string* error) const { - return Generate(file, Options(), generator_context, error); -} - -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 (!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, options, generator_context); - - return true; -} - -bool Generator::GenerateAll(const std::vector& files, - const std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const { - Options options; - - for (const auto& option : Split(parameter, ",", true)) { - const std::vector option_pair = Split(option, "=", true); - if (HasPrefixString(option_pair[0], "aggregate_metadata")) { - options.aggregate_metadata = true; - for (const auto& prefix : Split(option_pair[1], "#", false)) { - options.aggregate_metadata_prefixes.emplace(prefix); - GOOGLE_LOG(INFO) << prefix; - } - } else if (option_pair[0] == "internal") { - options.is_descriptor = true; - } else if (option_pair[0] == "internal_generate_c_wkt") { - GenerateCWellKnownTypes(files, generator_context); - } else { - GOOGLE_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; - } - } - - for (auto file : files) { - if (!Generate(file, options, generator_context, error)) { - return false; - } - } - - return true; -} - -} // namespace php -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/php/php_generator.h b/depends/protobuf/src/google/protobuf/compiler/php/php_generator.h deleted file mode 100644 index 17cb59c08..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/php/php_generator.h +++ /dev/null @@ -1,92 +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_COMPILER_PHP_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__ - -#include -#include - -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace php { - -struct Options; - -class PROTOC_EXPORT Generator : public CodeGenerator { - public: - virtual bool Generate( - const FileDescriptor* file, - const std::string& parameter, - GeneratorContext* generator_context, - 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, - const Options& options, - GeneratorContext* generator_context, - std::string* error) const; -}; - -// To skip reserved keywords in php, some generated classname are prefixed. -// Other code generators may need following API to figure out the actual -// classname. -PROTOC_EXPORT std::string GeneratedClassName(const Descriptor* desc); -PROTOC_EXPORT std::string GeneratedClassName(const EnumDescriptor* desc); -PROTOC_EXPORT std::string GeneratedClassName(const ServiceDescriptor* desc); - -inline bool IsWrapperType(const FieldDescriptor* descriptor) { - return descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - descriptor->message_type()->file()->name() == "google/protobuf/wrappers.proto"; -} - -} // namespace php -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/plugin.pb.cc b/depends/protobuf/src/google/protobuf/compiler/plugin.pb.cc deleted file mode 100644 index 8f8d83f02..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/plugin.pb.cc +++ /dev/null @@ -1,1612 +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 - -PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - -PROTOBUF_NAMESPACE_OPEN -namespace compiler { -PROTOBUF_CONSTEXPR Version::Version( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_._has_bits_)*/{} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_.suffix_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.major_)*/0 - , /*decltype(_impl_.minor_)*/0 - , /*decltype(_impl_.patch_)*/0} {} -struct VersionDefaultTypeInternal { - PROTOBUF_CONSTEXPR VersionDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~VersionDefaultTypeInternal() {} - union { - Version _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 VersionDefaultTypeInternal _Version_default_instance_; -PROTOBUF_CONSTEXPR CodeGeneratorRequest::CodeGeneratorRequest( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_._has_bits_)*/{} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_.file_to_generate_)*/{} - , /*decltype(_impl_.proto_file_)*/{} - , /*decltype(_impl_.parameter_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.compiler_version_)*/nullptr} {} -struct CodeGeneratorRequestDefaultTypeInternal { - PROTOBUF_CONSTEXPR CodeGeneratorRequestDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~CodeGeneratorRequestDefaultTypeInternal() {} - union { - CodeGeneratorRequest _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_; -PROTOBUF_CONSTEXPR CodeGeneratorResponse_File::CodeGeneratorResponse_File( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_._has_bits_)*/{} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.insertion_point_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.content_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.generated_code_info_)*/nullptr} {} -struct CodeGeneratorResponse_FileDefaultTypeInternal { - PROTOBUF_CONSTEXPR CodeGeneratorResponse_FileDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~CodeGeneratorResponse_FileDefaultTypeInternal() {} - union { - CodeGeneratorResponse_File _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_; -PROTOBUF_CONSTEXPR CodeGeneratorResponse::CodeGeneratorResponse( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_._has_bits_)*/{} - , /*decltype(_impl_._cached_size_)*/{} - , /*decltype(_impl_.file_)*/{} - , /*decltype(_impl_.error_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.supported_features_)*/uint64_t{0u}} {} -struct CodeGeneratorResponseDefaultTypeInternal { - PROTOBUF_CONSTEXPR CodeGeneratorResponseDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} - ~CodeGeneratorResponseDefaultTypeInternal() {} - union { - CodeGeneratorResponse _instance; - }; -}; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_; -} // namespace compiler -PROTOBUF_NAMESPACE_CLOSE -static ::_pb::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[4]; -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]; -static constexpr ::_pb::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, _impl_._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, _impl_.major_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _impl_.minor_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _impl_.patch_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _impl_.suffix_), - 1, - 2, - 3, - 0, - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_._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, _impl_.file_to_generate_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_.parameter_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_.proto_file_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_.compiler_version_), - ~0u, - 0, - ~0u, - 1, - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_._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, _impl_.name_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_.insertion_point_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_.content_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_.generated_code_info_), - 0, - 1, - 2, - 3, - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _impl_._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, _impl_.error_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _impl_.supported_features_), - PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _impl_.file_), - 0, - 1, - ~0u, -}; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, 10, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::Version)}, - { 14, 24, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest)}, - { 28, 38, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File)}, - { 42, 51, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse)}, -}; - -static const ::_pb::Message* const file_default_instances[] = { - &::PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_._instance, - &::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_._instance, - &::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_File_default_instance_._instance, - &::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_default_instance_._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 ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps[1] = { - &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, -}; -static ::_pbi::once_flag descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once; -const ::_pbi::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 ::_pbi::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_PRIORITY2 static ::_pbi::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()._impl_._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(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.Version) -} -Version::Version(const Version& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Version* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){from._impl_._has_bits_} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.suffix_){} - , decltype(_impl_.major_){} - , decltype(_impl_.minor_){} - , decltype(_impl_.patch_){}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.suffix_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.suffix_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (from._internal_has_suffix()) { - _this->_impl_.suffix_.Set(from._internal_suffix(), - _this->GetArenaForAllocation()); - } - ::memcpy(&_impl_.major_, &from._impl_.major_, - static_cast(reinterpret_cast(&_impl_.patch_) - - reinterpret_cast(&_impl_.major_)) + sizeof(_impl_.patch_)); - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) -} - -inline void Version::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.suffix_){} - , decltype(_impl_.major_){0} - , decltype(_impl_.minor_){0} - , decltype(_impl_.patch_){0} - }; - _impl_.suffix_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.suffix_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -Version::~Version() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.Version) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void Version::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.suffix_.Destroy(); -} - -void Version::SetCachedSize(int size) const { - _impl_._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 = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - _impl_.suffix_.ClearNonDefaultToEmpty(); - } - if (cached_has_bits & 0x0000000eu) { - ::memset(&_impl_.major_, 0, static_cast( - reinterpret_cast(&_impl_.patch_) - - reinterpret_cast(&_impl_.major_)) + sizeof(_impl_.patch_)); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* Version::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::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); - _impl_.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); - _impl_.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); - _impl_.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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.Version.suffix"); - #endif // !NDEBUG - } 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: - _impl_._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 = _impl_._has_bits_[0]; - // optional int32 major = 1; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_major(), target); - } - - // optional int32 minor = 2; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_minor(), target); - } - - // optional int32 patch = 3; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::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 = ::_pbi::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 = _impl_._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 += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_major()); - } - - // optional int32 minor = 2; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_minor()); - } - - // optional int32 patch = 3; - if (cached_has_bits & 0x00000008u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_patch()); - } - - } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Version::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Version::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Version::GetClassData() const { return &_class_data_; } - - -void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@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._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { - _this->_internal_set_suffix(from._internal_suffix()); - } - if (cached_has_bits & 0x00000002u) { - _this->_impl_.major_ = from._impl_.major_; - } - if (cached_has_bits & 0x00000004u) { - _this->_impl_.minor_ = from._impl_.minor_; - } - if (cached_has_bits & 0x00000008u) { - _this->_impl_.patch_ = from._impl_.patch_; - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - } - _this->_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(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.suffix_, lhs_arena, - &other->_impl_.suffix_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(Version, _impl_.patch_) - + sizeof(Version::_impl_.patch_) - - PROTOBUF_FIELD_OFFSET(Version, _impl_.major_)>( - reinterpret_cast(&_impl_.major_), - reinterpret_cast(&other->_impl_.major_)); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Version::GetMetadata() const { - return ::_pbi::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()._impl_._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->_impl_.compiler_version_; -} -void CodeGeneratorRequest::clear_proto_file() { - _impl_.proto_file_.Clear(); -} -CodeGeneratorRequest::CodeGeneratorRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorRequest) -} -CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - CodeGeneratorRequest* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){from._impl_._has_bits_} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.file_to_generate_){from._impl_.file_to_generate_} - , decltype(_impl_.proto_file_){from._impl_.proto_file_} - , decltype(_impl_.parameter_){} - , decltype(_impl_.compiler_version_){nullptr}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.parameter_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.parameter_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (from._internal_has_parameter()) { - _this->_impl_.parameter_.Set(from._internal_parameter(), - _this->GetArenaForAllocation()); - } - if (from._internal_has_compiler_version()) { - _this->_impl_.compiler_version_ = new ::PROTOBUF_NAMESPACE_ID::compiler::Version(*from._impl_.compiler_version_); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest) -} - -inline void CodeGeneratorRequest::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.file_to_generate_){arena} - , decltype(_impl_.proto_file_){arena} - , decltype(_impl_.parameter_){} - , decltype(_impl_.compiler_version_){nullptr} - }; - _impl_.parameter_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.parameter_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -CodeGeneratorRequest::~CodeGeneratorRequest() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorRequest) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void CodeGeneratorRequest::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.file_to_generate_.~RepeatedPtrField(); - _impl_.proto_file_.~RepeatedPtrField(); - _impl_.parameter_.Destroy(); - if (this != internal_default_instance()) delete _impl_.compiler_version_; -} - -void CodeGeneratorRequest::SetCachedSize(int size) const { - _impl_._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; - - _impl_.file_to_generate_.Clear(); - _impl_.proto_file_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { - _impl_.parameter_.ClearNonDefaultToEmpty(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(_impl_.compiler_version_ != nullptr); - _impl_.compiler_version_->Clear(); - } - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); - #endif // !NDEBUG - 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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); - #endif // !NDEBUG - } 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: - _impl_._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 = _impl_._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 = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(3, _Internal::compiler_version(this), - _Internal::compiler_version(this).GetCachedSize(), target, stream); - } - - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - for (unsigned i = 0, - n = static_cast(this->_internal_proto_file_size()); i < n; i++) { - const auto& repfield = this->_internal_proto_file(i); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(15, repfield, repfield.GetCachedSize(), target, stream); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::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(_impl_.file_to_generate_.size()); - for (int i = 0, n = _impl_.file_to_generate_.size(); i < n; i++) { - total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - _impl_.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->_impl_.proto_file_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - cached_has_bits = _impl_._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( - *_impl_.compiler_version_); - } - - } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorRequest::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - CodeGeneratorRequest::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorRequest::GetClassData() const { return &_class_data_; } - - -void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@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; - - _this->_impl_.file_to_generate_.MergeFrom(from._impl_.file_to_generate_); - _this->_impl_.proto_file_.MergeFrom(from._impl_.proto_file_); - cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { - _this->_internal_set_parameter(from._internal_parameter()); - } - if (cached_has_bits & 0x00000002u) { - _this->_internal_mutable_compiler_version()->::PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom( - from._internal_compiler_version()); - } - } - _this->_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(_impl_.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(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.file_to_generate_.InternalSwap(&other->_impl_.file_to_generate_); - _impl_.proto_file_.InternalSwap(&other->_impl_.proto_file_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.parameter_, lhs_arena, - &other->_impl_.parameter_, rhs_arena - ); - swap(_impl_.compiler_version_, other->_impl_.compiler_version_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorRequest::GetMetadata() const { - return ::_pbi::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()._impl_._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->_impl_.generated_code_info_; -} -void CodeGeneratorResponse_File::clear_generated_code_info() { - if (_impl_.generated_code_info_ != nullptr) _impl_.generated_code_info_->Clear(); - _impl_._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(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) -} -CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - CodeGeneratorResponse_File* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){from._impl_._has_bits_} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.name_){} - , decltype(_impl_.insertion_point_){} - , decltype(_impl_.content_){} - , decltype(_impl_.generated_code_info_){nullptr}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (from._internal_has_name()) { - _this->_impl_.name_.Set(from._internal_name(), - _this->GetArenaForAllocation()); - } - _impl_.insertion_point_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.insertion_point_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (from._internal_has_insertion_point()) { - _this->_impl_.insertion_point_.Set(from._internal_insertion_point(), - _this->GetArenaForAllocation()); - } - _impl_.content_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.content_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (from._internal_has_content()) { - _this->_impl_.content_.Set(from._internal_content(), - _this->GetArenaForAllocation()); - } - if (from._internal_has_generated_code_info()) { - _this->_impl_.generated_code_info_ = new ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from._impl_.generated_code_info_); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) -} - -inline void CodeGeneratorResponse_File::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.name_){} - , decltype(_impl_.insertion_point_){} - , decltype(_impl_.content_){} - , decltype(_impl_.generated_code_info_){nullptr} - }; - _impl_.name_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.name_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.insertion_point_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.insertion_point_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.content_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.content_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -CodeGeneratorResponse_File::~CodeGeneratorResponse_File() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorResponse.File) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void CodeGeneratorResponse_File::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.name_.Destroy(); - _impl_.insertion_point_.Destroy(); - _impl_.content_.Destroy(); - if (this != internal_default_instance()) delete _impl_.generated_code_info_; -} - -void CodeGeneratorResponse_File::SetCachedSize(int size) const { - _impl_._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 = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { - _impl_.name_.ClearNonDefaultToEmpty(); - } - if (cached_has_bits & 0x00000002u) { - _impl_.insertion_point_.ClearNonDefaultToEmpty(); - } - if (cached_has_bits & 0x00000004u) { - _impl_.content_.ClearNonDefaultToEmpty(); - } - if (cached_has_bits & 0x00000008u) { - GOOGLE_DCHECK(_impl_.generated_code_info_ != nullptr); - _impl_.generated_code_info_->Clear(); - } - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); - #endif // !NDEBUG - } 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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); - #endif // !NDEBUG - } 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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); - #endif // !NDEBUG - } 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: - _impl_._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 = _impl_._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 = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(16, _Internal::generated_code_info(this), - _Internal::generated_code_info(this).GetCachedSize(), target, stream); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::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 = _impl_._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( - *_impl_.generated_code_info_); - } - - } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse_File::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - 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_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@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._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { - _this->_internal_set_name(from._internal_name()); - } - if (cached_has_bits & 0x00000002u) { - _this->_internal_set_insertion_point(from._internal_insertion_point()); - } - if (cached_has_bits & 0x00000004u) { - _this->_internal_set_content(from._internal_content()); - } - if (cached_has_bits & 0x00000008u) { - _this->_internal_mutable_generated_code_info()->::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo::MergeFrom( - from._internal_generated_code_info()); - } - } - _this->_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(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.name_, lhs_arena, - &other->_impl_.name_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.insertion_point_, lhs_arena, - &other->_impl_.insertion_point_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.content_, lhs_arena, - &other->_impl_.content_, rhs_arena - ); - swap(_impl_.generated_code_info_, other->_impl_.generated_code_info_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse_File::GetMetadata() const { - return ::_pbi::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()._impl_._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) { - SharedCtor(arena, is_message_owned); - // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorResponse) -} -CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - CodeGeneratorResponse* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){from._impl_._has_bits_} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.file_){from._impl_.file_} - , decltype(_impl_.error_){} - , decltype(_impl_.supported_features_){}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.error_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.error_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (from._internal_has_error()) { - _this->_impl_.error_.Set(from._internal_error(), - _this->GetArenaForAllocation()); - } - _this->_impl_.supported_features_ = from._impl_.supported_features_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse) -} - -inline void CodeGeneratorResponse::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_._has_bits_){} - , /*decltype(_impl_._cached_size_)*/{} - , decltype(_impl_.file_){arena} - , decltype(_impl_.error_){} - , decltype(_impl_.supported_features_){uint64_t{0u}} - }; - _impl_.error_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.error_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING -} - -CodeGeneratorResponse::~CodeGeneratorResponse() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorResponse) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } - SharedDtor(); -} - -inline void CodeGeneratorResponse::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); - _impl_.file_.~RepeatedPtrField(); - _impl_.error_.Destroy(); -} - -void CodeGeneratorResponse::SetCachedSize(int size) const { - _impl_._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; - - _impl_.file_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - _impl_.error_.ClearNonDefaultToEmpty(); - } - _impl_.supported_features_ = uint64_t{0u}; - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::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 = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - #ifndef NDEBUG - ::_pbi::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.error"); - #endif // !NDEBUG - } 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); - _impl_.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: - _impl_._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 = _impl_._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 = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_supported_features(), target); - } - - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - for (unsigned i = 0, - n = static_cast(this->_internal_file_size()); i < n; i++) { - const auto& repfield = this->_internal_file(i); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(15, repfield, repfield.GetCachedSize(), target, stream); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::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->_impl_.file_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - cached_has_bits = _impl_._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 += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_supported_features()); - } - - } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); -} - -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - CodeGeneratorResponse::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse::GetClassData() const { return &_class_data_; } - - -void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@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; - - _this->_impl_.file_.MergeFrom(from._impl_.file_); - cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { - _this->_internal_set_error(from._internal_error()); - } - if (cached_has_bits & 0x00000002u) { - _this->_impl_.supported_features_ = from._impl_.supported_features_; - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - } - _this->_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(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.file_.InternalSwap(&other->_impl_.file_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.error_, lhs_arena, - &other->_impl_.error_, rhs_arena - ); - swap(_impl_.supported_features_, other->_impl_.supported_features_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse::GetMetadata() const { - return ::_pbi::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/depends/protobuf/src/google/protobuf/compiler/plugin.pb.h b/depends/protobuf/src/google/protobuf/compiler/plugin.pb.h deleted file mode 100644 index fd6773b6e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/plugin.pb.h +++ /dev/null @@ -1,1901 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/compiler/plugin.proto - -#ifndef GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fcompiler_2fplugin_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fcompiler_2fplugin_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3021000 -#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 3021010 < 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. -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fcompiler_2fplugin_2eproto PROTOC_EXPORT -#ifdef major -#undef major -#endif -#ifdef minor -#undef minor -#endif -PROTOBUF_NAMESPACE_OPEN -namespace internal { -class AnyMetadata; -} // namespace internal -PROTOBUF_NAMESPACE_CLOSE - -// Internal implementation detail -- do not use these members. -struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto { - static const uint32_t offsets[]; -}; -PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -PROTOBUF_NAMESPACE_OPEN -namespace compiler { -class CodeGeneratorRequest; -struct CodeGeneratorRequestDefaultTypeInternal; -PROTOC_EXPORT extern CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_; -class CodeGeneratorResponse; -struct CodeGeneratorResponseDefaultTypeInternal; -PROTOC_EXPORT extern CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_; -class CodeGeneratorResponse_File; -struct CodeGeneratorResponse_FileDefaultTypeInternal; -PROTOC_EXPORT extern CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_; -class Version; -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<::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 final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ { - public: - inline Version() : Version(nullptr) {} - ~Version() override; - explicit PROTOBUF_CONSTEXPR Version(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Version(const Version& from); - Version(Version&& from) noexcept - : Version() { - *this = ::std::move(from); - } - - inline Version& operator=(const Version& from) { - CopyFrom(from); - return *this; - } - inline Version& operator=(Version&& from) noexcept { - 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); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - 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<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Version& default_instance() { - return *internal_default_instance(); - } - static inline const Version* internal_default_instance() { - return reinterpret_cast( - &_Version_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - friend void swap(Version& a, Version& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Version& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Version& from) { - Version::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kSuffixFieldNumber = 4, - kMajorFieldNumber = 1, - kMinorFieldNumber = 2, - kPatchFieldNumber = 3, - }; - // optional string suffix = 4; - bool has_suffix() const; - private: - bool _internal_has_suffix() const; - public: - void clear_suffix(); - const std::string& suffix() const; - template - void set_suffix(ArgT0&& arg0, ArgT... args); - std::string* mutable_suffix(); - PROTOBUF_NODISCARD std::string* release_suffix(); - void set_allocated_suffix(std::string* suffix); - private: - const std::string& _internal_suffix() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const std::string& value); - std::string* _internal_mutable_suffix(); - public: - - // optional int32 major = 1; - bool has_major() const; - private: - bool _internal_has_major() const; - public: - void clear_major(); - int32_t major() const; - void set_major(int32_t value); - private: - int32_t _internal_major() const; - void _internal_set_major(int32_t value); - public: - - // optional int32 minor = 2; - bool has_minor() const; - private: - bool _internal_has_minor() const; - public: - void clear_minor(); - int32_t minor() const; - void set_minor(int32_t value); - private: - int32_t _internal_minor() const; - void _internal_set_minor(int32_t value); - public: - - // optional int32 patch = 3; - bool has_patch() const; - private: - bool _internal_has_patch() const; - public: - void clear_patch(); - int32_t patch() const; - void set_patch(int32_t value); - private: - 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; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr suffix_; - int32_t major_; - int32_t minor_; - int32_t patch_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -}; -// ------------------------------------------------------------------- - -class PROTOC_EXPORT CodeGeneratorRequest final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ { - public: - inline CodeGeneratorRequest() : CodeGeneratorRequest(nullptr) {} - ~CodeGeneratorRequest() override; - explicit PROTOBUF_CONSTEXPR CodeGeneratorRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - CodeGeneratorRequest(const CodeGeneratorRequest& from); - CodeGeneratorRequest(CodeGeneratorRequest&& from) noexcept - : CodeGeneratorRequest() { - *this = ::std::move(from); - } - - inline CodeGeneratorRequest& operator=(const CodeGeneratorRequest& from) { - CopyFrom(from); - return *this; - } - inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept { - 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); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - 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<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const CodeGeneratorRequest& default_instance() { - return *internal_default_instance(); - } - static inline const CodeGeneratorRequest* internal_default_instance() { - return reinterpret_cast( - &_CodeGeneratorRequest_default_instance_); - } - static constexpr int kIndexInFileMessages = - 1; - - friend void swap(CodeGeneratorRequest& a, CodeGeneratorRequest& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const CodeGeneratorRequest& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const CodeGeneratorRequest& from) { - CodeGeneratorRequest::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kFileToGenerateFieldNumber = 1, - kProtoFileFieldNumber = 15, - kParameterFieldNumber = 2, - kCompilerVersionFieldNumber = 3, - }; - // repeated string file_to_generate = 1; - int file_to_generate_size() const; - private: - int _internal_file_to_generate_size() const; - public: - void clear_file_to_generate(); - const std::string& file_to_generate(int index) const; - std::string* mutable_file_to_generate(int index); - void set_file_to_generate(int index, const std::string& value); - void set_file_to_generate(int index, std::string&& value); - void set_file_to_generate(int index, const char* value); - void set_file_to_generate(int index, const char* value, size_t size); - std::string* add_file_to_generate(); - void add_file_to_generate(const std::string& value); - void add_file_to_generate(std::string&& value); - void add_file_to_generate(const char* value); - void add_file_to_generate(const char* value, size_t size); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& file_to_generate() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_file_to_generate(); - private: - const std::string& _internal_file_to_generate(int index) const; - std::string* _internal_add_file_to_generate(); - public: - - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - int proto_file_size() const; - private: - 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 >* - mutable_proto_file(); - private: - 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 >& - proto_file() const; - - // optional string parameter = 2; - bool has_parameter() const; - private: - bool _internal_has_parameter() const; - public: - void clear_parameter(); - const std::string& parameter() const; - template - void set_parameter(ArgT0&& arg0, ArgT... args); - std::string* mutable_parameter(); - PROTOBUF_NODISCARD std::string* release_parameter(); - void set_allocated_parameter(std::string* parameter); - private: - const std::string& _internal_parameter() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_parameter(const std::string& value); - std::string* _internal_mutable_parameter(); - public: - - // optional .google.protobuf.compiler.Version compiler_version = 3; - bool has_compiler_version() const; - private: - bool _internal_has_compiler_version() const; - public: - void clear_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(); - 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; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::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::internal::ArenaStringPtr parameter_; - ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -}; -// ------------------------------------------------------------------- - -class PROTOC_EXPORT CodeGeneratorResponse_File final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ { - public: - inline CodeGeneratorResponse_File() : CodeGeneratorResponse_File(nullptr) {} - ~CodeGeneratorResponse_File() override; - explicit PROTOBUF_CONSTEXPR CodeGeneratorResponse_File(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from); - CodeGeneratorResponse_File(CodeGeneratorResponse_File&& from) noexcept - : CodeGeneratorResponse_File() { - *this = ::std::move(from); - } - - inline CodeGeneratorResponse_File& operator=(const CodeGeneratorResponse_File& from) { - CopyFrom(from); - return *this; - } - inline CodeGeneratorResponse_File& operator=(CodeGeneratorResponse_File&& from) noexcept { - 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); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - 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<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const CodeGeneratorResponse_File& default_instance() { - return *internal_default_instance(); - } - static inline const CodeGeneratorResponse_File* internal_default_instance() { - return reinterpret_cast( - &_CodeGeneratorResponse_File_default_instance_); - } - static constexpr int kIndexInFileMessages = - 2; - - friend void swap(CodeGeneratorResponse_File& a, CodeGeneratorResponse_File& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const CodeGeneratorResponse_File& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const CodeGeneratorResponse_File& from) { - CodeGeneratorResponse_File::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kNameFieldNumber = 1, - kInsertionPointFieldNumber = 2, - kContentFieldNumber = 15, - kGeneratedCodeInfoFieldNumber = 16, - }; - // optional string name = 1; - bool has_name() const; - private: - bool _internal_has_name() const; - public: - void clear_name(); - const std::string& name() const; - template - void set_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* name); - private: - const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); - std::string* _internal_mutable_name(); - public: - - // optional string insertion_point = 2; - bool has_insertion_point() const; - private: - bool _internal_has_insertion_point() const; - public: - void clear_insertion_point(); - const std::string& insertion_point() const; - template - void set_insertion_point(ArgT0&& arg0, ArgT... args); - std::string* mutable_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; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point(const std::string& value); - std::string* _internal_mutable_insertion_point(); - public: - - // optional string content = 15; - bool has_content() const; - private: - bool _internal_has_content() const; - public: - void clear_content(); - const std::string& content() const; - template - void set_content(ArgT0&& arg0, ArgT... args); - std::string* mutable_content(); - PROTOBUF_NODISCARD std::string* release_content(); - void set_allocated_content(std::string* content); - private: - const std::string& _internal_content() const; - 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; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::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_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -}; -// ------------------------------------------------------------------- - -class PROTOC_EXPORT CodeGeneratorResponse final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ { - public: - inline CodeGeneratorResponse() : CodeGeneratorResponse(nullptr) {} - ~CodeGeneratorResponse() override; - explicit PROTOBUF_CONSTEXPR CodeGeneratorResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - CodeGeneratorResponse(const CodeGeneratorResponse& from); - CodeGeneratorResponse(CodeGeneratorResponse&& from) noexcept - : CodeGeneratorResponse() { - *this = ::std::move(from); - } - - inline CodeGeneratorResponse& operator=(const CodeGeneratorResponse& from) { - CopyFrom(from); - return *this; - } - inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept { - 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); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - 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<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const CodeGeneratorResponse& default_instance() { - return *internal_default_instance(); - } - static inline const CodeGeneratorResponse* internal_default_instance() { - return reinterpret_cast( - &_CodeGeneratorResponse_default_instance_); - } - static constexpr int kIndexInFileMessages = - 3; - - friend void swap(CodeGeneratorResponse& a, CodeGeneratorResponse& b) { - a.Swap(&b); - } - 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 ---------------------------------------------- - - CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const CodeGeneratorResponse& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const CodeGeneratorResponse& from) { - CodeGeneratorResponse::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - 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; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - 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); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::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; - private: - 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 >* - mutable_file(); - private: - 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 >& - file() const; - - // optional string error = 1; - bool has_error() const; - private: - bool _internal_has_error() const; - public: - void clear_error(); - const std::string& error() const; - template - void set_error(ArgT0&& arg0, ArgT... args); - std::string* mutable_error(); - PROTOBUF_NODISCARD std::string* release_error(); - void set_allocated_error(std::string* error); - private: - const std::string& _internal_error() const; - 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; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::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::internal::ArenaStringPtr error_; - uint64_t supported_features_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// Version - -// optional int32 major = 1; -inline bool Version::_internal_has_major() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool Version::has_major() const { - return _internal_has_major(); -} -inline void Version::clear_major() { - _impl_.major_ = 0; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline int32_t Version::_internal_major() const { - return _impl_.major_; -} -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(int32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.major_ = value; -} -inline void Version::set_major(int32_t value) { - _internal_set_major(value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major) -} - -// optional int32 minor = 2; -inline bool Version::_internal_has_minor() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool Version::has_minor() const { - return _internal_has_minor(); -} -inline void Version::clear_minor() { - _impl_.minor_ = 0; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline int32_t Version::_internal_minor() const { - return _impl_.minor_; -} -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(int32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.minor_ = value; -} -inline void Version::set_minor(int32_t value) { - _internal_set_minor(value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor) -} - -// optional int32 patch = 3; -inline bool Version::_internal_has_patch() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool Version::has_patch() const { - return _internal_has_patch(); -} -inline void Version::clear_patch() { - _impl_.patch_ = 0; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline int32_t Version::_internal_patch() const { - return _impl_.patch_; -} -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(int32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.patch_ = value; -} -inline void Version::set_patch(int32_t value) { - _internal_set_patch(value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch) -} - -// optional string suffix = 4; -inline bool Version::_internal_has_suffix() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool Version::has_suffix() const { - return _internal_has_suffix(); -} -inline void Version::clear_suffix() { - _impl_.suffix_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const std::string& Version::suffix() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.suffix) - return _internal_suffix(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Version::set_suffix(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.suffix_.Set(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 _s; -} -inline const std::string& Version::_internal_suffix() const { - return _impl_.suffix_.Get(); -} -inline void Version::_internal_set_suffix(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.suffix_.Set(value, GetArenaForAllocation()); -} -inline std::string* Version::_internal_mutable_suffix() { - _impl_._has_bits_[0] |= 0x00000001u; - return _impl_.suffix_.Mutable(GetArenaForAllocation()); -} -inline std::string* Version::release_suffix() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix) - if (!_internal_has_suffix()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000001u; - auto* p = _impl_.suffix_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.suffix_.IsDefault()) { - _impl_.suffix_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Version::set_allocated_suffix(std::string* suffix) { - if (suffix != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.suffix_.SetAllocated(suffix, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.suffix_.IsDefault()) { - _impl_.suffix_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix) -} - -// ------------------------------------------------------------------- - -// CodeGeneratorRequest - -// repeated string file_to_generate = 1; -inline int CodeGeneratorRequest::_internal_file_to_generate_size() const { - return _impl_.file_to_generate_.size(); -} -inline int CodeGeneratorRequest::file_to_generate_size() const { - return _internal_file_to_generate_size(); -} -inline void CodeGeneratorRequest::clear_file_to_generate() { - _impl_.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 _s; -} -inline const std::string& CodeGeneratorRequest::_internal_file_to_generate(int index) const { - return _impl_.file_to_generate_.Get(index); -} -inline const std::string& CodeGeneratorRequest::file_to_generate(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return _internal_file_to_generate(index); -} -inline std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return _impl_.file_to_generate_.Mutable(index); -} -inline void CodeGeneratorRequest::set_file_to_generate(int index, const std::string& value) { - _impl_.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) { - _impl_.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); - _impl_.file_to_generate_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* value, size_t size) { - _impl_.file_to_generate_.Mutable(index)->assign( - reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -inline std::string* CodeGeneratorRequest::_internal_add_file_to_generate() { - return _impl_.file_to_generate_.Add(); -} -inline void CodeGeneratorRequest::add_file_to_generate(const std::string& value) { - _impl_.file_to_generate_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -inline void CodeGeneratorRequest::add_file_to_generate(std::string&& value) { - _impl_.file_to_generate_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -inline void CodeGeneratorRequest::add_file_to_generate(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _impl_.file_to_generate_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -inline void CodeGeneratorRequest::add_file_to_generate(const char* value, size_t size) { - _impl_.file_to_generate_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& -CodeGeneratorRequest::file_to_generate() const { - // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return _impl_.file_to_generate_; -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* -CodeGeneratorRequest::mutable_file_to_generate() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return &_impl_.file_to_generate_; -} - -// optional string parameter = 2; -inline bool CodeGeneratorRequest::_internal_has_parameter() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool CodeGeneratorRequest::has_parameter() const { - return _internal_has_parameter(); -} -inline void CodeGeneratorRequest::clear_parameter() { - _impl_.parameter_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const std::string& CodeGeneratorRequest::parameter() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter) - return _internal_parameter(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void CodeGeneratorRequest::set_parameter(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.parameter_.Set(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 _s; -} -inline const std::string& CodeGeneratorRequest::_internal_parameter() const { - return _impl_.parameter_.Get(); -} -inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.parameter_.Set(value, GetArenaForAllocation()); -} -inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() { - _impl_._has_bits_[0] |= 0x00000001u; - return _impl_.parameter_.Mutable(GetArenaForAllocation()); -} -inline std::string* CodeGeneratorRequest::release_parameter() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter) - if (!_internal_has_parameter()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000001u; - auto* p = _impl_.parameter_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.parameter_.IsDefault()) { - _impl_.parameter_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter) { - if (parameter != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.parameter_.SetAllocated(parameter, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.parameter_.IsDefault()) { - _impl_.parameter_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} - -// repeated .google.protobuf.FileDescriptorProto proto_file = 15; -inline int CodeGeneratorRequest::_internal_proto_file_size() const { - return _impl_.proto_file_.size(); -} -inline int CodeGeneratorRequest::proto_file_size() const { - return _internal_proto_file_size(); -} -inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return _impl_.proto_file_.Mutable(index); -} -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 &_impl_.proto_file_; -} -inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { - return _impl_.proto_file_.Get(index); -} -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() { - return _impl_.proto_file_.Add(); -} -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 _add; -} -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 _impl_.proto_file_; -} - -// optional .google.protobuf.compiler.Version compiler_version = 3; -inline bool CodeGeneratorRequest::_internal_has_compiler_version() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - PROTOBUF_ASSUME(!value || _impl_.compiler_version_ != nullptr); - return value; -} -inline bool CodeGeneratorRequest::has_compiler_version() const { - return _internal_has_compiler_version(); -} -inline void CodeGeneratorRequest::clear_compiler_version() { - if (_impl_.compiler_version_ != nullptr) _impl_.compiler_version_->Clear(); - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { - const ::PROTOBUF_NAMESPACE_ID::compiler::Version* p = _impl_.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 { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) - return _internal_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*>(_impl_.compiler_version_); - } - _impl_.compiler_version_ = compiler_version; - if (compiler_version) { - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._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() { - _impl_._has_bits_[0] &= ~0x00000002u; - ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = _impl_.compiler_version_; - _impl_.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) - _impl_._has_bits_[0] &= ~0x00000002u; - ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = _impl_.compiler_version_; - _impl_.compiler_version_ = nullptr; - return temp; -} -inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { - _impl_._has_bits_[0] |= 0x00000002u; - if (_impl_.compiler_version_ == nullptr) { - auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation()); - _impl_.compiler_version_ = p; - } - return _impl_.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 _msg; -} -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 _impl_.compiler_version_; - } - if (compiler_version) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(compiler_version); - if (message_arena != submessage_arena) { - compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, compiler_version, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._has_bits_[0] &= ~0x00000002u; - } - _impl_.compiler_version_ = compiler_version; - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) -} - -// ------------------------------------------------------------------- - -// CodeGeneratorResponse_File - -// optional string name = 1; -inline bool CodeGeneratorResponse_File::_internal_has_name() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool CodeGeneratorResponse_File::has_name() const { - return _internal_has_name(); -} -inline void CodeGeneratorResponse_File::clear_name() { - _impl_.name_.ClearToEmpty(); - _impl_._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(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void CodeGeneratorResponse_File::set_name(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.name_.Set(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 _s; -} -inline const std::string& CodeGeneratorResponse_File::_internal_name() const { - return _impl_.name_.Get(); -} -inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.name_.Set(value, GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() { - _impl_._has_bits_[0] |= 0x00000001u; - return _impl_.name_.Mutable(GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse_File::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name) - if (!_internal_has_name()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000001u; - auto* p = _impl_.name_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) { - if (name != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.name_.SetAllocated(name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} - -// optional string insertion_point = 2; -inline bool CodeGeneratorResponse_File::_internal_has_insertion_point() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool CodeGeneratorResponse_File::has_insertion_point() const { - return _internal_has_insertion_point(); -} -inline void CodeGeneratorResponse_File::clear_insertion_point() { - _impl_.insertion_point_.ClearToEmpty(); - _impl_._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(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void CodeGeneratorResponse_File::set_insertion_point(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.insertion_point_.Set(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 _s; -} -inline const std::string& CodeGeneratorResponse_File::_internal_insertion_point() const { - return _impl_.insertion_point_.Get(); -} -inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.insertion_point_.Set(value, GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() { - _impl_._has_bits_[0] |= 0x00000002u; - return _impl_.insertion_point_.Mutable(GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse_File::release_insertion_point() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) - if (!_internal_has_insertion_point()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000002u; - auto* p = _impl_.insertion_point_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.insertion_point_.IsDefault()) { - _impl_.insertion_point_.Set("", 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) { - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._has_bits_[0] &= ~0x00000002u; - } - _impl_.insertion_point_.SetAllocated(insertion_point, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.insertion_point_.IsDefault()) { - _impl_.insertion_point_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} - -// optional string content = 15; -inline bool CodeGeneratorResponse_File::_internal_has_content() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool CodeGeneratorResponse_File::has_content() const { - return _internal_has_content(); -} -inline void CodeGeneratorResponse_File::clear_content() { - _impl_.content_.ClearToEmpty(); - _impl_._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(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void CodeGeneratorResponse_File::set_content(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.content_.Set(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 _s; -} -inline const std::string& CodeGeneratorResponse_File::_internal_content() const { - return _impl_.content_.Get(); -} -inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.content_.Set(value, GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() { - _impl_._has_bits_[0] |= 0x00000004u; - return _impl_.content_.Mutable(GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse_File::release_content() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content) - if (!_internal_has_content()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000004u; - auto* p = _impl_.content_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.content_.IsDefault()) { - _impl_.content_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void CodeGeneratorResponse_File::set_allocated_content(std::string* content) { - if (content != nullptr) { - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - _impl_.content_.SetAllocated(content, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.content_.IsDefault()) { - _impl_.content_.Set("", 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 = (_impl_._has_bits_[0] & 0x00000008u) != 0; - PROTOBUF_ASSUME(!value || _impl_.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 = _impl_.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*>(_impl_.generated_code_info_); - } - _impl_.generated_code_info_ = generated_code_info; - if (generated_code_info) { - _impl_._has_bits_[0] |= 0x00000008u; - } else { - _impl_._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() { - _impl_._has_bits_[0] &= ~0x00000008u; - ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = _impl_.generated_code_info_; - _impl_.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) - _impl_._has_bits_[0] &= ~0x00000008u; - ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = _impl_.generated_code_info_; - _impl_.generated_code_info_ = nullptr; - return temp; -} -inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { - _impl_._has_bits_[0] |= 0x00000008u; - if (_impl_.generated_code_info_ == nullptr) { - auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation()); - _impl_.generated_code_info_ = p; - } - return _impl_.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*>(_impl_.generated_code_info_); - } - if (generated_code_info) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( - 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); - } - _impl_._has_bits_[0] |= 0x00000008u; - } else { - _impl_._has_bits_[0] &= ~0x00000008u; - } - _impl_.generated_code_info_ = generated_code_info; - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) -} - -// ------------------------------------------------------------------- - -// CodeGeneratorResponse - -// optional string error = 1; -inline bool CodeGeneratorResponse::_internal_has_error() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool CodeGeneratorResponse::has_error() const { - return _internal_has_error(); -} -inline void CodeGeneratorResponse::clear_error() { - _impl_.error_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const std::string& CodeGeneratorResponse::error() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error) - return _internal_error(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void CodeGeneratorResponse::set_error(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.error_.Set(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 _s; -} -inline const std::string& CodeGeneratorResponse::_internal_error() const { - return _impl_.error_.Get(); -} -inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.error_.Set(value, GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse::_internal_mutable_error() { - _impl_._has_bits_[0] |= 0x00000001u; - return _impl_.error_.Mutable(GetArenaForAllocation()); -} -inline std::string* CodeGeneratorResponse::release_error() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error) - if (!_internal_has_error()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000001u; - auto* p = _impl_.error_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.error_.IsDefault()) { - _impl_.error_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void CodeGeneratorResponse::set_allocated_error(std::string* error) { - if (error != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.error_.SetAllocated(error, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.error_.IsDefault()) { - _impl_.error_.Set("", 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 = (_impl_._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() { - _impl_.supported_features_ = uint64_t{0u}; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint64_t CodeGeneratorResponse::_internal_supported_features() const { - return _impl_.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) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.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 _impl_.file_.size(); -} -inline int CodeGeneratorResponse::file_size() const { - return _internal_file_size(); -} -inline void CodeGeneratorResponse::clear_file() { - _impl_.file_.Clear(); -} -inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) - return _impl_.file_.Mutable(index); -} -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 &_impl_.file_; -} -inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { - return _impl_.file_.Get(index); -} -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() { - return _impl_.file_.Add(); -} -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 _add; -} -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 _impl_.file_; -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - - -// @@protoc_insertion_point(namespace_scope) - -} // 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 -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_google_2fprotobuf_2fcompiler_2fplugin_2eproto diff --git a/depends/protobuf/src/google/protobuf/compiler/plugin.proto b/depends/protobuf/src/google/protobuf/compiler/plugin.proto deleted file mode 100644 index 9242aacc5..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/plugin.proto +++ /dev/null @@ -1,183 +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) -// -// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to -// change. -// -// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is -// just a program that reads a CodeGeneratorRequest from stdin and writes a -// CodeGeneratorResponse to stdout. -// -// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead -// of dealing with the raw protocol defined here. -// -// A plugin executable needs only to be placed somewhere in the path. The -// plugin should be named "protoc-gen-$NAME", and will then be used when the -// flag "--${NAME}_out" is passed to protoc. - -syntax = "proto2"; - -package google.protobuf.compiler; -option java_package = "com.google.protobuf.compiler"; -option java_outer_classname = "PluginProtos"; - -option go_package = "google.golang.org/protobuf/types/pluginpb"; - -import "google/protobuf/descriptor.proto"; - -// The version number of protocol compiler. -message Version { - optional int32 major = 1; - optional int32 minor = 2; - optional int32 patch = 3; - // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - // be empty for mainline stable releases. - optional string suffix = 4; -} - -// An encoded CodeGeneratorRequest is written to the plugin's stdin. -message CodeGeneratorRequest { - // The .proto files that were explicitly listed on the command-line. The - // code generator should generate code only for these files. Each file's - // descriptor will be included in proto_file, below. - repeated string file_to_generate = 1; - - // The generator parameter passed on the command-line. - optional string parameter = 2; - - // FileDescriptorProtos for all files in files_to_generate and everything - // they import. The files will appear in topological order, so each file - // appears before any file that imports it. - // - // protoc guarantees that all proto_files will be written after - // the fields above, even though this is not technically guaranteed by the - // protobuf wire format. This theoretically could allow a plugin to stream - // in the FileDescriptorProtos and handle them one by one rather than read - // the entire set into memory at once. However, as of this writing, this - // is not similarly optimized on protoc's end -- it will store all fields in - // memory at once before sending them to the plugin. - // - // Type names of fields and extensions in the FileDescriptorProto are always - // fully qualified. - repeated FileDescriptorProto proto_file = 15; - - // The version number of protocol compiler. - optional Version compiler_version = 3; - -} - -// The plugin writes an encoded CodeGeneratorResponse to stdout. -message CodeGeneratorResponse { - // Error message. If non-empty, code generation failed. The plugin process - // should exit with status code zero even if it reports an error in this way. - // - // This should be used to indicate errors in .proto files which prevent the - // code generator from generating correct code. Errors which indicate a - // problem in protoc itself -- such as the input CodeGeneratorRequest being - // unparseable -- should be reported by writing a message to stderr and - // 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 - // contain "." or ".." components and must be relative, not be absolute (so, - // the file cannot lie outside the output directory). "/" must be used as - // the path separator, not "\". - // - // If the name is omitted, the content will be appended to the previous - // file. This allows the generator to break large files into small chunks, - // and allows the generated text to be streamed back to protoc so that large - // files need not reside completely in memory at one time. Note that as of - // this writing protoc does not optimize for this -- it will read the entire - // CodeGeneratorResponse before writing files to disk. - optional string name = 1; - - // If non-empty, indicates that the named file should already exist, and the - // content here is to be inserted into that file at a defined insertion - // point. This feature allows a code generator to extend the output - // produced by another code generator. The original generator may provide - // insertion points by placing special annotations in the file that look - // like: - // @@protoc_insertion_point(NAME) - // The annotation can have arbitrary text before and after it on the line, - // which allows it to be placed in a comment. NAME should be replaced with - // an identifier naming the point -- this is what other generators will use - // as the insertion_point. Code inserted at this point will be placed - // immediately above the line containing the insertion point (thus multiple - // insertions to the same point will come out in the order they were added). - // The double-@ is intended to make it unlikely that the generated code - // could contain things that look like insertion points by accident. - // - // For example, the C++ code generator places the following line in the - // .pb.h files that it generates: - // // @@protoc_insertion_point(namespace_scope) - // This line appears within the scope of the file's package namespace, but - // outside of any particular class. Another plugin can then specify the - // insertion_point "namespace_scope" to generate additional classes or - // other declarations that should be placed in this scope. - // - // Note that if the line containing the insertion point begins with - // whitespace, the same whitespace will be added to every line of the - // inserted text. This is useful for languages like Python, where - // indentation matters. In these languages, the insertion point comment - // should be indented the same amount as any inserted code will need to be - // in order to work correctly in that context. - // - // The code generator that generates the initial file and the one which - // inserts into it must both run as part of a single invocation of protoc. - // Code generators are executed in the order in which they appear on the - // command line. - // - // If |insertion_point| is present, |name| must also be present. - optional string insertion_point = 2; - - // 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/depends/protobuf/src/google/protobuf/compiler/python/generator.cc b/depends/protobuf/src/google/protobuf/compiler/python/generator.cc deleted file mode 100644 index d8d6d7492..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/generator.cc +++ /dev/null @@ -1,1393 +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: robinson@google.com (Will Robinson) -// -// This module outputs pure-Python protocol message classes that will -// largely be constructed at runtime via the metaclass in reflection.py. -// In other words, our job is basically to output a Python equivalent -// of the C++ *Descriptor objects, and fix up all circular references -// within these objects. -// -// Note that the runtime performance of protocol message classes created in -// this way is expected to be lousy. The plan is to create an alternate -// generator that outputs a Python/C extension module that lets -// performance-minded Python code leverage the fast C++ implementation -// directly. - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace python { - -namespace { -// Returns the alias we assign to the module of the given .proto filename -// when importing. See testPackageInitializationImport in -// net/proto2/python/internal/reflection_test.py -// to see why we need the alias. -std::string ModuleAlias(const std::string& filename) { - std::string module_name = ModuleName(filename); - // We can't have dots in the module name, so we replace each with _dot_. - // But that could lead to a collision between a.b and a_dot_b, so we also - // duplicate each underscore. - GlobalReplaceSubstring("_", "__", &module_name); - GlobalReplaceSubstring(".", "_dot_", &module_name); - return module_name; -} - -// Name of the class attribute where we store the Python -// descriptor.Descriptor instance for the generated class. -// Must stay consistent with the _DESCRIPTOR_KEY constant -// in proto2/public/reflection.py. -const char kDescriptorKey[] = "DESCRIPTOR"; - - -// file output by this generator. -void PrintTopBoilerplate(io::Printer* printer, const FileDescriptor* file, - bool descriptor_proto) { - // TODO(robinson): Allow parameterization of Python version? - printer->Print( - "# -*- coding: utf-8 -*-\n" - "# Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "# source: $filename$\n" - "\"\"\"Generated protocol buffer code.\"\"\"\n", - "filename", file->name()); - printer->Print( - "from google.protobuf.internal import builder as _builder\n" - "from google.protobuf import descriptor as _descriptor\n" - "from google.protobuf import descriptor_pool as " - "_descriptor_pool\n" - "from google.protobuf import symbol_database as " - "_symbol_database\n"); - - printer->Print("# @@protoc_insertion_point(imports)\n\n"); - printer->Print("_sym_db = _symbol_database.Default()\n"); - printer->Print("\n\n"); -} - -// Returns a Python literal giving the default value for a field. -// If the field specifies no explicit default value, we'll return -// the default default value for the field type (zero for numbers, -// empty string for strings, empty list for repeated fields, and -// None for non-repeated, composite fields). -// -// TODO(robinson): Unify with code from -// //compiler/cpp/internal/primitive_field.cc -// //compiler/cpp/internal/enum_field.cc -// //compiler/cpp/internal/string_field.cc -std::string StringifyDefaultValue(const FieldDescriptor& field) { - if (field.is_repeated()) { - return "[]"; - } - - switch (field.cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return StrCat(field.default_value_int32()); - case FieldDescriptor::CPPTYPE_UINT32: - return StrCat(field.default_value_uint32()); - case FieldDescriptor::CPPTYPE_INT64: - return StrCat(field.default_value_int64()); - case FieldDescriptor::CPPTYPE_UINT64: - return StrCat(field.default_value_uint64()); - case FieldDescriptor::CPPTYPE_DOUBLE: { - double value = field.default_value_double(); - if (value == std::numeric_limits::infinity()) { - // Python pre-2.6 on Windows does not parse "inf" correctly. However, - // a numeric literal that is too big for a double will become infinity. - return "1e10000"; - } else if (value == -std::numeric_limits::infinity()) { - // See above. - return "-1e10000"; - } else if (value != value) { - // infinity * 0 = nan - return "(1e10000 * 0)"; - } else { - return "float(" + SimpleDtoa(value) + ")"; - } - } - case FieldDescriptor::CPPTYPE_FLOAT: { - float value = field.default_value_float(); - if (value == std::numeric_limits::infinity()) { - // Python pre-2.6 on Windows does not parse "inf" correctly. However, - // a numeric literal that is too big for a double will become infinity. - return "1e10000"; - } else if (value == -std::numeric_limits::infinity()) { - // See above. - return "-1e10000"; - } else if (value != value) { - // infinity - infinity = nan - return "(1e10000 * 0)"; - } else { - return "float(" + SimpleFtoa(value) + ")"; - } - } - case FieldDescriptor::CPPTYPE_BOOL: - return field.default_value_bool() ? "True" : "False"; - case FieldDescriptor::CPPTYPE_ENUM: - return StrCat(field.default_value_enum()->number()); - case FieldDescriptor::CPPTYPE_STRING: - return "b\"" + CEscape(field.default_value_string()) + - (field.type() != FieldDescriptor::TYPE_STRING - ? "\"" - : "\".decode('utf-8')"); - case FieldDescriptor::CPPTYPE_MESSAGE: - return "None"; - } - // (We could add a default case above but then we wouldn't get the nice - // compiler warning when a new type is added.) - GOOGLE_LOG(FATAL) << "Not reached."; - return ""; -} - -std::string StringifySyntax(FileDescriptor::Syntax syntax) { - switch (syntax) { - case FileDescriptor::SYNTAX_PROTO2: - return "proto2"; - case FileDescriptor::SYNTAX_PROTO3: - return "proto3"; - case FileDescriptor::SYNTAX_UNKNOWN: - default: - GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports proto2 " - "and proto3 syntax."; - return ""; - } -} - -} // namespace - -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 { - // ----------------------------------------------------------------- - // parse generator options - bool cpp_generated_lib_linked = false; - - std::vector > options; - ParseGeneratorParameter(parameter, &options); - - for (int i = 0; i < options.size(); i++) { - if (options[i].first == "cpp_generated_lib_linked") { - cpp_generated_lib_linked = true; - } else if (options[i].first == "pyi_out") { - python::PyiGenerator pyi_generator; - if (!pyi_generator.Generate(file, "", context, error)) { - return false; - } - } else { - *error = "Unknown generator option: " + options[i].first; - return false; - } - } - - // 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 - // we need to, but I doubt it will be an issue. - // TODO(kenton): The proper thing to do would be to allocate any state on - // the stack and use that, so that the Generator class itself does not need - // to have any mutable members. Then it is implicitly thread-safe. - MutexLock lock(&mutex_); - file_ = file; - - std::string filename = GetFileName(file, ".py"); - pure_python_workable_ = !cpp_generated_lib_linked; - if (HasPrefixString(file->name(), "google/protobuf/")) { - pure_python_workable_ = true; - } - - FileDescriptorProto fdp; - file_->CopyTo(&fdp); - fdp.SerializeToString(&file_descriptor_serialized_); - - - std::unique_ptr output(context->Open(filename)); - GOOGLE_CHECK(output.get()); - io::Printer printer(output.get(), '$'); - printer_ = &printer; - - PrintTopBoilerplate(printer_, file_, GeneratingDescriptorProto()); - if (pure_python_workable_) { - PrintImports(); - } - PrintFileDescriptor(); - if (pure_python_workable_) { - if (GeneratingDescriptorProto()) { - printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); - printer_->Indent(); - // Create enums before message descriptors - PrintAllNestedEnumsInFile(); - PrintMessageDescriptors(); - FixForeignFieldsInDescriptors(); - printer_->Outdent(); - printer_->Print("else:\n"); - printer_->Indent(); - } - // Find the message descriptors first and then use the message - // descriptor to find enums. - printer_->Print( - "_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())\n"); - if (GeneratingDescriptorProto()) { - printer_->Outdent(); - } - } - std::string module_name = ModuleName(file->name()); - printer_->Print( - "_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, '$module_name$', " - "globals())\n", - "module_name", module_name); - if (pure_python_workable_) { - 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. - FixForeignFieldsInExtensions(); - // Descriptor options may have custom extensions. These custom options - // can only be successfully parsed after we register corresponding - // extensions. Therefore we parse all options again here to recognize - // 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(); - - // Set serialized_start and serialized_end. - SetSerializedPbInterval(); - - printer_->Outdent(); - } - if (HasGenericServices(file)) { - printer_->Print( - "_builder.BuildServices(DESCRIPTOR, '$module_name$', globals())\n", - "module_name", module_name); - } - - printer.Print("# @@protoc_insertion_point(module_scope)\n"); - - return !printer.failed(); -} - -// Prints Python imports for all modules imported by |file|. -void Generator::PrintImports() const { - for (int i = 0; i < file_->dependency_count(); ++i) { - const std::string& filename = file_->dependency(i)->name(); - - std::string module_name = ModuleName(filename); - std::string module_alias = ModuleAlias(filename); - if (ContainsPythonKeyword(module_name)) { - // If the module path contains a Python keyword, we have to quote the - // module name and import it using importlib. Otherwise the usual kind of - // import statement would result in a syntax error from the presence of - // the keyword. - printer_->Print("import importlib\n"); - printer_->Print("$alias$ = importlib.import_module('$name$')\n", "alias", - module_alias, "name", module_name); - } else { - int last_dot_pos = module_name.rfind('.'); - std::string import_statement; - if (last_dot_pos == std::string::npos) { - // NOTE(petya): this is not tested as it would require a protocol buffer - // outside of any package, and I don't think that is easily achievable. - import_statement = "import " + module_name; - } else { - import_statement = "from " + module_name.substr(0, last_dot_pos) + - " import " + module_name.substr(last_dot_pos + 1); - } - printer_->Print("$statement$ as $alias$\n", "statement", import_statement, - "alias", module_alias); - } - - CopyPublicDependenciesAliases(module_alias, file_->dependency(i)); - } - printer_->Print("\n"); - - // Print public imports. - for (int i = 0; i < file_->public_dependency_count(); ++i) { - std::string module_name = ModuleName(file_->public_dependency(i)->name()); - printer_->Print("from $module$ import *\n", "module", module_name); - } - printer_->Print("\n"); -} - -// Prints the single file descriptor for this file. -void Generator::PrintFileDescriptor() const { - std::map m; - m["descriptor_name"] = kDescriptorKey; - m["name"] = file_->name(); - m["package"] = file_->package(); - m["syntax"] = StringifySyntax(file_->syntax()); - m["options"] = OptionsValue(file_->options().SerializeAsString()); - 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("]"); - } - 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("]"); - } - } 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. - - 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"); -} - -// Prints all enums contained in all message types in |file|. -void Generator::PrintAllNestedEnumsInFile() const { - for (int i = 0; i < file_->message_type_count(); ++i) { - PrintNestedEnums(*file_->message_type(i)); - } -} - -// 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 { - std::map m; - std::string module_level_descriptor_name = - ModuleLevelDescriptorName(enum_descriptor); - m["descriptor_name"] = module_level_descriptor_name; - m["name"] = enum_descriptor.name(); - m["full_name"] = enum_descriptor.full_name(); - m["file"] = kDescriptorKey; - const char enum_descriptor_template[] = - "$descriptor_name$ = _descriptor.EnumDescriptor(\n" - " name='$name$',\n" - " 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); - printer_->Print(m, enum_descriptor_template); - printer_->Indent(); - printer_->Indent(); - - if (pure_python_workable_) { - for (int i = 0; i < enum_descriptor.value_count(); ++i) { - PrintEnumValueDescriptor(*enum_descriptor.value(i)); - printer_->Print(",\n"); - } - } - - printer_->Outdent(); - printer_->Print("],\n"); - printer_->Print("containing_type=None,\n"); - printer_->Print("serialized_options=$options_value$,\n", "options_value", - OptionsValue(options_string)); - EnumDescriptorProto edp; - printer_->Outdent(); - printer_->Print(")\n"); - if (pure_python_workable_) { - printer_->Print("_sym_db.RegisterEnumDescriptor($name$)\n", "name", - module_level_descriptor_name); - } - printer_->Print("\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 { - for (int i = 0; i < descriptor.nested_type_count(); ++i) { - PrintNestedEnums(*descriptor.nested_type(i)); - } - - for (int i = 0; i < descriptor.enum_type_count(); ++i) { - PrintEnum(*descriptor.enum_type(i)); - } -} - -// 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::PrintServiceDescriptors() const { - for (int i = 0; i < file_->service_count(); ++i) { - PrintServiceDescriptor(*file_->service(i)); - } -} - -void Generator::PrintServices() const { - for (int i = 0; i < file_->service_count(); ++i) { - PrintServiceClass(*file_->service(i)); - PrintServiceStub(*file_->service(i)); - printer_->Print("\n"); - } -} - -void Generator::PrintServiceDescriptor( - const ServiceDescriptor& descriptor) const { - std::map m; - m["service_name"] = ModuleLevelServiceDescriptorName(descriptor); - m["name"] = descriptor.name(); - m["file"] = kDescriptorKey; - 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.ServiceDescriptor(full_name='" + - descriptor.full_name() + "')"; - } - printer_->Print("$descriptor_key$ = $descriptor_name$,\n", "descriptor_key", - kDescriptorKey, "descriptor_name", name); - std::string module_name = ModuleName(file_->name()); - printer_->Print("__module__ = '$module_name$'\n", "module_name", module_name); -} - -void Generator::PrintServiceClass(const ServiceDescriptor& descriptor) const { - // Print the service. - printer_->Print( - "$class_name$ = service_reflection.GeneratedServiceType(" - "'$class_name$', (_service.Service,), dict(\n", - "class_name", descriptor.name()); - printer_->Indent(); - Generator::PrintDescriptorKeyAndModuleName(descriptor); - printer_->Print("))\n\n"); - printer_->Outdent(); -} - -void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const { - // Print the service stub. - printer_->Print( - "$class_name$_Stub = " - "service_reflection.GeneratedServiceStubType(" - "'$class_name$_Stub', ($class_name$,), dict(\n", - "class_name", descriptor.name()); - printer_->Indent(); - Generator::PrintDescriptorKeyAndModuleName(descriptor); - printer_->Print("))\n\n"); - printer_->Outdent(); -} - -// Prints statement assigning ModuleLevelDescriptorName(message_descriptor) -// to a Python Descriptor object for message_descriptor. -// -// Mutually recursive with PrintNestedDescriptors(). -void Generator::PrintDescriptor(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); - - printer_->Print("\n"); - printer_->Print("$descriptor_name$ = _descriptor.Descriptor(\n", - "descriptor_name", - ModuleLevelDescriptorName(message_descriptor)); - printer_->Indent(); - const char required_function_arguments[] = - "name='$name$',\n" - "full_name='$full_name$',\n" - "filename=None,\n" - "file=$file$,\n" - "containing_type=None,\n" - "create_key=_descriptor._internal_create_key,\n"; - printer_->Print(m, required_function_arguments); - PrintFieldsInDescriptor(message_descriptor); - PrintExtensionsInDescriptor(message_descriptor); - - // Nested types - printer_->Print("nested_types=["); - for (int i = 0; i < message_descriptor.nested_type_count(); ++i) { - const std::string nested_name = - ModuleLevelDescriptorName(*message_descriptor.nested_type(i)); - printer_->Print("$name$, ", "name", nested_name); - } - printer_->Print("],\n"); - - // Enum types - printer_->Print("enum_types=[\n"); - printer_->Indent(); - for (int i = 0; i < message_descriptor.enum_type_count(); ++i) { - const std::string descriptor_name = - ModuleLevelDescriptorName(*message_descriptor.enum_type(i)); - printer_->Print(descriptor_name.c_str()); - printer_->Print(",\n"); - } - printer_->Outdent(); - printer_->Print("],\n"); - std::string options_string; - message_descriptor.options().SerializeToString(&options_string); - printer_->Print( - "serialized_options=$options_value$,\n" - "is_extendable=$extendable$,\n" - "syntax='$syntax$'", - "options_value", OptionsValue(options_string), "extendable", - message_descriptor.extension_range_count() > 0 ? "True" : "False", - "syntax", StringifySyntax(message_descriptor.file()->syntax())); - printer_->Print(",\n"); - - // Extension ranges - printer_->Print("extension_ranges=["); - for (int i = 0; i < message_descriptor.extension_range_count(); ++i) { - const Descriptor::ExtensionRange* range = - message_descriptor.extension_range(i); - printer_->Print("($start$, $end$), ", "start", StrCat(range->start), - "end", StrCat(range->end)); - } - printer_->Print("],\n"); - printer_->Print("oneofs=[\n"); - printer_->Indent(); - for (int i = 0; i < message_descriptor.oneof_decl_count(); ++i) { - const OneofDescriptor* desc = message_descriptor.oneof_decl(i); - m.clear(); - m["name"] = desc->name(); - m["full_name"] = desc->full_name(); - m["index"] = StrCat(desc->index()); - options_string = OptionsValue(desc->options().SerializeAsString()); - if (options_string == "None") { - m["serialized_options"] = ""; - } else { - m["serialized_options"] = ", serialized_options=" + options_string; - } - printer_->Print(m, - "_descriptor.OneofDescriptor(\n" - " name='$name$', full_name='$full_name$',\n" - " index=$index$, containing_type=None,\n" - " create_key=_descriptor._internal_create_key,\n" - "fields=[]$serialized_options$),\n"); - } - printer_->Outdent(); - printer_->Print("],\n"); - - printer_->Outdent(); - printer_->Print(")\n"); -} - -// 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)); - } -} - -// Prints all messages in |file|. -void Generator::PrintMessages() const { - for (int i = 0; i < file_->message_type_count(); ++i) { - std::vector to_register; - PrintMessage(*file_->message_type(i), "", &to_register, false); - for (int j = 0; j < to_register.size(); ++j) { - printer_->Print("_sym_db.RegisterMessage($name$)\n", "name", - ResolveKeyword(to_register[j])); - } - printer_->Print("\n"); - } -} - -// Prints a Python class for the given message descriptor. We defer to the -// metaclass to do almost all of the work of actually creating a useful class. -// The purpose of this function and its many helper functions above is merely -// to output a Python version of the descriptors, which the metaclass in -// reflection.py will use to construct the meat of the class itself. -// -// Mutually recursive with PrintNestedMessages(). -// Collect nested message names to_register for the symbol_database. -void Generator::PrintMessage(const Descriptor& message_descriptor, - const std::string& prefix, - std::vector* to_register, - bool is_nested) const { - std::string qualified_name; - if (is_nested) { - if (IsPythonKeyword(message_descriptor.name())) { - qualified_name = - "getattr(" + prefix + ", '" + message_descriptor.name() + "')"; - } else { - qualified_name = prefix + "." + message_descriptor.name(); - } - printer_->Print( - "'$name$' : _reflection.GeneratedProtocolMessageType('$name$', " - "(_message.Message,), {\n", - "name", message_descriptor.name()); - } else { - qualified_name = ResolveKeyword(message_descriptor.name()); - printer_->Print( - "$qualified_name$ = _reflection.GeneratedProtocolMessageType('$name$', " - "(_message.Message,), {\n", - "qualified_name", qualified_name, "name", message_descriptor.name()); - } - printer_->Indent(); - - to_register->push_back(qualified_name); - - PrintNestedMessages(message_descriptor, qualified_name, to_register); - std::map m; - m["descriptor_key"] = kDescriptorKey; - if (pure_python_workable_) { - m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor); - } else { - 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()); - printer_->Print("'__module__' : '$module_name$'\n", "module_name", - module_name); - printer_->Print("# @@protoc_insertion_point(class_scope:$full_name$)\n", - "full_name", message_descriptor.full_name()); - printer_->Print("})\n"); - printer_->Outdent(); -} - -// Prints all nested messages within |containing_descriptor|. -// Mutually recursive with PrintMessage(). -void Generator::PrintNestedMessages( - const Descriptor& containing_descriptor, const std::string& prefix, - std::vector* to_register) const { - for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { - printer_->Print("\n"); - PrintMessage(*containing_descriptor.nested_type(i), prefix, to_register, - true); - printer_->Print(",\n"); - } -} - -// Recursively fixes foreign fields in all nested types in |descriptor|, then -// sets the message_type and enum_type of all message and enum fields to point -// to their respective descriptors. -// Args: -// descriptor: descriptor to print fields for. -// containing_descriptor: if descriptor is a nested type, this is its -// containing type, or NULL if this is a root/top-level type. -void Generator::FixForeignFieldsInDescriptor( - const Descriptor& descriptor, - const Descriptor* containing_descriptor) const { - for (int i = 0; i < descriptor.nested_type_count(); ++i) { - FixForeignFieldsInDescriptor(*descriptor.nested_type(i), &descriptor); - } - - for (int i = 0; i < descriptor.field_count(); ++i) { - const FieldDescriptor& field_descriptor = *descriptor.field(i); - FixForeignFieldsInField(&descriptor, field_descriptor, "fields_by_name"); - } - - FixContainingTypeInDescriptor(descriptor, containing_descriptor); - for (int i = 0; i < descriptor.enum_type_count(); ++i) { - const EnumDescriptor& enum_descriptor = *descriptor.enum_type(i); - FixContainingTypeInDescriptor(enum_descriptor, &descriptor); - } - for (int i = 0; i < descriptor.oneof_decl_count(); ++i) { - std::map m; - const OneofDescriptor* oneof = descriptor.oneof_decl(i); - m["descriptor_name"] = ModuleLevelDescriptorName(descriptor); - m["oneof_name"] = oneof->name(); - for (int j = 0; j < oneof->field_count(); ++j) { - m["field_name"] = oneof->field(j)->name(); - printer_->Print( - m, - "$descriptor_name$.oneofs_by_name['$oneof_name$'].fields.append(\n" - " $descriptor_name$.fields_by_name['$field_name$'])\n"); - printer_->Print( - m, - "$descriptor_name$.fields_by_name['$field_name$'].containing_oneof = " - "$descriptor_name$.oneofs_by_name['$oneof_name$']\n"); - } - } -} - -void Generator::AddMessageToFileDescriptor(const Descriptor& descriptor) const { - std::map m; - m["descriptor_name"] = kDescriptorKey; - m["message_name"] = descriptor.name(); - m["message_descriptor_name"] = ModuleLevelDescriptorName(descriptor); - const char file_descriptor_template[] = - "$descriptor_name$.message_types_by_name['$message_name$'] = " - "$message_descriptor_name$\n"; - printer_->Print(m, file_descriptor_template); -} - -void Generator::AddServiceToFileDescriptor( - const ServiceDescriptor& descriptor) const { - std::map m; - m["descriptor_name"] = kDescriptorKey; - m["service_name"] = descriptor.name(); - m["service_descriptor_name"] = ModuleLevelServiceDescriptorName(descriptor); - const char file_descriptor_template[] = - "$descriptor_name$.services_by_name['$service_name$'] = " - "$service_descriptor_name$\n"; - printer_->Print(m, file_descriptor_template); -} - -void Generator::AddEnumToFileDescriptor( - const EnumDescriptor& descriptor) const { - std::map m; - m["descriptor_name"] = kDescriptorKey; - m["enum_name"] = descriptor.name(); - m["enum_descriptor_name"] = ModuleLevelDescriptorName(descriptor); - const char file_descriptor_template[] = - "$descriptor_name$.enum_types_by_name['$enum_name$'] = " - "$enum_descriptor_name$\n"; - printer_->Print(m, file_descriptor_template); -} - -void Generator::AddExtensionToFileDescriptor( - const FieldDescriptor& descriptor) const { - std::map m; - m["descriptor_name"] = kDescriptorKey; - m["field_name"] = descriptor.name(); - m["resolved_name"] = ResolveKeyword(descriptor.name()); - const char file_descriptor_template[] = - "$descriptor_name$.extensions_by_name['$field_name$'] = " - "$resolved_name$\n"; - printer_->Print(m, file_descriptor_template); -} - -// Sets any necessary message_type and enum_type attributes -// for the Python version of |field|. -// -// containing_type may be NULL, in which case this is a module-level field. -// -// python_dict_name is the name of the Python dict where we should -// look the field up in the containing type. (e.g., fields_by_name -// or extensions_by_name). We ignore python_dict_name if containing_type -// is NULL. -void Generator::FixForeignFieldsInField( - const Descriptor* containing_type, const FieldDescriptor& field, - const std::string& python_dict_name) const { - const std::string field_referencing_expression = - FieldReferencingExpression(containing_type, field, python_dict_name); - std::map m; - m["field_ref"] = field_referencing_expression; - const Descriptor* foreign_message_type = field.message_type(); - if (foreign_message_type) { - m["foreign_type"] = ModuleLevelDescriptorName(*foreign_message_type); - printer_->Print(m, "$field_ref$.message_type = $foreign_type$\n"); - } - const EnumDescriptor* enum_type = field.enum_type(); - if (enum_type) { - m["enum_type"] = ModuleLevelDescriptorName(*enum_type); - printer_->Print(m, "$field_ref$.enum_type = $enum_type$\n"); - } -} - -// Returns the module-level expression for the given FieldDescriptor. -// Only works for fields in the .proto file this Generator is generating for. -// -// containing_type may be NULL, in which case this is a module-level field. -// -// python_dict_name is the name of the Python dict where we should -// look the field up in the containing type. (e.g., fields_by_name -// or extensions_by_name). We ignore python_dict_name if containing_type -// is NULL. -std::string Generator::FieldReferencingExpression( - const Descriptor* containing_type, const FieldDescriptor& field, - const std::string& python_dict_name) const { - // We should only ever be looking up fields in the current file. - // The only things we refer to from other files are message descriptors. - GOOGLE_CHECK_EQ(field.file(), file_) - << field.file()->name() << " vs. " << file_->name(); - if (!containing_type) { - return ResolveKeyword(field.name()); - } - return strings::Substitute("$0.$1['$2']", - ModuleLevelDescriptorName(*containing_type), - python_dict_name, field.name()); -} - -// Prints containing_type for nested descriptors or enum descriptors. -template -void Generator::FixContainingTypeInDescriptor( - const DescriptorT& descriptor, - const Descriptor* containing_descriptor) const { - if (containing_descriptor != nullptr) { - const std::string nested_name = ModuleLevelDescriptorName(descriptor); - const std::string parent_name = - ModuleLevelDescriptorName(*containing_descriptor); - printer_->Print("$nested_name$.containing_type = $parent_name$\n", - "nested_name", nested_name, "parent_name", parent_name); - } -} - -// Prints statements setting the message_type and enum_type fields in the -// 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 { - for (int i = 0; i < file_->message_type_count(); ++i) { - FixForeignFieldsInDescriptor(*file_->message_type(i), nullptr); - } - for (int i = 0; i < file_->message_type_count(); ++i) { - AddMessageToFileDescriptor(*file_->message_type(i)); - } - for (int i = 0; i < file_->enum_type_count(); ++i) { - AddEnumToFileDescriptor(*file_->enum_type(i)); - } - for (int i = 0; i < file_->extension_count(); ++i) { - AddExtensionToFileDescriptor(*file_->extension(i)); - } - - // TODO(jieluo): Move this register to PrintFileDescriptor() when - // FieldDescriptor.file is added in generated file. - printer_->Print("_sym_db.RegisterFileDescriptor($name$)\n", "name", - kDescriptorKey); - printer_->Print("\n"); -} - -// We need to not only set any necessary message_type fields, but -// also need to call RegisterExtension() on each message we're -// extending. -void Generator::FixForeignFieldsInExtensions() const { - // Top-level extensions. - for (int i = 0; i < file_->extension_count(); ++i) { - FixForeignFieldsInExtension(*file_->extension(i)); - } - // Nested extensions. - for (int i = 0; i < file_->message_type_count(); ++i) { - FixForeignFieldsInNestedExtensions(*file_->message_type(i)); - } - printer_->Print("\n"); -} - -void Generator::FixForeignFieldsInExtension( - const FieldDescriptor& extension_field) const { - GOOGLE_CHECK(extension_field.is_extension()); - - std::map m; - // Confusingly, for FieldDescriptors that happen to be extensions, - // containing_type() means "extended type." - // On the other hand, extension_scope() will give us what we normally - // mean by containing_type(). - m["extended_message_class"] = - ModuleLevelMessageName(*extension_field.containing_type()); - m["field"] = FieldReferencingExpression( - extension_field.extension_scope(), extension_field, "extensions_by_name"); - printer_->Print(m, "$extended_message_class$.RegisterExtension($field$)\n"); -} - -void Generator::FixForeignFieldsInNestedExtensions( - const Descriptor& descriptor) const { - // Recursively fix up extensions in all nested types. - for (int i = 0; i < descriptor.nested_type_count(); ++i) { - FixForeignFieldsInNestedExtensions(*descriptor.nested_type(i)); - } - // Fix up extensions directly contained within this type. - for (int i = 0; i < descriptor.extension_count(); ++i) { - FixForeignFieldsInExtension(*descriptor.extension(i)); - } -} - -// Returns a Python expression that instantiates a Python EnumValueDescriptor -// object for the given C++ descriptor. -void Generator::PrintEnumValueDescriptor( - const EnumValueDescriptor& descriptor) const { - // TODO(robinson): Fix up EnumValueDescriptor "type" fields. - // More circular references. ::sigh:: - std::string options_string; - descriptor.options().SerializeToString(&options_string); - std::map m; - m["name"] = descriptor.name(); - m["index"] = StrCat(descriptor.index()); - m["number"] = StrCat(descriptor.number()); - m["options"] = OptionsValue(options_string); - printer_->Print(m, - "_descriptor.EnumValueDescriptor(\n" - " name='$name$', index=$index$, number=$number$,\n" - " serialized_options=$options$,\n" - " type=None,\n" - " create_key=_descriptor._internal_create_key)"); -} - -// Returns a CEscaped string of serialized_options. -std::string Generator::OptionsValue( - const std::string& serialized_options) const { - if (serialized_options.length() == 0 || GeneratingDescriptorProto()) { - return "None"; - } else { - return "b'" + CEscape(serialized_options) + "'"; - } -} - -// Prints an expression for a Python FieldDescriptor for |field|. -void Generator::PrintFieldDescriptor(const FieldDescriptor& field, - bool is_extension) const { - std::string options_string; - field.options().SerializeToString(&options_string); - std::map m; - m["name"] = field.name(); - m["full_name"] = field.full_name(); - m["index"] = StrCat(field.index()); - m["number"] = StrCat(field.number()); - m["type"] = StrCat(field.type()); - m["cpp_type"] = StrCat(field.cpp_type()); - m["label"] = StrCat(field.label()); - m["has_default_value"] = field.has_default_value() ? "True" : "False"; - m["default_value"] = StringifyDefaultValue(field); - m["is_extension"] = is_extension ? "True" : "False"; - m["serialized_options"] = OptionsValue(options_string); - m["json_name"] = - field.has_json_name() ? ", json_name='" + field.json_name() + "'" : ""; - // We always set message_type and enum_type to None at this point, and then - // these fields in correctly after all referenced descriptors have been - // defined and/or imported (see FixForeignFieldsInDescriptors()). - const char field_descriptor_decl[] = - "_descriptor.FieldDescriptor(\n" - " name='$name$', full_name='$full_name$', index=$index$,\n" - " number=$number$, type=$type$, cpp_type=$cpp_type$, label=$label$,\n" - " has_default_value=$has_default_value$, " - "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," - " create_key=_descriptor._internal_create_key)"; - printer_->Print(m, field_descriptor_decl); -} - -// Helper for Print{Fields,Extensions}InDescriptor(). -void Generator::PrintFieldDescriptorsInDescriptor( - const Descriptor& message_descriptor, bool is_extension, - const std::string& list_variable_name, int (Descriptor::*CountFn)() const, - const FieldDescriptor* (Descriptor::*GetterFn)(int)const) const { - printer_->Print("$list$=[\n", "list", list_variable_name); - printer_->Indent(); - for (int i = 0; i < (message_descriptor.*CountFn)(); ++i) { - PrintFieldDescriptor(*(message_descriptor.*GetterFn)(i), is_extension); - printer_->Print(",\n"); - } - printer_->Outdent(); - printer_->Print("],\n"); -} - -// Prints a statement assigning "fields" to a list of Python FieldDescriptors, -// one for each field present in message_descriptor. -void Generator::PrintFieldsInDescriptor( - const Descriptor& message_descriptor) const { - const bool is_extension = false; - PrintFieldDescriptorsInDescriptor(message_descriptor, is_extension, "fields", - &Descriptor::field_count, - &Descriptor::field); -} - -// Prints a statement assigning "extensions" to a list of Python -// FieldDescriptors, one for each extension present in message_descriptor. -void Generator::PrintExtensionsInDescriptor( - const Descriptor& message_descriptor) const { - const bool is_extension = true; - PrintFieldDescriptorsInDescriptor(message_descriptor, is_extension, - "extensions", &Descriptor::extension_count, - &Descriptor::extension); -} - -bool Generator::GeneratingDescriptorProto() const { - return file_->name() == "net/proto2/proto/descriptor.proto" || - file_->name() == "google/protobuf/descriptor.proto"; -} - -// Returns the unique Python module-level identifier given to a descriptor. -// This name is module-qualified iff the given descriptor describes an -// entity that doesn't come from the current file. -template -std::string Generator::ModuleLevelDescriptorName( - const DescriptorT& descriptor) const { - // FIXME(robinson): - // We currently don't worry about collisions with underscores in the type - // names, so these would collide in nasty ways if found in the same file: - // OuterProto.ProtoA.ProtoB - // OuterProto_ProtoA.ProtoB # Underscore instead of period. - // As would these: - // OuterProto.ProtoA_.ProtoB - // OuterProto.ProtoA._ProtoB # Leading vs. trailing underscore. - // (Contrived, but certainly possible). - // - // The C++ implementation doesn't guard against this either. Leaving - // it for now... - std::string name = NamePrefixedWithNestedTypes(descriptor, "_"); - ToUpper(&name); - // Module-private for now. Easy to make public later; almost impossible - // to make private later. - name = "_" + name; - // We now have the name relative to its own module. Also qualify with - // the module name iff this descriptor is from a different .proto file. - if (descriptor.file() != file_) { - name = ModuleAlias(descriptor.file()->name()) + "." + name; - } - return name; -} - -// Returns the name of the message class itself, not the descriptor. -// Like ModuleLevelDescriptorName(), module-qualifies the name iff -// the given descriptor describes an entity that doesn't come from -// the current file. -std::string Generator::ModuleLevelMessageName( - const Descriptor& descriptor) const { - std::string name = NamePrefixedWithNestedTypes(descriptor, "."); - if (descriptor.file() != file_) { - name = ModuleAlias(descriptor.file()->name()) + "." + name; - } - return name; -} - -// Returns the unique Python module-level identifier given to a service -// descriptor. -std::string Generator::ModuleLevelServiceDescriptorName( - const ServiceDescriptor& descriptor) const { - std::string name = descriptor.name(); - ToUpper(&name); - name = "_" + name; - if (descriptor.file() != file_) { - name = ModuleAlias(descriptor.file()->name()) + "." + name; - } - return name; -} - -// Prints standard constructor arguments serialized_start and serialized_end. -// Args: -// descriptor: The cpp descriptor to have a serialized reference. -// proto: A proto -// Example printer output: -// serialized_start=41, -// serialized_end=43, -// -template -void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, - DescriptorProtoT& proto, - const std::string& name) const { - descriptor.CopyTo(&proto); - std::string sp; - proto.SerializeToString(&sp); - int offset = file_descriptor_serialized_.find(sp); - GOOGLE_CHECK_GE(offset, 0); - - printer_->Print( - "$name$._serialized_start=$serialized_start$\n" - "$name$._serialized_end=$serialized_end$\n", - "name", name, "serialized_start", StrCat(offset), "serialized_end", - StrCat(offset + sp.size())); -} - -namespace { -void PrintDescriptorOptionsFixingCode(const std::string& descriptor, - const std::string& options, - 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$._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) { - const EnumDescriptor& enum_descriptor = *file_->enum_type(i); - FixOptionsForEnum(enum_descriptor); - } - // Prints expressions that set the options for all top level extensions. - for (int i = 0; i < file_->extension_count(); ++i) { - const FieldDescriptor& field = *file_->extension(i); - FixOptionsForField(field); - } - // Prints expressions that set the options for all messages, nested enums, - // nested extensions and message fields. - 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 { - std::string oneof_options = OptionsValue(oneof.options().SerializeAsString()); - if (oneof_options != "None") { - std::string oneof_name = strings::Substitute( - "$0.$1['$2']", ModuleLevelDescriptorName(*oneof.containing_type()), - "oneofs_by_name", oneof.name()); - PrintDescriptorOptionsFixingCode(oneof_name, oneof_options, printer_); - } -} - -// Prints expressions that set the options for an enum descriptor and its -// value descriptors. -void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const { - std::string descriptor_name = ModuleLevelDescriptorName(enum_descriptor); - std::string enum_options = - OptionsValue(enum_descriptor.options().SerializeAsString()); - if (enum_options != "None") { - PrintDescriptorOptionsFixingCode(descriptor_name, enum_options, printer_); - } - for (int i = 0; i < enum_descriptor.value_count(); ++i) { - const EnumValueDescriptor& value_descriptor = *enum_descriptor.value(i); - std::string value_options = - OptionsValue(value_descriptor.options().SerializeAsString()); - if (value_options != "None") { - PrintDescriptorOptionsFixingCode( - StringPrintf("%s.values_by_name[\"%s\"]", descriptor_name.c_str(), - value_descriptor.name().c_str()), - value_options, printer_); - } - } -} - -// 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 { - std::string field_options = OptionsValue(field.options().SerializeAsString()); - if (field_options != "None") { - std::string field_name; - if (field.is_extension()) { - if (field.extension_scope() == nullptr) { - // Top level extensions. - field_name = field.name(); - } else { - field_name = FieldReferencingExpression(field.extension_scope(), field, - "extensions_by_name"); - } - } else { - field_name = FieldReferencingExpression(field.containing_type(), field, - "fields_by_name"); - } - PrintDescriptorOptionsFixingCode(field_name, field_options, printer_); - } -} - -// Prints expressions that set the options for a message and all its inner -// types (nested messages, nested enums, extensions, fields). -void Generator::FixOptionsForMessage(const Descriptor& descriptor) const { - // Nested messages. - for (int i = 0; i < descriptor.nested_type_count(); ++i) { - FixOptionsForMessage(*descriptor.nested_type(i)); - } - // Oneofs. - for (int i = 0; i < descriptor.oneof_decl_count(); ++i) { - FixOptionsForOneof(*descriptor.oneof_decl(i)); - } - // Enums. - for (int i = 0; i < descriptor.enum_type_count(); ++i) { - FixOptionsForEnum(*descriptor.enum_type(i)); - } - // Fields. - for (int i = 0; i < descriptor.field_count(); ++i) { - const FieldDescriptor& field = *descriptor.field(i); - FixOptionsForField(field); - } - // Extensions. - for (int i = 0; i < descriptor.extension_count(); ++i) { - const FieldDescriptor& field = *descriptor.extension(i); - FixOptionsForField(field); - } - // Message option for this message. - std::string message_options = - OptionsValue(descriptor.options().SerializeAsString()); - if (message_options != "None") { - std::string descriptor_name = ModuleLevelDescriptorName(descriptor); - PrintDescriptorOptionsFixingCode(descriptor_name, message_options, - printer_); - } -} - -// If a dependency forwards other files through public dependencies, let's -// copy over the corresponding module aliases. -void Generator::CopyPublicDependenciesAliases( - const std::string& copy_from, const FileDescriptor* file) const { - for (int i = 0; i < file->public_dependency_count(); ++i) { - std::string module_name = ModuleName(file->public_dependency(i)->name()); - std::string module_alias = ModuleAlias(file->public_dependency(i)->name()); - // There's no module alias in the dependent file if it was generated by - // an old protoc (less than 3.0.0-alpha-1). Use module name in this - // situation. - printer_->Print( - "try:\n" - " $alias$ = $copy_from$.$alias$\n" - "except AttributeError:\n" - " $alias$ = $copy_from$.$module$\n", - "alias", module_alias, "module", module_name, "copy_from", copy_from); - CopyPublicDependenciesAliases(copy_from, file->public_dependency(i)); - } -} - -} // namespace python -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/python/generator.h b/depends/protobuf/src/google/protobuf/compiler/python/generator.h deleted file mode 100644 index f1fecbc73..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/generator.h +++ /dev/null @@ -1,185 +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: robinson@google.com (Will Robinson) -// -// Generates Python code for a given .proto file. - -#ifndef GOOGLE_PROTOBUF_COMPILER_PYTHON_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_PYTHON_GENERATOR_H__ - -#include - -#include -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { - -class Descriptor; -class EnumDescriptor; -class EnumValueDescriptor; -class FieldDescriptor; -class OneofDescriptor; -class ServiceDescriptor; - -namespace io { -class Printer; -} - -namespace compiler { -namespace python { - -// 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 -// CodeGenerator with the CommandLineInterface in your main() function. -class PROTOC_EXPORT Generator : public CodeGenerator { - public: - Generator(); - ~Generator() override; - - // CodeGenerator methods. - 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 PrintAllNestedEnumsInFile() const; - void PrintNestedEnums(const Descriptor& descriptor) const; - void PrintEnum(const EnumDescriptor& enum_descriptor) const; - - void PrintFieldDescriptor(const FieldDescriptor& field, - bool is_extension) const; - void PrintFieldDescriptorsInDescriptor( - const Descriptor& message_descriptor, bool is_extension, - const std::string& list_variable_name, int (Descriptor::*CountFn)() const, - 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 PrintMessages() const; - void PrintMessage(const Descriptor& message_descriptor, - const std::string& prefix, - std::vector* to_register, - bool is_nested) const; - void PrintNestedMessages(const Descriptor& containing_descriptor, - const std::string& prefix, - std::vector* to_register) const; - - void FixForeignFieldsInDescriptors() const; - void FixForeignFieldsInDescriptor( - const Descriptor& descriptor, - const Descriptor* containing_descriptor) const; - void FixForeignFieldsInField(const Descriptor* containing_type, - const FieldDescriptor& field, - const std::string& python_dict_name) const; - void AddMessageToFileDescriptor(const Descriptor& descriptor) const; - void AddEnumToFileDescriptor(const EnumDescriptor& descriptor) const; - void AddExtensionToFileDescriptor(const FieldDescriptor& descriptor) const; - void AddServiceToFileDescriptor(const ServiceDescriptor& descriptor) const; - std::string FieldReferencingExpression( - const Descriptor* containing_type, const FieldDescriptor& field, - const std::string& python_dict_name) const; - template - void FixContainingTypeInDescriptor( - const DescriptorT& descriptor, - const Descriptor* containing_descriptor) const; - - void FixForeignFieldsInExtensions() const; - void FixForeignFieldsInExtension( - const FieldDescriptor& extension_field) const; - void FixForeignFieldsInNestedExtensions(const Descriptor& descriptor) const; - - void PrintServices() const; - void PrintServiceDescriptors() const; - void PrintServiceDescriptor(const ServiceDescriptor& descriptor) const; - void PrintServiceClass(const ServiceDescriptor& descriptor) const; - void PrintServiceStub(const ServiceDescriptor& descriptor) const; - void PrintDescriptorKeyAndModuleName( - const ServiceDescriptor& descriptor) const; - - void PrintEnumValueDescriptor(const EnumValueDescriptor& descriptor) const; - std::string OptionsValue(const std::string& serialized_options) const; - bool GeneratingDescriptorProto() const; - - template - std::string ModuleLevelDescriptorName(const DescriptorT& descriptor) const; - std::string ModuleLevelMessageName(const Descriptor& descriptor) const; - std::string ModuleLevelServiceDescriptorName( - const ServiceDescriptor& descriptor) const; - - template - void PrintSerializedPbInterval(const DescriptorT& descriptor, - 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; - - // Very coarse-grained lock to ensure that Generate() is reentrant. - // Guards file_, printer_ and file_descriptor_serialized_. - mutable Mutex mutex_; - mutable const FileDescriptor* file_; // Set in Generate(). Under mutex_. - mutable std::string file_descriptor_serialized_; - mutable io::Printer* printer_; // Set in Generate(). Under mutex_. - mutable bool pure_python_workable_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Generator); -}; - -} // namespace python -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_PYTHON_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/python/helpers.cc b/depends/protobuf/src/google/protobuf/compiler/python/helpers.cc deleted file mode 100644 index e4d3c1385..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/helpers.cc +++ /dev/null @@ -1,131 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace python { - -// Returns the Python module name expected for a given .proto filename. -std::string ModuleName(const std::string& filename) { - std::string basename = StripProto(filename); - ReplaceCharacters(&basename, "-", '_'); - ReplaceCharacters(&basename, "/", '.'); - return basename + "_pb2"; -} - -std::string StrippedModuleName(const std::string& filename) { - std::string module_name = ModuleName(filename); - return module_name; -} - -// Keywords reserved by the Python language. -const char* const kKeywords[] = { - "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", -}; -const char* const* kKeywordsEnd = - kKeywords + (sizeof(kKeywords) / sizeof(kKeywords[0])); - -bool ContainsPythonKeyword(const std::string& module_name) { - std::vector tokens = Split(module_name, "."); - for (int i = 0; i < static_cast(tokens.size()); ++i) { - if (std::find(kKeywords, kKeywordsEnd, tokens[i]) != kKeywordsEnd) { - return true; - } - } - return false; -} - -bool IsPythonKeyword(const std::string& name) { - return (std::find(kKeywords, kKeywordsEnd, name) != kKeywordsEnd); -} - -std::string ResolveKeyword(const std::string& name) { - if (IsPythonKeyword(name)) { - return "globals()['" + name + "']"; - } - return name; -} - -std::string GetFileName(const FileDescriptor* file_des, - const std::string& suffix) { - std::string module_name = ModuleName(file_des->name()); - std::string filename = module_name; - ReplaceCharacters(&filename, ".", '/'); - filename += suffix; - return filename; -} - -bool HasGenericServices(const FileDescriptor* file) { - return file->service_count() > 0 && file->options().py_generic_services(); -} - -template -std::string NamePrefixedWithNestedTypes(const DescriptorT& descriptor, - const std::string& separator) { - std::string name = descriptor.name(); - const Descriptor* parent = descriptor.containing_type(); - if (parent != nullptr) { - std::string prefix = NamePrefixedWithNestedTypes(*parent, separator); - if (separator == "." && IsPythonKeyword(name)) { - return "getattr(" + prefix + ", '" + name + "')"; - } else { - return prefix + separator + name; - } - } - if (separator == ".") { - name = ResolveKeyword(name); - } - return name; -} - -template std::string NamePrefixedWithNestedTypes( - const Descriptor& descriptor, const std::string& separator); -template std::string NamePrefixedWithNestedTypes( - const EnumDescriptor& descriptor, const std::string& separator); - -} // namespace python -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/python/helpers.h b/depends/protobuf/src/google/protobuf/compiler/python/helpers.h deleted file mode 100644 index a68ceb196..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/helpers.h +++ /dev/null @@ -1,62 +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_COMPILER_PYTHON_HELPERS_H__ -#define GOOGLE_PROTOBUF_COMPILER_PYTHON_HELPERS_H__ - -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace python { - - -std::string ModuleName(const std::string& filename); -std::string StrippedModuleName(const std::string& filename); -bool ContainsPythonKeyword(const std::string& module_name); -bool IsPythonKeyword(const std::string& name); -std::string ResolveKeyword(const std::string& name); -std::string GetFileName(const FileDescriptor* file_des, - const std::string& suffix); -bool HasGenericServices(const FileDescriptor* file); - -template -std::string NamePrefixedWithNestedTypes(const DescriptorT& descriptor, - const std::string& separator); - -} // namespace python -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_PYTHON_HELPERS_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc b/depends/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc deleted file mode 100644 index 1ccc9a219..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc +++ /dev/null @@ -1,636 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace python { - -template -struct SortByName { - bool operator()(const DescriptorT* l, const DescriptorT* r) const { - return l->name() < r->name(); - } -}; - -PyiGenerator::PyiGenerator() : file_(nullptr) {} - -PyiGenerator::~PyiGenerator() {} - -void PyiGenerator::PrintItemMap( - const std::map& item_map) const { - for (const auto& entry : item_map) { - printer_->Print("$key$: $value$\n", "key", entry.first, "value", - entry.second); - } -} - -template -std::string PyiGenerator::ModuleLevelName( - const DescriptorT& descriptor, - const std::map& import_map) const { - std::string name = NamePrefixedWithNestedTypes(descriptor, "."); - if (descriptor.file() != file_) { - std::string module_alias; - std::string filename = descriptor.file()->name(); - if (import_map.find(filename) == import_map.end()) { - std::string module_name = ModuleName(descriptor.file()->name()); - std::vector tokens = Split(module_name, "."); - module_alias = "_" + tokens.back(); - } else { - module_alias = import_map.at(filename); - } - name = module_alias + "." + name; - } - return name; -} - -struct ImportModules { - bool has_repeated = false; // _containers - bool has_iterable = false; // typing.Iterable - bool has_messages = false; // _message - bool has_enums = false; // _enum_type_wrapper - bool has_extendable = false; // _python_message - bool has_mapping = false; // typing.Mapping - bool has_optional = false; // typing.Optional - bool has_union = false; // typing.Union - bool has_well_known_type = false; -}; - -// Checks whether a descriptor name matches a well-known type. -bool IsWellKnownType(const std::string& name) { - // LINT.IfChange(wktbases) - return (name == "google.protobuf.Any" || - name == "google.protobuf.Duration" || - name == "google.protobuf.FieldMask" || - name == "google.protobuf.ListValue" || - name == "google.protobuf.Struct" || - name == "google.protobuf.Timestamp"); - // LINT.ThenChange(//depot/google3/net/proto2/python/internal/well_known_types.py:wktbases) -} - -// Checks what modules should be imported for this message -// descriptor. -void CheckImportModules(const Descriptor* descriptor, - ImportModules* import_modules) { - if (descriptor->extension_range_count() > 0) { - import_modules->has_extendable = true; - } - if (descriptor->enum_type_count() > 0) { - import_modules->has_enums = true; - } - if (IsWellKnownType(descriptor->full_name())) { - import_modules->has_well_known_type = true; - } - for (int i = 0; i < descriptor->field_count(); ++i) { - const FieldDescriptor* field = descriptor->field(i); - if (IsPythonKeyword(field->name())) { - continue; - } - import_modules->has_optional = true; - if (field->is_repeated()) { - import_modules->has_repeated = true; - } - if (field->is_map()) { - import_modules->has_mapping = true; - const FieldDescriptor* value_des = field->message_type()->field(1); - if (value_des->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || - value_des->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - import_modules->has_union = true; - } - } else { - if (field->is_repeated()) { - import_modules->has_iterable = true; - } - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - import_modules->has_union = true; - import_modules->has_mapping = true; - } - if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - import_modules->has_union = true; - } - } - } - for (int i = 0; i < descriptor->nested_type_count(); ++i) { - CheckImportModules(descriptor->nested_type(i), import_modules); - } -} - -void PyiGenerator::PrintImportForDescriptor( - const FileDescriptor& desc, - std::map* import_map, - std::set* seen_aliases) const { - const std::string& filename = desc.name(); - std::string module_name = StrippedModuleName(filename); - size_t last_dot_pos = module_name.rfind('.'); - std::string import_statement; - if (last_dot_pos == std::string::npos) { - import_statement = "import " + module_name; - } else { - import_statement = "from " + module_name.substr(0, last_dot_pos) + - " import " + module_name.substr(last_dot_pos + 1); - module_name = module_name.substr(last_dot_pos + 1); - } - std::string alias = "_" + module_name; - // Generate a unique alias by adding _1 suffixes until we get an unused alias. - while (seen_aliases->find(alias) != seen_aliases->end()) { - alias = alias + "_1"; - } - printer_->Print("$statement$ as $alias$\n", "statement", - import_statement, "alias", alias); - (*import_map)[filename] = alias; - seen_aliases->insert(alias); -} - -void PyiGenerator::PrintImports( - std::map* item_map, - std::map* import_map) const { - // Prints imported dependent _pb2 files. - std::set seen_aliases; - for (int i = 0; i < file_->dependency_count(); ++i) { - const FileDescriptor* dep = file_->dependency(i); - PrintImportForDescriptor(*dep, import_map, &seen_aliases); - for (int j = 0; j < dep->public_dependency_count(); ++j) { - PrintImportForDescriptor( - *dep->public_dependency(j), import_map, &seen_aliases); - } - } - - // Checks what modules should be imported. - ImportModules import_modules; - if (file_->message_type_count() > 0) { - import_modules.has_messages = true; - } - if (file_->enum_type_count() > 0) { - import_modules.has_enums = true; - } - for (int i = 0; i < file_->message_type_count(); i++) { - CheckImportModules(file_->message_type(i), &import_modules); - } - - // Prints modules (e.g. _containers, _messages, typing) that are - // required in the proto file. - if (import_modules.has_repeated) { - printer_->Print( - "from google.protobuf.internal import containers as " - "_containers\n"); - } - if (import_modules.has_enums) { - printer_->Print( - "from google.protobuf.internal import enum_type_wrapper" - " as _enum_type_wrapper\n"); - } - if (import_modules.has_extendable) { - printer_->Print( - "from google.protobuf.internal import python_message" - " as _python_message\n"); - } - if (import_modules.has_well_known_type) { - printer_->Print( - "from google.protobuf.internal import well_known_types" - " as _well_known_types\n"); - } - printer_->Print( - "from google.protobuf import" - " descriptor as _descriptor\n"); - if (import_modules.has_messages) { - printer_->Print( - "from google.protobuf import message as _message\n"); - } - if (HasGenericServices(file_)) { - printer_->Print( - "from google.protobuf import service as" - " _service\n"); - } - printer_->Print("from typing import "); - printer_->Print("ClassVar as _ClassVar"); - if (import_modules.has_iterable) { - printer_->Print(", Iterable as _Iterable"); - } - if (import_modules.has_mapping) { - printer_->Print(", Mapping as _Mapping"); - } - if (import_modules.has_optional) { - printer_->Print(", Optional as _Optional"); - } - if (import_modules.has_union) { - printer_->Print(", Union as _Union"); - } - printer_->Print("\n\n"); - - // Public imports - for (int i = 0; i < file_->public_dependency_count(); ++i) { - const FileDescriptor* public_dep = file_->public_dependency(i); - std::string module_name = StrippedModuleName(public_dep->name()); - // Top level messages in public imports - for (int i = 0; i < public_dep->message_type_count(); ++i) { - printer_->Print("from $module$ import $message_class$\n", "module", - module_name, "message_class", - public_dep->message_type(i)->name()); - } - // Top level enums for public imports - for (int i = 0; i < public_dep->enum_type_count(); ++i) { - printer_->Print("from $module$ import $enum_class$\n", "module", - module_name, "enum_class", - public_dep->enum_type(i)->name()); - } - // Enum values for public imports - for (int i = 0; i < public_dep->enum_type_count(); ++i) { - const EnumDescriptor* enum_descriptor = public_dep->enum_type(i); - for (int j = 0; j < enum_descriptor->value_count(); ++j) { - (*item_map)[enum_descriptor->value(j)->name()] = - ModuleLevelName(*enum_descriptor, *import_map); - } - } - // Top level extensions for public imports - AddExtensions(*public_dep, item_map); - } -} - -void PyiGenerator::PrintEnum(const EnumDescriptor& enum_descriptor) const { - std::string enum_name = enum_descriptor.name(); - printer_->Print( - "class $enum_name$(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):\n" - " __slots__ = []\n", - "enum_name", enum_name); -} - -// Adds enum value to item map which will be ordered and printed later. -void PyiGenerator::AddEnumValue( - const EnumDescriptor& enum_descriptor, - std::map* item_map, - const std::map& import_map) const { - // enum values - std::string module_enum_name = ModuleLevelName(enum_descriptor, import_map); - for (int j = 0; j < enum_descriptor.value_count(); ++j) { - const EnumValueDescriptor* value_descriptor = enum_descriptor.value(j); - (*item_map)[value_descriptor->name()] = module_enum_name; - } -} - -// Prints top level enums -void PyiGenerator::PrintTopLevelEnums() const { - for (int i = 0; i < file_->enum_type_count(); ++i) { - printer_->Print("\n"); - PrintEnum(*file_->enum_type(i)); - } -} - -// Add top level extensions to item_map which will be ordered and -// printed later. -template -void PyiGenerator::AddExtensions( - const DescriptorT& descriptor, - std::map* item_map) const { - for (int i = 0; i < descriptor.extension_count(); ++i) { - const FieldDescriptor* extension_field = descriptor.extension(i); - std::string constant_name = extension_field->name() + "_FIELD_NUMBER"; - ToUpper(&constant_name); - (*item_map)[constant_name] = "_ClassVar[int]"; - (*item_map)[extension_field->name()] = "_descriptor.FieldDescriptor"; - } -} - -// Returns the string format of a field's cpp_type -std::string PyiGenerator::GetFieldType( - const FieldDescriptor& field_des, const Descriptor& containing_des, - const std::map& import_map) const { - switch (field_des.cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_UINT32: - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT64: - return "int"; - case FieldDescriptor::CPPTYPE_DOUBLE: - case FieldDescriptor::CPPTYPE_FLOAT: - return "float"; - case FieldDescriptor::CPPTYPE_BOOL: - return "bool"; - case FieldDescriptor::CPPTYPE_ENUM: - return ModuleLevelName(*field_des.enum_type(), import_map); - case FieldDescriptor::CPPTYPE_STRING: - if (field_des.type() == FieldDescriptor::TYPE_STRING) { - return "str"; - } else { - return "bytes"; - } - case FieldDescriptor::CPPTYPE_MESSAGE: { - // If the field is inside a nested message and the nested message has the - // same name as a top-level message, then we need to prefix the field type - // with the module name for disambiguation. - std::string name = ModuleLevelName(*field_des.message_type(), import_map); - if ((containing_des.containing_type() != nullptr && - name == containing_des.name())) { - std::string module = ModuleName(field_des.file()->name()); - name = module + "." + name; - } - return name; - } - default: - GOOGLE_LOG(FATAL) << "Unsupported field type."; - } - return ""; -} - -void PyiGenerator::PrintMessage( - const Descriptor& message_descriptor, bool is_nested, - const std::map& import_map) const { - if (!is_nested) { - printer_->Print("\n"); - } - std::string class_name = message_descriptor.name(); - std::string extra_base; - // A well-known type needs to inherit from its corresponding base class in - // net/proto2/python/internal/well_known_types. - if (IsWellKnownType(message_descriptor.full_name())) { - extra_base = ", _well_known_types." + message_descriptor.name(); - } else { - extra_base = ""; - } - printer_->Print("class $class_name$(_message.Message$extra_base$):\n", - "class_name", class_name, "extra_base", extra_base); - printer_->Indent(); - printer_->Indent(); - - std::vector fields; - fields.reserve(message_descriptor.field_count()); - for (int i = 0; i < message_descriptor.field_count(); ++i) { - fields.push_back(message_descriptor.field(i)); - } - std::sort(fields.begin(), fields.end(), SortByName()); - - // Prints slots - printer_->Print("__slots__ = [", "class_name", class_name); - bool first_item = true; - for (const auto& field_des : fields) { - if (IsPythonKeyword(field_des->name())) { - continue; - } - if (first_item) { - first_item = false; - } else { - printer_->Print(", "); - } - printer_->Print("\"$field_name$\"", "field_name", field_des->name()); - } - printer_->Print("]\n"); - - std::map item_map; - // Prints Extensions for extendable messages - if (message_descriptor.extension_range_count() > 0) { - item_map["Extensions"] = "_python_message._ExtensionDict"; - } - - // Prints nested enums - std::vector nested_enums; - nested_enums.reserve(message_descriptor.enum_type_count()); - for (int i = 0; i < message_descriptor.enum_type_count(); ++i) { - nested_enums.push_back(message_descriptor.enum_type(i)); - } - std::sort(nested_enums.begin(), nested_enums.end(), - SortByName()); - - for (const auto& entry : nested_enums) { - PrintEnum(*entry); - // Adds enum value to item_map which will be ordered and printed later - AddEnumValue(*entry, &item_map, import_map); - } - - // Prints nested messages - std::vector nested_messages; - nested_messages.reserve(message_descriptor.nested_type_count()); - for (int i = 0; i < message_descriptor.nested_type_count(); ++i) { - nested_messages.push_back(message_descriptor.nested_type(i)); - } - std::sort(nested_messages.begin(), nested_messages.end(), - SortByName()); - - for (const auto& entry : nested_messages) { - PrintMessage(*entry, true, import_map); - } - - // Adds extensions to item_map which will be ordered and printed later - AddExtensions(message_descriptor, &item_map); - - // Adds field number and field descriptor to item_map - for (int i = 0; i < message_descriptor.field_count(); ++i) { - const FieldDescriptor& field_des = *message_descriptor.field(i); - item_map[ToUpper(field_des.name()) + "_FIELD_NUMBER"] = - "_ClassVar[int]"; - if (IsPythonKeyword(field_des.name())) { - continue; - } - std::string field_type = ""; - if (field_des.is_map()) { - const FieldDescriptor* key_des = field_des.message_type()->field(0); - const FieldDescriptor* value_des = field_des.message_type()->field(1); - field_type = (value_des->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE - ? "_containers.MessageMap[" - : "_containers.ScalarMap["); - field_type += GetFieldType(*key_des, message_descriptor, import_map); - field_type += ", "; - field_type += GetFieldType(*value_des, message_descriptor, import_map); - } else { - if (field_des.is_repeated()) { - field_type = (field_des.cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE - ? "_containers.RepeatedCompositeFieldContainer[" - : "_containers.RepeatedScalarFieldContainer["); - } - field_type += GetFieldType(field_des, message_descriptor, import_map); - } - - if (field_des.is_repeated()) { - field_type += "]"; - } - item_map[field_des.name()] = field_type; - } - - // Prints all items in item_map - PrintItemMap(item_map); - - // Prints __init__ - printer_->Print("def __init__(self"); - bool has_key_words = false; - bool is_first = true; - for (int i = 0; i < message_descriptor.field_count(); ++i) { - const FieldDescriptor* field_des = message_descriptor.field(i); - if (IsPythonKeyword(field_des->name())) { - has_key_words = true; - continue; - } - std::string field_name = field_des->name(); - if (is_first && field_name == "self") { - // See b/144146793 for an example of real code that generates a (self, - // self) method signature. Since repeating a parameter name is illegal in - // Python, we rename the duplicate self. - field_name = "self_"; - } - is_first = false; - printer_->Print(", $field_name$: ", "field_name", field_name); - if (field_des->is_repeated() || - field_des->cpp_type() != FieldDescriptor::CPPTYPE_BOOL) { - printer_->Print("_Optional["); - } - if (field_des->is_map()) { - const Descriptor* map_entry = field_des->message_type(); - printer_->Print( - "_Mapping[$key_type$, $value_type$]", "key_type", - GetFieldType(*map_entry->field(0), message_descriptor, import_map), - "value_type", - GetFieldType(*map_entry->field(1), message_descriptor, import_map)); - } else { - if (field_des->is_repeated()) { - printer_->Print("_Iterable["); - } - if (field_des->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer_->Print( - "_Union[$type_name$, _Mapping]", "type_name", - GetFieldType(*field_des, message_descriptor, import_map)); - } else { - if (field_des->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - printer_->Print("_Union[$type_name$, str]", "type_name", - ModuleLevelName(*field_des->enum_type(), import_map)); - } else { - printer_->Print( - "$type_name$", "type_name", - GetFieldType(*field_des, message_descriptor, import_map)); - } - } - if (field_des->is_repeated()) { - printer_->Print("]"); - } - } - if (field_des->is_repeated() || - field_des->cpp_type() != FieldDescriptor::CPPTYPE_BOOL) { - printer_->Print("]"); - } - printer_->Print(" = ..."); - } - if (has_key_words) { - printer_->Print(", **kwargs"); - } - printer_->Print(") -> None: ...\n"); - - printer_->Outdent(); - printer_->Outdent(); -} - -void PyiGenerator::PrintMessages( - const std::map& import_map) const { - // Deterministically order the descriptors. - std::vector messages; - messages.reserve(file_->message_type_count()); - for (int i = 0; i < file_->message_type_count(); ++i) { - messages.push_back(file_->message_type(i)); - } - std::sort(messages.begin(), messages.end(), SortByName()); - - for (const auto& entry : messages) { - PrintMessage(*entry, false, import_map); - } -} - -void PyiGenerator::PrintServices() const { - std::vector services; - services.reserve(file_->service_count()); - for (int i = 0; i < file_->service_count(); ++i) { - services.push_back(file_->service(i)); - } - std::sort(services.begin(), services.end(), SortByName()); - - // Prints $Service$ and $Service$_Stub classes - for (const auto& entry : services) { - printer_->Print("\n"); - printer_->Print( - "class $service_name$(_service.service): ...\n\n" - "class $service_name$_Stub($service_name$): ...\n", - "service_name", entry->name()); - } -} - -bool PyiGenerator::Generate(const FileDescriptor* file, - const std::string& parameter, - GeneratorContext* context, - std::string* error) const { - MutexLock lock(&mutex_); - // Calculate file name. - file_ = file; - std::string filename = - parameter.empty() ? GetFileName(file, ".pyi") : parameter; - - std::unique_ptr output(context->Open(filename)); - GOOGLE_CHECK(output.get()); - io::Printer printer(output.get(), '$'); - printer_ = &printer; - - // item map will store "DESCRIPTOR", top level extensions, top level enum - // values. The items will be sorted and printed later. - std::map item_map; - - // Adds "DESCRIPTOR" into item_map. - item_map["DESCRIPTOR"] = "_descriptor.FileDescriptor"; - - // import_map will be a mapping from filename to module alias, e.g. - // "google3/foo/bar.py" -> "_bar" - std::map import_map; - - PrintImports(&item_map, &import_map); - // Adds top level enum values to item_map. - for (int i = 0; i < file_->enum_type_count(); ++i) { - AddEnumValue(*file_->enum_type(i), &item_map, import_map); - } - // Adds top level extensions to item_map. - AddExtensions(*file_, &item_map); - // Prints item map - PrintItemMap(item_map); - - PrintMessages(import_map); - PrintTopLevelEnums(); - if (HasGenericServices(file)) { - PrintServices(); - } - return true; -} - -} // namespace python -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/python/pyi_generator.h b/depends/protobuf/src/google/protobuf/compiler/python/pyi_generator.h deleted file mode 100644 index 9611ed43d..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/pyi_generator.h +++ /dev/null @@ -1,120 +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: jieluo@google.com (Jie Luo) -// -// Generates Python stub (.pyi) for a given .proto file. - -#ifndef GOOGLE_PROTOBUF_COMPILER_PYTHON_PYI_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_PYTHON_PYI_GENERATOR_H__ - -#include -#include -#include - -#include -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { -class Descriptor; -class EnumDescriptor; -class FieldDescriptor; -class MethodDescriptor; -class ServiceDescriptor; - -namespace io { -class Printer; -} - -namespace compiler { -namespace python { - -class PROTOC_EXPORT PyiGenerator : public google::protobuf::compiler::CodeGenerator { - public: - PyiGenerator(); - ~PyiGenerator() override; - - // CodeGenerator methods. - uint64_t GetSupportedFeatures() const override { - // Code generators must explicitly support proto3 optional. - return CodeGenerator::FEATURE_PROTO3_OPTIONAL; - } - bool Generate(const FileDescriptor* file, const std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const override; - - private: - void PrintImportForDescriptor(const FileDescriptor& desc, - std::map* import_map, - std::set* seen_aliases) const; - void PrintImports(std::map* item_map, - std::map* import_map) const; - void PrintEnum(const EnumDescriptor& enum_descriptor) const; - void AddEnumValue(const EnumDescriptor& enum_descriptor, - std::map* item_map, - const std::map& import_map) const; - void PrintTopLevelEnums() const; - template - void AddExtensions(const DescriptorT& descriptor, - std::map* item_map) const; - void PrintMessages( - const std::map& import_map) const; - void PrintMessage(const Descriptor& message_descriptor, bool is_nested, - const std::map& import_map) const; - void PrintServices() const; - void PrintItemMap(const std::map& item_map) const; - std::string GetFieldType( - const FieldDescriptor& field_des, const Descriptor& containing_des, - const std::map& import_map) const; - template - std::string ModuleLevelName( - const DescriptorT& descriptor, - const std::map& import_map) const; - - // Very coarse-grained lock to ensure that Generate() is reentrant. - // Guards file_ and printer_. - mutable Mutex mutex_; - mutable const FileDescriptor* file_; // Set in Generate(). Under mutex_. - mutable io::Printer* printer_; // Set in Generate(). Under mutex_. - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PyiGenerator); -}; - -} // namespace python -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_PYTHON_PYI_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/python/python_generator.h b/depends/protobuf/src/google/protobuf/compiler/python/python_generator.h deleted file mode 100644 index 21d48cd9a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/python/python_generator.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GOOGLE_PROTOBUF_COMPILER_PYTHON_PYTHON_GENERATOR_H_ -#define GOOGLE_PROTOBUF_COMPILER_PYTHON_PYTHON_GENERATOR_H_ - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_PYTHON_PYTHON_GENERATOR_H_ diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code.proto b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code.proto deleted file mode 100644 index 70ec9f17a..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code.proto +++ /dev/null @@ -1,70 +0,0 @@ -syntax = "proto3"; - -package A.B.C; - -import "ruby_generated_code_proto2_import.proto"; - -message TestMessage { - int32 optional_int32 = 1; - int64 optional_int64 = 2; - uint32 optional_uint32 = 3; - uint64 optional_uint64 = 4; - bool optional_bool = 5; - double optional_double = 6; - float optional_float = 7; - string optional_string = 8; - 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; - repeated uint32 repeated_uint32 = 23; - repeated uint64 repeated_uint64 = 24; - repeated bool repeated_bool = 25; - repeated double repeated_double = 26; - repeated float repeated_float = 27; - repeated string repeated_string = 28; - repeated bytes repeated_bytes = 29; - repeated TestEnum repeated_enum = 30; - repeated TestMessage repeated_msg = 31; - - oneof my_oneof { - int32 oneof_int32 = 41; - int64 oneof_int64 = 42; - uint32 oneof_uint32 = 43; - uint64 oneof_uint64 = 44; - bool oneof_bool = 45; - double oneof_double = 46; - float oneof_float = 47; - string oneof_string = 48; - bytes oneof_bytes = 49; - TestEnum oneof_enum = 50; - TestMessage oneof_msg = 51; - } - - map map_int32_string = 61; - map map_int64_string = 62; - map map_uint32_string = 63; - map map_uint64_string = 64; - map map_bool_string = 65; - map map_string_string = 66; - map map_string_msg = 67; - map map_string_enum = 68; - map map_string_int32 = 69; - map map_string_bool = 70; - - message NestedMessage { - int32 foo = 1; - } - - NestedMessage nested_message = 80; -} - -enum TestEnum { - Default = 0; - A = 1; - B = 2; - C = 3; -} diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb deleted file mode 100644 index 256ac7c15..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb +++ /dev/null @@ -1,79 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: ruby_generated_code.proto - -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 - optional :optional_int32, :int32, 1 - optional :optional_int64, :int64, 2 - optional :optional_uint32, :uint32, 3 - optional :optional_uint64, :uint64, 4 - optional :optional_bool, :bool, 5 - optional :optional_double, :double, 6 - optional :optional_float, :float, 7 - optional :optional_string, :string, 8 - 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 - repeated :repeated_uint64, :uint64, 24 - repeated :repeated_bool, :bool, 25 - repeated :repeated_double, :double, 26 - repeated :repeated_float, :float, 27 - repeated :repeated_string, :string, 28 - repeated :repeated_bytes, :bytes, 29 - repeated :repeated_enum, :enum, 30, "A.B.C.TestEnum" - repeated :repeated_msg, :message, 31, "A.B.C.TestMessage" - map :map_int32_string, :int32, :string, 61 - map :map_int64_string, :int64, :string, 62 - map :map_uint32_string, :uint32, :string, 63 - map :map_uint64_string, :uint64, :string, 64 - map :map_bool_string, :bool, :string, 65 - map :map_string_string, :string, :string, 66 - map :map_string_msg, :string, :message, 67, "A.B.C.TestMessage" - map :map_string_enum, :string, :enum, 68, "A.B.C.TestEnum" - map :map_string_int32, :string, :int32, 69 - map :map_string_bool, :string, :bool, 70 - optional :nested_message, :message, 80, "A.B.C.TestMessage.NestedMessage" - oneof :my_oneof do - optional :oneof_int32, :int32, 41 - optional :oneof_int64, :int64, 42 - optional :oneof_uint32, :uint32, 43 - optional :oneof_uint64, :uint64, 44 - optional :oneof_bool, :bool, 45 - optional :oneof_double, :double, 46 - optional :oneof_float, :float, 47 - optional :oneof_string, :string, 48 - optional :oneof_bytes, :bytes, 49 - optional :oneof_enum, :enum, 50, "A.B.C.TestEnum" - optional :oneof_msg, :message, 51, "A.B.C.TestMessage" - end - end - add_message "A.B.C.TestMessage.NestedMessage" do - optional :foo, :int32, 1 - end - add_enum "A.B.C.TestEnum" do - value :Default, 0 - value :A, 1 - value :B, 2 - value :C, 3 - end - end -end - -module A - module B - module C - TestMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("A.B.C.TestMessage").msgclass - TestMessage::NestedMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("A.B.C.TestMessage.NestedMessage").msgclass - TestEnum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("A.B.C.TestEnum").enummodule - end - end -end diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto deleted file mode 100644 index ea7f78363..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto +++ /dev/null @@ -1,71 +0,0 @@ -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]; - optional uint32 optional_uint32 = 3 [default = 3]; - optional uint64 optional_uint64 = 4 [default = 4]; - optional bool optional_bool = 5 [default = true]; - optional double optional_double = 6 [default = 6.0]; - optional float optional_float = 7 [default = 7.0]; - optional string optional_string = 8 [default = "default str"]; - 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; - repeated uint32 repeated_uint32 = 23; - repeated uint64 repeated_uint64 = 24; - repeated bool repeated_bool = 25; - repeated double repeated_double = 26; - repeated float repeated_float = 27; - repeated string repeated_string = 28; - repeated bytes repeated_bytes = 29; - repeated TestEnum repeated_enum = 30; - repeated TestMessage repeated_msg = 31; - - required int32 required_int32 = 41; - required int64 required_int64 = 42; - required uint32 required_uint32 = 43; - required uint64 required_uint64 = 44; - required bool required_bool = 45; - required double required_double = 46; - required float required_float = 47; - required string required_string = 48; - required bytes required_bytes = 49; - required TestEnum required_enum = 50; - required TestMessage required_msg = 51; - - oneof my_oneof { - int32 oneof_int32 = 61; - int64 oneof_int64 = 62; - uint32 oneof_uint32 = 63; - uint64 oneof_uint64 = 64; - bool oneof_bool = 65; - double oneof_double = 66; - float oneof_float = 67; - string oneof_string = 68; - bytes oneof_bytes = 69; - TestEnum oneof_enum = 70; - TestMessage oneof_msg = 71; - } - - message NestedMessage { - optional int32 foo = 1; - } - - optional NestedMessage nested_message = 80; -} - -enum TestEnum { - Default = 0; - A = 1; - B = 2; - C = 3; -} diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto deleted file mode 100644 index 9ec07381b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto +++ /dev/null @@ -1,5 +0,0 @@ -syntax = "proto2"; - -package A.B.C; - -message TestImportedMessage {} diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb deleted file mode 100644 index 44d31969e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb +++ /dev/null @@ -1,80 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: ruby_generated_code_proto2.proto - -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 - optional :optional_int32, :int32, 1, default: 1 - optional :optional_int64, :int64, 2, default: 2 - optional :optional_uint32, :uint32, 3, default: 3 - optional :optional_uint64, :uint64, 4, default: 4 - optional :optional_bool, :bool, 5, default: true - optional :optional_double, :double, 6, default: 6 - optional :optional_float, :float, 7, default: 7 - optional :optional_string, :string, 8, default: "default str" - 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 - repeated :repeated_uint64, :uint64, 24 - repeated :repeated_bool, :bool, 25 - repeated :repeated_double, :double, 26 - repeated :repeated_float, :float, 27 - repeated :repeated_string, :string, 28 - repeated :repeated_bytes, :bytes, 29 - repeated :repeated_enum, :enum, 30, "A.B.C.TestEnum" - repeated :repeated_msg, :message, 31, "A.B.C.TestMessage" - required :required_int32, :int32, 41 - required :required_int64, :int64, 42 - required :required_uint32, :uint32, 43 - required :required_uint64, :uint64, 44 - required :required_bool, :bool, 45 - required :required_double, :double, 46 - required :required_float, :float, 47 - required :required_string, :string, 48 - required :required_bytes, :bytes, 49 - required :required_enum, :enum, 50, "A.B.C.TestEnum" - required :required_msg, :message, 51, "A.B.C.TestMessage" - optional :nested_message, :message, 80, "A.B.C.TestMessage.NestedMessage" - oneof :my_oneof do - optional :oneof_int32, :int32, 61 - optional :oneof_int64, :int64, 62 - optional :oneof_uint32, :uint32, 63 - optional :oneof_uint64, :uint64, 64 - optional :oneof_bool, :bool, 65 - optional :oneof_double, :double, 66 - optional :oneof_float, :float, 67 - optional :oneof_string, :string, 68 - optional :oneof_bytes, :bytes, 69 - optional :oneof_enum, :enum, 70, "A.B.C.TestEnum" - optional :oneof_msg, :message, 71, "A.B.C.TestMessage" - end - end - add_message "A.B.C.TestMessage.NestedMessage" do - optional :foo, :int32, 1 - end - add_enum "A.B.C.TestEnum" do - value :Default, 0 - value :A, 1 - value :B, 2 - value :C, 3 - end - end -end - -module A - module B - module C - TestMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("A.B.C.TestMessage").msgclass - TestMessage::NestedMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("A.B.C.TestMessage.NestedMessage").msgclass - TestEnum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("A.B.C.TestEnum").enummodule - end - end -end diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto deleted file mode 100644 index 8d7c948a1..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package one.two.a_three; - -option ruby_package = "A::B::C"; - -message Four { - string a_string = 1; -} diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto deleted file mode 100644 index 7a0d26086..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package one.two.a_three.and; - -option ruby_package = "AA.BB.CC"; - -message Four { - string another_string = 1; -} diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb deleted file mode 100644 index cdbbe891b..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: ruby_generated_pkg_explicit_legacy.proto - -require 'google/protobuf' - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_file("ruby_generated_pkg_explicit_legacy.proto", :syntax => :proto3) do - add_message "one.two.a_three.and.Four" do - optional :another_string, :string, 1 - end - end -end - -module AA - module BB - module CC - Four = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("one.two.a_three.and.Four").msgclass - end - end -end diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb deleted file mode 100644 index e6d47011e..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: ruby_generated_pkg_explicit.proto - -require 'google/protobuf' - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_file("ruby_generated_pkg_explicit.proto", :syntax => :proto3) do - add_message "one.two.a_three.Four" do - optional :a_string, :string, 1 - end - end -end - -module A - module B - module C - Four = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("one.two.a_three.Four").msgclass - end - end -end diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto deleted file mode 100644 index 544db64d9..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; - -package one.two.a_three; - -message Four { - string a_string = 1; -} diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb deleted file mode 100644 index 1ac0ef7ad..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: ruby_generated_pkg_implicit.proto - -require 'google/protobuf' - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_file("ruby_generated_pkg_implicit.proto", :syntax => :proto3) do - add_message "one.two.a_three.Four" do - optional :a_string, :string, 1 - end - end -end - -module One - module Two - module AThree - Four = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("one.two.a_three.Four").msgclass - end - end -end diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc deleted file mode 100644 index d4a53d563..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ /dev/null @@ -1,575 +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 - -namespace google { -namespace protobuf { -namespace compiler { -namespace ruby { - -// Forward decls. -template -std::string NumberToString(numeric_type value); -std::string GetRequireName(const std::string& proto_file); -std::string LabelForField(FieldDescriptor* field); -std::string TypeName(FieldDescriptor* field); -bool GenerateMessage(const Descriptor* message, io::Printer* printer, - std::string* error); -void GenerateEnum(const EnumDescriptor* en, io::Printer* printer); -void GenerateMessageAssignment(const std::string& prefix, - const Descriptor* message, io::Printer* printer); -void GenerateEnumAssignment(const std::string& prefix, const EnumDescriptor* en, - io::Printer* printer); -std::string DefaultValueForField(const FieldDescriptor* field); - -template -std::string NumberToString(numeric_type value) { - std::ostringstream os; - os << value; - return os.str(); -} - -std::string GetRequireName(const std::string& proto_file) { - int lastindex = proto_file.find_last_of("."); - return proto_file.substr(0, lastindex) + "_pb"; -} - -std::string GetOutputFilename(const std::string& proto_file) { - return GetRequireName(proto_file) + ".rb"; -} - -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"; - case FieldDescriptor::LABEL_REPEATED: return "repeated"; - default: assert(false); return ""; - } -} - -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 StringifySyntax(FileDescriptor::Syntax syntax) { - switch (syntax) { - case FileDescriptor::SYNTAX_PROTO2: - return "proto2"; - case FileDescriptor::SYNTAX_PROTO3: - return "proto3"; - case FileDescriptor::SYNTAX_UNKNOWN: - default: - GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports " - "proto2 and proto3 syntax."; - return ""; - } -} - -std::string DefaultValueForField(const FieldDescriptor* field) { - switch(field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return NumberToString(field->default_value_int32()); - case FieldDescriptor::CPPTYPE_INT64: - return NumberToString(field->default_value_int64()); - case FieldDescriptor::CPPTYPE_UINT32: - return NumberToString(field->default_value_uint32()); - case FieldDescriptor::CPPTYPE_UINT64: - return NumberToString(field->default_value_uint64()); - case FieldDescriptor::CPPTYPE_FLOAT: - return NumberToString(field->default_value_float()); - case FieldDescriptor::CPPTYPE_DOUBLE: - return NumberToString(field->default_value_double()); - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool() ? "true" : "false"; - case FieldDescriptor::CPPTYPE_ENUM: - return NumberToString(field->default_value_enum()->number()); - case FieldDescriptor::CPPTYPE_STRING: { - std::ostringstream os; - std::string default_str = field->default_value_string(); - - if (field->type() == FieldDescriptor::TYPE_STRING) { - os << "\"" << default_str << "\""; - } else if (field->type() == FieldDescriptor::TYPE_BYTES) { - os << "\""; - - os.fill('0'); - for (int i = 0; i < default_str.length(); ++i) { - // Write the hex form of each byte. - os << "\\x" << std::hex << std::setw(2) - << ((uint16_t)((unsigned char)default_str.at(i))); - } - os << "\".force_encoding(\"ASCII-8BIT\")"; - } - - return os.str(); - } - default: assert(false); return ""; - } -} - -void GenerateField(const FieldDescriptor* field, io::Printer* printer) { - if (field->is_map()) { - const FieldDescriptor* key_field = - field->message_type()->FindFieldByNumber(1); - const FieldDescriptor* value_field = - field->message_type()->FindFieldByNumber(2); - - printer->Print( - "map :$name$, :$key_type$, :$value_type$, $number$", - "name", field->name(), - "key_type", TypeName(key_field), - "value_type", TypeName(value_field), - "number", NumberToString(field->number())); - - if (value_field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print( - ", \"$subtype$\"\n", - "subtype", value_field->message_type()->full_name()); - } else if (value_field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - printer->Print( - ", \"$subtype$\"\n", - "subtype", value_field->enum_type()->full_name()); - } else { - printer->Print("\n"); - } - } else { - - printer->Print( - "$label$ :$name$, ", - "label", LabelForField(field), - "name", field->name()); - printer->Print( - ":$type$, $number$", - "type", TypeName(field), - "number", NumberToString(field->number())); - - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print( - ", \"$subtype$\"", - "subtype", field->message_type()->full_name()); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - printer->Print( - ", \"$subtype$\"", - "subtype", field->enum_type()->full_name()); - } - - if (field->has_default_value()) { - printer->Print(", default: $default$", "default", - DefaultValueForField(field)); - } - - if (field->has_json_name()) { - printer->Print(", json_name: \"$json_name$\"", "json_name", - field->json_name()); - } - - printer->Print("\n"); - } -} - -void GenerateOneof(const OneofDescriptor* oneof, io::Printer* printer) { - printer->Print( - "oneof :$name$ do\n", - "name", oneof->name()); - printer->Indent(); - - for (int i = 0; i < oneof->field_count(); i++) { - const FieldDescriptor* field = oneof->field(i); - GenerateField(field, printer); - } - - printer->Outdent(); - printer->Print("end\n"); -} - -bool GenerateMessage(const Descriptor* message, io::Printer* printer, - std::string* error) { - if (message->extension_range_count() > 0 || message->extension_count() > 0) { - GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; - } - - // Don't generate MapEntry messages -- we use the Ruby extension's native - // support for map fields instead. - if (message->options().map_entry()) { - return true; - } - - printer->Print( - "add_message \"$name$\" do\n", - "name", message->full_name()); - printer->Indent(); - - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - if (!field->real_containing_oneof()) { - GenerateField(field, printer); - } - } - - for (int i = 0; i < message->real_oneof_decl_count(); i++) { - const OneofDescriptor* oneof = message->oneof_decl(i); - GenerateOneof(oneof, printer); - } - - printer->Outdent(); - printer->Print("end\n"); - - for (int i = 0; i < message->nested_type_count(); i++) { - if (!GenerateMessage(message->nested_type(i), printer, error)) { - return false; - } - } - for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnum(message->enum_type(i), printer); - } - - return true; -} - -void GenerateEnum(const EnumDescriptor* en, io::Printer* printer) { - printer->Print( - "add_enum \"$name$\" do\n", - "name", en->full_name()); - printer->Indent(); - - for (int i = 0; i < en->value_count(); i++) { - const EnumValueDescriptor* value = en->value(i); - printer->Print( - "value :$name$, $number$\n", - "name", value->name(), - "number", NumberToString(value->number())); - } - - printer->Outdent(); - printer->Print( - "end\n"); -} - -// Locale-agnostic utility functions. -bool IsLower(char ch) { return ch >= 'a' && ch <= 'z'; } - -bool IsUpper(char ch) { return ch >= 'A' && ch <= 'Z'; } - -bool IsAlpha(char ch) { return IsLower(ch) || IsUpper(ch); } - -char UpperChar(char ch) { return IsLower(ch) ? (ch - 'a' + 'A') : ch; } - - -// Package names in protobuf are snake_case by convention, but Ruby module -// names must be PascalCased. -// -// foo_bar_baz -> FooBarBaz -std::string PackageToModule(const std::string& name) { - bool next_upper = true; - std::string result; - result.reserve(name.size()); - - for (int i = 0; i < name.size(); i++) { - if (name[i] == '_') { - next_upper = true; - } else { - if (next_upper) { - result.push_back(UpperChar(name[i])); - } else { - result.push_back(name[i]); - } - next_upper = false; - } - } - - return result; -} - -// Class and enum names in protobuf should be PascalCased by convention, but -// since there is nothing enforcing this we need to ensure that they are valid -// Ruby constants. That mainly means making sure that the first character is -// an upper-case letter. -std::string RubifyConstant(const std::string& name) { - std::string ret = name; - if (!ret.empty()) { - if (IsLower(ret[0])) { - // If it starts with a lowercase letter, capitalize it. - ret[0] = UpperChar(ret[0]); - } else if (!IsAlpha(ret[0])) { - // Otherwise (e.g. if it begins with an underscore), we need to come up - // with some prefix that starts with a capital letter. We could be smarter - // here, e.g. try to strip leading underscores, but this may cause other - // problems if the user really intended the name. So let's just prepend a - // well-known suffix. - ret = "PB_" + ret; - } - } - - return ret; -} - -void GenerateMessageAssignment(const std::string& prefix, - const Descriptor* message, - io::Printer* printer) { - // Don't generate MapEntry messages -- we use the Ruby extension's native - // support for map fields instead. - if (message->options().map_entry()) { - return; - } - - printer->Print( - "$prefix$$name$ = ", - "prefix", prefix, - "name", RubifyConstant(message->name())); - printer->Print( - "::Google::Protobuf::DescriptorPool.generated_pool." - "lookup(\"$full_name$\").msgclass\n", - "full_name", message->full_name()); - - std::string nested_prefix = prefix + RubifyConstant(message->name()) + "::"; - for (int i = 0; i < message->nested_type_count(); i++) { - GenerateMessageAssignment(nested_prefix, message->nested_type(i), printer); - } - for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnumAssignment(nested_prefix, message->enum_type(i), printer); - } -} - -void GenerateEnumAssignment(const std::string& prefix, const EnumDescriptor* en, - io::Printer* printer) { - printer->Print( - "$prefix$$name$ = ", - "prefix", prefix, - "name", RubifyConstant(en->name())); - printer->Print( - "::Google::Protobuf::DescriptorPool.generated_pool." - "lookup(\"$full_name$\").enummodule\n", - "full_name", en->full_name()); -} - -int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) { - int levels = 0; - bool need_change_to_module = true; - std::string package_name; - - // Determine the name to use in either format: - // proto package: one.two.three - // option ruby_package: One::Two::Three - if (file->options().has_ruby_package()) { - package_name = file->options().ruby_package(); - - // If :: is in the package use the Ruby formatted name as-is - // -> A::B::C - // otherwise, use the dot separator - // -> A.B.C - if (package_name.find("::") != std::string::npos) { - need_change_to_module = false; - } else if (package_name.find(".") != std::string::npos) { - GOOGLE_LOG(WARNING) << "ruby_package option should be in the form of:" - << " 'A::B::C' and not 'A.B.C'"; - } - } else { - package_name = file->package(); - } - - // 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); - std::string component; - if (dot_index == std::string::npos) { - component = package_name; - package_name = ""; - } else { - component = package_name.substr(0, dot_index); - package_name = package_name.substr(dot_index + delimiter_size); - } - if (need_change_to_module) { - component = PackageToModule(component); - } - printer->Print( - "module $name$\n", - "name", component); - printer->Indent(); - levels++; - } - return levels; -} - -void EndPackageModules(int levels, io::Printer* printer) { - while (levels > 0) { - levels--; - printer->Outdent(); - printer->Print( - "end\n"); - } -} - -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 < file->enum_type_count(); i++) { - GenerateEnum(file->enum_type(i), printer); - } - printer->Outdent(); - printer->Print("end\n"); - printer->Outdent(); - printer->Print( - "end\n\n"); - 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, - 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"); - - 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) { - GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; - } - - bool use_raw_descriptor = file->name() == "google/protobuf/descriptor.proto"; - - if (use_raw_descriptor) { - GenerateBinaryDescriptor(file, printer, error); - } else { - GenerateDslDescriptor(file, printer, error); - } - - int levels = GeneratePackageModules(file, printer); - for (int i = 0; i < file->message_type_count(); i++) { - GenerateMessageAssignment("", file->message_type(i), printer); - } - for (int i = 0; i < file->enum_type_count(); i++) { - 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 std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const { - - if (file->syntax() != FileDescriptor::SYNTAX_PROTO3 && - file->syntax() != FileDescriptor::SYNTAX_PROTO2) { - *error = "Invalid or unsupported proto syntax"; - return false; - } - - std::unique_ptr output( - generator_context->Open(GetOutputFilename(file->name()))); - io::Printer printer(output.get(), '$'); - - return GenerateFile(file, &printer, error); -} - -} // namespace ruby -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.h b/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.h deleted file mode 100644 index 647bb8360..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.h +++ /dev/null @@ -1,67 +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. - -// Generates Ruby code for a given .proto file. - -#ifndef GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__ - -#include - -#include - -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace ruby { - -// CodeGenerator implementation for generated Ruby protocol buffer classes. -// If you create your own protocol compiler binary and you want it to support -// 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 { - 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 -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/scc.h b/depends/protobuf/src/google/protobuf/compiler/scc.h deleted file mode 100644 index 7b95689d7..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/scc.h +++ /dev/null @@ -1,165 +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_COMPILER_SCC_H__ -#define GOOGLE_PROTOBUF_COMPILER_SCC_H__ - -#include - -#include -#include -#include - -// Must be included last. -#include - -namespace google { -namespace protobuf { -namespace compiler { - -// Description of each strongly connected component. Note that the order -// of both the descriptors in this SCC and the order of children is -// deterministic. -struct SCC { - std::vector descriptors; - std::vector children; - - const Descriptor* GetRepresentative() const { return descriptors[0]; } - - // All messages must necessarily be in the same file. - const FileDescriptor* GetFile() const { return descriptors[0]->file(); } -}; - -// This class is used for analyzing the SCC for each message, to ensure linear -// instead of quadratic performance, if we do this per message we would get -// O(V*(V+E)). -template -class PROTOC_EXPORT SCCAnalyzer { - public: - explicit SCCAnalyzer() : index_(0) {} - - const SCC* GetSCC(const Descriptor* descriptor) { - if (cache_.count(descriptor)) return cache_[descriptor].scc; - return DFS(descriptor).scc; - } - - private: - struct NodeData { - const SCC* scc; // if null it means its still on the stack - int index; - int lowlink; - }; - - std::map cache_; - std::vector stack_; - int index_; - std::vector> garbage_bin_; - - SCC* CreateSCC() { - garbage_bin_.emplace_back(new SCC()); - return garbage_bin_.back().get(); - } - - // Tarjan's Strongly Connected Components algo - NodeData DFS(const Descriptor* descriptor) { - // Must not have visited already. - GOOGLE_DCHECK_EQ(cache_.count(descriptor), 0); - - // Mark visited by inserting in map. - NodeData& result = cache_[descriptor]; - // Initialize data structures. - result.index = result.lowlink = index_++; - stack_.push_back(descriptor); - - // Recurse the fields / nodes in graph - for (auto dep : DepsGenerator()(descriptor)) { - GOOGLE_CHECK(dep); - if (cache_.count(dep) == 0) { - // unexplored node - NodeData child_data = DFS(dep); - result.lowlink = std::min(result.lowlink, child_data.lowlink); - } else { - NodeData child_data = cache_[dep]; - if (child_data.scc == nullptr) { - // Still in the stack_ so we found a back edge - result.lowlink = std::min(result.lowlink, child_data.index); - } - } - } - if (result.index == result.lowlink) { - // This is the root of a strongly connected component - SCC* scc = CreateSCC(); - while (true) { - const Descriptor* scc_desc = stack_.back(); - scc->descriptors.push_back(scc_desc); - // Remove from stack - stack_.pop_back(); - cache_[scc_desc].scc = scc; - - if (scc_desc == descriptor) break; - } - - // The order of descriptors is random and depends how this SCC was - // discovered. In-order to ensure maximum stability we sort it by name. - std::sort(scc->descriptors.begin(), scc->descriptors.end(), - [](const Descriptor* a, const Descriptor* b) { - return a->full_name() < b->full_name(); - }); - AddChildren(scc); - } - return result; - } - - // Add the SCC's that are children of this SCC to its children. - void AddChildren(SCC* scc) { - std::set seen; - for (auto descriptor : scc->descriptors) { - for (auto child_msg : DepsGenerator()(descriptor)) { - GOOGLE_CHECK(child_msg); - const SCC* child = GetSCC(child_msg); - if (child == scc) continue; - if (seen.insert(child).second) { - scc->children.push_back(child); - } - } - } - } - - // This is necessary for compiler bug in msvc2015. - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SCCAnalyzer); -}; - -} // namespace compiler -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_COMPILER_SCC_H__ diff --git a/depends/protobuf/src/google/protobuf/compiler/zip_writer.cc b/depends/protobuf/src/google/protobuf/compiler/zip_writer.cc deleted file mode 100644 index 72e1d7114..000000000 --- a/depends/protobuf/src/google/protobuf/compiler/zip_writer.cc +++ /dev/null @@ -1,195 +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: 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 { -namespace protobuf { -namespace compiler { - -// January 1, 1980 as a DOS date. -// see https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx -static const uint16_t kDosEpoch = 1 << 5 | 1; - -static const uint32_t kCRC32Table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d}; - -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); - } - return ~x; -} - -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); -} - -ZipWriter::ZipWriter(io::ZeroCopyOutputStream* raw_output) - : raw_output_(raw_output) {} -ZipWriter::~ZipWriter() {} - -bool ZipWriter::Write(const std::string& filename, - const std::string& contents) { - FileInfo info; - - info.name = filename; - uint16_t filename_size = filename.size(); - info.offset = raw_output_->ByteCount(); - info.size = contents.size(); - info.crc32 = ComputeCRC32(contents); - - files_.push_back(info); - - // write file header - io::CodedOutputStream output(raw_output_); - output.WriteLittleEndian32(0x04034b50); // magic - WriteShort(&output, 10); // version needed to extract - WriteShort(&output, 0); // flags - WriteShort(&output, 0); // compression method: stored - WriteShort(&output, 0); // last modified time - WriteShort(&output, kDosEpoch); // last modified date - output.WriteLittleEndian32(info.crc32); // crc-32 - output.WriteLittleEndian32(info.size); // compressed size - output.WriteLittleEndian32(info.size); // uncompressed size - WriteShort(&output, filename_size); // file name length - WriteShort(&output, 0); // extra field length - output.WriteString(filename); // file name - output.WriteString(contents); // file data - - return !output.HadError(); -} - -bool ZipWriter::WriteDirectory() { - 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_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 - WriteShort(&output, 10); // version needed to extract - WriteShort(&output, 0); // flags - WriteShort(&output, 0); // compression method: stored - WriteShort(&output, 0); // last modified time - WriteShort(&output, kDosEpoch); // last modified date - output.WriteLittleEndian32(crc32); // crc-32 - output.WriteLittleEndian32(size); // compressed size - output.WriteLittleEndian32(size); // uncompressed size - WriteShort(&output, filename_size); // file name length - WriteShort(&output, 0); // extra field length - WriteShort(&output, 0); // file comment length - WriteShort(&output, 0); // starting disk number - WriteShort(&output, 0); // internal file attributes - output.WriteLittleEndian32(0); // external file attributes - output.WriteLittleEndian32(offset); // local header offset - output.WriteString(filename); // file name - } - uint32_t dir_len = output.ByteCount(); - - // write end of central directory marker - output.WriteLittleEndian32(0x06054b50); // magic - WriteShort(&output, 0); // disk number - WriteShort(&output, 0); // disk with start of central directory - WriteShort(&output, num_entries); // central directory entries (this disk) - WriteShort(&output, num_entries); // central directory entries (total) - output.WriteLittleEndian32(dir_len); // central directory byte size - output.WriteLittleEndian32(dir_ofs); // central directory offset - WriteShort(&output, 0); // comment length - - return output.HadError(); -} - -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/depends/protobuf/src/google/protobuf/descriptor.cc b/depends/protobuf/src/google/protobuf/descriptor.cc deleted file mode 100644 index 5f3427dc7..000000000 --- a/depends/protobuf/src/google/protobuf/descriptor.cc +++ /dev/null @@ -1,8340 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef PACKAGE // autoheader #defines this. :( - - -// Must be included last. -#include - -namespace google { -namespace protobuf { - -namespace { -const int kPackageLimit = 100; - -// Note: I distrust ctype.h due to locales. -char ToUpper(char ch) { - return (ch >= 'a' && ch <= 'z') ? (ch - 'a' + 'A') : ch; -} - -char ToLower(char ch) { - return (ch >= 'A' && ch <= 'Z') ? (ch - 'A' + 'a') : ch; -} - -std::string ToCamelCase(const std::string& input, bool lower_first) { - bool capitalize_next = !lower_first; - std::string result; - result.reserve(input.size()); - - for (char character : input) { - if (character == '_') { - capitalize_next = true; - } else if (capitalize_next) { - result.push_back(ToUpper(character)); - capitalize_next = false; - } else { - result.push_back(character); - } - } - - // Lower-case the first letter. - if (lower_first && !result.empty()) { - result[0] = ToLower(result[0]); - } - - return result; -} - -std::string ToJsonName(const std::string& input) { - bool capitalize_next = false; - std::string result; - result.reserve(input.size()); - - for (char character : input) { - if (character == '_') { - capitalize_next = true; - } else if (capitalize_next) { - result.push_back(ToUpper(character)); - capitalize_next = false; - } else { - result.push_back(character); - } - } - - return result; -} - -// Backport of fold expressions for the comma operator to C++11. -// Usage: Fold({expr...}); -// Guaranteed to evaluate left-to-right -struct ExpressionEater { - template - ExpressionEater(T&&) {} // NOLINT -}; -void Fold(std::initializer_list) {} - -template -constexpr size_t RoundUpTo(size_t n) { - static_assert((R & (R - 1)) == 0, "Must be power of two"); - return (n + (R - 1)) & ~(R - 1); -} - -constexpr size_t Max(size_t a, size_t b) { return a > b ? a : b; } -template -constexpr size_t Max(T a, Ts... b) { - return Max(a, Max(b...)); -} - -template -constexpr size_t EffectiveAlignof() { - // `char` is special in that it gets aligned to 8. It is where we drop the - // trivial structs. - return std::is_same::value ? 8 : alignof(T); -} - -template -using AppendIfAlign = - typename std::conditional() == align, void (*)(T..., U), - void (*)(T...)>::type; - -// Metafunction to sort types in descending order of alignment. -// Useful for the flat allocator to ensure proper alignment of all elements -// without having to add padding. -// Instead of implementing a proper sort metafunction we just do a -// filter+merge, which is much simpler to write as a metafunction. -// We have a fixed set of alignments we can filter on. -// For simplicity we use a function pointer as a type list. -template -struct TypeListSortImpl; - -template -struct TypeListSortImpl { - using type = void (*)(T16..., T8..., T4..., T2..., T1...); -}; - -template -struct TypeListSortImpl { - using type = typename TypeListSortImpl< - void (*)(Rest...), AppendIfAlign<16, First, T16...>, - AppendIfAlign<8, First, T8...>, AppendIfAlign<4, First, T4...>, - AppendIfAlign<2, First, T2...>, AppendIfAlign<1, First, T1...>>::type; -}; - -template -using SortByAlignment = - typename TypeListSortImpl::type; - -template