introduce a new macro EIGEN_ARG_UNUSED(arg) and use it in some places to

silent some warnings (from clang)
This commit is contained in:
Thomas Capricelli 2010-05-21 02:05:25 +02:00
parent 742bbdfa57
commit c1d005e976
4 changed files with 18 additions and 2 deletions

View File

@ -214,6 +214,9 @@ template<typename Derived> class DenseBase
*/ */
void resize(int size) void resize(int size)
{ {
#ifdef EIGEN_NO_DEBUG
EIGEN_ARG_UNUSED(size);
#endif
ei_assert(size == this->size() ei_assert(size == this->size()
&& "DenseBase::resize() does not actually allow to resize."); && "DenseBase::resize() does not actually allow to resize.");
} }
@ -223,6 +226,10 @@ template<typename Derived> class DenseBase
*/ */
void resize(int rows, int cols) void resize(int rows, int cols)
{ {
#ifdef EIGEN_NO_DEBUG
EIGEN_ARG_UNUSED(rows);
EIGEN_ARG_UNUSED(cols);
#endif
ei_assert(rows == this->rows() && cols == this->cols() ei_assert(rows == this->rows() && cols == this->cols()
&& "DenseBase::resize() does not actually allow to resize."); && "DenseBase::resize() does not actually allow to resize.");
} }

View File

@ -89,6 +89,10 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
void check_coordinates(int row, int col) void check_coordinates(int row, int col)
{ {
#ifdef EIGEN_NO_DEBUG
EIGEN_ARG_UNUSED(row);
EIGEN_ARG_UNUSED(col);
#endif
ei_assert(col>=0 && col<cols() && row>=0 && row<rows()); ei_assert(col>=0 && col<cols() && row>=0 && row<rows());
ei_assert( (Mode==Upper && col>=row) ei_assert( (Mode==Upper && col>=row)
|| (Mode==Lower && col<=row) || (Mode==Lower && col<=row)

View File

@ -172,6 +172,8 @@
#define EIGEN_UNUSED #define EIGEN_UNUSED
#endif #endif
#define EIGEN_ARG_UNUSED(x) (void)x;
#if (defined __GNUC__) #if (defined __GNUC__)
#define EIGEN_ASM_COMMENT(X) asm("#"X) #define EIGEN_ASM_COMMENT(X) asm("#"X)
#else #else

View File

@ -461,9 +461,12 @@ struct ei_solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
template<typename Dest> void evalTo(Dest& dst) const template<typename Dest> void evalTo(Dest& dst) const
{ {
const int rows = dec().rows(), cols = dec().cols(), #ifndef EIGEN_NO_DEBUG
nonzero_pivots = dec().nonzeroPivots(); const int rows = dec().rows();
ei_assert(rhs().rows() == rows); ei_assert(rhs().rows() == rows);
#endif
const int cols = dec().cols(),
nonzero_pivots = dec().nonzeroPivots();
if(nonzero_pivots == 0) if(nonzero_pivots == 0)
{ {