Skip to content

Commit

Permalink
Bug 1782859 - Update protobuf to version 21.4. r=markh
Browse files Browse the repository at this point in the history
  • Loading branch information
rvandermeulen committed Aug 3, 2022
1 parent 2fcc83a commit e0fe0f6
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion devtools/shared/heapsnapshot/CoreDump.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion toolkit/components/protobuf/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Protocol Buffers (protobuf) source is available at:
This code is covered under the BSD license (see COPYING.txt). Documentation is
available at https://developers.google.com/protocol-buffers/.

The tree's current version of the protobuf library is 21.2.
The tree's current version of the protobuf library is 21.4.

We do not include the protobuf tests or the protoc compiler.

Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/protobuf/src/google/protobuf/any.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion toolkit/components/protobuf/src/google/protobuf/api.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ namespace internal {

namespace {

// Enforce that allocated data aligns to at least 8 bytes, and that
// TaggedStringPtr::Flags uses the lower 2 bits as tags.
// Enforce that allocated data aligns to at least 4 bytes, and that
// the alignment of the global const string value does as well.
// The alignment guaranteed by `new std::string` depends on both:
// - new align = __STDCPP_DEFAULT_NEW_ALIGNMENT__ / max_align_t
Expand All @@ -64,8 +65,8 @@ constexpr size_t kNewAlign = alignof(std::max_align_t);
#endif
constexpr size_t kStringAlign = alignof(std::string);

static_assert((kStringAlign > kNewAlign ? kStringAlign : kNewAlign) >= 8, "");
static_assert(alignof(ExplicitlyConstructedArenaString) >= 8, "");
static_assert((kStringAlign > kNewAlign ? kStringAlign : kNewAlign) >= 4, "");
static_assert(alignof(ExplicitlyConstructedArenaString) >= 4, "");

} // namespace

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion toolkit/components/protobuf/src/google/protobuf/empty.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -520,18 +520,14 @@ void GenericTypeHandler<std::string>::Merge(const std::string& from,
*to = from;
}

// Non-inline implementations of InternalMetadata routines
#if defined(NDEBUG) || defined(_MSC_VER)
// for opt and MSVC builds, the destructor is defined in the header.
#else
// Non-inline implementations of InternalMetadata destructor
// This is moved out of the header because the GOOGLE_DCHECK produces a lot of code.
InternalMetadata::~InternalMetadata() {
void InternalMetadata::CheckedDestruct() {
if (HasMessageOwnedArenaTag()) {
GOOGLE_DCHECK(!HasUnknownFieldsTag());
delete reinterpret_cast<Arena*>(ptr_ - kMessageOwnedArenaTagMask);
}
}
#endif

// Non-inline variants of std::string specializations for
// various InternalMetadata routines.
Expand Down
13 changes: 10 additions & 3 deletions toolkit/components/protobuf/src/google/protobuf/metadata_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,19 @@ class PROTOBUF_EXPORT InternalMetadata {
GOOGLE_DCHECK(!is_message_owned || arena != nullptr);
}

#if defined(NDEBUG) || defined(_MSC_VER)
// To keep the ABI identical between debug and non-debug builds,
// the destructor is always defined here even though it may delegate
// to a non-inline private method.
// (see https://github.com/protocolbuffers/protobuf/issues/9947)
~InternalMetadata() {
#if defined(NDEBUG) || defined(_MSC_VER)
if (HasMessageOwnedArenaTag()) {
delete reinterpret_cast<Arena*>(ptr_ - kMessageOwnedArenaTagMask);
}
}
#else
~InternalMetadata();
CheckedDestruct();
#endif
}

template <typename T>
void Delete() {
Expand Down Expand Up @@ -261,6 +265,9 @@ class PROTOBUF_EXPORT InternalMetadata {
PROTOBUF_NOINLINE void DoSwap(T* other) {
mutable_unknown_fields<T>()->Swap(other);
}

// Private helper with debug checks for ~InternalMetadata()
void CheckedDestruct();
};

// String Template specializations.
Expand Down
11 changes: 8 additions & 3 deletions toolkit/components/protobuf/src/google/protobuf/port_def.inc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
#ifdef PROTOBUF_VERSION
#error PROTOBUF_VERSION was previously defined
#endif
#define PROTOBUF_VERSION 3021002
#define PROTOBUF_VERSION 3021004

#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
Expand Down Expand Up @@ -638,21 +638,26 @@
#ifdef PROTOBUF_CONSTINIT
#error PROTOBUF_CONSTINIT was previously defined
#endif
#if defined(__cpp_constinit)
#if defined(__cpp_constinit) && !defined(_MSC_VER)
#define PROTOBUF_CONSTINIT constinit
#define PROTOBUF_CONSTEXPR constexpr
// Some older Clang versions incorrectly raise an error about
// constant-initializing weak default instance pointers. Versions 12.0 and
// higher seem to work, except that XCode 12.5.1 shows the error even though it
// uses Clang 12.0.5.
#elif __has_cpp_attribute(clang::require_constant_initialization) && \
// Clang-cl on Windows raises error also.
#elif !defined(_MSC_VER) && __has_cpp_attribute(clang::require_constant_initialization) && \
((defined(__APPLE__) && __clang_major__ >= 13) || \
(!defined(__APPLE__) && __clang_major__ >= 12))
#define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]
#define PROTOBUF_CONSTEXPR constexpr
#elif PROTOBUF_GNUC_MIN(12, 2)
#define PROTOBUF_CONSTINIT __constinit
#define PROTOBUF_CONSTEXPR constexpr
// MSVC 17 currently seems to raise an error about constant-initialized pointers.
#elif defined(_MSC_VER) && _MSC_VER >= 1930
#define PROTOBUF_CONSTINIT
#define PROTOBUF_CONSTEXPR constexpr
#else
#define PROTOBUF_CONSTINIT
#define PROTOBUF_CONSTEXPR
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ 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 3021002
#define GOOGLE_PROTOBUF_VERSION 3021004

// A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion toolkit/components/protobuf/src/google/protobuf/type.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion toolkit/components/viaduct/fetch_msg_types.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0fe0f6

Please sign in to comment.