Browse Source

Merge remote-tracking branch 'bpay/clang-cl-build-fixes' into development

Conflicts:
	Engine/source/T3D/shapeBase.h
Daniel Buckmaster 10 years ago
parent
commit
c2e5dc3345

+ 0 - 1
Engine/source/T3D/shapeBase.cpp

@@ -40,7 +40,6 @@
 #include "scene/sceneRenderState.h"
 #include "scene/sceneRenderState.h"
 #include "scene/sceneObjectLightingPlugin.h"
 #include "scene/sceneObjectLightingPlugin.h"
 #include "T3D/fx/explosion.h"
 #include "T3D/fx/explosion.h"
-#include "T3D/fx/particleEmitter.h"
 #include "T3D/fx/cameraFXMgr.h"
 #include "T3D/fx/cameraFXMgr.h"
 #include "environment/waterBlock.h"
 #include "environment/waterBlock.h"
 #include "T3D/debris.h"
 #include "T3D/debris.h"

+ 3 - 2
Engine/source/T3D/shapeBase.h

@@ -63,14 +63,15 @@
    #include "console/dynamicTypes.h"
    #include "console/dynamicTypes.h"
 #endif
 #endif
 
 
+// Need full definition visible for SimObjectPtr<ParticleEmitter>
+#include "T3D/fx/particleEmitter.h"
+
 class GFXCubemap;
 class GFXCubemap;
 class TSShapeInstance;
 class TSShapeInstance;
 class SceneRenderState;
 class SceneRenderState;
 class TSThread;
 class TSThread;
 class GameConnection;
 class GameConnection;
 struct CameraScopeQuery;
 struct CameraScopeQuery;
-class ParticleEmitter;
-class ParticleEmitterData;
 class ProjectileData;
 class ProjectileData;
 class ExplosionData;
 class ExplosionData;
 struct DebrisData;
 struct DebrisData;

+ 1 - 2
Engine/source/core/util/str.h

@@ -293,11 +293,10 @@ private:
    // causes an ambiguous cast compile error.  Making it private is simply
    // causes an ambiguous cast compile error.  Making it private is simply
    // more insurance that it isn't used on different compilers.
    // more insurance that it isn't used on different compilers.
    // NOTE: disable on GCC since it causes hyper casting to U32 on gcc.
    // NOTE: disable on GCC since it causes hyper casting to U32 on gcc.
-#ifndef TORQUE_COMPILER_GCC
+#if !defined(TORQUE_COMPILER_GCC) && !defined(__clang__)
    operator const bool() const { return false; }
    operator const bool() const { return false; }
 #endif
 #endif
 
 
-
    static void copy(StringChar *dst, const StringChar *src, U32 size);
    static void copy(StringChar *dst, const StringChar *src, U32 size);
 
 
    StringData   *_string;
    StringData   *_string;

+ 1 - 1
Engine/source/gfx/D3D9/gfxD3D9Device.h

@@ -76,7 +76,7 @@ inline void D3D9Assert( HRESULT hr, const char *info )
 
 
 // Typedefs
 // Typedefs
 #define D3DX_FUNCTION(fn_name, fn_return, fn_args) \
 #define D3DX_FUNCTION(fn_name, fn_return, fn_args) \
