浏览代码

Merge pull request #813 from 0xAAE/master

Add GOOGLE_ATTRIBUTE_NOINLINE to GetArena() and GetMaybeArenaPointer(…
Feng Xiao 10 年之前
父节点
当前提交
c9418912cb
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/google/protobuf/message.cc

+ 8 - 0
src/google/protobuf/message.cc

@@ -495,11 +495,19 @@ Message* GenericTypeHandler<Message>::NewFromPrototype(
   return prototype->New(arena);
 }
 template<>
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240
+GOOGLE_ATTRIBUTE_NOINLINE
+#endif
 google::protobuf::Arena* GenericTypeHandler<Message>::GetArena(
     Message* value) {
   return value->GetArena();
 }
 template<>
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240
+GOOGLE_ATTRIBUTE_NOINLINE
+#endif
 void* GenericTypeHandler<Message>::GetMaybeArenaPointer(
     Message* value) {
   return value->GetMaybeArenaPointer();