From b4f12aace15b53b67047530ce9c0272aa59327b8 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 6 Jul 2022 13:13:35 +0200 Subject: [PATCH] Explicitly ignore result of std::unique_ptr::release call components/nifbullet/bulletnifloader.cpp:206:13: warning: the value returned by this function should be used [bugprone-unused-return-value] boxShape.release(); ^~~~~~~~~~~~~~~~~~ components/nifbullet/bulletnifloader.cpp:232:13: warning: the value returned by this function should be used [bugprone-unused-return-value] child.release(); ^~~~~~~~~~~~~~~ components/nifbullet/bulletnifloader.cpp:233:13: warning: the value returned by this function should be used [bugprone-unused-return-value] mStaticMesh.release(); ^~~~~~~~~~~~~~~~~~~~~ components/nifbullet/bulletnifloader.cpp:240:9: warning: the value returned by this function should be used [bugprone-unused-return-value] mStaticMesh.release(); ^~~~~~~~~~~~~~~~~~~~~ components/nifbullet/bulletnifloader.cpp:246:9: warning: the value returned by this function should be used [bugprone-unused-return-value] mAvoidStaticMesh.release(); ^~~~~~~~~~~~~~~~~~~~~~~~~~ components/nifbullet/bulletnifloader.cpp:411:9: warning: the value returned by this function should be used [bugprone-unused-return-value] childMesh.release(); ^~~~~~~~~~~~~~~~~~~ components/nifbullet/bulletnifloader.cpp:425:9: warning: the value returned by this function should be used [bugprone-unused-return-value] childShape.release(); ^~~~~~~~~~~~~~~~~~~~ --- components/nifbullet/bulletnifloader.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index bedd2ce939..49f5e8f069 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -205,7 +206,7 @@ osg::ref_ptr BulletNifLoader::load(const Nif::File& nif) btTransform transform = btTransform::getIdentity(); transform.setOrigin(center); compound->addChildShape(transform, boxShape.get()); - boxShape.release(); + std::ignore = boxShape.release(); mShape->mCollisionShape.reset(compound.release()); return mShape; @@ -231,21 +232,21 @@ osg::ref_ptr BulletNifLoader::load(const Nif::File& nif) trans.setIdentity(); std::unique_ptr child = std::make_unique(mStaticMesh.get(), true); mCompoundShape->addChildShape(trans, child.get()); - child.release(); - mStaticMesh.release(); + std::ignore = child.release(); + std::ignore = mStaticMesh.release(); } mShape->mCollisionShape = std::move(mCompoundShape); } else if (mStaticMesh != nullptr && mStaticMesh->getNumTriangles() > 0) { mShape->mCollisionShape.reset(new Resource::TriangleMeshShape(mStaticMesh.get(), true)); - mStaticMesh.release(); + std::ignore = mStaticMesh.release(); } if (mAvoidStaticMesh != nullptr && mAvoidStaticMesh->getNumTriangles() > 0) { mShape->mAvoidCollisionShape.reset(new Resource::TriangleMeshShape(mAvoidStaticMesh.get(), false)); - mAvoidStaticMesh.release(); + std::ignore = mAvoidStaticMesh.release(); } return mShape; @@ -410,7 +411,7 @@ void BulletNifLoader::handleNiTriShape(const Nif::NiGeometry& niGeometry, const mCompoundShape.reset(new btCompoundShape); auto childShape = std::make_unique(childMesh.get(), true); - childMesh.release(); + std::ignore = childMesh.release(); float scale = niGeometry.trafo.scale; for (const Nif::Parent* parent = nodeParent; parent != nullptr; parent = parent->mParent) @@ -424,7 +425,7 @@ void BulletNifLoader::handleNiTriShape(const Nif::NiGeometry& niGeometry, const mShape->mAnimatedShapes.emplace(niGeometry.recIndex, mCompoundShape->getNumChildShapes()); mCompoundShape->addChildShape(trans, childShape.get()); - childShape.release(); + std::ignore = childShape.release(); } else if (avoid) fillTriangleMesh(mAvoidStaticMesh, niGeometry, transform);