Skip to content

Commit

Permalink
Let protobuf's GOOGLE_COMPILE_ASSERT use static_assert.
Browse files Browse the repository at this point in the history
This merges protocolbuffers/protobuf#621

BUG=411648

Review URL: https://codereview.chromium.org/1242603003

Cr-Commit-Position: refs/heads/master@{#339353}
  • Loading branch information
nico authored and JulienIsorce committed Jul 27, 2015
1 parent e35efe6 commit 4c68f94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions third_party/protobuf/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ A BUILD.gn file has been added for building with GN.
Cherry-pick pherl changes to make protobuf build on VS2015.

Cherry-pick c3cb53b (fix "sometimes-uninitialized" warning).

Cherry-pick https://github.com/google/protobuf/pull/621
6 changes: 4 additions & 2 deletions third_party/protobuf/src/google/protobuf/stubs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,12 @@ struct CompileAssert {
} // namespace internal

#undef GOOGLE_COMPILE_ASSERT
#if __cplusplus >= 201103L
#define GOOGLE_COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
#else
#define GOOGLE_COMPILE_ASSERT(expr, msg) \
typedef ::google::protobuf::internal::CompileAssert<(bool(expr))> \
msg[bool(expr) ? 1 : -1]


// Implementation details of COMPILE_ASSERT:
//
// - COMPILE_ASSERT works by defining an array type that has -1
Expand Down Expand Up @@ -437,6 +438,7 @@ struct CompileAssert {
//
// This is to avoid running into a bug in MS VC 7.1, which
// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
#endif // __cplusplus >= 201103L

// ===================================================================
// from google3/base/memory/scoped_ptr.h
Expand Down

0 comments on commit 4c68f94

Please sign in to comment.