فهرست منبع

Compile fixes for MSVC 17.4 (#320)

Jorrit Rouwe 2 سال پیش
والد
کامیت
dccb4e13aa

+ 6 - 1
Jolt/Core/Core.h

@@ -163,6 +163,7 @@
 	JPH_GCC_SUPPRESS_WARNING("-Winvalid-offsetof")												\
 	JPH_GCC_SUPPRESS_WARNING("-Wclass-memaccess")												\
 																								\
+	JPH_MSVC_SUPPRESS_WARNING(4619) /* #pragma warning: there is no warning number 'XXXX' */	\
 	JPH_MSVC_SUPPRESS_WARNING(4514) /* 'X' : unreferenced inline function has been removed */	\
 	JPH_MSVC_SUPPRESS_WARNING(4710) /* 'X' : function not inlined */							\
 	JPH_MSVC_SUPPRESS_WARNING(4711) /* function 'X' selected for automatic inline expansion */	\
@@ -181,7 +182,8 @@
 	JPH_MSVC_SUPPRESS_WARNING(4583) /* 'X': destructor is not implicitly called */				\
 	JPH_MSVC_SUPPRESS_WARNING(4582) /* 'X': constructor is not implicitly called */				\
 	JPH_MSVC_SUPPRESS_WARNING(5219) /* implicit conversion from 'X' to 'Y', possible loss of data  */ \
-	JPH_MSVC_SUPPRESS_WARNING(4826) /* Conversion from 'X *' to 'JPH::uint64' is sign-extended. This may cause unexpected runtime behavior. (32-bit) */
+	JPH_MSVC_SUPPRESS_WARNING(4826) /* Conversion from 'X *' to 'JPH::uint64' is sign-extended. This may cause unexpected runtime behavior. (32-bit) */ \
+	JPH_MSVC_SUPPRESS_WARNING(5264) /* 'X': 'const' variable is not used */
 
 // OS-specific includes
 #if defined(JPH_PLATFORM_WINDOWS)
@@ -221,10 +223,13 @@
 // Suppress warnings generated by the standard template library
 #define JPH_SUPPRESS_WARNINGS_STD_BEGIN															\
 	JPH_SUPPRESS_WARNING_PUSH																	\
+	JPH_MSVC_SUPPRESS_WARNING(4619)																\
 	JPH_MSVC_SUPPRESS_WARNING(4710)																\
 	JPH_MSVC_SUPPRESS_WARNING(4711)																\
 	JPH_MSVC_SUPPRESS_WARNING(4820)																\
 	JPH_MSVC_SUPPRESS_WARNING(4514)																\
+	JPH_MSVC_SUPPRESS_WARNING(5262)																\
+	JPH_MSVC_SUPPRESS_WARNING(5264)																\
 																								\
 	JPH_GCC_SUPPRESS_WARNING("-Wstringop-overflow=")
 

+ 2 - 0
Jolt/Physics/Collision/BroadPhase/QuadTree.cpp

@@ -14,7 +14,9 @@
 #include <Jolt/Geometry/OrientedBox.h>
 
 #ifdef JPH_DUMP_BROADPHASE_TREE
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 #endif // JPH_DUMP_BROADPHASE_TREE
 
 JPH_NAMESPACE_BEGIN

+ 2 - 0
Jolt/Physics/DeterminismLog.h

@@ -9,8 +9,10 @@
 #include <Jolt/Physics/Body/BodyID.h>
 #include <Jolt/Physics/Collision/Shape/SubShapeID.h>
 
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <iomanip>
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_NAMESPACE_BEGIN
 

+ 3 - 0
JoltViewer/JoltViewer.cpp

@@ -9,7 +9,10 @@
 #include <Renderer/DebugRendererImp.h>
 #include <UI/UIManager.h>
 #include <Application/DebugUI.h>
+
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 #ifndef JPH_DEBUG_RENDERER	
 	// Hack to still compile DebugRenderer inside the test framework when Jolt is compiled without

+ 2 - 0
PerformanceTest/PerformanceTest.cpp

@@ -18,11 +18,13 @@
 #endif // JPH_DEBUG_RENDERER
 
 // STL includes
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <iostream>
 #include <thread>
 #include <chrono>
 #include <memory>
 #include <cstdarg>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 using namespace JPH;
 using namespace std;

+ 3 - 0
Samples/SamplesApp.cpp

@@ -39,7 +39,10 @@
 #include <Utils/ShapeCreator.h>
 #include <Utils/CustomMemoryHook.h>
 #include <Renderer/DebugRendererImp.h>
+
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 //-----------------------------------------------------------------------------
 // RTTI definitions

+ 3 - 0
Samples/Tests/ConvexCollision/ConvexHullShrinkTest.cpp

@@ -8,7 +8,10 @@
 #include <Jolt/Geometry/ConvexSupport.h>
 #include <Jolt/Physics/Collision/Shape/ConvexHullShape.h>
 #include <Renderer/DebugRendererImp.h>
+
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(ConvexHullShrinkTest) 
 { 

+ 3 - 0
Samples/Tests/ConvexCollision/ConvexHullTest.cpp

@@ -7,7 +7,10 @@
 #include <Jolt/Geometry/ConvexHullBuilder.h>
 #include <Utils/Log.h>
 #include <Renderer/DebugRendererImp.h>
+
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(ConvexHullTest) 
 { 

+ 3 - 0
Samples/Tests/Tools/LoadSnapshotTest.cpp

@@ -9,7 +9,10 @@
 #include <Application/DebugUI.h>
 #include <Utils/Log.h>
 #include <Layers.h>
+
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(LoadSnapshotTest) 
 { 

+ 3 - 0
TestFramework/Application/DebugUI.cpp

@@ -14,7 +14,10 @@
 #include <UI/UITextButton.h>
 #include <Image/LoadTGA.h>
 #include <Utils/Log.h>
+
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
 
 DebugUI::DebugUI(UIManager *inUIManager, const Font *inFont) :
 	mUI(inUIManager),

+ 4 - 1
TestFramework/Utils/ReadData.cpp

@@ -2,10 +2,13 @@
 // SPDX-License-Identifier: MIT
 
 #include <TestFramework.h>
-#include <fstream>
 #include <Utils/ReadData.h>
 #include <Utils/Log.h>
 
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
+#include <fstream>
+JPH_SUPPRESS_WARNINGS_STD_END
+
 // Read file contents
 Array<uint8> ReadData(const char *inFileName)
 {

+ 1 - 1
UnitTests/Physics/CharacterVirtualTests.cpp

@@ -109,7 +109,7 @@ TEST_SUITE("CharacterVirtualTests")
 
 	private:
 		// CharacterContactListener callback
-		virtual void			OnContactSolve(const CharacterVirtual *inCharacter, const BodyID &inBodyID2, const SubShapeID &inSubShapeID2, Vec3Arg inContactPosition, Vec3Arg inContactNormal, Vec3Arg inContactVelocity, const PhysicsMaterial *inContactMaterial, Vec3Arg inCharacterVelocity, Vec3 &ioNewCharacterVelocity)
+		virtual void			OnContactSolve(const CharacterVirtual *inCharacter, const BodyID &inBodyID2, const SubShapeID &inSubShapeID2, Vec3Arg inContactPosition, Vec3Arg inContactNormal, Vec3Arg inContactVelocity, const PhysicsMaterial *inContactMaterial, Vec3Arg inCharacterVelocity, Vec3 &ioNewCharacterVelocity) override
 		{
 			// Don't allow sliding if the character doesn't want to move
 			if (mHorizontalSpeed.IsNearZero() && inContactVelocity.IsNearZero() && !inCharacter->IsSlopeTooSteep(inContactNormal))

+ 6 - 1
UnitTests/UnitTestFramework.cpp

@@ -3,7 +3,6 @@
 
 #include <Jolt/Jolt.h>
 
-#include <cstdarg>
 #include <Jolt/Core/FPException.h>
 #include <Jolt/Core/Factory.h>
 #include <Jolt/RegisterTypes.h>
@@ -16,13 +15,19 @@
 #include <android_native_app_glue.h>
 #endif // JPH_PLATFORM_ANDROID
 
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
+#include <cstdarg>
+JPH_SUPPRESS_WARNINGS_STD_END
+
 using namespace JPH;
 
 // Emit everything needed for the main function
 #define DOCTEST_CONFIG_IMPLEMENT
 #define DOCTEST_CONFIG_NO_WINDOWS_SEH
 
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include "doctest.h"
+JPH_SUPPRESS_WARNINGS_STD_END
 
 using namespace doctest;
 

+ 2 - 0
UnitTests/UnitTestFramework.h

@@ -9,7 +9,9 @@
 JPH_SUPPRESS_WARNINGS
 JPH_CLANG_SUPPRESS_WARNING("-Wheader-hygiene")
 
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include "doctest.h"
+JPH_SUPPRESS_WARNINGS_STD_END
 
 using namespace JPH;
 using namespace std;