diff --git a/.github/workflows/ros_ci.yml b/.github/workflows/ros_ci.yml index 04fc0a82d..4595a358d 100644 --- a/.github/workflows/ros_ci.yml +++ b/.github/workflows/ros_ci.yml @@ -14,14 +14,14 @@ jobs: - {ROS_DISTRO: noetic} - {ROS_DISTRO: iron} - {ROS_DISTRO: humble} - #- {ROS_DISTRO: rolling, PRERELEASE: false} # 2024-04-02: turn off prerelease until Noble is stable; turned off entirely until eigenpy is available + #- {ROS_DISTRO: rolling} env: #CCACHE_DIR: /github/home/.ccache # Enable ccache BUILDER: colcon PRERELEASE: true runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive # This step will fetch/store the directory used by ccache before/after the ci run diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f0dd9777..ce17ca4b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +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)) +- Compiler warnings ([#601](https://github.com/humanoid-path-planner/hpp-fcl/pull/601), [#605](https://github.com/humanoid-path-planner/hpp-fcl/pull/605)) - 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/INSTALL b/INSTALL index 0f327aab5..1a315de79 100644 --- a/INSTALL +++ b/INSTALL @@ -5,7 +5,7 @@ Dependencies: - Eigen - Boost (thread, date_time, filesystem) - assimp - - octomap (optional dependency, available at http://octomap.github.com) + - octomap (optional dependency, available at http://octomap.github.io) - Qhull (optional dependency, available at http://www.qhull.org) Boost and Eigen are mandatory dependencies. If Octomap is not found, diff --git a/include/hpp/fcl/fwd.hh b/include/hpp/fcl/fwd.hh index 1d51a4f40..cb756a84e 100644 --- a/include/hpp/fcl/fwd.hh +++ b/include/hpp/fcl/fwd.hh @@ -95,15 +95,32 @@ #define HPP_FCL_COMPILER_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") #define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + +// GCC version 4.6 and higher supports -Wmaybe-uninitialized +#if (defined(__GNUC__) && \ + ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) +#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \ + _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +// Use __has_warning with clang. Clang introduced it in 2024 (3.5+) +#elif (defined(__clang__) && defined(__has_warning) && \ + __has_warning("-Wmaybe-uninitialized")) +#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \ + _Pragma("clang diagnostic ignored \"-Wmaybe-uninitialized\"") +#else +#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED +#endif #elif defined(WIN32) #define HPP_FCL_COMPILER_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define HPP_FCL_COMPILER_DIAGNOSTIC_POP _Pragma("warning(pop)") #define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS \ _Pragma("warning(disable : 4996)") +#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \ + _Pragma("warning(disable : 4700)") #else #define HPP_FCL_COMPILER_DIAGNOSTIC_PUSH #define HPP_FCL_COMPILER_DIAGNOSTIC_POP #define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS +#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED #endif // __GNUC__ namespace hpp { diff --git a/include/hpp/fcl/internal/traversal_node_setup.h b/include/hpp/fcl/internal/traversal_node_setup.h index 76ed7e008..20b5c71db 100644 --- a/include/hpp/fcl/internal/traversal_node_setup.h +++ b/include/hpp/fcl/internal/traversal_node_setup.h @@ -682,9 +682,14 @@ bool initialize(MeshDistanceTraversalNode& node, node.tri_indices2 = model2.tri_indices.get() ? model2.tri_indices->data() : NULL; + HPP_FCL_COMPILER_DIAGNOSTIC_PUSH + HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED + relativeTransform(tf1.getRotation(), tf1.getTranslation(), tf2.getRotation(), tf2.getTranslation(), node.RT.R, node.RT.T); + HPP_FCL_COMPILER_DIAGNOSTIC_POP + return true; } diff --git a/include/hpp/fcl/serialization/fwd.h b/include/hpp/fcl/serialization/fwd.h index 0075ac064..abb1943fc 100644 --- a/include/hpp/fcl/serialization/fwd.h +++ b/include/hpp/fcl/serialization/fwd.h @@ -18,6 +18,7 @@ #include #include +#include "hpp/fcl/fwd.hh" #include "hpp/fcl/serialization/eigen.h" #define HPP_FCL_SERIALIZATION_SPLIT(Type) \ @@ -74,7 +75,10 @@ struct cast_register_initializer { void init(std::false_type) const {} cast_register_initializer const& init() const { - BOOST_STATIC_WARNING((std::is_base_of::value)); + HPP_FCL_COMPILER_DIAGNOSTIC_PUSH + _Pragma("GCC diagnostic ignored \"-Wconversion\"") + BOOST_STATIC_WARNING((std::is_base_of::value)); + HPP_FCL_COMPILER_DIAGNOSTIC_POP init(std::is_base_of()); return *this; } diff --git a/src/narrowphase/support_functions.cpp b/src/narrowphase/support_functions.cpp index 5b39f152f..3b632abb9 100644 --- a/src/narrowphase/support_functions.cpp +++ b/src/narrowphase/support_functions.cpp @@ -570,13 +570,15 @@ void getShapeSupportSet(const TriangleP* triangle, SupportSet& support_set, } } } -getShapeSupportSetTplInstantiation(TriangleP); +// clang-format off +getShapeSupportSetTplInstantiation(TriangleP) // ============================================================================ template void getShapeSupportSet(const Box* box, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data, size_t /*unused*/, FCL_REAL tol) { + // clang-format on assert(tol > 0); Vec3f support; const Vec3f& support_dir = support_set.getNormal(); @@ -612,7 +614,8 @@ void getShapeSupportSet(const Box* box, SupportSet& support_set, } computeSupportSetConvexHull(polygon, support_set.points()); } -getShapeSupportSetTplInstantiation(Box); +// clang-format off +getShapeSupportSetTplInstantiation(Box) // ============================================================================ template @@ -620,6 +623,7 @@ void getShapeSupportSet(const Sphere* sphere, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data /*unused*/, size_t /*unused*/, FCL_REAL /*unused*/) { + // clang-format on support_set.points().clear(); Vec3f support; @@ -628,13 +632,15 @@ void getShapeSupportSet(const Sphere* sphere, SupportSet& support_set, support_data); support_set.addPoint(support); } -getShapeSupportSetTplInstantiation(Sphere); +// clang-format off +getShapeSupportSetTplInstantiation(Sphere) // ============================================================================ template void getShapeSupportSet(const Ellipsoid* ellipsoid, SupportSet& support_set, int& hint, ShapeSupportData& support_data /*unused*/, size_t /*unused*/, FCL_REAL /*unused*/) { + // clang-format on support_set.points().clear(); Vec3f support; @@ -643,7 +649,8 @@ void getShapeSupportSet(const Ellipsoid* ellipsoid, SupportSet& support_set, support_data); support_set.addPoint(support); } -getShapeSupportSetTplInstantiation(Ellipsoid); +// clang-format off +getShapeSupportSetTplInstantiation(Ellipsoid) // ============================================================================ template @@ -651,6 +658,7 @@ void getShapeSupportSet(const Capsule* capsule, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data /*unused*/, size_t /*unused*/, FCL_REAL tol) { + // clang-format on assert(tol > 0); support_set.points().clear(); @@ -686,7 +694,8 @@ void getShapeSupportSet(const Capsule* capsule, SupportSet& support_set, } } } -getShapeSupportSetTplInstantiation(Capsule); +// clang-format off +getShapeSupportSetTplInstantiation(Capsule) // ============================================================================ template @@ -694,6 +703,7 @@ void getShapeSupportSet(const Cone* cone, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data /*unused*/, size_t num_sampled_supports, FCL_REAL tol) { + // clang-format on assert(tol > 0); support_set.points().clear(); @@ -757,7 +767,8 @@ void getShapeSupportSet(const Cone* cone, SupportSet& support_set, } } } -getShapeSupportSetTplInstantiation(Cone); +// clang-format off +getShapeSupportSetTplInstantiation(Cone) // ============================================================================ template @@ -765,6 +776,7 @@ void getShapeSupportSet(const Cylinder* cylinder, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data /*unused*/, size_t num_sampled_supports, FCL_REAL tol) { + // clang-format on assert(tol > 0); support_set.points().clear(); @@ -819,7 +831,8 @@ void getShapeSupportSet(const Cylinder* cylinder, SupportSet& support_set, } } } -getShapeSupportSetTplInstantiation(Cylinder); +// clang-format off +getShapeSupportSetTplInstantiation(Cylinder) // ============================================================================ template @@ -827,6 +840,7 @@ void getShapeSupportSetLinear(const ConvexBase* convex, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data, size_t /*unused*/, FCL_REAL tol) { + // clang-format on assert(tol > 0); Vec3f support; const Vec3f& support_dir = support_set.getNormal(); @@ -943,7 +957,8 @@ void getShapeSupportSet(const ConvexBase* convex, SupportSet& support_set, convex, support_set, hint, support_data, num_sampled_supports, tol); } } -getShapeSupportSetTplInstantiation(ConvexBase); +// clang-format off +getShapeSupportSetTplInstantiation(ConvexBase) // ============================================================================ template @@ -951,26 +966,32 @@ void getShapeSupportSet(const SmallConvex* convex, SupportSet& support_set, int& hint /*unused*/, ShapeSupportData& support_data /*unused*/, size_t num_sampled_supports /*unused*/, FCL_REAL tol) { + // clang-format on getShapeSupportSetLinear<_SupportOptions>( reinterpret_cast(convex), support_set, hint, support_data, num_sampled_supports, tol); } -getShapeSupportSetTplInstantiation(SmallConvex); +// clang-format off +getShapeSupportSetTplInstantiation(SmallConvex) // ============================================================================ template void getShapeSupportSet(const LargeConvex* convex, SupportSet& support_set, int& hint, ShapeSupportData& support_data, size_t num_sampled_supports /*unused*/, FCL_REAL tol) { + // clang-format on getShapeSupportSetLog<_SupportOptions>( reinterpret_cast(convex), support_set, hint, support_data, num_sampled_supports, tol); } -getShapeSupportSetTplInstantiation(LargeConvex); +//clang-format off +getShapeSupportSetTplInstantiation(LargeConvex) + // clang-format on -// ============================================================================ -HPP_FCL_DLLAPI void computeSupportSetConvexHull(SupportSet::Polygon& cloud, - SupportSet::Polygon& cvx_hull) { + // ============================================================================ + HPP_FCL_DLLAPI + void computeSupportSetConvexHull(SupportSet::Polygon& cloud, + SupportSet::Polygon& cvx_hull) { cvx_hull.clear(); if (cloud.size() <= 2) { diff --git a/test/collision.cpp b/test/collision.cpp index d672e95da..5b70aae4b 100644 --- a/test/collision.cpp +++ b/test/collision.cpp @@ -43,7 +43,15 @@ #include #include +#include + +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS + #include + +HPP_FCL_COMPILER_DIAGNOSTIC_POP + #include #include #include @@ -300,6 +308,9 @@ struct traits, Oriented, recursive> : base_traits { enum { IS_IMPLEMENTED = false }; }; +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS + struct mesh_mesh_run_test { mesh_mesh_run_test(const std::vector& _transforms, const CollisionRequest _request) @@ -319,6 +330,8 @@ struct mesh_mesh_run_test { int indent; + HPP_FCL_COMPILER_DIAGNOSTIC_POP + const char* getindent() { assert(indent < 9); static const char* t[] = {"", @@ -628,11 +641,16 @@ BOOST_AUTO_TEST_CASE(mesh_mesh) { << transforms[i].getQuatRotation().coeffs().format(f)); } + HPP_FCL_COMPILER_DIAGNOSTIC_PUSH + HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS + // Request all contacts and check that all methods give the same result. mesh_mesh_run_test runner( transforms, CollisionRequest(CONTACT, (size_t)num_max_contacts)); runner.enable_statistics = true; boost::mpl::for_each >(runner); + + HPP_FCL_COMPILER_DIAGNOSTIC_POP } BOOST_AUTO_TEST_CASE(mesh_mesh_benchmark) { diff --git a/test/normal_and_nearest_points.cpp b/test/normal_and_nearest_points.cpp index 696dd0269..a3ef2a696 100644 --- a/test/normal_and_nearest_points.cpp +++ b/test/normal_and_nearest_points.cpp @@ -240,7 +240,7 @@ void test_normal_and_nearest_points( } } -template +template Eigen::Matrix generateRandomVector(FCL_REAL min, FCL_REAL max) { typedef Eigen::Matrix VecType; diff --git a/test/serialization.cpp b/test/serialization.cpp index c8a0231b0..46177408c 100644 --- a/test/serialization.cpp +++ b/test/serialization.cpp @@ -36,6 +36,11 @@ #include #include +#include + +HPP_FCL_COMPILER_DIAGNOSTIC_PUSH +HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS + #include #include #include @@ -584,3 +589,5 @@ BOOST_AUTO_TEST_CASE(test_memory_footprint) { BOOST_CHECK(static_cast(m1.memUsage(false)) == computeMemoryFootprint(m1)); } + +HPP_FCL_COMPILER_DIAGNOSTIC_POP