robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
395 stars 118 forks source link

Fix simple warnings #125

Closed k2shah closed 2 years ago

k2shah commented 2 years ago

This MR fixes some warnings thrown by c++17 using -Wall

In file included from /src/Solver.cpp:11:0:
osqp_eigen/OsqpEigen/Solver.hpp: In constructor 'OsqpEigen::Solver::Solver()':
osqp_eigen/OsqpEigen/Solver.hpp:53:14: warning: 'OsqpEigen::Solver::m_isSolverInitialized' will be initialized after [-Wreorder]
         bool m_isSolverInitialized; /**< Boolean true if solver is initialized. */
              ^~~~~~~~~~~~~~~~~~~~~
In file included from /src/Solver.cpp:11:0:
osqp_eigen/OsqpEigen/Solver.hpp:34:78: warning:   'std::unique_ptr<OSQPWorkspace, std::function<void(OSQPWorkspace*)> > OsqpEigen::Solver::m_workspace' [-Wreorder]
         std::unique_ptr<OSQPWorkspace, std::function<void(OSQPWorkspace *)>> m_workspace;  /**< Pointer to OSQPWorkspace struct. */
                                                                              ^~~~~~~~~~~
/src/Solver.cpp:20:1: warning:   when initialized here [-Wreorder]
 OsqpEigen::Solver::Solver()
 ^~~~~~~~~
INFO: From Compiling src/Data.cpp:
/src/Data.cpp: In member function 'bool OsqpEigen::Data::isSet() const':
/src/Data.cpp:92:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         m_isLinearConstraintsMatrixSet &&
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         m_isLowerBoundSet &&
         ~~~~~~~~~~~~~~~~~~^~
         m_isUpperBoundSet;
         ~~~~~~~~~~~~~~~~~  
k2shah commented 2 years ago

hi @GiulioRomualdi Please let me know if this PR is acceptable and who might be able to review it. It''s a small PR aimed at fixing warnings.

GiulioRomualdi commented 2 years ago

Thank you @k2shah for the contribution