Introduce a TEST_SET_BUT_UNUSED_VARIABLE macro for initialized but unused variables in the unit tests and also fix a few other warnings.

This commit is contained in:
Gael Guennebaud 2013-06-25 11:42:04 +02:00
parent 4cc9377941
commit 95f8a738ea
17 changed files with 29 additions and 36 deletions

View File

@ -851,7 +851,6 @@ struct solve_retval<JacobiSVD<_MatrixType, QRPreconditioner>, Rhs>
// So A^{-1} = V S^{-1} U^*
Matrix<Scalar, Dynamic, Rhs::ColsAtCompileTime, 0, _MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime> tmp;
Index diagSize = (std::min)(dec().rows(), dec().cols());
Index nonzeroSingVals = dec().nonzeroSingularValues();
tmp.noalias() = dec().matrixU().leftCols(nonzeroSingVals).adjoint() * rhs();

View File

@ -305,7 +305,6 @@ template<typename MatrixType> void cholesky_verify_assert()
void test_cholesky()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );
CALL_SUBTEST_3( cholesky(Matrix2d()) );
@ -328,5 +327,5 @@ void test_cholesky()
CALL_SUBTEST_9( LLT<MatrixXf>(10) );
CALL_SUBTEST_9( LDLT<MatrixXf>(10) );
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -55,7 +55,6 @@ void test_determinant()
{
for(int i = 0; i < g_repeat; i++) {
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
CALL_SUBTEST_1( determinant(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( determinant(Matrix<double, 2, 2>()) );
CALL_SUBTEST_3( determinant(Matrix<double, 3, 3>()) );
@ -63,6 +62,6 @@ void test_determinant()
CALL_SUBTEST_5( determinant(Matrix<std::complex<double>, 10, 10>()) );
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
CALL_SUBTEST_6( determinant(MatrixXd(s, s)) );
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}
}

View File

@ -102,7 +102,6 @@ template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m
void test_eigensolver_complex()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( eigensolver(Matrix4cf()) );
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
@ -119,5 +118,5 @@ void test_eigensolver_complex()
// Test problem size constructors
CALL_SUBTEST_5(ComplexEigenSolver<MatrixXf> tmp(s));
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -45,7 +45,6 @@ void test_eigensolver_generalized_real()
{
for(int i = 0; i < g_repeat; i++) {
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
CALL_SUBTEST_1( generalized_eigensolver_real(Matrix4f()) );
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(s,s)) );
@ -55,6 +54,6 @@ void test_eigensolver_generalized_real()
CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(2,2)) );
CALL_SUBTEST_3( generalized_eigensolver_real(Matrix<double,1,1>()) );
CALL_SUBTEST_4( generalized_eigensolver_real(Matrix2d()) );
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}
}

View File

@ -89,7 +89,6 @@ template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m
void test_eigensolver_generic()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( eigensolver(Matrix4f()) );
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
@ -122,5 +121,5 @@ void test_eigensolver_generic()
}
);
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -111,7 +111,6 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
void test_eigensolver_selfadjoint()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat; i++) {
// very important to test 3x3 and 2x2 matrices since we provide special paths for them
CALL_SUBTEST_1( selfadjointeigensolver(Matrix2d()) );
@ -139,6 +138,6 @@ void test_eigensolver_selfadjoint()
CALL_SUBTEST_8(SelfAdjointEigenSolver<MatrixXf> tmp1(s));
CALL_SUBTEST_8(Tridiagonalization<MatrixXf> tmp2(s));
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -87,7 +87,6 @@ template<typename MatrixType> void inverse(const MatrixType& m)
void test_inverse()
{
int s = 0;
s = s; // ICC shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( inverse(Matrix<double,1,1>()) );
CALL_SUBTEST_2( inverse(Matrix2d()) );
@ -101,5 +100,5 @@ void test_inverse()
CALL_SUBTEST_7( inverse(Matrix4d()) );
CALL_SUBTEST_7( inverse(Matrix<double,4,4,DontAlign>()) );
}
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -324,8 +324,10 @@ void test_jacobisvd()
int r = internal::random<int>(1, 30),
c = internal::random<int>(1, 30);
r = r; // shuts down ICC's remark #593: variable "s" was set but never used
c = c;
TEST_SET_BUT_UNUSED_VARIABLE(r)
TEST_SET_BUT_UNUSED_VARIABLE(c)
CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(r,c)) ));
CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(r,c)) ));
(void) r;

View File

