Skip to content

Commit

Permalink
Apply the fix for the compiler error.
Browse files Browse the repository at this point in the history
Fix for the compiler error that occurs with the latest compilers (gcc 11 and up) when compiling sophus.

Reference: stonier/sophus#23
  • Loading branch information
YuZhong-Chen committed Dec 1, 2023
1 parent 14846a8 commit 7beb725
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions kobuki_ws/src/sophus/sophus/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,22 @@ class optional {
explicit operator bool() const { return is_valid_; }

T const* operator->() const {
SOPHUS_ENSURE(is_valid_, "must be valid");
SOPHUS_ENSURE(is_valid_, "%s", "must be valid");
return &type_;
}

T* operator->() {
SOPHUS_ENSURE(is_valid_, "must be valid");
SOPHUS_ENSURE(is_valid_, "%s", "must be valid");
return &type_;
}

T const& operator*() const {
SOPHUS_ENSURE(is_valid_, "must be valid");
SOPHUS_ENSURE(is_valid_, "%s", "must be valid");
return type_;
}

T& operator*() {
SOPHUS_ENSURE(is_valid_, "must be valid");
SOPHUS_ENSURE(is_valid_, "%s", "must be valid");
return type_;
}

Expand Down
2 changes: 1 addition & 1 deletion kobuki_ws/src/sophus/sophus/se2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ class SE2 : public SE2Base<SE2<Scalar_, Options>> {
/// Precondition: ``i`` must be in 0, 1 or 2.
///
SOPHUS_FUNC static Transformation generator(int i) {
SOPHUS_ENSURE(i >= 0 || i <= 2, "i should be in range [0,2].");
SOPHUS_ENSURE(i >= 0 || i <= 2, "%s", "i should be in range [0,2].");
Tangent e;
e.setZero();
e[i] = Scalar(1);
Expand Down
2 changes: 1 addition & 1 deletion kobuki_ws/src/sophus/sophus/se3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ class SE3 : public SE3Base<SE3<Scalar_, Options>> {
/// Precondition: ``i`` must be in [0, 5].
///
SOPHUS_FUNC static Transformation generator(int i) {
SOPHUS_ENSURE(i >= 0 && i <= 5, "i should be in range [0,5].");
SOPHUS_ENSURE(i >= 0 && i <= 5, "%s", "i should be in range [0,5].");
Tangent e;
e.setZero();
e[i] = Scalar(1);
Expand Down
2 changes: 1 addition & 1 deletion kobuki_ws/src/sophus/sophus/so2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class SO2Base {
using std::hypot;
// Avoid under/overflows for higher precision
Scalar length = hypot(unit_complex().x(), unit_complex().y());
SOPHUS_ENSURE(length >= Constants<Scalar>::epsilon(),
SOPHUS_ENSURE(length >= Constants<Scalar>::epsilon(), "%s",
"Complex number should not be close to zero!");
unit_complex_nonconst() /= length;
}
Expand Down
4 changes: 2 additions & 2 deletions kobuki_ws/src/sophus/sophus/so3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ class SO3 : public SO3Base<SO3<Scalar_, Options>> {
///
SOPHUS_FUNC static SO3<Scalar> expAndTheta(Tangent const& omega,
Scalar* theta) {
SOPHUS_ENSURE(theta != nullptr, "must not be nullptr.");
SOPHUS_ENSURE(theta != nullptr, "%s", "must not be nullptr.");
using std::abs;
using std::cos;
using std::sin;
Expand Down Expand Up @@ -733,7 +733,7 @@ class SO3 : public SO3Base<SO3<Scalar_, Options>> {
/// Precondition: ``i`` must be 0, 1 or 2.
///
SOPHUS_FUNC static Transformation generator(int i) {
SOPHUS_ENSURE(i >= 0 && i <= 2, "i should be in range [0,2].");
SOPHUS_ENSURE(i >= 0 && i <= 2, "%s", "i should be in range [0,2].");
Tangent e;
e.setZero();
e[i] = Scalar(1);
Expand Down

0 comments on commit 7beb725

Please sign in to comment.