diff options
author | Adam Cozzette <acozzette@google.com> | 2017-12-01 10:05:19 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2017-12-01 10:05:19 -0800 |
commit | 0ba8eea655a5e40d19ab95c773192b5d908c5a61 (patch) | |
tree | 4c2c97ade1ab197d361c146bacae5adde55986bf /src/google/protobuf | |
parent | 92a7e778e7394386f413cec28d67a07630f784b1 (diff) | |
parent | a711e3d5b4ee1dd7f9d21197dca8432a5819a64e (diff) | |
download | protobuf-0ba8eea655a5e40d19ab95c773192b5d908c5a61.tar.gz protobuf-0ba8eea655a5e40d19ab95c773192b5d908c5a61.tar.bz2 protobuf-0ba8eea655a5e40d19ab95c773192b5d908c5a61.zip |
Merge branch 'master' into down-integrate
Diffstat (limited to 'src/google/protobuf')
34 files changed, 97 insertions, 426 deletions
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 14134370..673d335a 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 9e175e3e..ffcba0fd 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 6c2fc164..1f6d748d 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -100,7 +100,7 @@ namespace compiler { #endif namespace { -#if defined(_MSC_VER) +#if defined(_WIN32) // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::access; diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 38d0e388..ef7579a2 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -70,7 +70,7 @@ namespace google { namespace protobuf { namespace compiler { -#if defined(_MSC_VER) +#if defined(_WIN32) // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::access; diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc index 9792ffe8..a5341e0d 100644 --- a/src/google/protobuf/compiler/importer.cc +++ b/src/google/protobuf/compiler/importer.cc @@ -65,7 +65,7 @@ namespace google { namespace protobuf { namespace compiler { -#ifdef _MSC_VER +#ifdef _WIN32 // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::access; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 54dc7455..14715ef6 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -50,11 +50,6 @@ #include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/strutil.h> -#if defined(_MSC_VER) -// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import -// them like we do below. -using google::protobuf::internal::win32::open; -#endif // 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. @@ -64,6 +59,16 @@ namespace protobuf { namespace compiler { namespace objectivec { +// <io.h> 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::internal::win32::open; +#else +using ::open; +#endif +} // namespace port + Options::Options() { // Default is the value of the env for the package prefixes. const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); @@ -1469,7 +1474,7 @@ bool ParseSimpleFile( const string& path, LineConsumer* line_consumer, string* out_error) { int fd; do { - fd = open(path.c_str(), O_RDONLY); + fd = posix::open(path.c_str(), O_RDONLY); } while (fd < 0 && errno == EINTR); if (fd < 0) { *out_error = diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index e4364ac2..dd4392c2 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -215,19 +215,12 @@ std::string NamespacedName(const string& classname, template <typename DescriptorType> std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { - string classname = desc->name(); - const Descriptor* containing = desc->containing_type(); - while (containing != NULL) { - classname = containing->name() + '_' + classname; - containing = containing->containing_type(); - } - classname = ClassNamePrefix(classname, desc) + classname; + string classname = GeneratedClassName(desc); return NamespacedName(classname, desc, is_descriptor); } std::string FullClassName(const ServiceDescriptor* desc, bool is_descriptor) { - string classname = desc->name(); - classname = ClassNamePrefix(classname, desc) + classname; + string classname = GeneratedClassName(desc); return NamespacedName(classname, desc, is_descriptor); } @@ -1419,6 +1412,31 @@ bool Generator::Generate(const FileDescriptor* file, const string& parameter, return true; } +std::string GeneratedClassName(const Descriptor* 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 GeneratedClassName(const EnumDescriptor* 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 GeneratedClassName(const ServiceDescriptor* desc) { + std::string classname = desc->name(); + return ClassNamePrefix(classname, desc) + classname; +} + } // namespace php } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/php/php_generator.h b/src/google/protobuf/compiler/php/php_generator.h index ce2b000a..67e70bc7 100644 --- a/src/google/protobuf/compiler/php/php_generator.h +++ b/src/google/protobuf/compiler/php/php_generator.h @@ -32,6 +32,7 @@ #define GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__ #include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/descriptor.h> #include <string> @@ -47,8 +48,16 @@ class LIBPROTOC_EXPORT Generator const string& parameter, GeneratorContext* generator_context, 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. +std::string GeneratedClassName(const google::protobuf::Descriptor* desc); +std::string GeneratedClassName(const google::protobuf::EnumDescriptor* desc); +std::string GeneratedClassName(const google::protobuf::ServiceDescriptor* desc); + } // namespace php } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc index 7f975510..bde3d798 100644 --- a/src/google/protobuf/compiler/plugin.cc +++ b/src/google/protobuf/compiler/plugin.cc @@ -54,7 +54,7 @@ namespace google { namespace protobuf { namespace compiler { -#if defined(_MSC_VER) +#if defined(_WIN32) // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::setmode; diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 617fd799..9618ec00 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 2eecfa29..3f964afe 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 23f7f4bb..bc1a043e 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 3d44429a..88be1475 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index e94cdd03..76be06a7 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc index 83dec3e6..dd921135 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/src/google/protobuf/io/zero_copy_stream_impl.cc @@ -56,9 +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) -#endif - -#ifdef _MSC_VER // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::access; diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc index dfc383a3..91792f18 100644 --- a/src/google/protobuf/io/zero_copy_stream_unittest.cc +++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc @@ -83,9 +83,6 @@ namespace { #ifdef _WIN32 #define pipe(fds) _pipe(fds, 4096, O_BINARY) -#endif - -#ifdef _MSC_VER // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::access; diff --git a/src/google/protobuf/map_unittest_proto3.proto b/src/google/protobuf/map_unittest_proto3.proto deleted file mode 100644 index 16be2773..00000000 --- a/src/google/protobuf/map_unittest_proto3.proto +++ /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. - -// This file is mostly equivalent to map_unittest.proto, but imports -// unittest_proto3.proto instead of unittest.proto, so that it only -// uses proto3 messages. This makes it suitable for testing -// implementations which only support proto3. -// The TestRequiredMessageMap message has been removed as there are no -// required fields in proto3. -syntax = "proto3"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.TestProtos"; - -import "google/protobuf/unittest_proto3.proto"; - -// We don't put this in a package within proto2 because we need to make sure -// that the generated code doesn't depend on being in the proto2 namespace. -// In map_test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest; - -// Tests maps. -message TestMap { - map<int32 , int32 > map_int32_int32 = 1; - map<int64 , int64 > map_int64_int64 = 2; - map<uint32 , uint32 > map_uint32_uint32 = 3; - map<uint64 , uint64 > map_uint64_uint64 = 4; - map<sint32 , sint32 > map_sint32_sint32 = 5; - map<sint64 , sint64 > map_sint64_sint64 = 6; - map<fixed32 , fixed32 > map_fixed32_fixed32 = 7; - map<fixed64 , fixed64 > map_fixed64_fixed64 = 8; - map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; - map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; - map<int32 , float > map_int32_float = 11; - map<int32 , double > map_int32_double = 12; - map<bool , bool > map_bool_bool = 13; - map<string , string > map_string_string = 14; - map<int32 , bytes > map_int32_bytes = 15; - map<int32 , MapEnum > map_int32_enum = 16; - map<int32 , ForeignMessage> map_int32_foreign_message = 17; -} - -message TestMapSubmessage { - TestMap test_map = 1; -} - -message TestMessageMap { - map<int32, TestAllTypes> map_int32_message = 1; -} - -// Two map fields share the same entry default instance. -message TestSameTypeMap { - map<int32, int32> map1 = 1; - map<int32, int32> map2 = 2; -} - -enum MapEnum { - MAP_ENUM_FOO = 0; - MAP_ENUM_BAR = 1; - MAP_ENUM_BAZ = 2; -} - -message TestArenaMap { - map<int32 , int32 > map_int32_int32 = 1; - map<int64 , int64 > map_int64_int64 = 2; - map<uint32 , uint32 > map_uint32_uint32 = 3; - map<uint64 , uint64 > map_uint64_uint64 = 4; - map<sint32 , sint32 > map_sint32_sint32 = 5; - map<sint64 , sint64 > map_sint64_sint64 = 6; - map<fixed32 , fixed32 > map_fixed32_fixed32 = 7; - map<fixed64 , fixed64 > map_fixed64_fixed64 = 8; - map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; - map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; - map<int32 , float > map_int32_float = 11; - map<int32 , double > map_int32_double = 12; - map<bool , bool > map_bool_bool = 13; - map<int32 , MapEnum > map_int32_enum = 14; - map<int32 , ForeignMessage> map_int32_foreign_message = 15; -} - -// Previously, message containing enum called Type cannot be used as value of -// map field. -message MessageContainingEnumCalledType { - enum Type { - TYPE_FOO = 0; - } - map<int32, MessageContainingEnumCalledType> type = 1; -} - -// Previously, message cannot contain map field called "entry". -message MessageContainingMapCalledEntry { - map<int32, int32> entry = 1; -} diff --git a/src/google/protobuf/message_unittest.cc b/src/google/protobuf/message_unittest.cc index d328f9dd..a27036e7 100644 --- a/src/google/protobuf/message_unittest.cc +++ b/src/google/protobuf/message_unittest.cc @@ -63,7 +63,7 @@ namespace google { namespace protobuf { -#if defined(_MSC_VER) +#if defined(_WIN32) // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::close; diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 74a41850..9f8255cd 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 45c168b9..ada1a189 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h index 64c838fb..cb4553b1 100644 --- a/src/google/protobuf/stubs/atomicops.h +++ b/src/google/protobuf/stubs/atomicops.h @@ -67,15 +67,16 @@ namespace internal { typedef intptr_t Atomic32; typedef int64 Atomic64; #else - typedef int32 Atomic32; // We need to be able to go between Atomic64 and AtomicWord implicitly. This // means Atomic64 and AtomicWord should be the same type on 64-bit. #if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) // NaCl's intptr_t is not actually 64-bits on 64-bit! // http://code.google.com/p/nativeclient/issues/detail?id=1162 // sparcv9's pointer type is 32bits + typedef intptr_t Atomic32; typedef int64 Atomic64; #else + typedef int32 Atomic32; typedef intptr_t Atomic64; #endif #endif @@ -229,12 +230,6 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); #error GOOGLE_PROTOBUF_ATOMICOPS_ERROR #endif -// On some platforms we need additional declarations to make AtomicWord -// compatible with our other Atomic* types. -#if defined(GOOGLE_PROTOBUF_OS_APPLE) -#include <google/protobuf/stubs/atomicops_internals_atomicword_compat.h> -#endif - #undef GOOGLE_PROTOBUF_ATOMICOPS_ERROR #endif // GOOGLE_PROTOBUF_NO_THREAD_SAFETY diff --git a/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h b/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h deleted file mode 100644 index eb198ff5..00000000 --- a/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +++ /dev/null @@ -1,122 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2012 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 is an internal atomic implementation, use atomicops.h instead. - -#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ -#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ - -// AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32, -// which in turn means int. On some LP32 platforms, intptr_t is an int, but -// on others, it's a long. When AtomicWord and Atomic32 are based on different -// fundamental types, their pointers are incompatible. -// -// This file defines function overloads to allow both AtomicWord and Atomic32 -// data to be used with this interface. -// -// On LP64 platforms, AtomicWord and Atomic64 are both always long, -// so this problem doesn't occur. - -#if !defined(GOOGLE_PROTOBUF_ARCH_64_BIT) - -namespace google { -namespace protobuf { -namespace internal { - -inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return NoBarrier_CompareAndSwap( - reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value); -} - -inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr, - AtomicWord new_value) { - return NoBarrier_AtomicExchange( - reinterpret_cast<volatile Atomic32*>(ptr), new_value); -} - -inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr, - AtomicWord increment) { - return NoBarrier_AtomicIncrement( - reinterpret_cast<volatile Atomic32*>(ptr), increment); -} - -inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr, - AtomicWord increment) { - return Barrier_AtomicIncrement( - reinterpret_cast<volatile Atomic32*>(ptr), increment); -} - -inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return Acquire_CompareAndSwap( - reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value); -} - -inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return Release_CompareAndSwap( - reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value); -} - -inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) { - NoBarrier_Store(reinterpret_cast<volatile Atomic32*>(ptr), value); -} - -inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) { - return Acquire_Store(reinterpret_cast<volatile Atomic32*>(ptr), value); -} - -inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) { - return Release_Store(reinterpret_cast<volatile Atomic32*>(ptr), value); -} - -inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) { - return NoBarrier_Load(reinterpret_cast<volatile const Atomic32*>(ptr)); -} - -inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) { - return Acquire_Load(reinterpret_cast<volatile const Atomic32*>(ptr)); -} - -inline AtomicWord Release_Load(volatile const AtomicWord* ptr) { - return Release_Load(reinterpret_cast<volatile const Atomic32*>(ptr)); -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#endif // !defined(GOOGLE_PROTOBUF_ARCH_64_BIT) - -#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ diff --git a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h index 0b0b06ce..075c406a 100644 --- a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +++ b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h @@ -146,6 +146,14 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { return __atomic_load_n(ptr, __ATOMIC_RELAXED); } +inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + __atomic_compare_exchange_n(ptr, &old_value, new_value, false, + __ATOMIC_RELEASE, __ATOMIC_ACQUIRE); + return old_value; +} + #endif // defined(__LP64__) } // namespace internal diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index ff363482..79bb2396 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -101,27 +101,27 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3004000 +#define GOOGLE_PROTOBUF_VERSION 3005000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3004000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3005000 // 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 = 3004000; +static const int kMinHeaderVersionForLibrary = 3005000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3004000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3005000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 3004000; +static const int kMinHeaderVersionForProtoc = 3005000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. diff --git a/src/google/protobuf/stubs/io_win32.cc b/src/google/protobuf/stubs/io_win32.cc index 7e1cf785..fa2cb8b1 100644 --- a/src/google/protobuf/stubs/io_win32.cc +++ b/src/google/protobuf/stubs/io_win32.cc @@ -39,7 +39,7 @@ // // This file is only used on Windows, it's empty on other platforms. -#if defined(_MSC_VER) +#if defined(_WIN32) // Comment this out to fall back to using the ANSI versions (open, mkdir, ...) // instead of the Unicode ones (_wopen, _wmkdir, ...). Doing so can be useful to @@ -358,5 +358,5 @@ wstring testonly_path_to_winpath(const string& path) { } // namespace protobuf } // namespace google -#endif // defined(_MSC_VER) +#endif // defined(_WIN32) diff --git a/src/google/protobuf/stubs/io_win32.h b/src/google/protobuf/stubs/io_win32.h index a20e64c7..53160089 100644 --- a/src/google/protobuf/stubs/io_win32.h +++ b/src/google/protobuf/stubs/io_win32.h @@ -52,7 +52,6 @@ // Compilers on Windows other than MSVC (e.g. Cygwin, MinGW32) define the // following functions already, except for mkdir. -#ifdef _MSC_VER namespace google { namespace protobuf { namespace internal { @@ -77,9 +76,6 @@ LIBPROTOBUF_EXPORT std::wstring testonly_path_to_winpath( } // namespace internal } // namespace protobuf } // namespace google -#else // _MSC_VER -#define mkdir(name, mode) mkdir(name) -#endif // !_MSC_VER #ifndef W_OK #define W_OK 02 // not defined by MSVC for whatever reason @@ -100,5 +96,3 @@ LIBPROTOBUF_EXPORT std::wstring testonly_path_to_winpath( #endif // defined(_WIN32) #endif // GOOGLE_PROTOBUF_STUBS_IO_WIN32_H__ - - diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index 288f27ab..ce6f7162 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -34,7 +34,7 @@ // // This file is only used on Windows, it's empty on other platforms. -#if defined(_MSC_VER) +#if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include <errno.h> @@ -369,5 +369,5 @@ TEST_F(IoWin32Test, AsWindowsPathTest) { } // namespace protobuf } // namespace google -#endif // defined(_MSC_VER) +#endif // defined(_WIN32) diff --git a/src/google/protobuf/testing/file.cc b/src/google/protobuf/testing/file.cc index f68aba9a..26cb0a67 100644 --- a/src/google/protobuf/testing/file.cc +++ b/src/google/protobuf/testing/file.cc @@ -57,7 +57,7 @@ namespace protobuf { // them like we do below. #endif -#ifdef _MSC_VER +#ifdef _WIN32 using google::protobuf::internal::win32::access; using google::protobuf::internal::win32::chdir; using google::protobuf::internal::win32::fopen; diff --git a/src/google/protobuf/testing/googletest.cc b/src/google/protobuf/testing/googletest.cc index 91f0ef89..c329b6c1 100644 --- a/src/google/protobuf/testing/googletest.cc +++ b/src/google/protobuf/testing/googletest.cc @@ -52,7 +52,7 @@ namespace google { namespace protobuf { -#ifdef _MSC_VER +#ifdef _WIN32 // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::close; diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index b4dbb379..31936ff2 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 9d19d39f..7a2135c4 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. diff --git a/src/google/protobuf/unittest_import_proto3.proto b/src/google/protobuf/unittest_import_proto3.proto deleted file mode 100644 index 59673eaf..00000000 --- a/src/google/protobuf/unittest_import_proto3.proto +++ /dev/null @@ -1,68 +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. -// -// A proto file which is imported by unittest_proto3.proto to test importing. - -syntax = "proto3"; - -// We don't put this in a package within proto2 because we need to make sure -// that the generated code doesn't depend on being in the proto2 namespace. -// In test_util.h we do -// "using namespace unittest_import = protobuf_unittest_import". -package protobuf_unittest_import; - -option optimize_for = SPEED; -option cc_enable_arenas = true; - -// Exercise the java_package option. -option java_package = "com.google.protobuf.test"; -option csharp_namespace = "Google.Protobuf.TestProtos"; - -// Do not set a java_outer_classname here to verify that Proto2 works without -// one. - -// Test public import -import public "google/protobuf/unittest_import_public_proto3.proto"; - -message ImportMessage { - int32 d = 1; -} - -enum ImportEnum { - IMPORT_ENUM_UNSPECIFIED = 0; - IMPORT_FOO = 7; - IMPORT_BAR = 8; - IMPORT_BAZ = 9; -} - diff --git a/src/google/protobuf/unittest_import_public_proto3.proto b/src/google/protobuf/unittest_import_public_proto3.proto deleted file mode 100644 index d6f11e28..00000000 --- a/src/google/protobuf/unittest_import_public_proto3.proto +++ /dev/null @@ -1,42 +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) - -syntax = "proto3"; - -package protobuf_unittest_import; - -option java_package = "com.google.protobuf.test"; -option csharp_namespace = "Google.Protobuf.TestProtos"; - -message PublicImportMessage { - int32 e = 1; -} diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 4d7efec1..18c7a2cd 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -8,12 +8,12 @@ #include <google/protobuf/stubs/common.h> -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #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 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005000 < 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. |