diff options
author | Bruce Dawson <randomascii@users.noreply.github.com> | 2017-10-02 14:43:05 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-10-02 14:43:05 -0700 |
commit | 210be267fd81d5aafdc049d197d57cb45b75f3ba (patch) | |
tree | a2e75ed9343477ce15ebd15a16a8aa23fa4723d0 | |
parent | fc5aa5d910eb0e58ea7dbd545f2bc0a61e80a323 (diff) |
Use constexpr more with VC++ 2017 (#3707)
* Use constexpr more with VC++ 2017
Chrome's official builds have over 170 dynamic initializers for
variables of the form *::TableStruct::aux. Defining
PROTOBUF_CONSTEXPR_VAR to be constexpr for VS 2017 gets rid of all of
these and saves about 10 KB of binary size.
* Update generated_message_table_driven.h
Restore accidentally deleted line.
-rw-r--r-- | src/google/protobuf/generated_message_table_driven.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/google/protobuf/generated_message_table_driven.h b/src/google/protobuf/generated_message_table_driven.h index 5b477051..6f3fe666 100644 --- a/src/google/protobuf/generated_message_table_driven.h +++ b/src/google/protobuf/generated_message_table_driven.h @@ -44,7 +44,8 @@ // We require C++11 and Clang to use constexpr for variables, as GCC 4.8 // requires constexpr to be consistent between declarations of variables // unnecessarily (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58541). -#ifdef __clang__ +// VS 2017 Update 3 also supports this usage of constexpr. +#if defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1911) #define PROTOBUF_CONSTEXPR_VAR constexpr #else // !__clang__ #define PROTOBUF_CONSTEXPR_VAR |