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 compilation for Release-builds by sprinkling [[maybe_unused]] #1051

Closed crocdialer closed 4 months ago

crocdialer commented 4 months ago

compilation of 5.0 and current master fails for me, only for Release-builds:

e.g.

JoltPhysics/Build/../Jolt/Physics/Collision/Shape/Shape.h:373:140: error: unused parameter ‘inNumMaterials’ [-Werror=unused-parameter]
  373 |         virtual void                                    RestoreMaterialState([[maybe_unused]] const PhysicsMaterialRefC *inMaterials, uint inNumMaterials) { JPH_ASSERT(inNumMaterials == 0); }

debug-builds were not affected, due to JPH_ASSERT using the parameters. this PR sprinkles more [[maybe_unused]] and fixes Release-compilation for me.

using ubuntu 22.04, gcc 11.4.0

CLAassistant commented 4 months ago

CLA assistant check
All committers have signed the CLA.

crocdialer commented 4 months ago

more precisely, I'm seeing those compilation-errors in my client-code, which includes headers Jolt/Physics/Collision/Shape/Shape.h|ConvexShape.h with rather strict gcc-settings "-Wall -Wextra -Werror"

jrouwe commented 4 months ago

Thanks!