Suppress unused variable warning from Eigen 3.2.0. - Eigen 3.2.0 emits an unused variable warning from Ordering.h #included by Eigen/SparseQR which prevents Ceres compilation due to -Werror. - As Eigen 3.2.0 is still in widespread use, we explicitly disable the warning only around the inclusion of Eigen/SparseQR. Change-Id: I48ce905ef6a22bc1b06f9e5bed328bd315f407f0
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc index 0fe481d..0a536f8 100644 --- a/internal/ceres/covariance_impl.cc +++ b/internal/ceres/covariance_impl.cc
@@ -39,7 +39,24 @@ #include <utility> #include <vector> #include "Eigen/SparseCore" + +// Suppress unused local variable warning from Eigen Ordering.h #included by +// SparseQR in Eigen 3.2.0. This was fixed in Eigen 3.2.1, but 3.2.0 is still +// widely used (Ubuntu 14.04), and Ceres won't compile otherwise due to -Werror. +#if defined(_MSC_VER) +#pragma warning( push ) +#pragma warning( disable : 42024 ) +#else +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif #include "Eigen/SparseQR" +#if defined(_MSC_VER) +#pragma warning( pop ) +#else +#pragma GCC diagnostic pop +#endif + #include "Eigen/SVD" #include "ceres/compressed_col_sparse_matrix_utils.h" #include "ceres/compressed_row_sparse_matrix.h"