浏览代码

Merge pull request #559 from Ragora/bugfix-gcc-release-mode

* Workaround: GCC Release mode Runtime Errors
Brian Roberts 4 年之前
父节点
当前提交
3aa7174a64
共有 3 个文件被更改,包括 7 次插入2 次删除
  1. 2 2
      Engine/source/core/util/str.cpp
  2. 3 0
      Engine/source/platform/types.gcc.h
  3. 2 0
      Engine/source/platform/types.visualc.h

+ 2 - 2
Engine/source/core/util/str.cpp

@@ -284,8 +284,8 @@ class String::StringData : protected StringDataImpl
             delete [] mUTF16;
       }
 
-      void* operator new(size_t size, U32 len);
-      void* operator new( size_t size, U32 len, DataChunker& chunker );
+      void* TORQUE_NOINLINE operator new(size_t size, U32 len);
+      void* TORQUE_NOINLINE operator new( size_t size, U32 len, DataChunker& chunker );
       void operator delete(void *);
 
       bool isShared() const

+ 3 - 0
Engine/source/platform/types.gcc.h

@@ -165,5 +165,8 @@ typedef unsigned long  U64;
 #endif
 #endif
 
+// Set GCC noinline
+#define TORQUE_NOINLINE __attribute__ ((noinline))
+
 #endif // INCLUDED_TYPES_GCC_H
 

+ 2 - 0
Engine/source/platform/types.visualc.h

@@ -104,6 +104,8 @@ typedef unsigned _int64 U64;
 // see msdn.microsoft.com "Compiler Warning (level 1) C4291" for more details
 #pragma warning(disable: 4291) 
 
+// Set MSVC noline attribute
+#define TORQUE_NOINLINE __declspec(noinline)
 
 #endif // INCLUDED_TYPES_VISUALC_H