Pārlūkot izejas kodu

Suppress warnings on MinGW build.

Yao Wei Tjong 姚伟忠 10 gadi atpakaļ
vecāks
revīzija
fa82c55efd

+ 3 - 2
CMake/Modules/Urho3D-CMake-common.cmake

@@ -811,12 +811,13 @@ macro (enable_pch HEADER_PATHNAME)
                     # At the moment it seems using the function is the "only way" to get the export flags into a CMake variable
                     # Additionally, CMake implementation of 'VISIBILITY_INLINES_HIDDEN' has a bug (tested in 2.8.12.2) that it erroneously sets the flag for C compiler too
                     add_compiler_export_flags (COMPILER_EXPORT_FLAGS)
-                    if (NOT ANDROID)    # To cater for Android/CMake toolchain which already adds -fPIC flags into the CMake C and CXX compiler flags
+                    # To cater for Android/CMake toolchain which already adds -fPIC flags into the CMake C and CXX compiler flags and MinGW which already uses PIC for all codes
+                    if (NOT ANDROID AND NOT MINGW)
                         set (COMPILER_EXPORT_FLAGS "${COMPILER_EXPORT_FLAGS} -fPIC")
                     endif ()
                 elseif (PROJECT_NAME STREQUAL Urho3D AND NOT ${TARGET_NAME} STREQUAL Urho3D AND URHO3D_LIB_TYPE STREQUAL SHARED)
                     # If it is one of the Urho3D library dependency then use the same PIC flag as Urho3D library
-                    if (NOT ANDROID)
+                    if (NOT ANDROID AND NOT MINGW)
                         set (COMPILER_EXPORT_FLAGS -fPIC)
                     endif ()
                 endif ()

+ 4 - 0
Source/ThirdParty/STB/stb_vorbis.c

@@ -1,3 +1,5 @@
+// Modified by Yao Wei Tjong
+
 #include "stb_vorbis.h"
 
 #ifndef STB_VORBIS_HEADER_ONLY
@@ -181,6 +183,8 @@
 
 #ifndef _MSC_VER
    #if __GNUC__
+      // Urho3D - undefine before redefining to suppress warning on MinGW build
+      #undef __forceinline
       #define __forceinline inline
    #else
       #define __forceinline

+ 6 - 5
Source/ThirdParty/kNet/src/Thread.cpp

@@ -15,6 +15,8 @@
 /** @file Thread.cpp
 	@brief Implements platform-generic Thread functions. */
 
+// Modified by Yao Wei Tjong for Urho3D
+
 #ifdef KNET_USE_BOOST
 #include <boost/thread/thread.hpp>
 #endif
@@ -100,9 +102,10 @@ typedef struct tagTHREADNAME_INFO
 } THREADNAME_INFO;
 #pragma pack(pop)
 
+// Urho3D - avoid unnecessary warning in MinGW build
+#ifdef _MSC_VER
 void SetThreadName(DWORD dwThreadID, const char *threadName)
 {
-#ifdef _MSC_VER
 	THREADNAME_INFO info;
 	info.dwType = 0x1000;
 	info.szName = threadName;
@@ -117,16 +120,14 @@ void SetThreadName(DWORD dwThreadID, const char *threadName)
 	__except(EXCEPTION_CONTINUE_EXECUTION)
 	{
 	}
-#else
-#warning SetThreadName undefined for current platform!
-#endif
 }
 #endif
+#endif
 
 void Thread::SetName(const char *name)
 {
 // The thread name can only be set when it is ensured that Thread::Id() returns the proper Win32 thread ID
-#ifdef WIN32
+#ifdef _MSC_VER
 #if !defined(KNET_USE_BOOST) || !defined(KNET_ENABLE_WINXP_SUPPORT)
 	SetThreadName(Id(), name);
 #endif