diff options
author | Adam Cozzette <acozzette@gmail.com> | 2016-12-15 13:15:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-15 13:15:22 -0800 |
commit | a95e38ce8dec20d327692f4f5c2b0d37d6776696 (patch) | |
tree | 81748d3fab2948bbae670ad33aa59480eb25c198 /src/google | |
parent | 83d681ee2caef1feb009656417830f846382d8ba (diff) | |
parent | a902e2588d3917c867632e120906019cfca409fa (diff) | |
download | protobuf-a95e38ce8dec20d327692f4f5c2b0d37d6776696.tar.gz protobuf-a95e38ce8dec20d327692f4f5c2b0d37d6776696.tar.bz2 protobuf-a95e38ce8dec20d327692f4f5c2b0d37d6776696.zip |
Merge pull request #2499 from ckennelly/master
Define LANG_CXX11 for port.h and use this to guard C++11 features.
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/generated_message_util.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/stubs/port.h | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index 19bac7dc..14101832 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -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 @@ -99,7 +99,7 @@ class ExplicitlyConstructed { } } -#if __cplusplus >= 201103L +#if LANG_CXX11 constexpr #endif const T& diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index d5ef166e..72adba6d 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -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 { |