[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45924] trunk/blender: Remove mingw-w64 errors from loss of precision by converting 64bit pointers to ints .

Antony Riakiotakis kalast at gmail.com
Tue Apr 24 16:33:45 CEST 2012


Revision: 45924
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45924
Author:   psy-fi
Date:     2012-04-24 14:33:44 +0000 (Tue, 24 Apr 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/scons/config/win64-mingw-config.py
    trunk/blender/extern/bullet2/src/LinearMath/btSerializer.h
    trunk/blender/intern/audaspace/intern/AUD_Buffer.cpp
    trunk/blender/intern/elbeem/intern/ntl_geometrymodel.cpp
    trunk/blender/source/gameengine/Expressions/KX_HashedPtr.cpp
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_IPO_SGController.cpp

Added Paths:
-----------
    trunk/blender/extern/bullet2/patches/MinGW64-nopermissive.patch
    trunk/blender/intern/audaspace/patches/
    trunk/blender/intern/audaspace/patches/mingw64-nopermissive.patch
    trunk/blender/intern/elbeem/patches/
    trunk/blender/intern/elbeem/patches/mingw64_nopermissive.patch

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/CMakeLists.txt	2012-04-24 14:33:44 UTC (rev 45924)
@@ -1008,8 +1008,9 @@
 
 		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)

Modified: trunk/blender/build_files/scons/config/win64-mingw-config.py
===================================================================
--- trunk/blender/build_files/scons/config/win64-mingw-config.py	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/build_files/scons/config/win64-mingw-config.py	2012-04-24 14:33:44 UTC (rev 45924)
@@ -176,7 +176,7 @@
 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']

Added: trunk/blender/extern/bullet2/patches/MinGW64-nopermissive.patch
===================================================================
--- trunk/blender/extern/bullet2/patches/MinGW64-nopermissive.patch	                        (rev 0)
+++ trunk/blender/extern/bullet2/patches/MinGW64-nopermissive.patch	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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--)

Modified: trunk/blender/extern/bullet2/src/LinearMath/btSerializer.h
===================================================================
--- trunk/blender/extern/bullet2/src/LinearMath/btSerializer.h	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/extern/bullet2/src/LinearMath/btSerializer.h	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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--)

Modified: trunk/blender/intern/audaspace/intern/AUD_Buffer.cpp
===================================================================
--- trunk/blender/intern/audaspace/intern/AUD_Buffer.cpp	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/intern/audaspace/intern/AUD_Buffer.cpp	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;

Added: trunk/blender/intern/audaspace/patches/mingw64-nopermissive.patch
===================================================================
--- trunk/blender/intern/audaspace/patches/mingw64-nopermissive.patch	                        (rev 0)
+++ trunk/blender/intern/audaspace/patches/mingw64-nopermissive.patch	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;

Modified: trunk/blender/intern/elbeem/intern/ntl_geometrymodel.cpp
===================================================================
--- trunk/blender/intern/elbeem/intern/ntl_geometrymodel.cpp	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/intern/elbeem/intern/ntl_geometrymodel.cpp	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;

Added: trunk/blender/intern/elbeem/patches/mingw64_nopermissive.patch
===================================================================
--- trunk/blender/intern/elbeem/patches/mingw64_nopermissive.patch	                        (rev 0)
+++ trunk/blender/intern/elbeem/patches/mingw64_nopermissive.patch	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;

Modified: trunk/blender/source/gameengine/Expressions/KX_HashedPtr.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/KX_HashedPtr.cpp	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/source/gameengine/Expressions/KX_HashedPtr.cpp	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;

Modified: trunk/blender/source/gameengine/Ketsji/KX_IPO_SGController.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_IPO_SGController.cpp	2012-04-24 13:39:14 UTC (rev 45923)
+++ trunk/blender/source/gameengine/Ketsji/KX_IPO_SGController.cpp	2012-04-24 14:33:44 UTC (rev 45924)
@@ -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;




More information about the Bf-blender-cvs mailing list