aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-06-25 11:42:04 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-06-25 11:42:04 +0200
commit95f8a738ea23cf7d6f86ca99eddb5b22045c7f4b (patch)
tree3da2bd15b9159ad1aa37c9995eb651c3a0e5e688 /test
parent4cc937794117a27c7a1d2643fdadd242dc83359a (diff)
Introduce a TEST_SET_BUT_UNUSED_VARIABLE macro for initialized but unused variables in the unit tests and also fix a few other warnings.
Diffstat (limited to 'test')
-rw-r--r--test/cholesky.cpp3
-rw-r--r--test/determinant.cpp3
-rw-r--r--test/eigensolver_complex.cpp3
-rw-r--r--test/eigensolver_generalized_real.cpp3
-rw-r--r--test/eigensolver_generic.cpp3
-rw-r--r--test/eigensolver_selfadjoint.cpp3
-rw-r--r--test/inverse.cpp3
-rw-r--r--test/jacobisvd.cpp6
-rw-r--r--test/main.h16
-rw-r--r--test/product_selfadjoint.cpp3
-rw-r--r--test/product_trmv.cpp3
-rw-r--r--test/real_qz.cpp3
-rw-r--r--test/redux.cpp3
-rw-r--r--test/selfadjoint.cpp3
-rw-r--r--test/triangular.cpp4
15 files changed, 28 insertions, 34 deletions
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index d084ec72c..38862924a 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -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)
}
diff --git a/test/determinant.cpp b/test/determinant.cpp
index 81ab4b084..758f3afbb 100644
--- a/test/determinant.cpp
+++ b/test/determinant.cpp
@@ -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)
}
}
diff --git a/test/eigensolver_complex.cpp b/test/eigensolver_complex.cpp
index 9a52cfa5e..c9d8c0877 100644
--- a/test/eigensolver_complex.cpp
+++ b/test/eigensolver_complex.cpp
@@ -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)
}
diff --git a/test/eigensolver_generalized_real.cpp b/test/eigensolver_generalized_real.cpp
index c4dc8a775..566a4bdc6 100644
--- a/test/eigensolver_generalized_real.cpp
+++ b/test/eigensolver_generalized_real.cpp
@@ -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)
}
}
diff --git a/test/eigensolver_generic.cpp b/test/eigensolver_generic.cpp
index 0e1e508ae..005af81eb 100644
--- a/test/eigensolver_generic.cpp
+++ b/test/eigensolver_generic.cpp
@@ -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)
}
diff --git a/test/eigensolver_selfadjoint.cpp b/test/eigensolver_selfadjoint.cpp
index 67d4c543b..5c6ecd875 100644
--- a/test/eigensolver_selfadjoint.cpp
+++ b/test/eigensolver_selfadjoint.cpp
@@ -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)
}
diff --git a/test/inverse.cpp b/test/inverse.cpp
index 8dd35f6ac..8187b088d 100644
--- a/test/inverse.cpp
+++ b/test/inverse.cpp
@@ -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)
}
diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp
index 8fda8d261..76157c30f 100644
--- a/test/jacobisvd.cpp
+++ b/test/jacobisvd.cpp
@@ -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;
diff --git a/test/main.h b/test/main.h
index 1094b6b36..0d65d64c1 100644
--- a/test/main.h
+++ b/test/main.h
@@ -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)();
diff --git a/test/product_selfadjoint.cpp b/test/product_selfadjoint.cpp
index e3e2b2cf1..374e2393b 100644
--- a/test/product_selfadjoint.cpp
+++ b/test/product_selfadjoint.cpp
@@ -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)
}
diff --git a/test/product_trmv.cpp b/test/product_trmv.cpp
index 50a414b29..4c3c435c2 100644
--- a/test/product_trmv.cpp
+++ b/test/product_trmv.cpp
@@ -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);
}
diff --git a/test/real_qz.cpp b/test/real_qz.cpp
index ed11e17f3..7d743a734 100644
--- a/test/real_qz.cpp
+++ b/test/real_qz.cpp
@@ -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)
}
diff --git a/test/redux.cpp b/test/redux.cpp
index 26082527e..bb65f9461 100644
--- a/test/redux.cpp
+++ b/test/redux.cpp
@@ -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>()) );
diff --git a/test/selfadjoint.cpp b/test/selfadjoint.cpp
index ab8eb8173..76dab6d64 100644
--- a/test/selfadjoint.cpp
+++ b/test/selfadjoint.cpp
@@ -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() );
diff --git a/test/triangular.cpp b/test/triangular.cpp
index 78b2c31f7..54320390b 100644
--- a/test/triangular.cpp
+++ b/test/triangular.cpp
@@ -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>()) );