[Bf-blender-cvs] [d3fa1bd] master: Fix warnings reported by MSVC

Sergey Sharybin noreply at git.blender.org
Tue Feb 23 09:47:20 CET 2016


Commit: d3fa1bd4d5a8ec82ffa41b996d7169711ee5831d
Author: Sergey Sharybin
Date:   Tue Feb 23 09:44:54 2016 +0100
Branches: master
https://developer.blender.org/rBd3fa1bd4d5a8ec82ffa41b996d7169711ee5831d

Fix warnings reported by MSVC

Mainly it's related on a bad practice in SDL to force-define __SSE__
and __SSE2__ flags which generates quite some warnings and causes too
much noise.

There are some other warnings fixed. Should be no functional changes.

NeXyon, please check the changes in audaspace :)

===================================================================

M	intern/audaspace/SDL/AUD_SDLDevice.h
M	intern/audaspace/intern/AUD_C-API.cpp
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/python/intern/bpy_app_sdl.c
M	source/gameengine/Converter/BL_BlenderDataConversion.cpp
M	source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
M	source/gameengine/GameLogic/Joystick/SCA_Joystick.h
M	source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
M	source/gameengine/Ketsji/KX_GameObject.cpp

===================================================================

diff --git a/intern/audaspace/SDL/AUD_SDLDevice.h b/intern/audaspace/SDL/AUD_SDLDevice.h
index 266edd0..c4ff9e8 100644
--- a/intern/audaspace/SDL/AUD_SDLDevice.h
+++ b/intern/audaspace/SDL/AUD_SDLDevice.h
@@ -32,7 +32,18 @@
 
 #include "AUD_SoftwareDevice.h"
 
+/* SDL force defines __SSE__ and __SSE2__ flags, which generates warnings
+ * because we pass those defines via command line as well. For until there's
+ * proper ifndef added to SDL headers we ignore the redefinition warning.
+ */
+#ifdef _MSC_VER
+#  pragma warning(push)
+#  pragma warning(disable : 4005)
+#endif
 #include <SDL.h>
+#ifdef _MSC_VER
+#  pragma warning(pop)
+#endif
 
 /**
  * This device plays back through SDL, the simple direct media layer.
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index db3d157..b326c9f 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -75,7 +75,6 @@
 #include "AUD_MutexLock.h"
 
 #ifdef WITH_SDL
-#include <SDL.h>
 #include "AUD_SDLDevice.h"
 #endif
 
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index e617871..d037600 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -6106,7 +6106,7 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
 }
 
 static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type,
-                                        char ftype, int len, void *dest, void *src, StructRNA *srna,
+                                        char ftype, int len, void *dest, const void *src, StructRNA *srna,
                                         const char *tid, const char *fid, const char *pid)
 {
 	/* ptr is always a function pointer, prop always a parameter */
@@ -6401,7 +6401,7 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
 				}
 				case PROP_STRING:
 				{
-					const char **arg = va_arg(args, const char **);
+					char **arg = va_arg(args, char **);
 					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
 					                                   NULL, tid, fid, pid);
 					break;
diff --git a/source/blender/python/intern/bpy_app_sdl.c b/source/blender/python/intern/bpy_app_sdl.c
index c91595b..2f4d8e6 100644
--- a/source/blender/python/intern/bpy_app_sdl.c
+++ b/source/blender/python/intern/bpy_app_sdl.c
@@ -30,7 +30,18 @@
 #include "bpy_app_sdl.h"
 
 #ifdef WITH_SDL
+/* SDL force defines __SSE__ and __SSE2__ flags, which generates warnings
+ * because we pass those defines via command line as well. For until there's
+ * proper ifndef added to SDL headers we ignore the redefinition warning.
+ */
+#  ifdef _MSC_VER
+#    pragma warning(push)
+#    pragma warning(disable : 4005)
+#  endif
 #  include "SDL.h"
+#  ifdef _MSC_VER
+#    pragma warning(pop)
+#  endif
 #  ifdef WITH_SDL_DYNLOAD
 #    include "sdlew.h"
 #  endif
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 0f55438..20281eb 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -228,17 +228,7 @@ static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
 	m[EKEY				] = SCA_IInputDevice::KX_EKEY;                  
 	m[FKEY				] = SCA_IInputDevice::KX_FKEY;                  
 	m[GKEY				] = SCA_IInputDevice::KX_GKEY;                  
-
-//XXX clean up
-#ifdef WIN32
-#define HKEY	'h'
-#endif
 	m[HKEY				] = SCA_IInputDevice::KX_HKEY;                  
-//XXX clean up
-#ifdef WIN32
-#undef HKEY
-#endif
-
 	m[IKEY				] = SCA_IInputDevice::KX_IKEY;                  
 	m[JKEY				] = SCA_IInputDevice::KX_JKEY;                  
 	m[KKEY				] = SCA_IInputDevice::KX_KKEY;                  
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index b03570e..1a66b2a 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -29,10 +29,6 @@
  *  \ingroup gamelogic
  */
 
-#ifdef WITH_SDL
-#  include <SDL.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
index dd9fbef..c922175 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
@@ -34,7 +34,18 @@
 
 #include "SCA_JoystickDefines.h"
 #ifdef WITH_SDL
+/* SDL force defines __SSE__ and __SSE2__ flags, which generates warnings
+ * because we pass those defines via command line as well. For until there's
+ * proper ifndef added to SDL headers we ignore the redefinition warning.
+ */
+#  ifdef _MSC_VER
+#    pragma warning(push)
+#    pragma warning(disable : 4005)
+#  endif
 #  include "SDL.h"
+#  ifdef _MSC_VER
+#    pragma warning(pop)
+#  endif
 #endif
 
 /**
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index 0033c13..fd3d713 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -29,10 +29,6 @@
  *  \ingroup gamelogic
  */
 
-#ifdef WITH_SDL
-#  include <SDL.h>
-#endif
-
 #include "SCA_Joystick.h"
 #include "SCA_JoystickPrivate.h"
 
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index ad64477..188128a 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -3734,7 +3734,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
 	if (!spc && parent)
 		spc = parent->GetPhysicsController();
 
-	RayCastData rayData(propName, false, (1 << OB_MAX_COL_MASKS) - 1);
+	RayCastData rayData(propName, false, (1u << OB_MAX_COL_MASKS) - 1);
 	KX_RayCast::Callback<KX_GameObject, RayCastData> callback(this, spc, &rayData);
 	if (KX_RayCast::RayTest(pe, fromPoint, toPoint, callback) && rayData.m_hitObject) {
 		return rayData.m_hitObject->GetProxy();




More information about the Bf-blender-cvs mailing list