diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2012-04-24 18:33:44 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2012-04-24 18:33:44 +0400 |
commit | 0db3c5f74300980d35b3114992c299f072b913b1 (patch) | |
tree | 46cd6f52ac700ed09afc455944ca33e6e7e0d672 | |
parent | 4782522379b708f15bd5b045ca4193637c465979 (diff) |
Remove mingw-w64 errors from loss of precision by converting 64bit pointers to ints. All cases found were harmless and the error behaviour could be turned off by the -fpermissive flag but I'd rather keep that off to detect any real problems should they arise.
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | build_files/scons/config/win64-mingw-config.py | 2 | ||||
-rw-r--r-- | extern/bullet2/patches/MinGW64-nopermissive.patch | 39 | ||||
-rw-r--r-- | extern/bullet2/src/LinearMath/btSerializer.h | 13 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_Buffer.cpp | 11 | ||||
-rw-r--r-- | intern/audaspace/patches/mingw64-nopermissive.patch | 23 | ||||
-rw-r--r-- | intern/elbeem/intern/ntl_geometrymodel.cpp | 11 | ||||
-rw-r--r-- | intern/elbeem/patches/mingw64_nopermissive.patch | 29 | ||||
-rw-r--r-- | source/gameengine/Expressions/KX_HashedPtr.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 5 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_IPO_SGController.cpp | 5 |
11 files changed, 136 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a2926182c5a..9250dae9ad8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1008,8 +1008,9 @@ elseif(WIN32) if(WITH_MINGW64) #Yes, the point for MinGW64 is moar optimization by default :) - set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -O3") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") + set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2") + set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread") add_definitions(-DFREE_WINDOWS64 -DMS_WIN64) diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py index 0379ea48088..98d45ae2054 100644 --- a/build_files/scons/config/win64-mingw-config.py +++ b/build_files/scons/config/win64-mingw-config.py @@ -176,7 +176,7 @@ CC = 'gcc' CXX = 'g++' CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -CXXFLAGS = [ '-fpermissive' ] +#CXXFLAGS = [ '-fpermissive' ] CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-D_SSIZE_T_'] REL_CFLAGS = ['-O3', '-mmmx', '-msse', '-msse2'] diff --git a/extern/bullet2/patches/MinGW64-nopermissive.patch b/extern/bullet2/patches/MinGW64-nopermissive.patch new file mode 100644 index 00000000000..915f232f6d7 --- /dev/null +++ b/extern/bullet2/patches/MinGW64-nopermissive.patch @@ -0,0 +1,39 @@ +Index: LinearMath/btSerializer.h +=================================================================== +--- LinearMath/btSerializer.h (revision 45919) ++++ LinearMath/btSerializer.h (working copy) +@@ -25,8 +25,15 @@ + #endif + #include <string.h> + ++#if defined(_WIN64) ++# ifdef __MINGW64__ ++# include <basetsd.h> ++# endif ++typedef __int64 int_ptr; ++#else ++typedef long int_ptr; ++#endif + +- + ///only the 32bit versions for now + extern unsigned char sBulletDNAstr[]; + extern int sBulletDNAlen; +@@ -247,7 +254,7 @@ + cp++; + } + { +- nr= (long)cp; ++ nr= (int_ptr)cp; + // long mask=3; + nr= ((nr+3)&~3)-nr; + while (nr--) +@@ -282,7 +289,7 @@ + } + + { +- nr= (long)cp; ++ nr= (int_ptr)cp; + // long mask=3; + nr= ((nr+3)&~3)-nr; + while (nr--) diff --git a/extern/bullet2/src/LinearMath/btSerializer.h b/extern/bullet2/src/LinearMath/btSerializer.h index 8a89374c612..a1e766c95ce 100644 --- a/extern/bullet2/src/LinearMath/btSerializer.h +++ b/extern/bullet2/src/LinearMath/btSerializer.h @@ -25,7 +25,14 @@ subject to the following restrictions: #endif #include <string.h> - +#if defined(_WIN64) +# ifdef __MINGW64__ +# include <basetsd.h> +# endif +typedef __int64 int_ptr; +#else +typedef long int_ptr; +#endif ///only the 32bit versions for now extern unsigned char sBulletDNAstr[]; @@ -247,7 +254,7 @@ protected: cp++; } { - nr= (long)cp; + nr= (int_ptr)cp; // long mask=3; nr= ((nr+3)&~3)-nr; while (nr--) @@ -282,7 +289,7 @@ protected: } { - nr= (long)cp; + nr= (int_ptr)cp; // long mask=3; nr= ((nr+3)&~3)-nr; while (nr--) diff --git a/intern/audaspace/intern/AUD_Buffer.cpp b/intern/audaspace/intern/AUD_Buffer.cpp index b7157f672b4..624a4d0b2c8 100644 --- a/intern/audaspace/intern/AUD_Buffer.cpp +++ b/intern/audaspace/intern/AUD_Buffer.cpp @@ -33,7 +33,16 @@ #include <cstring> #include <cstdlib> -#define AUD_ALIGN(a) (a + 16 - ((long)a & 15)) +#if defined(_WIN64) +# ifdef __MINGW64__ +# include <basetsd.h> +# endif +typedef unsigned __int64 uint_ptr; +#else +typedef unsigned long uint_ptr; +#endif + +#define AUD_ALIGN(a) (a + 16 - ((uint_ptr)a & 15)) AUD_Buffer::AUD_Buffer(int size) { diff --git a/intern/audaspace/patches/mingw64-nopermissive.patch b/intern/audaspace/patches/mingw64-nopermissive.patch new file mode 100644 index 00000000000..64420d240f3 --- /dev/null +++ b/intern/audaspace/patches/mingw64-nopermissive.patch @@ -0,0 +1,23 @@ +Index: intern/AUD_Buffer.cpp +=================================================================== +--- intern/AUD_Buffer.cpp (revision 45919) ++++ intern/AUD_Buffer.cpp (working copy) +@@ -33,8 +33,17 @@ + #include <cstring> + #include <cstdlib> + +-#define AUD_ALIGN(a) (a + 16 - ((long)a & 15)) ++#if defined(_WIN64) ++# ifdef __MINGW64__ ++# include <basetsd.h> ++# endif ++typedef unsigned __int64 uint_ptr; ++#else ++typedef unsigned long uint_ptr; ++#endif + ++#define AUD_ALIGN(a) (a + 16 - ((uint_ptr)a & 15)) ++ + AUD_Buffer::AUD_Buffer(int size) + { + m_size = size; diff --git a/intern/elbeem/intern/ntl_geometrymodel.cpp b/intern/elbeem/intern/ntl_geometrymodel.cpp index 13220736b8e..b518416b639 100644 --- a/intern/elbeem/intern/ntl_geometrymodel.cpp +++ b/intern/elbeem/intern/ntl_geometrymodel.cpp @@ -21,7 +21,14 @@ #endif #endif // WIN32 - +#if defined(_WIN64) +# ifdef __MINGW64__ +# include <basetsd.h> +# endif +typedef __int64 int_ptr; +#else +typedef long int_ptr; +#endif /****************************************************************************** * Default Constructor *****************************************************************************/ @@ -164,7 +171,7 @@ int ntlGeometryObjModel::initModel(int numVertices, float *vertices, int numTria } //fprintf(stderr,"initModel DEBUG %d \n",channelSize); - debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(long)(channelVertices) ,10); + debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(int_ptr)(channelVertices) ,10); if(channelVertices && (channelSize>0)) { vector<ntlSetVec3f> aniverts; vector<ntlSetVec3f> aninorms; diff --git a/intern/elbeem/patches/mingw64_nopermissive.patch b/intern/elbeem/patches/mingw64_nopermissive.patch new file mode 100644 index 00000000000..a01e65d43e4 --- /dev/null +++ b/intern/elbeem/patches/mingw64_nopermissive.patch @@ -0,0 +1,29 @@ +Index: intern/ntl_geometrymodel.cpp +=================================================================== +--- intern/ntl_geometrymodel.cpp (revision 45919) ++++ intern/ntl_geometrymodel.cpp (working copy) +@@ -21,7 +21,14 @@ + #endif + #endif // WIN32 + +- ++#if defined(_WIN64) ++# ifdef __MINGW64__ ++# include <basetsd.h> ++# endif ++typedef __int64 int_ptr; ++#else ++typedef long int_ptr; ++#endif + /****************************************************************************** + * Default Constructor + *****************************************************************************/ +@@ -164,7 +171,7 @@ + } + + //fprintf(stderr,"initModel DEBUG %d \n",channelSize); +- debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(long)(channelVertices) ,10); ++ debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(int_ptr)(channelVertices) ,10); + if(channelVertices && (channelSize>0)) { + vector<ntlSetVec3f> aniverts; + vector<ntlSetVec3f> aninorms; diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index 51550d52636..84488e3641d 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -28,13 +28,15 @@ /** \file gameengine/Expressions/KX_HashedPtr.cpp * \ingroup expressions */ - +#ifdef __MINGW64__ +#include <basetsd.h> +#endif #include "KX_HashedPtr.h" unsigned int KX_Hash(void * inDWord) { -#if defined(_WIN64) && !defined(FREE_WINDOWS64) +#ifdef _WIN64 unsigned __int64 key = (unsigned __int64)inDWord; #else unsigned long key = (unsigned long)inDWord; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index c5145ef2171..bdb586b2474 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -31,7 +31,10 @@ */ -#if defined(_WIN64) && !defined(FREE_WINDOWS64) +#if defined(_WIN64) +# ifdef __MINGW64__ +# include <basetsd.h> +# endif typedef unsigned __int64 uint_ptr; #else typedef unsigned long uint_ptr; diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index 950e3c88a9e..b8872f5ddc3 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -31,7 +31,10 @@ */ -#if defined(_WIN64) && !defined(FREE_WINDOWS64) +#if defined(_WIN64) +# ifdef __MINGW64__ +# include <basetsd.h> +# endif typedef unsigned __int64 uint_ptr; #else typedef unsigned long uint_ptr; |