Sfoglia il codice sorgente

Suppress GCC warning: 'XXX' may be used uninitialized in this function [-Werror=maybe-uninitialized] (#1166)

When INTERPROCEDURAL_OPTIMIZATION is OFF, GCC warns about various uninitialized variables. Turning this warning off as it finds too many false positives.

Fixes #1156
Jorrit Rouwe 1 anno fa
parent
commit
6cad26a300
4 ha cambiato i file con 2 aggiunte e 9 eliminazioni
  1. 1 0
      Docs/ReleaseNotes.md
  2. 1 0
      Jolt/Core/Core.h
  3. 0 3
      Jolt/Core/Result.h
  4. 0 6
      Jolt/Geometry/GJKClosestPoint.h

+ 1 - 0
Docs/ReleaseNotes.md

@@ -50,6 +50,7 @@ For breaking API changes see [this document](https://github.com/jrouwe/JoltPhysi
 * Fix for new warning in MSVC 17.10 in immintrin.h: '__check_isa_support': unreferenced inline function has been removed.
 * Fix error in gcc 14. Using always_inline in debug mode causes error: "inlining failed in call to 'always_inline' 'XXX': function not considered for inlining"
 * Fixed clang-18 warning "LLVMgold.so: error loading plugin ... cannot open shared object file: No such file or directory", due to https://github.com/llvm/llvm-project/issues/84271 it currently doesn't support LTO.
+* Suppress GCC warning: 'XXX' may be used uninitialized in this function [-Werror=maybe-uninitialized].
 * When calling CharacterVirtual::SetShape, a collision with a sensor would cause the function to abort as if the character was in collision.
 * Fixed bug where the the skinned position of a soft body would update in the first sub-iteration, causing a large velocity spike and jittery behavior.
 * Fixed bug where the velocity of soft body vertices would increase indefinitely when resting on the back stop of a skinned constraint.

+ 1 - 0
Jolt/Core/Core.h

@@ -318,6 +318,7 @@
 	JPH_GCC_SUPPRESS_WARNING("-Wclass-memaccess")												\
 	JPH_GCC_SUPPRESS_WARNING("-Wpedantic")														\
 	JPH_GCC_SUPPRESS_WARNING("-Wunused-parameter")												\
+	JPH_GCC_SUPPRESS_WARNING("-Wmaybe-uninitialized")											\
 																								\
 	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 */	\

+ 0 - 3
Jolt/Core/Result.h

@@ -6,9 +6,6 @@
 
 JPH_NAMESPACE_BEGIN
 
-// GCC doesn't properly detect that mState is used to ensure that mResult is initialized
-JPH_GCC_SUPPRESS_WARNING("-Wmaybe-uninitialized")
-
 /// Helper class that either contains a valid result or an error
 template <class Type>
 class Result

+ 0 - 6
Jolt/Geometry/GJKClosestPoint.h

@@ -115,10 +115,6 @@ private:
 		mNumPoints = num_points;
 	}
 
-	// GCC 11.3 thinks the assignments to mP, mQ and mY below may use uninitialized variables
-	JPH_SUPPRESS_WARNING_PUSH
-	JPH_GCC_SUPPRESS_WARNING("-Wmaybe-uninitialized")
-
 	// Remove points that are not in the set, only updates mP
 	void		UpdatePointSetP(uint32 inSet)
 	{
@@ -161,8 +157,6 @@ private:
 		mNumPoints = num_points;
 	}
 
-	JPH_SUPPRESS_WARNING_POP
-
 	// Calculate closest points on A and B
 	void		CalculatePointAAndB(Vec3 &outPointA, Vec3 &outPointB) const
 	{