diff options
56 files changed, 291 insertions, 252 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c83da2d6..ea3252bb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,79 @@ +2017-11-13 version 3.5.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.6.0 release. Please join this github issue: + https://github.com/google/protobuf/issues/2780 to provide your feedback. + + General + * Unknown fields are now preserved in proto3 for most of the language + implementations for proto3 by default. See the per-language section for + details. + * reserve keyword are now supported in enums + + C++ + * Proto3 messages are now preserving unknown fields by default. If you rely on + unknowns fields being dropped. Please use DiscardUnknownFields() explicitly. + * Deprecated the unsafe_arena_release_* and unsafe_arena_add_allocated_* + methods for string fields. + * Added move constructor and move assignment to RepeatedField, + RepeatedPtrField and google::protobuf::Any. + * Added perfect forwarding in Arena::CreateMessage + * In-progress experimental support for implicit weak fields with lite protos. + This feature allows the linker to strip out more unused messages and reduce + binary size. + * Various performance optimizations. + + Java + * Proto3 messages are now preserving unknown fields by default. If you’d like + to drop unknown fields, please use the DiscardUnknownFieldsParser API. For + example: + Parser<Foo> parser = DiscardUnknownFieldsParser.wrap(Foo.parser()); + Foo foo = parser.parseFrom(input); + * Added a new CodedInputStream decoder for Iterable<ByteBuffer> with direct + ByteBuffers. + * TextFormat now prints unknown length-delimited fields as messages if + possible. + * FieldMaskUtil.merge() no longer creates unnecessary empty messages when a + message field is unset in both source message and destination message. + * Various performance optimizations. + + Python + * Proto3 messages are now preserving unknown fields by default. Use + message.DiscardUnknownFields() to drop unknown fields. + * Add FieldDescriptor.file in generated code. + * Add descriptor pool FindOneofByName in pure python. + * Change unknown enum values into unknown field set . + * Add more Python dict/list compatibility for Struct/ListValue. + * Add utf-8 support for text_format.Merge()/Parse(). + * Support numeric unknown enum values for proto3 JSON format. + * Add warning for Unexpected end-group tag in cpp extension. + + PHP + * Proto3 messages are now preserving unknown fields. + * Provide well known type messages in runtime. + * Add prefix ‘PB’ to generated class of reserved names. + * Fixed all conformance tests for encode/decode json in php runtime. C + extension needs more work. + + Objective-C + * Fixed some issues around copying of messages with unknown fields and then + mutating the unknown fields in the copy. + + C# + * Added unknown field support in JsonParser. + * Fixed oneof message field merge. + * Simplify parsing messages from array slices. + + Ruby + * Unknown fields are now preserved by default. + * Fixed several bugs for segment fault. + + Javascript + * Decoder can handle both paced and unpacked data no matter how the proto is + defined. + * Decoder now accept long varint for 32 bit integers. + + 2017-08-14 version 3.4.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) Planned Future Changes * There are some changes that are not included in this release but are planned @@ -92,7 +168,7 @@ * Note: AppEngine 2.5 is deprecated on June 2017 that AppEngine 2.5 will never update protobuf runtime. Users who depend on AppEngine 2.5 should use old protoc. - + PHP * Support PHP generic services. Specify file option php_generic_service=true to enable generating service interface. diff --git a/Protobuf.podspec b/Protobuf.podspec index d559d18a..b65ac43c 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.4.1' + s.version = '3.5.0' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/google/protobuf' s.license = '3-Clause BSD License' diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in index deb6de3b..5212d00a 100644 --- a/cmake/extract_includes.bat.in +++ b/cmake/extract_includes.bat.in @@ -83,7 +83,6 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops.h" in copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm64_gcc.h" include\google\protobuf\stubs\atomicops_internals_arm64_gcc.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_gcc.h" include\google\protobuf\stubs\atomicops_internals_arm_gcc.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_qnx.h" include\google\protobuf\stubs\atomicops_internals_arm_qnx.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_atomicword_compat.h" include\google\protobuf\stubs\atomicops_internals_atomicword_compat.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_c11_atomic.h" include\google\protobuf\stubs\atomicops_internals_generic_c11_atomic.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_gcc.h" include\google\protobuf\stubs\atomicops_internals_generic_gcc.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_mips_gcc.h" include\google\protobuf\stubs\atomicops_internals_mips_gcc.h diff --git a/configure.ac b/configure.ac index ae15f5f8..b035ca07 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.4.1],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.5.0],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index c54d4ccd..98c2eae4 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -1842,6 +1842,14 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, "optionalInt64": null, "optionalUint32": null, "optionalUint64": null, + "optionalSint32": null, + "optionalSint64": null, + "optionalFixed32": null, + "optionalFixed64": null, + "optionalSfixed32": null, + "optionalSfixed64": null, + "optionalFloat": null, + "optionalDouble": null, "optionalBool": null, "optionalString": null, "optionalBytes": null, @@ -1851,6 +1859,14 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, "repeatedInt64": null, "repeatedUint32": null, "repeatedUint64": null, + "repeatedSint32": null, + "repeatedSint64": null, + "repeatedFixed32": null, + "repeatedFixed64": null, + "repeatedSfixed32": null, + "repeatedSfixed64": null, + "repeatedFloat": null, + "repeatedDouble": null, "repeatedBool": null, "repeatedString": null, "repeatedBytes": null, diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 5b38241a..7cd9dc59 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ <title>Google Protocol Buffers tools</title> <summary>Tools for Protocol Buffers - Google's data interchange format.</summary> <description>See project site for more info.</description> - <version>3.4.1</version> + <version>3.5.0</version> <authors>Google Inc.</authors> <owners>protobuf-packages</owners> <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl> diff --git a/java/core/pom.xml b/java/core/pom.xml index b0925f74..95f6f7ff 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-parent</artifactId> - <version>3.4.1</version> + <version>3.5.0</version> </parent> <artifactId>protobuf-java</artifactId> diff --git a/java/pom.xml b/java/pom.xml index bc8e89b5..fa0d0e13 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -11,7 +11,7 @@ <groupId>com.google.protobuf</groupId> <artifactId>protobuf-parent</artifactId> - <version>3.4.1</version> + <version>3.5.0</version> <packaging>pom</packaging> <name>Protocol Buffers [Parent]</name> diff --git a/java/util/pom.xml b/java/util/pom.xml index 35afb844..c3f2a69a 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-parent</artifactId> - <version>3.4.1</version> + <version>3.5.0</version> </parent> <artifactId>protobuf-java-util</artifactId> diff --git a/js/package.json b/js/package.json index 5231c846..50ebdac8 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-protobuf", - "version": "3.4.1", + "version": "3.5.0", "description": "Protocol Buffers for JavaScript", "main": "google-protobuf.js", "files": [ diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c index 7e2b3ae6..ae5a61f5 100644 --- a/php/ext/google/protobuf/encode_decode.c +++ b/php/ext/google/protobuf/encode_decode.c @@ -1614,3 +1614,12 @@ PHP_METHOD(Message, mergeFromJsonString) { stackenv_uninit(&se); } } + +PHP_METHOD(Message, discardUnknownFields) { + MessageHeader* msg = UNBOX(MessageHeader, getThis()); + stringsink* unknown = DEREF(message_data(msg), 0, stringsink*); + if (unknown != NULL) { + stringsink_uninit(unknown); + DEREF(message_data(msg), 0, stringsink*) = NULL; + } +} diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 3fce2c17..6db010c5 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -42,6 +42,7 @@ static void hex_to_binary(const char* hex, char** binary, int* binary_len); static zend_function_entry message_methods[] = { PHP_ME(Message, clear, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Message, discardUnknownFields, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, serializeToString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, mergeFromString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, serializeToJsonString, NULL, ZEND_ACC_PUBLIC) diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 4a473801..53aa4c7f 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,11 +10,11 @@ <email>protobuf-opensource@google.com</email> <active>yes</active> </lead> - <date>2017-09-14</date> + <date>2017-11-15</date> <time>11:02:07</time> <version> - <release>3.4.1</release> - <api>3.4.1</api> + <release>3.5.0</release> + <api>3.5.0</api> </version> <stability> <release>stable</release> @@ -168,5 +168,21 @@ GA release. GA release. </notes> </release> + <release> + <version> + <release>3.5.0</release> + <api>3.5.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2017-11-15</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +GA release. + </notes> + </release> </changelog> </package> diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 18343772..bd475144 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.4.1" +#define PHP_PROTOBUF_VERSION "3.5.0" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 @@ -608,48 +608,36 @@ typedef struct Api Api; typedef struct BoolValue BoolValue; typedef struct BytesValue BytesValue; typedef struct Descriptor Descriptor; -typedef struct Descriptor Descriptor; typedef struct DescriptorPool DescriptorPool; typedef struct DoubleValue DoubleValue; typedef struct Duration Duration; -typedef struct Enum Enum; typedef struct EnumDescriptor EnumDescriptor; -typedef struct EnumDescriptor EnumDescriptor; -typedef struct EnumValue EnumValue; -typedef struct EnumValueDescriptor EnumValueDescriptor; +typedef struct Enum Enum; typedef struct EnumValueDescriptor EnumValueDescriptor; -typedef struct Field Field; -typedef struct FieldDescriptor FieldDescriptor; -typedef struct FieldDescriptor FieldDescriptor; -typedef struct FieldMask FieldMask; +typedef struct EnumValue EnumValue; typedef struct Field_Cardinality Field_Cardinality; +typedef struct FieldDescriptor FieldDescriptor; +typedef struct Field Field; typedef struct Field_Kind Field_Kind; +typedef struct FieldMask FieldMask; typedef struct FloatValue FloatValue; typedef struct GPBEmpty GPBEmpty; typedef struct Int32Value Int32Value; typedef struct Int64Value Int64Value; typedef struct InternalDescriptorPool InternalDescriptorPool; typedef struct ListValue ListValue; -typedef struct Map Map; -typedef struct Map Map; -typedef struct MapIter MapIter; typedef struct MapIter MapIter; +typedef struct Map Map; typedef struct MessageField MessageField; -typedef struct MessageField MessageField; -typedef struct MessageHeader MessageHeader; typedef struct MessageHeader MessageHeader; typedef struct MessageLayout MessageLayout; -typedef struct MessageLayout MessageLayout; typedef struct Method Method; typedef struct Mixin Mixin; typedef struct NullValue NullValue; typedef struct Oneof Oneof; -typedef struct Oneof Oneof; typedef struct Option Option; -typedef struct RepeatedField RepeatedField; -typedef struct RepeatedField RepeatedField; -typedef struct RepeatedFieldIter RepeatedFieldIter; typedef struct RepeatedFieldIter RepeatedFieldIter; +typedef struct RepeatedField RepeatedField; typedef struct SourceContext SourceContext; typedef struct StringValue StringValue; typedef struct Struct Struct; @@ -969,6 +957,7 @@ PHP_METHOD(Message, serializeToString); PHP_METHOD(Message, mergeFromString); PHP_METHOD(Message, serializeToJsonString); PHP_METHOD(Message, mergeFromJsonString); +PHP_METHOD(Message, discardUnknownFields); // ----------------------------------------------------------------------------- // Type check / conversion. diff --git a/php/src/Google/Protobuf/Any.php b/php/src/Google/Protobuf/Any.php index 91ba4bd5..f027b05d 100644 --- a/php/src/Google/Protobuf/Any.php +++ b/php/src/Google/Protobuf/Any.php @@ -4,7 +4,6 @@ namespace Google\Protobuf; -use Google\Protobuf\Internal\DescriptorPool; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; use Google\Protobuf\Internal\Message; @@ -217,7 +216,7 @@ class Any extends \Google\Protobuf\Internal\Message substr($this->type_url, $url_prifix_len); // Create message according to fully qualified name. - $pool = DescriptorPool::getGeneratedPool(); + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByProtoName( ".".$fully_qualifed_name); if (is_null($desc)) { throw new \Exception("Class ".$fully_qualifed_name @@ -248,7 +247,7 @@ class Any extends \Google\Protobuf\Internal\Message $this->value = $msg->serializeToString(); // Set type url. - $pool = DescriptorPool::getGeneratedPool(); + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByClassName(get_class($msg)); $fully_qualifed_name = $desc->getFullName(); $this->type_url = GPBUtil::TYPE_URL_PREFIX.substr( @@ -262,7 +261,7 @@ class Any extends \Google\Protobuf\Internal\Message */ public function is($klass) { - $pool = DescriptorPool::getGeneratedPool(); + $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); $desc = $pool->getDescriptorByClassName($klass); $fully_qualifed_name = $desc->getFullName(); $type_url = GPBUtil::TYPE_URL_PREFIX.substr( diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index 9785be30..26d20575 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -577,6 +577,15 @@ class Message } /** + * Clear all unknown fields previously parsed. + * @return null. + */ + public function discardUnknownFields() + { + $this->unknown = ""; + } + + /** * Merges the contents of the specified message into current message. * * This method merges the contents of the specified message into the @@ -833,6 +842,8 @@ class Message } return $value; case GPBType::INT32: + case GPBType::SINT32: + case GPBType::SFIXED32: if (is_null($value)) { return $this->defaultValue($field); } @@ -850,6 +861,7 @@ class Message } return $value; case GPBType::UINT32: + case GPBType::FIXED32: if (is_null($value)) { return $this->defaultValue($field); } @@ -863,6 +875,8 @@ class Message } return $value; case GPBType::INT64: + case GPBType::SINT64: + case GPBType::SFIXED64: if (is_null($value)) { return $this->defaultValue($field); } @@ -880,6 +894,7 @@ class Message } return $value; case GPBType::UINT64: + case GPBType::FIXED64: if (is_null($value)) { return $this->defaultValue($field); } @@ -895,11 +910,6 @@ class Message $value = bcsub($value, "18446744073709551616"); } return $value; - case GPBType::FIXED64: - if (is_null($value)) { - return $this->defaultValue($field); - } - return $value; default: return $value; } diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php index 4dca922b..4512c871 100644 --- a/php/tests/encode_decode_test.php +++ b/php/tests/encode_decode_test.php @@ -466,6 +466,13 @@ class EncodeDecodeTest extends TestBase $m->mergeFromString($from); $to = $m->serializeToString(); $this->assertSame(bin2hex($from), bin2hex($to)); + + $m = new TestMessage(); + $from = hex2bin('F80601'); + $m->mergeFromString($from); + $m->discardUnknownFields(); + $to = $m->serializeToString(); + $this->assertSame("", bin2hex($to)); } public function testJsonEncode() diff --git a/post_process_dist.sh b/post_process_dist.sh index a5f95800..eb5f584d 100755 --- a/post_process_dist.sh +++ b/post_process_dist.sh @@ -27,7 +27,7 @@ fi set -ex -LANGUAGES="cpp csharp java javanano js objectivec python ruby php" +LANGUAGES="cpp csharp java javanano js objectivec python ruby php all" BASENAME=`basename $1 .tar.gz` VERSION=${BASENAME:9} diff --git a/protoc-artifacts/README.md b/protoc-artifacts/README.md index b306c7c3..ba3ca018 100644 --- a/protoc-artifacts/README.md +++ b/protoc-artifacts/README.md @@ -70,9 +70,9 @@ support. DO NOT close the staging repository until you have done the deployment for all platforms. Currently the following platforms are supported: - Linux (x86_32, x86_64 and cross compiled aarch_64) - Windows (x86_32 and x86_64) with - * Cygwin64 with MinGW compilers (x86_64) - * MSYS with MinGW32 (x86_32) - * Cross compile in Linux with MinGW-w64 (x86_32, x86_64) + - Cygwin64 with MinGW compilers (x86_64) + - MSYS with MinGW32 (x86_32) + - Cross compile in Linux with MinGW-w64 (x86_32, x86_64) - MacOSX (x86_32 and x86_64) As for MSYS2/MinGW64 for Windows: protoc will build, but it insists on @@ -177,8 +177,9 @@ stored: ### Tested build environments We have successfully built artifacts on the following environments: - Linux x86_32 and x86_64: - - Centos 6.6 (within Docker 1.6.1) - - Ubuntu 14.04.2 64-bit + - Centos 6.6 (within Docker 1.6.1) + - Ubuntu 14.04.2 64-bit +- Linux aarch_64: Cross compiled with `g++-aarch64-linux-gnu` on Ubuntu 14.04.2 64-bit - Windows x86_32: MSYS with ``mingw32-gcc-g++ 4.8.1-4`` on Windows 7 64-bit - Windows x86_32: Cross compile with ``i686-w64-mingw32-g++ 4.8.2`` on Ubuntu 14.04.2 64-bit - Windows x86_64: Cygwin64 with ``mingw64-x86_64-gcc-g++ 4.8.3-1`` on Windows 7 64-bit diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh index 57523a41..fe1dec24 100755 --- a/protoc-artifacts/build-protoc.sh +++ b/protoc-artifacts/build-protoc.sh @@ -6,6 +6,12 @@ # Usage: build-protoc.sh <OS> <ARCH> <TARGET> # <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin # <TARGET> can be "protoc" or "protoc-gen-javalite" +# +# The script now supports cross-compiling windows and linux-arm64 in linux-x86 +# environment. Required packages: +# - Windows: i686-w64-mingw32-gcc (32bit) and x86_64-w64-mingw32-gcc (64bit) +# - Arm64: g++-aarch64-linux-gnu + OS=$1 ARCH=$2 MAKE_TARGET=$3 @@ -73,6 +79,8 @@ checkArch () assertEq $format "elf32-i386" $LINENO elif [[ "$ARCH" == x86_64 ]]; then assertEq $format "elf64-x86-64" $LINENO + elif [[ "$ARCH" == aarch_64 ]]; then + assertEq $format "elf64-little" $LINENO else fail "Unsupported arch: $ARCH" fi @@ -116,6 +124,9 @@ checkDependencies () white_list="linux-gate\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux\.so\.2" elif [[ "$ARCH" == x86_64 ]]; then white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-x86-64\.so\.2" + elif [[ "$ARCH" == aarch_64 ]]; then + dump_cmd='objdump -p '"$1"' | grep NEEDED' + white_list="libpthread\.so\.0\|libc\.so\.6\|ld-linux-aarch64\.so\.1" fi elif [[ "$OS" == osx ]]; then dump_cmd='otool -L '"$1"' | fgrep dylib' @@ -180,6 +191,8 @@ elif [[ "$(uname)" == Linux* ]]; then CXXFLAGS="$CXXFLAGS -m64" elif [[ "$ARCH" == x86_32 ]]; then CXXFLAGS="$CXXFLAGS -m32" + elif [[ "$ARCH" == aarch_64 ]]; then + CONFIGURE_ARGS="$CONFIGURE_ARGS --host=aarch64-linux-gnu" else fail "Unsupported arch: $ARCH" fi diff --git a/protoc-artifacts/build-zip.sh b/protoc-artifacts/build-zip.sh index a124ed7c..f08e2758 100755 --- a/protoc-artifacts/build-zip.sh +++ b/protoc-artifacts/build-zip.sh @@ -13,12 +13,13 @@ Example: This script will download pre-built protoc or protoc plugin binaries from maven repository and create .zip packages suitable to be included in the github release page. If the target is protoc, well-known type .proto files will also be -included. Each invocation will create 5 zip packages: +included. Each invocation will create 6 zip packages: dist/<TARGET>-<VERSION_NUMBER>-win32.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip + dist/<TARGET>-<VERSION_NUMBER>-linux-aarch_64.zip EOF exit 1 fi @@ -33,6 +34,7 @@ declare -a FILE_NAMES=( \ osx-x86_64.zip osx-x86_64.exe \ linux-x86_32.zip linux-x86_32.exe \ linux-x86_64.zip linux-x86_64.exe \ + linux-aarch_64.zip linux-aarch_64.exe \ ) # List of all well-known types to be included. diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index c6f5a77f..742fab93 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>com.google.protobuf</groupId> <artifactId>protoc</artifactId> - <version>3.4.1</version> + <version>3.5.0</version> <packaging>pom</packaging> <name>Protobuf Compiler</name> <description> diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 9f1a4f19..0f4d63b0 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,7 +30,7 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.4.1' +__version__ = '3.5.0.post1' if __name__ != '__main__': try: diff --git a/python/google/protobuf/descriptor_pool.py b/python/google/protobuf/descriptor_pool.py index cb7146b6..f4c533a4 100644 --- a/python/google/protobuf/descriptor_pool.py +++ b/python/google/protobuf/descriptor_pool.py @@ -127,6 +127,9 @@ class DescriptorPool(object): self._service_descriptors = {} self._file_descriptors = {} self._toplevel_extensions = {} + # TODO(jieluo): Remove _file_desc_by_toplevel_extension after + # maybe year 2020 for compatibility issue (with 3.4.1 only). + self._file_desc_by_toplevel_extension = {} # We store extensions in two two-level mappings: The first key is the # descriptor of the message being extended, the second key is the extension # full name or its tag number. @@ -252,6 +255,12 @@ class DescriptorPool(object): """ self._AddFileDescriptor(file_desc) + # TODO(jieluo): This is a temporary solution for FieldDescriptor.file. + # FieldDescriptor.file is added in code gen. Remove this solution after + # maybe 2020 for compatibility reason (with 3.4.1 only). + for extension in file_desc.extensions_by_name.values(): + self._file_desc_by_toplevel_extension[ + extension.full_name] = file_desc def _AddFileDescriptor(self, file_desc): """Adds a FileDescriptor to the pool, non-recursively. @@ -331,7 +340,7 @@ class DescriptorPool(object): pass try: - return self._toplevel_extensions[symbol].file + return self._file_desc_by_toplevel_extension[symbol] except KeyError: pass diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 96606f06..c3963822 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.4.1.1" + s.version = "3.5.0" s.licenses = ["BSD-3-Clause"] s.summary = "Protocol Buffers" s.description = "Protocol Buffers are Google's data interchange format." diff --git a/src/Makefile.am b/src/Makefile.am index 9df104cc..261ab3e7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -71,7 +71,6 @@ nobase_include_HEADERS = \ google/protobuf/stubs/atomicops_internals_arm64_gcc.h \ google/protobuf/stubs/atomicops_internals_arm_gcc.h \ google/protobuf/stubs/atomicops_internals_arm_qnx.h \ - google/protobuf/stubs/atomicops_internals_atomicword_compat.h \ google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h \ google/protobuf/stubs/atomicops_internals_generic_gcc.h \ google/protobuf/stubs/atomicops_internals_mips_gcc.h \ @@ -183,7 +182,7 @@ nobase_include_HEADERS = \ lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS) -libprotobuf_lite_la_LDFLAGS = -version-info 14:0:0 -export-dynamic -no-undefined +libprotobuf_lite_la_LDFLAGS = -version-info 15:0:0 -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 @@ -232,7 +231,7 @@ libprotobuf_lite_la_SOURCES = \ google/protobuf/io/zero_copy_stream_impl_lite.cc libprotobuf_la_LIBADD = $(PTHREAD_LIBS) -libprotobuf_la_LDFLAGS = -version-info 14:0:0 -export-dynamic -no-undefined +libprotobuf_la_LDFLAGS = -version-info 15:0:0 -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map @@ -323,7 +322,7 @@ libprotobuf_la_SOURCES = \ nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la -libprotoc_la_LDFLAGS = -version-info 14:0:0 -export-dynamic -no-undefined +libprotoc_la_LDFLAGS = -version-info 15:0:0 -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 20a1cbed..580acc6a 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 e74528e1..26af28fb 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 8f92b6ae..c3d96e83 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 ee3ad7d7..1a35681b 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 0489df43..555122aa 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 1d7c5887..b7f32f4e 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 3275dc54..9b9032c4 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/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 1e5499ca..fdab394c 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 83b7da6d..36b56e95 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/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 4ec7f0a0..3d5ee5ca 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 85bd660f..e080339e 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/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index be49c3ec..9c1ed5f2 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. |