From a61cbdc4d12e8fad03e98ed703ca40ebb72ec61e Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco Claraco Date: Wed, 3 Nov 2021 17:14:37 +0100 Subject: [PATCH] Fix warnings raised by GCC -Wpedactic --- gtsam/base/Manifold.h | 2 +- gtsam/base/Matrix.h | 22 +++++++++---------- gtsam/base/Testable.h | 2 +- gtsam/base/Vector.h | 4 ++-- gtsam/geometry/concepts.h | 4 ++-- gtsam/inference/FactorGraph.h | 2 +- gtsam/navigation/MagPoseFactor.h | 4 ++-- gtsam/nonlinear/CustomFactor.h | 2 +- gtsam/nonlinear/NonlinearEquality.h | 6 ++--- gtsam/nonlinear/PriorFactor.h | 2 +- gtsam_unstable/slam/BetweenFactorEM.h | 3 ++- gtsam_unstable/slam/PoseBetweenFactor.h | 4 ++-- gtsam_unstable/slam/PosePriorFactor.h | 4 ++-- .../slam/TransformBtwRobotsUnaryFactor.h | 4 ++-- 14 files changed, 33 insertions(+), 32 deletions(-) diff --git a/gtsam/base/Manifold.h b/gtsam/base/Manifold.h index dbe497005..a14404268 100644 --- a/gtsam/base/Manifold.h +++ b/gtsam/base/Manifold.h @@ -178,4 +178,4 @@ struct FixedDimension { // * the gtsam namespace to be more easily enforced as testable // */ #define GTSAM_CONCEPT_MANIFOLD_INST(T) template class gtsam::IsManifold; -#define GTSAM_CONCEPT_MANIFOLD_TYPE(T) typedef gtsam::IsManifold _gtsam_IsManifold_##T; +#define GTSAM_CONCEPT_MANIFOLD_TYPE(T) using _gtsam_IsManifold_##T = gtsam::IsManifold diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index 013947bbd..26f03f3e3 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -46,18 +46,18 @@ typedef Eigen::Matrix M // Create handy typedefs and constants for square-size matrices // MatrixMN, MatrixN = MatrixNN, I_NxN, and Z_NxN, for M,N=1..9 #define GTSAM_MAKE_MATRIX_DEFS(N) \ -typedef Eigen::Matrix Matrix##N; \ -typedef Eigen::Matrix Matrix1##N; \ -typedef Eigen::Matrix Matrix2##N; \ -typedef Eigen::Matrix Matrix3##N; \ -typedef Eigen::Matrix Matrix4##N; \ -typedef Eigen::Matrix Matrix5##N; \ -typedef Eigen::Matrix Matrix6##N; \ -typedef Eigen::Matrix Matrix7##N; \ -typedef Eigen::Matrix Matrix8##N; \ -typedef Eigen::Matrix Matrix9##N; \ +using Matrix##N = Eigen::Matrix; \ +using Matrix1##N = Eigen::Matrix; \ +using Matrix2##N = Eigen::Matrix; \ +using Matrix3##N = Eigen::Matrix; \ +using Matrix4##N = Eigen::Matrix; \ +using Matrix5##N = Eigen::Matrix; \ +using Matrix6##N = Eigen::Matrix; \ +using Matrix7##N = Eigen::Matrix; \ +using Matrix8##N = Eigen::Matrix; \ +using Matrix9##N = Eigen::Matrix; \ static const Eigen::MatrixBase::IdentityReturnType I_##N##x##N = Matrix##N::Identity(); \ -static const Eigen::MatrixBase::ConstantReturnType Z_##N##x##N = Matrix##N::Zero(); +static const Eigen::MatrixBase::ConstantReturnType Z_##N##x##N = Matrix##N::Zero() GTSAM_MAKE_MATRIX_DEFS(1); GTSAM_MAKE_MATRIX_DEFS(2); diff --git a/gtsam/base/Testable.h b/gtsam/base/Testable.h index 6062c7ae1..74e237699 100644 --- a/gtsam/base/Testable.h +++ b/gtsam/base/Testable.h @@ -173,4 +173,4 @@ namespace gtsam { * @deprecated please use BOOST_CONCEPT_ASSERT and */ #define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable; -#define GTSAM_CONCEPT_TESTABLE_TYPE(T) typedef gtsam::IsTestable _gtsam_Testable_##T; +#define GTSAM_CONCEPT_TESTABLE_TYPE(T) using _gtsam_Testable_##T = gtsam::IsTestable diff --git a/gtsam/base/Vector.h b/gtsam/base/Vector.h index ed90a7126..8a7eb1d55 100644 --- a/gtsam/base/Vector.h +++ b/gtsam/base/Vector.h @@ -48,8 +48,8 @@ static const Eigen::MatrixBase::ConstantReturnType Z_3x1 = Vector3::Zer // Create handy typedefs and constants for vectors with N>3 // VectorN and Z_Nx1, for N=1..9 #define GTSAM_MAKE_VECTOR_DEFS(N) \ - typedef Eigen::Matrix Vector##N; \ - static const Eigen::MatrixBase::ConstantReturnType Z_##N##x1 = Vector##N::Zero(); + using Vector##N = Eigen::Matrix; \ + static const Eigen::MatrixBase::ConstantReturnType Z_##N##x1 = Vector##N::Zero() GTSAM_MAKE_VECTOR_DEFS(4); GTSAM_MAKE_VECTOR_DEFS(5); diff --git a/gtsam/geometry/concepts.h b/gtsam/geometry/concepts.h index 207b48f56..a313d4448 100644 --- a/gtsam/geometry/concepts.h +++ b/gtsam/geometry/concepts.h @@ -71,6 +71,6 @@ private: */ /** Pose Concept macros */ -#define GTSAM_CONCEPT_POSE_INST(T) template class gtsam::PoseConcept; -#define GTSAM_CONCEPT_POSE_TYPE(T) typedef gtsam::PoseConcept _gtsam_PoseConcept##T; +#define GTSAM_CONCEPT_POSE_INST(T) template class gtsam::PoseConcept +#define GTSAM_CONCEPT_POSE_TYPE(T) using _gtsam_PoseConcept##T = gtsam::PoseConcept; diff --git a/gtsam/inference/FactorGraph.h b/gtsam/inference/FactorGraph.h index e337e3249..0a0c89f50 100644 --- a/gtsam/inference/FactorGraph.h +++ b/gtsam/inference/FactorGraph.h @@ -121,7 +121,7 @@ class FactorGraph { protected: /** concept check, makes sure FACTOR defines print and equals */ - GTSAM_CONCEPT_TESTABLE_TYPE(FACTOR) + GTSAM_CONCEPT_TESTABLE_TYPE(FACTOR); /** Collection of factors */ FastVector factors_; diff --git a/gtsam/navigation/MagPoseFactor.h b/gtsam/navigation/MagPoseFactor.h index da2a54ce9..feb6e0e19 100644 --- a/gtsam/navigation/MagPoseFactor.h +++ b/gtsam/navigation/MagPoseFactor.h @@ -45,8 +45,8 @@ class MagPoseFactor: public NoiseModelFactor1 { using shared_ptr = boost::shared_ptr>; /// Concept check by type. - GTSAM_CONCEPT_TESTABLE_TYPE(POSE) - GTSAM_CONCEPT_POSE_TYPE(POSE) + GTSAM_CONCEPT_TESTABLE_TYPE(POSE); + GTSAM_CONCEPT_POSE_TYPE(POSE); public: ~MagPoseFactor() override {} diff --git a/gtsam/nonlinear/CustomFactor.h b/gtsam/nonlinear/CustomFactor.h index dbaf31898..615b5418e 100644 --- a/gtsam/nonlinear/CustomFactor.h +++ b/gtsam/nonlinear/CustomFactor.h @@ -101,4 +101,4 @@ private: } }; -}; +} diff --git a/gtsam/nonlinear/NonlinearEquality.h b/gtsam/nonlinear/NonlinearEquality.h index 47083d5d7..1d7be99fd 100644 --- a/gtsam/nonlinear/NonlinearEquality.h +++ b/gtsam/nonlinear/NonlinearEquality.h @@ -218,9 +218,9 @@ protected: X value_; /// fixed value for variable - GTSAM_CONCEPT_MANIFOLD_TYPE(X) + GTSAM_CONCEPT_MANIFOLD_TYPE(X); - GTSAM_CONCEPT_TESTABLE_TYPE(X) + GTSAM_CONCEPT_TESTABLE_TYPE(X); public: @@ -296,7 +296,7 @@ class NonlinearEquality2 : public NoiseModelFactor2 { using Base = NoiseModelFactor2; using This = NonlinearEquality2; - GTSAM_CONCEPT_MANIFOLD_TYPE(T) + GTSAM_CONCEPT_MANIFOLD_TYPE(T); /// Default constructor to allow for serialization NonlinearEquality2() {} diff --git a/gtsam/nonlinear/PriorFactor.h b/gtsam/nonlinear/PriorFactor.h index c745f7bd9..71c204ad0 100644 --- a/gtsam/nonlinear/PriorFactor.h +++ b/gtsam/nonlinear/PriorFactor.h @@ -39,7 +39,7 @@ namespace gtsam { VALUE prior_; /** The measurement */ /** concept check by type */ - GTSAM_CONCEPT_TESTABLE_TYPE(T) + GTSAM_CONCEPT_TESTABLE_TYPE(T); public: diff --git a/gtsam_unstable/slam/BetweenFactorEM.h b/gtsam_unstable/slam/BetweenFactorEM.h index 98ec59fe9..f78f9b334 100644 --- a/gtsam_unstable/slam/BetweenFactorEM.h +++ b/gtsam_unstable/slam/BetweenFactorEM.h @@ -56,7 +56,8 @@ private: bool flag_bump_up_near_zero_probs_; /** concept check by type */ - GTSAM_CONCEPT_LIE_TYPE(T)GTSAM_CONCEPT_TESTABLE_TYPE(T) + GTSAM_CONCEPT_LIE_TYPE(T); + GTSAM_CONCEPT_TESTABLE_TYPE(T); public: diff --git a/gtsam_unstable/slam/PoseBetweenFactor.h b/gtsam_unstable/slam/PoseBetweenFactor.h index a6c583418..624fd4a54 100644 --- a/gtsam_unstable/slam/PoseBetweenFactor.h +++ b/gtsam_unstable/slam/PoseBetweenFactor.h @@ -40,8 +40,8 @@ namespace gtsam { boost::optional body_P_sensor_; ///< The pose of the sensor in the body frame /** concept check by type */ - GTSAM_CONCEPT_TESTABLE_TYPE(POSE) - GTSAM_CONCEPT_POSE_TYPE(POSE) + GTSAM_CONCEPT_TESTABLE_TYPE(POSE); + GTSAM_CONCEPT_POSE_TYPE(POSE); public: // shorthand for a smart pointer to a factor diff --git a/gtsam_unstable/slam/PosePriorFactor.h b/gtsam_unstable/slam/PosePriorFactor.h index f657fc443..bea849c00 100644 --- a/gtsam_unstable/slam/PosePriorFactor.h +++ b/gtsam_unstable/slam/PosePriorFactor.h @@ -37,8 +37,8 @@ namespace gtsam { boost::optional body_P_sensor_; ///< The pose of the sensor in the body frame /** concept check by type */ - GTSAM_CONCEPT_TESTABLE_TYPE(POSE) - GTSAM_CONCEPT_POSE_TYPE(POSE) + GTSAM_CONCEPT_TESTABLE_TYPE(POSE); + GTSAM_CONCEPT_POSE_TYPE(POSE); public: /// shorthand for a smart pointer to a factor diff --git a/gtsam_unstable/slam/TransformBtwRobotsUnaryFactor.h b/gtsam_unstable/slam/TransformBtwRobotsUnaryFactor.h index 956c75999..3f2e02a78 100644 --- a/gtsam_unstable/slam/TransformBtwRobotsUnaryFactor.h +++ b/gtsam_unstable/slam/TransformBtwRobotsUnaryFactor.h @@ -55,8 +55,8 @@ namespace gtsam { SharedGaussian model_; /** concept check by type */ - GTSAM_CONCEPT_LIE_TYPE(T) - GTSAM_CONCEPT_TESTABLE_TYPE(T) + GTSAM_CONCEPT_LIE_TYPE(T); + GTSAM_CONCEPT_TESTABLE_TYPE(T); public: