From 97dd175a917fcdf1a0e0421659498a974f3a464a Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Thu, 2 Nov 2017 14:16:22 -0700 Subject: Update version number to 3.5.0 --- src/Makefile.am | 6 +++--- src/google/protobuf/stubs/common.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 73abb7f2..bff3ae5a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -183,7 +183,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 +232,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 +323,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/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. -- cgit v1.2.3 From 19080127104b24c3448bc8f9ecc736fd9967d9e3 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Thu, 2 Nov 2017 14:29:02 -0700 Subject: Update generated descritpors. --- src/google/protobuf/any.pb.h | 4 ++-- src/google/protobuf/api.pb.h | 4 ++-- src/google/protobuf/compiler/plugin.pb.h | 4 ++-- src/google/protobuf/descriptor.pb.h | 4 ++-- src/google/protobuf/duration.pb.h | 4 ++-- src/google/protobuf/empty.pb.h | 4 ++-- src/google/protobuf/field_mask.pb.h | 4 ++-- src/google/protobuf/source_context.pb.h | 4 ++-- src/google/protobuf/struct.pb.h | 4 ++-- src/google/protobuf/timestamp.pb.h | 4 ++-- src/google/protobuf/type.pb.h | 4 ++-- src/google/protobuf/wrappers.pb.h | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') 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 -#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 -#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/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 -#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 -#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 -#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 -#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 -#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/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 -#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 -#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/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 -#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 -#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 -#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. -- cgit v1.2.3 From 181e284b55dd234320b0e4fd5fbc81a5dfa6b580 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Wed, 8 Nov 2017 15:27:48 -0800 Subject: Fix Atomic32/AtomicWord on some platforms. - Removed the redefination in the atomicword_compat.h. Now Atomic32 will alwyas be intptr_t in 32bit platforms, the bridge is no longer needed. - Change NaCl 64bit to use intptr_t instead of int32 for Atomic32, otherwise AtmoicWord APIs will miss the definations. After this change, the AtmoicWord will always be either Atomic32 or Atmoic64 depending on the platforms. --- cmake/extract_includes.bat.in | 1 - src/Makefile.am | 1 - src/google/protobuf/stubs/atomicops.h | 9 +- .../stubs/atomicops_internals_atomicword_compat.h | 122 --------------------- 4 files changed, 2 insertions(+), 131 deletions(-) delete mode 100644 src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h (limited to 'src') 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/src/Makefile.am b/src/Makefile.am index bff3ae5a..1d651dc8 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 \ 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 -#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(ptr), old_value, new_value); -} - -inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr, - AtomicWord new_value) { - return NoBarrier_AtomicExchange( - reinterpret_cast(ptr), new_value); -} - -inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr, - AtomicWord increment) { - return NoBarrier_AtomicIncrement( - reinterpret_cast(ptr), increment); -} - -inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr, - AtomicWord increment) { - return Barrier_AtomicIncrement( - reinterpret_cast(ptr), increment); -} - -inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return Acquire_CompareAndSwap( - reinterpret_cast(ptr), old_value, new_value); -} - -inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return Release_CompareAndSwap( - reinterpret_cast(ptr), old_value, new_value); -} - -inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) { - NoBarrier_Store(reinterpret_cast(ptr), value); -} - -inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) { - return Acquire_Store(reinterpret_cast(ptr), value); -} - -inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) { - return Release_Store(reinterpret_cast(ptr), value); -} - -inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) { - return NoBarrier_Load(reinterpret_cast(ptr)); -} - -inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) { - return Acquire_Load(reinterpret_cast(ptr)); -} - -inline AtomicWord Release_Load(volatile const AtomicWord* ptr) { - return Release_Load(reinterpret_cast(ptr)); -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#endif // !defined(GOOGLE_PROTOBUF_ARCH_64_BIT) - -#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_ -- cgit v1.2.3 From 662e8b20bcc67ff11bd8a8a514484481b7e68839 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 8 Nov 2017 15:39:47 -0800 Subject: Provide util funtions to figure out correct php class names. (#3850) --- src/google/protobuf/compiler/php/php_generator.cc | 36 +++++++++++++++++------ src/google/protobuf/compiler/php/php_generator.h | 9 ++++++ 2 files changed, 36 insertions(+), 9 deletions(-) (limited to 'src') 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 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 +#include #include @@ -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 -- cgit v1.2.3 From 9c197b7ecba6019b7c81c673cf100b2fad4033ad Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 10 Nov 2017 10:28:14 -0800 Subject: Support win32 long path for cross compiled build --- src/google/protobuf/compiler/command_line_interface.cc | 2 +- .../compiler/command_line_interface_unittest.cc | 2 +- src/google/protobuf/compiler/importer.cc | 2 +- .../protobuf/compiler/objectivec/objectivec_helpers.cc | 17 +++++++++++------ src/google/protobuf/compiler/plugin.cc | 2 +- src/google/protobuf/io/zero_copy_stream_impl.cc | 3 --- src/google/protobuf/io/zero_copy_stream_unittest.cc | 3 --- src/google/protobuf/message_unittest.cc | 2 +- src/google/protobuf/stubs/io_win32.cc | 4 ++-- src/google/protobuf/stubs/io_win32.h | 6 ------ src/google/protobuf/stubs/io_win32_unittest.cc | 4 ++-- src/google/protobuf/testing/file.cc | 2 +- src/google/protobuf/testing/googletest.cc | 2 +- 13 files changed, 22 insertions(+), 29 deletions(-) (limited to 'src') 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 , 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 , 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 , 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 #include -#if defined(_MSC_VER) -// DO NOT include , 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 { +// 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/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 , 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/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 , 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 , 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 , 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/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 @@ -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 , instead create functions in io_win32.{h,cc} and import // them like we do below. using google::protobuf::internal::win32::close; -- cgit v1.2.3 From aa77eab622fe0ccc6cf7ec8a3fce1005dd759562 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Fri, 10 Nov 2017 09:50:02 +0000 Subject: Move C#-only test protos to csharp/protos unittest_proto3 had been changed in a very backward-incompatible way which was never going to work with C# as it imports proto2 messages. This is now a copy of the old file, but with a package name change for compatibility with the remaining files in src/google/protobuf. The other moves are for files that are only used by C#. --- Makefile.am | 5 + csharp/generate_protos.sh | 30 +- csharp/protos/README.md | 3 + csharp/protos/map_unittest_proto3.proto | 117 ++++++ csharp/protos/unittest_import_proto3.proto | 68 ++++ csharp/protos/unittest_import_public_proto3.proto | 42 +++ csharp/protos/unittest_proto3.proto | 391 +++++++++++++++++++++ src/Makefile.am | 3 - src/google/protobuf/map_unittest_proto3.proto | 120 ------- src/google/protobuf/unittest_import_proto3.proto | 68 ---- .../protobuf/unittest_import_public_proto3.proto | 42 --- 11 files changed, 637 insertions(+), 252 deletions(-) create mode 100644 csharp/protos/README.md create mode 100644 csharp/protos/map_unittest_proto3.proto create mode 100644 csharp/protos/unittest_import_proto3.proto create mode 100644 csharp/protos/unittest_import_public_proto3.proto create mode 100644 csharp/protos/unittest_proto3.proto delete mode 100644 src/google/protobuf/map_unittest_proto3.proto delete mode 100644 src/google/protobuf/unittest_import_proto3.proto delete mode 100644 src/google/protobuf/unittest_import_public_proto3.proto (limited to 'src') diff --git a/Makefile.am b/Makefile.am index cd1cfc3e..fa652ee5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,8 +61,13 @@ csharp_EXTRA_DIST= \ csharp/keys/Google.Protobuf.public.snk \ csharp/keys/Google.Protobuf.snk \ csharp/keys/README.md \ + csharp/protos/README.md \ + csharp/protos/map_unittest_proto3.proto \ csharp/protos/unittest_custom_options_proto3.proto \ + csharp/protos/unittest_import_public_proto3.proto \ + csharp/protos/unittest_import_proto3.proto \ csharp/protos/unittest_issues.proto \ + csharp/protos/unittest_proto3.proto \ csharp/src/AddressBook/AddPerson.cs \ csharp/src/AddressBook/Addressbook.cs \ csharp/src/AddressBook/AddressBook.csproj \ diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index d2f47479..5c748e35 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -3,7 +3,7 @@ # You first need to make sure protoc has been built (see instructions on # building protoc in root of this repository) -set -ex +set -e # cd to repository root pushd $(dirname $0)/.. @@ -40,28 +40,20 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ src/google/protobuf/type.proto \ src/google/protobuf/wrappers.proto -# Test protos where the namespace matches the target location -$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \ - --csharp_opt=base_namespace=Google.Protobuf \ - src/google/protobuf/map_unittest_proto3.proto \ - src/google/protobuf/unittest_proto3.proto \ - src/google/protobuf/unittest_import_proto3.proto \ - src/google/protobuf/unittest_import_public_proto3.proto \ - src/google/protobuf/unittest_well_known_types.proto - -# Different base namespace to the protos above -$PROTOC -Isrc -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ - --csharp_opt=base_namespace=UnitTest.Issues \ +# Test protos +$PROTOC -Isrc -Icsharp/protos \ + --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + csharp/protos/map_unittest_proto3.proto \ csharp/protos/unittest_issues.proto \ - csharp/protos/unittest_custom_options_proto3.proto - -# Don't specify a base namespace at all; we just want to make sure the -# results end up in TestProtos. -$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + csharp/protos/unittest_custom_options_proto3.proto \ + csharp/protos/unittest_proto3.proto \ + csharp/protos/unittest_import_proto3.proto \ + csharp/protos/unittest_import_public_proto3.proto \ + src/google/protobuf/unittest_well_known_types.proto \ src/google/protobuf/test_messages_proto3.proto # AddressBook sample protos -$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ +$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ examples/addressbook.proto $PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \ diff --git a/csharp/protos/README.md b/csharp/protos/README.md new file mode 100644 index 00000000..bdd66fcf --- /dev/null +++ b/csharp/protos/README.md @@ -0,0 +1,3 @@ +This directory contains unit test protos adapted from those in +src/google/protobuf, and C#-specific test protos for regression +tests against bugs found in the C# codegen or library. diff --git a/csharp/protos/map_unittest_proto3.proto b/csharp/protos/map_unittest_proto3.proto new file mode 100644 index 00000000..1909f0b2 --- /dev/null +++ b/csharp/protos/map_unittest_proto3.proto @@ -0,0 +1,117 @@ +// 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 "unittest_proto3.proto"; + +package protobuf_unittest3; + +// Tests maps. +message TestMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_string_string = 14; + map map_int32_bytes = 15; + map map_int32_enum = 16; + map map_int32_foreign_message = 17; +} + +message TestMapSubmessage { + TestMap test_map = 1; +} + +message TestMessageMap { + map map_int32_message = 1; +} + +// Two map fields share the same entry default instance. +message TestSameTypeMap { + map map1 = 1; + map map2 = 2; +} + +enum MapEnum { + MAP_ENUM_FOO = 0; + MAP_ENUM_BAR = 1; + MAP_ENUM_BAZ = 2; +} + +message TestArenaMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_int32_enum = 14; + map 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 type = 1; +} + +// Previously, message cannot contain map field called "entry". +message MessageContainingMapCalledEntry { + map entry = 1; +} diff --git a/csharp/protos/unittest_import_proto3.proto b/csharp/protos/unittest_import_proto3.proto new file mode 100644 index 00000000..f5fb3bc2 --- /dev/null +++ b/csharp/protos/unittest_import_proto3.proto @@ -0,0 +1,68 @@ +// 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 "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/csharp/protos/unittest_import_public_proto3.proto b/csharp/protos/unittest_import_public_proto3.proto new file mode 100644 index 00000000..d6f11e28 --- /dev/null +++ b/csharp/protos/unittest_import_public_proto3.proto @@ -0,0 +1,42 @@ +// 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/csharp/protos/unittest_proto3.proto b/csharp/protos/unittest_proto3.proto new file mode 100644 index 00000000..2277bb50 --- /dev/null +++ b/csharp/protos/unittest_proto3.proto @@ -0,0 +1,391 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. + +syntax = "proto3"; + +// Some generic_services option(s) added automatically. +// See: http://go/proto2-generic-services-default +option cc_generic_services = true; // auto-added +option java_generic_services = true; // auto-added +option py_generic_services = true; // auto-added +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "unittest_import_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 test_util.h we do "using namespace unittest = protobuf_unittest". +package protobuf_unittest3; + +// Protos optimized for SPEED use a strict superset of the generated code +// of equivalent ones optimized for CODE_SIZE, so we should optimize all our +// tests for speed unless explicitly testing code size optimization. +option optimize_for = SPEED; + +option java_outer_classname = "UnittestProto"; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + NESTED_ENUM_UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 single_int32 = 1; + int64 single_int64 = 2; + uint32 single_uint32 = 3; + uint64 single_uint64 = 4; + sint32 single_sint32 = 5; + sint64 single_sint64 = 6; + fixed32 single_fixed32 = 7; + fixed64 single_fixed64 = 8; + sfixed32 single_sfixed32 = 9; + sfixed64 single_sfixed64 = 10; + float single_float = 11; + double single_double = 12; + bool single_bool = 13; + string single_string = 14; + bytes single_bytes = 15; + + NestedMessage single_nested_message = 18; + ForeignMessage single_foreign_message = 19; + protobuf_unittest_import.ImportMessage single_import_message = 20; + + NestedEnum single_nested_enum = 21; + ForeignEnum single_foreign_enum = 22; + protobuf_unittest_import.ImportEnum single_import_enum = 23; + + // Defined in unittest_import_public.proto + protobuf_unittest_import.PublicImportMessage + single_public_import_message = 26; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // Defined in unittest_import_public.proto + repeated protobuf_unittest_import.PublicImportMessage + repeated_public_import_message = 54; + + // For oneof test + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + } +} + +// This proto includes a recusively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; +} + +message TestDeprecatedFields { + int32 deprecated_int32 = 1 [deprecated=true]; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_UNSPECIFIED = 0; + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} + +message TestReservedFields { + reserved 2, 15, 9 to 11; + reserved "bar", "baz"; +} + + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + TestAllTypes.NestedMessage foreign_nested = 1; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + int32 a = 1; + int32 bb = 268435455; +} + +message TestRecursiveMessage { + TestRecursiveMessage a = 1; + int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + TestMutualRecursionB bb = 1; +} + +message TestMutualRecursionB { + TestMutualRecursionA a = 1; + int32 optional_int32 = 2; +} + +message TestEnumAllowAlias { + TestEnumWithDupValue value = 1; +} + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0; + option allow_alias = true; + + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + TEST_SPARSE_ENUM_UNSPECIFIED = 0; + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + // In proto3, value 0 must be the first one specified + // SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + int32 PrimitiveField = 1; + string StringField = 2; + ForeignEnum EnumField = 3; + ForeignMessage MessageField = 4; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; +} + + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + string my_string = 11; + int64 my_int = 1; + float my_float = 101; + message NestedMessage { + int64 oo = 2; + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + NestedMessage single_nested_message = 200; +} + +message SparseEnumMessage { + TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + string data = 1; +} + +message MoreString { + repeated string data = 1; +} + +message OneBytes { + bytes data = 1; +} + +message MoreBytes { + bytes data = 1; +} + +// Test int32, uint32, int64, uint64, and bool are all compatible +message Int32Message { + int32 data = 1; +} + +message Uint32Message { + uint32 data = 1; +} + +message Int64Message { + int64 data = 1; +} + +message Uint64Message { + uint64 data = 1; +} + +message BoolMessage { + bool data = 1; +} + +// Test oneofs. +message TestOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90 [packed = false]; + repeated int64 unpacked_int64 = 91 [packed = false]; + repeated uint32 unpacked_uint32 = 92 [packed = false]; + repeated uint64 unpacked_uint64 = 93 [packed = false]; + repeated sint32 unpacked_sint32 = 94 [packed = false]; + repeated sint64 unpacked_sint64 = 95 [packed = false]; + repeated fixed32 unpacked_fixed32 = 96 [packed = false]; + repeated fixed64 unpacked_fixed64 = 97 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; + repeated float unpacked_float = 100 [packed = false]; + repeated double unpacked_double = 101 [packed = false]; + repeated bool unpacked_bool = 102 [packed = false]; + repeated ForeignEnum unpacked_enum = 103 [packed = false]; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + +message TestCommentInjectionMessage { + // */ <- This should not close the generated doc comment + string a = 1; +} + + +// Test that RPC services work. +message FooRequest {} +message FooResponse {} + +message FooClientMessage {} +message FooServerMessage{} + +service TestService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + + +message BarRequest {} +message BarResponse {} + diff --git a/src/Makefile.am b/src/Makefile.am index 73abb7f2..9df104cc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -587,11 +587,8 @@ EXTRA_DIST = \ $(js_well_known_types_sources) \ solaris/libstdc++.la \ google/protobuf/unittest_proto3.proto \ - google/protobuf/unittest_import_public_proto3.proto \ - google/protobuf/unittest_import_proto3.proto \ google/protobuf/test_messages_proto3.proto \ google/protobuf/test_messages_proto2.proto \ - google/protobuf/map_unittest_proto3.proto \ google/protobuf/io/gzip_stream.h \ google/protobuf/io/gzip_stream_unittest.sh \ google/protobuf/testdata/golden_message \ 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 map_int32_int32 = 1; - map map_int64_int64 = 2; - map map_uint32_uint32 = 3; - map map_uint64_uint64 = 4; - map map_sint32_sint32 = 5; - map map_sint64_sint64 = 6; - map map_fixed32_fixed32 = 7; - map map_fixed64_fixed64 = 8; - map map_sfixed32_sfixed32 = 9; - map map_sfixed64_sfixed64 = 10; - map map_int32_float = 11; - map map_int32_double = 12; - map map_bool_bool = 13; - map map_string_string = 14; - map map_int32_bytes = 15; - map map_int32_enum = 16; - map map_int32_foreign_message = 17; -} - -message TestMapSubmessage { - TestMap test_map = 1; -} - -message TestMessageMap { - map map_int32_message = 1; -} - -// Two map fields share the same entry default instance. -message TestSameTypeMap { - map map1 = 1; - map map2 = 2; -} - -enum MapEnum { - MAP_ENUM_FOO = 0; - MAP_ENUM_BAR = 1; - MAP_ENUM_BAZ = 2; -} - -message TestArenaMap { - map map_int32_int32 = 1; - map map_int64_int64 = 2; - map map_uint32_uint32 = 3; - map map_uint64_uint64 = 4; - map map_sint32_sint32 = 5; - map map_sint64_sint64 = 6; - map map_fixed32_fixed32 = 7; - map map_fixed64_fixed64 = 8; - map map_sfixed32_sfixed32 = 9; - map map_sfixed64_sfixed64 = 10; - map map_int32_float = 11; - map map_int32_double = 12; - map map_bool_bool = 13; - map map_int32_enum = 14; - map 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 type = 1; -} - -// Previously, message cannot contain map field called "entry". -message MessageContainingMapCalledEntry { - map entry = 1; -} 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; -} -- cgit v1.2.3 From 642e1ac635f2563b4a14c255374f02645ae85dac Mon Sep 17 00:00:00 2001 From: Nayana-ibm Date: Mon, 27 Nov 2017 05:43:30 -0500 Subject: Adding Release_CompareAndSwap 64-bit variant --- src/google/protobuf/stubs/atomicops_internals_generic_gcc.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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 -- cgit v1.2.3 From 1b1d1ea340c12c9fd030dac7581af4f30a850941 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Mon, 27 Nov 2017 17:00:49 -0800 Subject: Added back in LIBPROTOC_EXPORT which was removed by mistake --- src/google/protobuf/compiler/code_generator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h index 4b1d90b8..4c2b3ee1 100644 --- a/src/google/protobuf/compiler/code_generator.h +++ b/src/google/protobuf/compiler/code_generator.h @@ -166,7 +166,7 @@ typedef GeneratorContext OutputDirectory; // "foo=bar,baz,qux=corge" // parses to the pairs: // ("foo", "bar"), ("baz", ""), ("qux", "corge") -void ParseGeneratorParameter( +LIBPROTOC_EXPORT void ParseGeneratorParameter( const string&, std::vector >*); } // namespace compiler -- cgit v1.2.3