-   typedef fn_return (WINAPI *D3DXFNPTR##fn_name##)##fn_args##;
+   typedef fn_return (WINAPI *D3DXFNPTR##fn_name)fn_args;
 #include "gfx/D3D9/d3dx9Functions.h"
 #include "gfx/D3D9/d3dx9Functions.h"
 #undef D3DX_FUNCTION
 #undef D3DX_FUNCTION
 
 

+ 1 - 1
Engine/source/gfx/D3D9/gfxD3D9EnumTranslate.h

@@ -55,7 +55,7 @@ extern _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
 
 
 #define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
 #define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
    for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
    for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
-      if( (S32)tablearray##[i] == val ) \
+      if( (S32)tablearray[i] == val ) \
       { \
       { \
          val = i; \
          val = i; \
          break; \
          break; \

+ 3 - 3
Engine/source/gfx/D3D9/pc/gfxD3D9EnumTranslate.pc.cpp

@@ -47,13 +47,13 @@ _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
 
 
 #define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
 #define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
    for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
    for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
-      tablearray##[i] = (##type##)GFX_UNINIT_VAL;
+      tablearray[i] = (type)GFX_UNINIT_VAL;
 
 
 #define VALIDATE_LOOKUPTABLE( tablearray, enumprefix ) \
 #define VALIDATE_LOOKUPTABLE( tablearray, enumprefix ) \
    for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
    for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
-      if( (S32)tablearray##[i] == GFX_UNINIT_VAL ) \
+      if( (S32)tablearray[i] == GFX_UNINIT_VAL ) \
          Con::warnf( "GFXD3D9EnumTranslate: Unassigned value in " #tablearray ": %i", i ); \
          Con::warnf( "GFXD3D9EnumTranslate: Unassigned value in " #tablearray ": %i", i ); \
-      else if( (S32)tablearray##[i] == GFX_UNSUPPORTED_VAL ) \
+      else if( (S32)tablearray[i] == GFX_UNSUPPORTED_VAL ) \
          Con::warnf( "GFXD3D9EnumTranslate: Unsupported value in " #tablearray ": %i", i );
          Con::warnf( "GFXD3D9EnumTranslate: Unsupported value in " #tablearray ": %i", i );
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------

+ 1 - 1
Engine/source/gui/containers/guiRolloutCtrl.h

@@ -118,6 +118,7 @@ class GuiRolloutCtrl : public GuiTickCtrl
 
 
       DECLARE_CALLBACK( void, onCollapsed, () );
       DECLARE_CALLBACK( void, onCollapsed, () );
       /// @}
       /// @}
+      virtual void processTick();
 
 
    public:
    public:
    
    
@@ -152,7 +153,6 @@ class GuiRolloutCtrl : public GuiTickCtrl
 
 
       // Sizing Animation Functions
       // Sizing Animation Functions
       void animateTo( S32 height );
       void animateTo( S32 height );
-      virtual void processTick();
 
 
       void collapse() { animateTo( mHeader.extent.y ); }
       void collapse() { animateTo( mHeader.extent.y ); }
       void expand() { animateTo( mExpanded.extent.y ); }
       void expand() { animateTo( mExpanded.extent.y ); }

+ 3 - 1
Engine/source/gui/worldEditor/undoActions.h

@@ -30,7 +30,9 @@
 #include "console/simObjectMemento.h"
 #include "console/simObjectMemento.h"
 #endif
 #endif
 
 
-class GuiInspectorField;
+// Need full definition visible for SimObjectPtr<GuiInspectorField>
+#include "gui/editor/inspector/field.h"
+
 class GuiInspector;
 class GuiInspector;
 
 
 class MECreateUndoAction : public UndoAction
 class MECreateUndoAction : public UndoAction

+ 10 - 0
Engine/source/platform/types.h

@@ -54,7 +54,17 @@ struct EmptyType {};                ///< "Null" type used by templates
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 typedef char           UTF8;        ///< Compiler independent 8  bit Unicode encoded character
 typedef char           UTF8;        ///< Compiler independent 8  bit Unicode encoded character
+
+#if defined(_MSC_VER) && defined(__clang__)
+// Clang's MSVC compatibility mode doesn't currently support /Zc:wchar_t-,
+// which we rely on to avoid type conversion errors when calling system
+// APIs when UTF16 is defined as unsigned short.  So, just define UTF16
+// as wchar_t instead since it's always a 2 byte unsigned on windows anyway.
+typedef wchar_t        UTF16;
+#else
 typedef unsigned short UTF16;       ///< Compiler independent 16 bit Unicode encoded character
 typedef unsigned short UTF16;       ///< Compiler independent 16 bit Unicode encoded character
+#endif
+
 typedef unsigned int   UTF32;       ///< Compiler independent 32 bit Unicode encoded character
 typedef unsigned int   UTF32;       ///< Compiler independent 32 bit Unicode encoded character
 
 
 typedef const char* StringTableEntry;
 typedef const char* StringTableEntry;

+ 3 - 1
Engine/source/platform/types.visualc.h

@@ -42,7 +42,7 @@ typedef unsigned _int64 U64;
 #if _MSC_VER < 1200
 #if _MSC_VER < 1200
    // No support for old compilers
    // No support for old compilers
 #  error "VC: Minimum VisualC++ 6.0 or newer required"
 #  error "VC: Minimum VisualC++ 6.0 or newer required"
-#else _MSC_VER >= 1200
+#else // _MSC_VER >= 1200
 #  define TORQUE_COMPILER_STRING "VisualC++"
 #  define TORQUE_COMPILER_STRING "VisualC++"
 #endif
 #endif
 
 
@@ -84,8 +84,10 @@ typedef unsigned _int64 U64;
 #  define TORQUE_CPU_STRING "x86"
 #  define TORQUE_CPU_STRING "x86"
 #  define TORQUE_CPU_X86
 #  define TORQUE_CPU_X86
 #  define TORQUE_LITTLE_ENDIAN
 #  define TORQUE_LITTLE_ENDIAN
+#ifndef __clang__ // asm not yet supported with clang
 #  define TORQUE_SUPPORTS_NASM
 #  define TORQUE_SUPPORTS_NASM
 #  define TORQUE_SUPPORTS_VC_INLINE_X86_ASM
 #  define TORQUE_SUPPORTS_VC_INLINE_X86_ASM
+#endif
 #elif defined( TORQUE_OS_XENON )
 #elif defined( TORQUE_OS_XENON )
 #  define TORQUE_CPU_STRING "ppc"
 #  define TORQUE_CPU_STRING "ppc"
 #  define TORQUE_CPU_PPC
 #  define TORQUE_CPU_PPC

+ 1 - 1
Engine/source/platformWin32/winDirectInput.cpp

@@ -450,7 +450,7 @@ int DInputManager::getXInputState(S32 controllerID, S32 property, bool current)
    switch(property)
    switch(property)
    {
    {
 #define CHECK_PROP_ANALOG(prop, stateTest) \
 #define CHECK_PROP_ANALOG(prop, stateTest) \
-   case prop:        (current) ? retVal = mXInputStateNew[controllerID].state.Gamepad.##stateTest : retVal = mXInputStateOld[controllerID].state.Gamepad.##stateTest; return retVal;
+   case prop:        (current) ? retVal = mXInputStateNew[controllerID].state.Gamepad.stateTest : retVal = mXInputStateOld[controllerID].state.Gamepad.stateTest; return retVal;
 
 
       CHECK_PROP_ANALOG(XI_THUMBLX, sThumbLX)
       CHECK_PROP_ANALOG(XI_THUMBLX, sThumbLX)
       CHECK_PROP_ANALOG(XI_THUMBLY, sThumbLY)
       CHECK_PROP_ANALOG(XI_THUMBLY, sThumbLY)

+ 3 - 3
Engine/source/platformWin32/winFileio.cpp

@@ -1411,9 +1411,9 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
          if( ( subPath  && ( dStrncmp( subPath, "", 1 ) != 0 ) ))
          if( ( subPath  && ( dStrncmp( subPath, "", 1 ) != 0 ) ))
          {
          {
             if( subTrail == '/' )
             if( subTrail == '/' )
-               dSprintf(search, search.size, "%s%s", subPath, fileName);
+               dSprintf(search, search.size, "%s%s", subPath, fileName.ptr);
             else
             else
-               dSprintf(search, search.size, "%s/%s", subPath, fileName);
+               dSprintf(search, search.size, "%s/%s", subPath, fileName.ptr);
             char* child = search;
             char* child = search;
 
 
             if( currentDepth < recurseDepth || recurseDepth == -1 )
             if( currentDepth < recurseDepth || recurseDepth == -1 )
@@ -1427,7 +1427,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
                child = fileName;
                child = fileName;
             else
             else
             {
             {
-               dSprintf(search, search.size, "/%s", fileName);
+               dSprintf(search, search.size, "/%s", fileName.ptr);
                child = search;
                child = search;
             }
             }
 
 

+ 1 - 1
Engine/source/platformWin32/winMath.cpp

@@ -79,7 +79,7 @@ ConsoleFunction( mathInit, void, 1, 10, "( ... )"
          properties |= CPU_PROP_SSE;
          properties |= CPU_PROP_SSE;
          continue;
          continue;
       }
       }
-      Con::printf("Error: MathInit(): ignoring unknown math extension '%s'", *argv);
+      Con::printf("Error: MathInit(): ignoring unknown math extension '%s'", argv->getStringValue());
    }
    }
    Math::init(properties);
    Math::init(properties);
 }
 }

+ 1 - 1
Engine/source/scene/scenePolyhedralSpace.h

@@ -30,7 +30,7 @@
 #ifndef _SCENEPOLYHEDRALOBJECT_H_
 #ifndef _SCENEPOLYHEDRALOBJECT_H_
 #include "scene/mixin/scenePolyhedralObject.h"
 #include "scene/mixin/scenePolyhedralObject.h"
 #endif
 #endif
-
+#include "scene/mixin/scenePolyhedralObject.impl.h"
 
 
 ///
 ///
 class ScenePolyhedralSpace : public ScenePolyhedralObject< SceneSpace >
 class ScenePolyhedralSpace : public ScenePolyhedralObject< SceneSpace >

+ 4 - 4
Engine/source/windowManager/win32/win32Window.cpp

@@ -439,8 +439,8 @@ void Win32Window::centerWindow()
 
 
 	// Get the monitor's extents.
 	// Get the monitor's extents.
 	MONITORINFO monInfo;
 	MONITORINFO monInfo;
-	dMemset(&monInfo, 0, sizeof MONITORINFO);
-	monInfo.cbSize = sizeof MONITORINFO;
+	dMemset(&monInfo, 0, sizeof(MONITORINFO));
+	monInfo.cbSize = sizeof(MONITORINFO);
 	GetMonitorInfo(hMon, &monInfo);
 	GetMonitorInfo(hMon, &monInfo);
 
 
    // Calculate the offset to center the window in the working area
    // Calculate the offset to center the window in the working area
@@ -502,8 +502,8 @@ bool Win32Window::setSize( const Point2I &newSize )
 
 
 		// Get the monitor's extents.
 		// Get the monitor's extents.
 		MONITORINFO monInfo;
 		MONITORINFO monInfo;
-		dMemset(&monInfo, 0, sizeof MONITORINFO);
-		monInfo.cbSize = sizeof MONITORINFO;
+		dMemset(&monInfo, 0, sizeof(MONITORINFO));
+		monInfo.cbSize = sizeof(MONITORINFO);
 		GetMonitorInfo(hMon, &monInfo);
 		GetMonitorInfo(hMon, &monInfo);
 
 
       // Calculate the offset to center the window in the working area
       // Calculate the offset to center the window in the working area

+ 2 - 2
Engine/source/windowManager/win32/win32WindowMgr.cpp

@@ -502,8 +502,8 @@ void Win32WindowManager::lowerCurtain()
 
 
    // Get the monitor's extents.
    // Get the monitor's extents.
    MONITORINFO monInfo;
    MONITORINFO monInfo;
-   dMemset(&monInfo, 0, sizeof MONITORINFO);
-   monInfo.cbSize = sizeof MONITORINFO;
+   dMemset(&monInfo, 0, sizeof(MONITORINFO));
+   monInfo.cbSize = sizeof(MONITORINFO);
 
 
    GetMonitorInfo(hMon, &monInfo);
    GetMonitorInfo(hMon, &monInfo);
  
  

+ 2 - 2
Engine/source/windowManager/win32/winDispatch.cpp

@@ -137,14 +137,14 @@ static void _keyboardEvent(Win32Window* window,UINT message, WPARAM wParam, WPAR
        && window->getKeyboardTranslation()
        && window->getKeyboardTranslation()
 	    && !window->shouldNotTranslate( torqueMods, newVirtKey ) )
 	    && !window->shouldNotTranslate( torqueMods, newVirtKey ) )
 	{
 	{
-      U16 chars[ 64 ];
+      wchar_t chars[ 64 ];
       dMemset( chars, 0, sizeof( chars ) );
       dMemset( chars, 0, sizeof( chars ) );
 
 
       S32 res = ToUnicode( keyCode, scanCode, keyboardState, chars, sizeof( chars ) / sizeof( chars[ 0 ] ), 0 );
       S32 res = ToUnicode( keyCode, scanCode, keyboardState, chars, sizeof( chars ) / sizeof( chars[ 0 ] ), 0 );
 
 
    	// This should only happen on Window 9x/ME systems
    	// This should only happen on Window 9x/ME systems
    	if( res == 0 )
    	if( res == 0 )
-   		res = ToAscii( keyCode, scanCode, keyboardState, chars, 0 );
+         res = ToAscii( keyCode, scanCode, keyboardState, (LPWORD)chars, 0 );
 
 
       if( res >= 1 )
       if( res >= 1 )
       {
       {