Skip to content

Commit

Permalink
Merge pull request #2499 from ckennelly/master
Browse files Browse the repository at this point in the history
Define LANG_CXX11 for port.h and use this to guard C++11 features.
  • Loading branch information
Adam Cozzette committed Dec 15, 2016
2 parents 83d681e + a902e25 commit a95e38c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/google/protobuf/generated_message_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <google/protobuf/has_bits.h>

#ifndef PROTOBUF_FINAL
#if __cplusplus >= 201103L
#if LANG_CXX11
#define PROTOBUF_FINAL final
#else
#define PROTOBUF_FINAL
Expand Down Expand Up @@ -99,7 +99,7 @@ class ExplicitlyConstructed {
}
}

#if __cplusplus >= 201103L
#if LANG_CXX11
constexpr
#endif
const T&
Expand Down
9 changes: 9 additions & 0 deletions src/google/protobuf/stubs/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@

// ===================================================================
// from google3/base/port.h

#if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L || \
(defined(_MSC_VER) && _MSC_VER >= 1900))
// Define this to 1 if the code is compiled in C++11 mode; leave it
// undefined otherwise. Do NOT define it to 0 -- that causes
// '#ifdef LANG_CXX11' to behave differently from '#if LANG_CXX11'.
#define LANG_CXX11 1
#endif

namespace google {
namespace protobuf {

Expand Down

0 comments on commit a95e38c

Please sign in to comment.