jrouwe / JoltPhysics

A multi core friendly rigid body physics and collision detection library. Written in C++. Suitable for games and VR applications. Used by Horizon Forbidden West.
MIT License
6.42k stars 414 forks source link

Fix warnings by commenting out unused parameters. #1053

Closed crocdialer closed 4 months ago

crocdialer commented 4 months ago

warnings occurred when including 'Jolt/Physics/Collision/Shape/MeshShape.h'. this commit comments out unused parameters of MeshShape::GetSubmergedVolume

Jolt/Physics/Collision/Shape/MeshShape.h:130:85: error: unused parameter ‘inCenterOfMassTransform’ [-Werror=unused-parameter]
virtual void GetSubmergedVolume(Mat44Arg inCenterOfMassTransform, ...)

ubuntu 22.04, gcc 11.4.0

jrouwe commented 4 months ago

I tried adding -Wextra to CMakelists.txt but the number of errors is just too much. On clang we're also disabling this warning, so I did the same for gcc now.

crocdialer commented 4 months ago

nice, can confirm that works for me :)

jrouwe commented 4 months ago

Note that Sonar will still find unused parameters, but it's a bit smarter about them.

crocdialer commented 4 months ago

yeah, the usage of JPH_GCC_SUPPRESS_WARNING does have the downside of unconditionally disabling those warnings for all compilation-units (indirectly) including Core.h. and I can imagine how cumbersome it would be to try limiting the scope of those ignores (e.g. wrapping with diagnostic push/pop). anyway, thanks a lot, that was helpful!

jrouwe commented 4 months ago

They are wrapped in a push/pop:

https://github.com/jrouwe/JoltPhysics/blob/178141555fe442af3209156bf4b7945ff521bf34/Jolt/Core/Core.h#L362-L365