Fix warnings reported by MSVC
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 23 Feb 2016 08:44:54 +0000 (09:44 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 23 Feb 2016 08:44:54 +0000 (09:44 +0100)
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 :)

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

index 266edd0dfcc576e1f9a290015d7f972541fc169b..c4ff9e80aa9e4f0fa44e5ac392728f1add4ce06d 100644 (file)
 
 #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.
index db3d157df72c1fb5024892dcef05f2a61eb1a586..b326c9f42816166e8260ba414a7e5ac1d0483122 100644 (file)
@@ -75,7 +75,6 @@
 #include "AUD_MutexLock.h"
 
 #ifdef WITH_SDL
-#include <SDL.h>
 #include "AUD_SDLDevice.h"
 #endif
 
index e6178710389cd4c9bd539ddc9c3721d19cfbb087..d037600830ad0828240d82ab6bef232de049bb7e 100644 (file)
@@ -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;
index c91595b59008c0031e077652e880f83cd3c2a240..2f4d8e6c3256532055a3e617058d5c136db4121d 100644 (file)
 #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
index 0f55438ecf6bb188c0fb3003406f4929e6ed9b43..20281eb986ec369630c567f9bd4dce96eff6a4ca 100644 (file)
@@ -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;                  
index b03570e3c286d5c97f617d1d010547a9fb49724f..1a66b2aee52b065c50948bfb9bf8b689360ff17c 100644 (file)
  *  \ingroup gamelogic
  */
 
-#ifdef WITH_SDL
-#  include <SDL.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
index dd9fbefa5450bb73f433a29830dcec0702554c1d..c9221753d45e9ba9f2205475ebf3717794cfb1a7 100644 (file)
 
 #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
 
 /**
index 0033c137eb6b415ec45b2e1ba8fa4d7e2c0b5902..fd3d713b3d24bb8052f9ec6d0cb8b696f055c281 100644 (file)
  *  \ingroup gamelogic
  */
 
-#ifdef WITH_SDL
-#  include <SDL.h>
-#endif
-
 #include "SCA_Joystick.h"
 #include "SCA_JoystickPrivate.h"
 
index ad6447778e5e7a0da72ef2a79a06551317c96a90..188128a3ec9bf2fc6c655db4996ecef4be20b290 100644 (file)
@@ -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();