@ -31,6 +31,10 @@
// B0 is defined in POSIX header termios.h
#define B0 FORBIDDEN_IDENTIFIER
// shuts down ICC's remark #593: variable "XXX" was set but never used
#define TEST_SET_BUT_UNUSED_VARIABLE(X) X = X + 0;
// the following file is automatically generated by cmake
#include "split_test_helper.h"
@ -380,13 +384,13 @@ template<typename T> struct GetDifferentType<std::complex<T> >
// Forward declaration to avoid ICC warning
template<typename T> std::string type_name();
template<typename T> std::string type_name() { return "other"; }
template<> std::string type_name<float>() { return "float"; }
template<> std::string type_name<double>() { return "double"; }
template<> std::string type_name<int>() { return "int"; }
template<> std::string type_name<std::complex<float> >() { return "complex<float>"; }
template<typename T> std::string type_name() { return "other"; }
template<> std::string type_name<float>() { return "float"; }
template<> std::string type_name<double>() { return "double"; }
template<> std::string type_name<int>() { return "int"; }
template<> std::string type_name<std::complex<float> >() { return "complex<float>"; }
template<> std::string type_name<std::complex<double> >() { return "complex<double>"; }
template<> std::string type_name<std::complex<int> >() { return "complex<int>"; }
template<> std::string type_name<std::complex<int> >() { return "complex<int>"; }
// forward declaration of the main test function
void EIGEN_CAT(test_,EIGEN_TEST_FUNC)();

View File

@ -63,7 +63,6 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
void test_product_selfadjoint()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST_1( product_selfadjoint(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( product_selfadjoint(Matrix<float, 2, 2>()) );
@ -77,5 +76,5 @@ void test_product_selfadjoint()
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);
CALL_SUBTEST_7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(s,s)) );
}
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -74,7 +74,6 @@ template<typename MatrixType> void trmv(const MatrixType& m)
void test_product_trmv()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST_1( trmv(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( trmv(Matrix<float, 2, 2>()) );
@ -86,5 +85,5 @@ void test_product_trmv()
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);
CALL_SUBTEST_6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(s, s)) );
}
EIGEN_UNUSED_VARIABLE(s);
TEST_SET_BUT_UNUSED_VARIABLE(s);
}

View File

@ -49,7 +49,6 @@ template<typename MatrixType> void real_qz(const MatrixType& m)
void test_real_qz()
{
int s = 0;
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( real_qz(Matrix4f()) );
s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
@ -62,5 +61,5 @@ void test_real_qz()
CALL_SUBTEST_4( real_qz(Matrix2d()) );
}
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}

View File

@ -133,8 +133,7 @@ void test_redux()
{
// the max size cannot be too large, otherwise reduxion operations obviously generate large errors.
int maxsize = (std::min)(100,EIGEN_TEST_MAX_SIZE);
maxsize = maxsize; // shuts down ICC's remark #593: variable "s" was set but never used
EIGEN_UNUSED_VARIABLE(maxsize);
TEST_SET_BUT_UNUSED_VARIABLE(maxsize);
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );
CALL_SUBTEST_1( matrixRedux(Array<float, 1, 1>()) );

View File

@ -47,7 +47,6 @@ void test_selfadjoint()
for(int i = 0; i < g_repeat ; i++)
{
int s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);
s = s; // shuts down ICC's remark #593: variable "s" was set but never used
CALL_SUBTEST_1( selfadjoint(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( selfadjoint(Matrix<float, 2, 2>()) );
@ -55,7 +54,7 @@ void test_selfadjoint()
CALL_SUBTEST_4( selfadjoint(MatrixXcd(s,s)) );
CALL_SUBTEST_5( selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(s, s)) );
EIGEN_UNUSED_VARIABLE(s)
TEST_SET_BUT_UNUSED_VARIABLE(s)
}
CALL_SUBTEST_1( bug_159() );

View File

@ -211,8 +211,8 @@ void test_triangular()
int maxsize = (std::min)(EIGEN_TEST_MAX_SIZE,20);
for(int i = 0; i < g_repeat ; i++)
{
int r = internal::random<int>(2,maxsize); r=r; // shuts down ICC's remark #593: variable "s" was set but never used
int c = internal::random<int>(2,maxsize); c=c;
int r = internal::random<int>(2,maxsize); TEST_SET_BUT_UNUSED_VARIABLE(r)
int c = internal::random<int>(2,maxsize); TEST_SET_BUT_UNUSED_VARIABLE(c)
CALL_SUBTEST_1( triangular_square(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( triangular_square(Matrix<float, 2, 2>()) );