diff --git a/CHANGELOG.md b/CHANGELOG.md index ae10ad290..5f0dd9777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed +- Compiler warnings ([#601](https://github.com/humanoid-path-planner/hpp-fcl/pull/601)) - CMake: fix assimp finder - Don't define GCC7 Boost serialization hack when `HPP_FCL_SKIP_EIGEN_BOOST_SERIALIZATION` is defined ([#530](https://github.com/humanoid-path-planner/hpp-fcl/pull/530)) - Default parameters for narrowphase algorithms (GJK and EPA); fixed assertion checks that were sometimes failing in GJK simplex projection and BVH `collide` ([#531](https://github.com/humanoid-path-planner/hpp-fcl/pull/531)). diff --git a/include/hpp/fcl/internal/shape_shape_contact_patch_func.h b/include/hpp/fcl/internal/shape_shape_contact_patch_func.h index 33c5b9791..9e3f6ec01 100644 --- a/include/hpp/fcl/internal/shape_shape_contact_patch_func.h +++ b/include/hpp/fcl/internal/shape_shape_contact_patch_func.h @@ -201,8 +201,8 @@ void computePatchPlaneOrHalfspace(const OtherShapeType& s1, } \ }; -PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH(Plane); -PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH(Halfspace); +PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH(Plane) +PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH(Halfspace) #define PLANE_HSPACE_CONTACT_PATCH(PlaneOrHspace1, PlaneOrHspace2) \ template <> \ @@ -241,10 +241,10 @@ PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH(Halfspace); } \ }; -PLANE_HSPACE_CONTACT_PATCH(Plane, Plane); -PLANE_HSPACE_CONTACT_PATCH(Plane, Halfspace); -PLANE_HSPACE_CONTACT_PATCH(Halfspace, Plane); -PLANE_HSPACE_CONTACT_PATCH(Halfspace, Halfspace); +PLANE_HSPACE_CONTACT_PATCH(Plane, Plane) +PLANE_HSPACE_CONTACT_PATCH(Plane, Halfspace) +PLANE_HSPACE_CONTACT_PATCH(Halfspace, Plane) +PLANE_HSPACE_CONTACT_PATCH(Halfspace, Halfspace) #undef PLANE_OR_HSPACE_AND_OTHER_SHAPE_CONTACT_PATCH #undef PLANE_HSPACE_CONTACT_PATCH diff --git a/include/hpp/fcl/internal/shape_shape_func.h b/include/hpp/fcl/internal/shape_shape_func.h index 43643712a..3321b4b38 100644 --- a/include/hpp/fcl/internal/shape_shape_func.h +++ b/include/hpp/fcl/internal/shape_shape_func.h @@ -278,32 +278,32 @@ std::size_t ShapeShapeCollide(const CollisionGeometry* o1, return result.min_distance; \ } -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box, Plane); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box, Sphere); -SHAPE_SELF_DISTANCE_SPECIALIZATION(Capsule); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule, Plane); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cone, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cone, Plane); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cylinder, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cylinder, Plane); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Plane); -SHAPE_SELF_DISTANCE_SPECIALIZATION(Sphere); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Cylinder); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Capsule); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Ellipsoid, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Ellipsoid, Plane); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(ConvexBase, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(ConvexBase, Plane); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Halfspace); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Plane); -SHAPE_SELF_DISTANCE_SPECIALIZATION(TriangleP); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Sphere); -SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Plane, Halfspace); -SHAPE_SELF_DISTANCE_SPECIALIZATION(Plane); -SHAPE_SELF_DISTANCE_SPECIALIZATION(Halfspace); +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box, Plane) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Box, Sphere) +SHAPE_SELF_DISTANCE_SPECIALIZATION(Capsule) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Capsule, Plane) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cone, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cone, Plane) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cylinder, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Cylinder, Plane) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Plane) +SHAPE_SELF_DISTANCE_SPECIALIZATION(Sphere) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Cylinder) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Sphere, Capsule) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Ellipsoid, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Ellipsoid, Plane) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(ConvexBase, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(ConvexBase, Plane) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Halfspace) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Plane) +SHAPE_SELF_DISTANCE_SPECIALIZATION(TriangleP) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(TriangleP, Sphere) +SHAPE_SHAPE_DISTANCE_SPECIALIZATION(Plane, Halfspace) +SHAPE_SELF_DISTANCE_SPECIALIZATION(Plane) +SHAPE_SELF_DISTANCE_SPECIALIZATION(Halfspace) #undef SHAPE_SHAPE_DISTANCE_SPECIALIZATION #undef SHAPE_SELF_DISTANCE_SPECIALIZATION diff --git a/include/hpp/fcl/math/transform.h b/include/hpp/fcl/math/transform.h index 34d3fcda0..9a1d31e5d 100644 --- a/include/hpp/fcl/math/transform.h +++ b/include/hpp/fcl/math/transform.h @@ -234,7 +234,7 @@ inline Quatf uniformRandomQuaternion() { const FCL_REAL mult1 = std::sqrt(FCL_REAL(1.0) - u1); const FCL_REAL mult2 = std::sqrt(u1); - static const FCL_REAL PI_value = EIGEN_PI; + static const FCL_REAL PI_value = static_cast(EIGEN_PI); FCL_REAL s2 = std::sin(2 * PI_value * u2); FCL_REAL c2 = std::cos(2 * PI_value * u2); FCL_REAL s3 = std::sin(2 * PI_value * u3); diff --git a/include/hpp/fcl/serialization/contact_patch.h b/include/hpp/fcl/serialization/contact_patch.h index 09a5cab4a..71d984ca9 100644 --- a/include/hpp/fcl/serialization/contact_patch.h +++ b/include/hpp/fcl/serialization/contact_patch.h @@ -26,7 +26,7 @@ void serialize(Archive& ar, hpp::fcl::ContactPatch& contact_patch, } Eigen::Map points_map( reinterpret_cast(contact_patch.points().data()), 2, - patch_size); + static_cast(patch_size)); ar& make_nvp("points", points_map); } diff --git a/python/broadphase/broadphase.cc b/python/broadphase/broadphase.cc index 9e5ee5243..f6f9592ae 100644 --- a/python/broadphase/broadphase.cc +++ b/python/broadphase/broadphase.cc @@ -44,8 +44,11 @@ #include "hpp/fcl/broadphase/broadphase_interval_tree.h" #include "hpp/fcl/broadphase/broadphase_spatialhash.h" +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS #ifdef HPP_FCL_HAS_DOXYGEN_AUTODOC #include "doxygen_autodoc/functions.h" +HPP_FCL_COMPILER_DIAGNOSTIC_POP #include "doxygen_autodoc/hpp/fcl/broadphase/default_broadphase_callbacks.h" // #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_dynamic_AABB_tree.h" // #include @@ -62,6 +65,8 @@ using namespace hpp::fcl; +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS void exposeBroadPhase() { CollisionCallBackBaseWrapper::expose(); DistanceCallBackBaseWrapper::expose(); @@ -134,3 +139,4 @@ void exposeBroadPhase() { bp::optional>()); } } +HPP_FCL_COMPILER_DIAGNOSTIC_POP diff --git a/python/collision.cc b/python/collision.cc index 5ea8550f5..a759b193a 100644 --- a/python/collision.cc +++ b/python/collision.cc @@ -35,8 +35,11 @@ #include #include +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS #include #include +HPP_FCL_COMPILER_DIAGNOSTIC_POP #include "fcl.hh" #include "deprecation.hh" @@ -91,6 +94,8 @@ void exposeCollisionAPI() { .def("clear", &CPUTimes::clear, arg("self"), "Reset the time values."); } + HPP_FCL_COMPILER_DIAGNOSTIC_PUSH + HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS if (!eigenpy::register_symbolic_link_to_registered_type()) { class_("QueryRequest", doxygen::class_doc(), no_init) @@ -127,7 +132,10 @@ void exposeCollisionAPI() { .DEF_RW_CLASS_ATTRIB(QueryRequest, enable_timings) .DEF_CLASS_FUNC(QueryRequest, updateGuess); } + HPP_FCL_COMPILER_DIAGNOSTIC_POP + HPP_FCL_COMPILER_DIAGNOSTIC_PUSH + HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS if (!eigenpy::register_symbolic_link_to_registered_type()) { class_ >( "CollisionRequest", doxygen::class_doc(), no_init) @@ -166,6 +174,7 @@ void exposeCollisionAPI() { class_ >("StdVec_CollisionRequest") .def(vector_indexing_suite >()); } + HPP_FCL_COMPILER_DIAGNOSTIC_POP if (!eigenpy::register_symbolic_link_to_registered_type()) { class_("Contact", doxygen::class_doc(), diff --git a/python/distance.cc b/python/distance.cc index 61aebf684..0231814da 100644 --- a/python/distance.cc +++ b/python/distance.cc @@ -36,10 +36,13 @@ #include "fcl.hh" +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS #include #include #include #include "deprecation.hh" +HPP_FCL_COMPILER_DIAGNOSTIC_POP #include "serializable.hh" @@ -64,6 +67,8 @@ struct DistanceResultWrapper { }; void exposeDistanceAPI() { + HPP_FCL_COMPILER_DIAGNOSTIC_PUSH + HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS if (!eigenpy::register_symbolic_link_to_registered_type()) { class_ >( "DistanceRequest", doxygen::class_doc(), @@ -105,6 +110,7 @@ void exposeDistanceAPI() { .DEF_RW_CLASS_ATTRIB(DistanceRequest, abs_err) .def(SerializableVisitor()); } + HPP_FCL_COMPILER_DIAGNOSTIC_POP if (!eigenpy::register_symbolic_link_to_registered_type< std::vector >()) { diff --git a/src/narrowphase/support_functions.cpp b/src/narrowphase/support_functions.cpp index c215654d9..5b39f152f 100644 --- a/src/narrowphase/support_functions.cpp +++ b/src/narrowphase/support_functions.cpp @@ -132,12 +132,15 @@ void getShapeSupport(const TriangleP* triangle, const Vec3f& dir, support += triangle->getSweptSphereRadius() * dir.normalized(); } } -getShapeSupportTplInstantiation(TriangleP); - -// ============================================================================ -template -inline void getShapeSupport(const Box* box, const Vec3f& dir, Vec3f& support, - int& /*unused*/, ShapeSupportData& /*unused*/) { +// clang-format off +getShapeSupportTplInstantiation(TriangleP) + // clang-format on + + // ============================================================================ + template + inline void getShapeSupport(const Box* box, const Vec3f& dir, + Vec3f& support, int& /*unused*/, + ShapeSupportData& /*unused*/) { // The inflate value is simply to make the specialized functions with box // have a preferred side for edge cases. static const FCL_REAL inflate = (dir.array() == 0).any() ? 1 + 1e-10 : 1.; @@ -152,13 +155,15 @@ inline void getShapeSupport(const Box* box, const Vec3f& dir, Vec3f& support, support += box->getSweptSphereRadius() * dir.normalized(); } } -getShapeSupportTplInstantiation(Box); - -// ============================================================================ -template -inline void getShapeSupport(const Sphere* sphere, const Vec3f& dir, - Vec3f& support, int& /*unused*/, - ShapeSupportData& /*unused*/) { +// clang-format off +getShapeSupportTplInstantiation(Box) + // clang-format on + + // ============================================================================ + template + inline void getShapeSupport(const Sphere* sphere, const Vec3f& dir, + Vec3f& support, int& /*unused*/, + ShapeSupportData& /*unused*/) { if (_SupportOptions == SupportOptions::WithSweptSphere) { support.noalias() = (sphere->radius + sphere->getSweptSphereRadius()) * dir.normalized(); @@ -169,13 +174,15 @@ inline void getShapeSupport(const Sphere* sphere, const Vec3f& dir, HPP_FCL_UNUSED_VARIABLE(sphere); HPP_FCL_UNUSED_VARIABLE(dir); } -getShapeSupportTplInstantiation(Sphere); - -// ============================================================================ -template -inline void getShapeSupport(const Ellipsoid* ellipsoid, const Vec3f& dir, - Vec3f& support, int& /*unused*/, - ShapeSupportData& /*unused*/) { +// clang-format off +getShapeSupportTplInstantiation(Sphere) + // clang-format on + + // ============================================================================ + template + inline void getShapeSupport(const Ellipsoid* ellipsoid, const Vec3f& dir, + Vec3f& support, int& /*unused*/, + ShapeSupportData& /*unused*/) { FCL_REAL a2 = ellipsoid->radii[0] * ellipsoid->radii[0]; FCL_REAL b2 = ellipsoid->radii[1] * ellipsoid->radii[1]; FCL_REAL c2 = ellipsoid->radii[2] * ellipsoid->radii[2]; @@ -190,13 +197,15 @@ inline void getShapeSupport(const Ellipsoid* ellipsoid, const Vec3f& dir, support += ellipsoid->getSweptSphereRadius() * dir.normalized(); } } -getShapeSupportTplInstantiation(Ellipsoid); - -// ============================================================================ -template -inline void getShapeSupport(const Capsule* capsule, const Vec3f& dir, - Vec3f& support, int& /*unused*/, - ShapeSupportData& /*unused*/) { +// clang-format off +getShapeSupportTplInstantiation(Ellipsoid) + // clang-format on + + // ============================================================================ + template + inline void getShapeSupport(const Capsule* capsule, const Vec3f& dir, + Vec3f& support, int& /*unused*/, + ShapeSupportData& /*unused*/) { static const FCL_REAL dummy_precision = Eigen::NumTraits::dummy_precision(); support.setZero(); @@ -211,12 +220,14 @@ inline void getShapeSupport(const Capsule* capsule, const Vec3f& dir, (capsule->radius + capsule->getSweptSphereRadius()) * dir.normalized(); } } -getShapeSupportTplInstantiation(Capsule); +// clang-format off +getShapeSupportTplInstantiation(Capsule) + // clang-format on -// ============================================================================ -template -void getShapeSupport(const Cone* cone, const Vec3f& dir, Vec3f& support, - int& /*unused*/, ShapeSupportData& /*unused*/) { + // ============================================================================ + template + void getShapeSupport(const Cone* cone, const Vec3f& dir, Vec3f& support, + int& /*unused*/, ShapeSupportData& /*unused*/) { static const FCL_REAL dummy_precision = Eigen::NumTraits::dummy_precision(); @@ -261,12 +272,15 @@ void getShapeSupport(const Cone* cone, const Vec3f& dir, Vec3f& support, support += cone->getSweptSphereRadius() * dir.normalized(); } } -getShapeSupportTplInstantiation(Cone); - -// ============================================================================ -template -void getShapeSupport(const Cylinder* cylinder, const Vec3f& dir, Vec3f& support, - int& /*unused*/, ShapeSupportData& /*unused*/) { +// clang-format off +getShapeSupportTplInstantiation(Cone) + // clang-format on + + // ============================================================================ + template + void getShapeSupport(const Cylinder* cylinder, const Vec3f& dir, + Vec3f& support, int& /*unused*/, + ShapeSupportData& /*unused*/) { static const FCL_REAL dummy_precision = Eigen::NumTraits::dummy_precision(); @@ -301,13 +315,15 @@ void getShapeSupport(const Cylinder* cylinder, const Vec3f& dir, Vec3f& support, support += cylinder->getSweptSphereRadius() * dir.normalized(); } } -getShapeSupportTplInstantiation(Cylinder); +// clang-format off +getShapeSupportTplInstantiation(Cylinder) + // clang-format on -// ============================================================================ -template -void getShapeSupportLog(const ConvexBase* convex, const Vec3f& dir, - Vec3f& support, int& hint, - ShapeSupportData& support_data) { + // ============================================================================ + template + void getShapeSupportLog(const ConvexBase* convex, const Vec3f& dir, + Vec3f& support, int& hint, + ShapeSupportData& support_data) { assert(convex->neighbors != nullptr && "Convex has no neighbors."); // Use warm start if current support direction is distant from last support @@ -419,38 +435,44 @@ void getShapeSupport(const ConvexBase* convex, const Vec3f& dir, Vec3f& support, support_data); } } -getShapeSupportTplInstantiation(ConvexBase); - -// ============================================================================ -template -inline void getShapeSupport(const SmallConvex* convex, const Vec3f& dir, - Vec3f& support, int& hint, - ShapeSupportData& support_data) { +// clang-format off +getShapeSupportTplInstantiation(ConvexBase) + // clang-format on + + // ============================================================================ + template + inline void getShapeSupport(const SmallConvex* convex, const Vec3f& dir, + Vec3f& support, int& hint, + ShapeSupportData& support_data) { getShapeSupportLinear<_SupportOptions>( reinterpret_cast(convex), dir, support, hint, support_data); } -getShapeSupportTplInstantiation(SmallConvex); - -// ============================================================================ -template -inline void getShapeSupport(const LargeConvex* convex, const Vec3f& dir, - Vec3f& support, int& hint, - ShapeSupportData& support_data) { +// clang-format off +getShapeSupportTplInstantiation(SmallConvex) + // clang-format on + + // ============================================================================ + template + inline void getShapeSupport(const LargeConvex* convex, const Vec3f& dir, + Vec3f& support, int& hint, + ShapeSupportData& support_data) { getShapeSupportLog<_SupportOptions>( reinterpret_cast(convex), dir, support, hint, support_data); } -getShapeSupportTplInstantiation(LargeConvex); +// clang-format off +getShapeSupportTplInstantiation(LargeConvex) +// clang-format on // ============================================================================ #define CALL_GET_SHAPE_SUPPORT_SET(ShapeType) \ getShapeSupportSet<_SupportOptions>(static_cast(shape), \ support_set, hint, support_data, \ max_num_supports, tol) -template -void getSupportSet(const ShapeBase* shape, SupportSet& support_set, int& hint, - size_t max_num_supports, FCL_REAL tol) { + template + void getSupportSet(const ShapeBase* shape, SupportSet& support_set, + int& hint, size_t max_num_supports, FCL_REAL tol) { ShapeSupportData support_data; switch (shape->getNodeType()) { case GEOM_TRIANGLE: