Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings #2139

Merged
merged 20 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4f01b5e
core: Use C++11 std::vector constructor to avoid maybe-uninitialized …
jorisv Jan 25, 2024
44cce06
core: Don't use const_derived Eigen3 hack for QuaternionBase type
jorisv Jan 25, 2024
468339b
python: Don't use a deprecated macro when using recent Eigenpy version
jorisv Jan 25, 2024
3728327
core: Add macro to ignore -Wmaybe-uninitialized
jorisv Jan 25, 2024
940c3c1
core: Initialize second base class in default copy constructor/assign…
jorisv Jan 25, 2024
d71d45e
cmake: Deactivate maybe-uninitialized warning
jorisv Jan 25, 2024
e122d6e
Revert "core: Add macro to ignore -Wmaybe-uninitialized"
jorisv Jan 25, 2024
da9ab67
[core] Remove -Wconversion warning
jorisv Jan 25, 2024
a2cfeb0
cmake: Remove NOMINMAX definition since is a public pinocchio definition
jorisv Jan 26, 2024
3c7742c
[cmake] Improve ClangCL support with CXX_FLAGS_BY_COMPILER_FRONTEND
jorisv Jan 26, 2024
f3e7480
cmake: Since -Wno-maybe-uninitialized is PRIVATE, add it to unit test…
jorisv Jan 26, 2024
ef26d62
changelog: Add entries
jorisv Jan 26, 2024
d9023ee
core: Add macro to ignore -Wmaybe-uninitialized
jorisv Jan 26, 2024
eccd6f7
core: Don't use -Wno-maybe-uninitialized, ignore the warning locally
jorisv Jan 26, 2024
72603cc
cmake: update jrl-cmakemodules
jorisv Jan 26, 2024
75e69d3
cmake: Move CXX_FLAGS_BY_COMPILER_FRONTEND to jrl-cmakemodules
jorisv Jan 26, 2024
713e496
cmake: update jrl-cmakemodules
jorisv Jan 26, 2024
4583a84
cmake: use standard jrl-cmakemodules
jorisv Jan 29, 2024
bea7367
compiler: remove lasts warnings
jorisv Jan 29, 2024
e67b023
[core] Remove O2 specific warnings
jorisv Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Changed
- Set NOMINMAX as a public definitions on Windows ([#2139](https://github.com/stack-of-tasks/pinocchio/pull/2139))

### Fixed
- Remove a lot of warnings ([#2139](https://github.com/stack-of-tasks/pinocchio/pull/2139))

## [2.7.0] - 2024-01-23

### Added
Expand Down
4 changes: 0 additions & 4 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
# ----------------------------------------------------
# --- BENCHMARK --------------------------------------
# ----------------------------------------------------
IF(WIN32)
ADD_DEFINITIONS("-DNOMINMAX")
ENDIF()

ADD_CUSTOM_TARGET(bench)

MACRO(ADD_BENCH bench_name)
Expand Down
11 changes: 6 additions & 5 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ IF(BUILD_PYTHON_INTERFACE)
# Do not report:
# -Wconversion as the BOOST_PYTHON_FUNCTION_OVERLOADS implicitly converts.
# -Wcomment as latex equations have multi-line comments.
# -Wself-assign-overloaded as bp::self operations trigger this
IF(NOT WIN32)
TARGET_COMPILE_OPTIONS(${PYWRAP} PRIVATE -Wno-conversion -Wno-comment -Wno-self-assign-overloaded)
ENDIF(NOT WIN32)
# -Wself-assign-overloaded as bp::self operations trigger this (Clang only)
CXX_FLAGS_BY_COMPILER_FRONTEND(
GNU -Wno-conversion -Wno-comment -Wno-self-assign-overloaded
OUTPUT PRIVATE_OPTIONS
FILTER)
TARGET_COMPILE_OPTIONS(${PYWRAP} PRIVATE ${PRIVATE_OPTIONS})

SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES VERSION ${PROJECT_VERSION})
IF(BUILD_WITH_COMMIT_VERSION)
Expand All @@ -61,7 +63,6 @@ IF(BUILD_PYTHON_INTERFACE)
TARGET_COMPILE_DEFINITIONS(${PYWRAP} PRIVATE -DPINOCCHIO_PYTHON_INTERFACE_WITH_HPP_FCL_PYTHON_BINDINGS)
ENDIF(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
IF(WIN32)
TARGET_COMPILE_DEFINITIONS(${PYWRAP} PRIVATE -DNOMINMAX)
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PYTHON_LIBRARY})
ENDIF(WIN32)

Expand Down
3 changes: 3 additions & 0 deletions bindings/python/parsers/urdf/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ namespace pinocchio
MeshLoaderPtr mesh_loader = MeshLoaderPtr();
if (!py_mesh_loader.is_none()) {
#ifdef PINOCCHIO_WITH_HPP_FCL
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
mesh_loader = bp::extract<::hpp::fcl::MeshLoaderPtr>(py_mesh_loader);
PINOCCHIO_COMPILER_DIAGNOSTIC_POP
#else
PyErr_WarnEx(PyExc_UserWarning, "Mesh loader is ignored because Pinocchio is not built with hpp-fcl", 1);
#endif
Expand Down
15 changes: 9 additions & 6 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
# Copyright (c) 2015-2022 CNRS INRIA
#

# Compute flags outside the macro to avoid recomputing it for each tests
CXX_FLAGS_BY_COMPILER_FRONTEND(
MSVC _USE_MATH_DEFINES
OUTPUT EXAMPLE_PRIVATE_DEFINITIONS)

FUNCTION(ADD_PINOCCHIO_CPP_EXAMPLE EXAMPLE)
GET_FILENAME_COMPONENT(EXAMPLE_NAME ${EXAMPLE} NAME)
SET(EXAMPLE_NAME "example-cpp-${EXAMPLE_NAME}")
ADD_UNIT_TEST(${EXAMPLE_NAME} "${EXAMPLE}.cpp")
TARGET_LINK_LIBRARIES(${EXAMPLE_NAME} PUBLIC ${PROJECT_NAME})

TARGET_COMPILE_DEFINITIONS(${EXAMPLE_NAME}
PRIVATE ${EXAMPLE_PRIVATE_DEFINITIONS}
PINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")

# There is no RPATH in Windows, then we must use the PATH to find the DLL
IF(WIN32)
STRING(REPLACE ";" "\\\;" _PATH "$ENV{PATH}")
Expand Down Expand Up @@ -51,12 +60,6 @@ IF(hpp-fcl_FOUND)
ENDIF()
ENDIF(hpp-fcl_FOUND)

ADD_DEFINITIONS(-DPINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")

IF(WIN32)
ADD_DEFINITIONS("-DNOMINMAX -D_USE_MATH_DEFINES")
ENDIF(WIN32)

FOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
ADD_PINOCCHIO_CPP_EXAMPLE(${EXAMPLE})
ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
Expand Down
1 change: 1 addition & 0 deletions examples/overview-lie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ int main()
SE2Operation aSE2;
SE2Operation::ConfigVector_t pose_s,pose_g;
SE2Operation::TangentVector_t delta_u;
delta_u.setZero();

// Starting configuration
pose_s(0) = 1.0; pose_s(1) = 1.0;
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/multibody/data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include "pinocchio/bindings/python/utils/copyable.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::Data)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/multibody/geometry-data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include "pinocchio/bindings/python/utils/std-vector.hpp"
#include "pinocchio/bindings/python/serialization/serializable.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::GeometryData)
#endif

namespace pinocchio
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/multibody/geometry.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::GeometryModel)
#endif

namespace pinocchio
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

#include "pinocchio/multibody/geometry.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::GeometryObject)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/multibody/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include "pinocchio/bindings/python/utils/pickle-map.hpp"
#include "pinocchio/bindings/python/utils/std-vector.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::Model)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/multibody/pool/geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/std-vector.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::GeometryPool)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/multibody/pool/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/std-vector.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::ModelPool)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/spatial/force.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/printable.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::Force)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/spatial/inertia.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/printable.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::Inertia)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/spatial/motion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/printable.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::Motion)
#endif

namespace pinocchio
{
Expand Down
2 changes: 2 additions & 0 deletions include/pinocchio/bindings/python/spatial/se3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/printable.hpp"

#if EIGENPY_VERSION_AT_MOST(2,8,1)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::SE3)
#endif

namespace pinocchio
{
Expand Down
4 changes: 3 additions & 1 deletion include/pinocchio/container/aligned-vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ namespace pinocchio
aligned_vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type())
: vector_base(first, last, a) {}
aligned_vector(const aligned_vector & c) : vector_base(c) {}
explicit aligned_vector(size_type num, const value_type & val = value_type())
explicit aligned_vector(size_type num, const value_type & val)
: vector_base(num, val) {}
explicit aligned_vector(size_type num)
: vector_base(num) {}
aligned_vector(iterator start, iterator end) : vector_base(start, end) {}
aligned_vector & operator=(const aligned_vector& x)
{ vector_base::operator=(x); return *this; }
Expand Down
7 changes: 7 additions & 0 deletions include/pinocchio/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,21 @@ namespace pinocchio
# define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
# define PINOCCHIO_COMPILER_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# if defined(__clang__)
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
# else
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# endif
#elif defined (WIN32)
# define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH _Pragma("warning(push)")
# define PINOCCHIO_COMPILER_DIAGNOSTIC_POP _Pragma("warning(pop)")
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS _Pragma("warning(disable : 4996)")
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
#else
# define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
# define PINOCCHIO_COMPILER_DIAGNOSTIC_POP
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
# define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
#endif // __GNUC__

// Handle explicitely the GCC boring warning: 'anonymous variadic macros were introduced in C++11'
Expand Down
10 changes: 5 additions & 5 deletions include/pinocchio/math/quaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace pinocchio

/// Uniformly random quaternion sphere.
template<typename Derived>
void uniformRandom(const Eigen::QuaternionBase<Derived> & q)
void uniformRandom(Eigen::QuaternionBase<Derived> & q)
{
typedef typename Derived::Scalar Scalar;

Expand All @@ -121,10 +121,10 @@ namespace pinocchio
Scalar s2,c2; SINCOS(Scalar(2)*PI_value*u2,&s2,&c2);
Scalar s3,c3; SINCOS(Scalar(2)*PI_value*u3,&s3,&c3);

PINOCCHIO_EIGEN_CONST_CAST(Derived,q).w() = mult1 * s2;
PINOCCHIO_EIGEN_CONST_CAST(Derived,q).x() = mult1 * c2;
PINOCCHIO_EIGEN_CONST_CAST(Derived,q).y() = mult2 * s3;
PINOCCHIO_EIGEN_CONST_CAST(Derived,q).z() = mult2 * c3;
q.w() = mult1 * s2;
q.x() = mult1 * c2;
q.y() = mult2 * s3;
q.z() = mult2 * c3;
}

namespace internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ namespace pinocchio

typedef Eigen::Matrix<Scalar,3,1,_Options> Vector3;

JointModelPrismaticUnalignedTpl() {}
JointModelPrismaticUnalignedTpl(): axis(Vector3::UnitX()) {}
JointModelPrismaticUnalignedTpl(const Scalar & x,
const Scalar & y,
const Scalar & z)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ namespace pinocchio
using Base::idx_v;
using Base::setIndexes;

JointModelRevoluteUnalignedTpl() {}
JointModelRevoluteUnalignedTpl(): axis(Vector3::UnitX()) {}

JointModelRevoluteUnalignedTpl(const Scalar & x,
const Scalar & y,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace pinocchio
using Base::idx_v;
using Base::setIndexes;

JointModelRevoluteUnboundedUnalignedTpl() {}
JointModelRevoluteUnboundedUnalignedTpl(): axis(Vector3::UnitX()) {}

JointModelRevoluteUnboundedUnalignedTpl(const Scalar & x,
const Scalar & y,
Expand Down
9 changes: 9 additions & 0 deletions include/pinocchio/multibody/liegroup/liegroup-base.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,11 @@ namespace pinocchio {
const AssignmentOperatorType op) const
{
Index nv_ (nv());
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
JacobianMatrix_t J (nv_, nv_);
dIntegrate(q, v, J, arg);
PINOCCHIO_COMPILER_DIAGNOSTIC_POP
switch (op) {
case SETTO:
if(dIntegrateOnTheLeft) Jout = J * Jin;
Expand All @@ -585,8 +588,11 @@ namespace pinocchio {
const AssignmentOperatorType op) const
{
Index nv_ (nv());
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
JacobianMatrix_t J (nv_, nv_);
dDifference<arg>(q0, q1, J);
PINOCCHIO_COMPILER_DIAGNOSTIC_POP
switch (op) {
case SETTO:
if(dDifferenceOnTheLeft) Jout = J * Jin;
Expand Down Expand Up @@ -627,8 +633,11 @@ namespace pinocchio {
const Eigen::MatrixBase<ConfigL_t> & q0,
const Eigen::MatrixBase<ConfigR_t> & q1) const
{
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
TangentVector_t t(nv());
difference(q0.derived(), q1.derived(), t);
PINOCCHIO_COMPILER_DIAGNOSTIC_POP
return t.squaredNorm();
}

Expand Down
11 changes: 2 additions & 9 deletions include/pinocchio/multibody/liegroup/liegroup-generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,8 @@ namespace pinocchio
: Base(lg_variant)
{}

LieGroupGenericTpl(const LieGroupGenericTpl & lg_generic)
: Base(lg_generic)
{}

LieGroupGenericTpl & operator=(const LieGroupGenericTpl & other)
{
static_cast<Base&>(*this) = other.toVariant();
return *this;
}
LieGroupGenericTpl(const LieGroupGenericTpl & lg_generic) = default;
LieGroupGenericTpl & operator=(const LieGroupGenericTpl & other) = default;

const LieGroupVariant & toVariant() const
{ return static_cast<const LieGroupVariant &>(*this); }
Expand Down
Loading
Loading