Fix compiler warnings in 3.4

This commit is contained in:
Charles Schlosser 2023-12-21 00:57:21 +00:00
parent ebf968b272
commit 25270e35db
9 changed files with 26 additions and 24 deletions

View File

@ -355,7 +355,7 @@ class BlockImpl_dense<XprType,BlockRows,BlockCols, InnerPanel,true>
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
BlockImpl_dense(XprType& xpr, Index i)
: Base(add_to_nullable_pointer(xpr.data(),
: Base((BlockRows == 0 || BlockCols == 0) ? NULL : add_to_nullable_pointer(xpr.data(),
i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor))
|| ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride())),
BlockRows==1 ? 1 : xpr.rows(),
@ -371,7 +371,7 @@ class BlockImpl_dense<XprType,BlockRows,BlockCols, InnerPanel,true>
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
BlockImpl_dense(XprType& xpr, Index startRow, Index startCol)
: Base(add_to_nullable_pointer(xpr.data(),
: Base((BlockRows == 0 || BlockCols == 0) ? NULL : add_to_nullable_pointer(xpr.data(),
xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol))),
m_xpr(xpr), m_startRow(startRow), m_startCol(startCol)
{
@ -384,7 +384,7 @@ class BlockImpl_dense<XprType,BlockRows,BlockCols, InnerPanel,true>
BlockImpl_dense(XprType& xpr,
Index startRow, Index startCol,
Index blockRows, Index blockCols)
: Base(add_to_nullable_pointer(xpr.data(),
: Base((blockRows == 0 || blockCols == 0) ? NULL : add_to_nullable_pointer(xpr.data(),
xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)),
blockRows, blockCols),
m_xpr(xpr), m_startRow(startRow), m_startCol(startCol)

View File

@ -196,7 +196,6 @@ public:
pointer_based_stl_iterator() EIGEN_NO_THROW : m_ptr(0) {}
pointer_based_stl_iterator(XprType& xpr, Index index) EIGEN_NO_THROW : m_incr(xpr.innerStride())
{
eigen_assert(xpr.data() != NULL || index == 0 || m_incr.value() == 0);
m_ptr = xpr.data() + index * m_incr.value();
}

View File

@ -161,7 +161,8 @@ void upperbidiagonalization_blocked_helper(MatrixType& A,
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
typedef typename NumTraits<RealScalar>::Literal Literal;
enum { StorageOrder = (traits<MatrixType>::Flags & RowMajorBit) ? RowMajor : ColMajor };
static const int StorageOrder =
(traits<MatrixType>::Flags & RowMajorBit) ? RowMajor : ColMajor;
typedef InnerStride<StorageOrder == ColMajor ? 1 : Dynamic> ColInnerStride;
typedef InnerStride<StorageOrder == ColMajor ? Dynamic : 1> RowInnerStride;
typedef Ref<Matrix<Scalar, Dynamic, 1>, 0, ColInnerStride> SubColumnType;

View File

@ -126,7 +126,7 @@ template<>
struct NumTraits<AnnoyingScalar> : NumTraits<float>
{
enum {
RequireInitialization = 1,
RequireInitialization = 1
};
typedef AnnoyingScalar Real;
typedef AnnoyingScalar Nested;

View File

@ -143,11 +143,12 @@ template<typename MatrixType> void block(const MatrixType& m)
// check that linear acccessors works on blocks
m1 = m1_copy;
if((MatrixType::Flags&RowMajorBit)==0)
VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1+c1*rows), m1(r1,c1));
else
VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1+r1*cols), m1(r1,c1));
if (c1 > 0 && r1 > 0) {
if ((MatrixType::Flags & RowMajorBit) == 0)
VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1 + c1 * rows), m1(r1, c1));
else
VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1 + r1 * cols), m1(r1, c1));
}
// now test some block-inside-of-block.

View File

@ -63,7 +63,7 @@ void check_stdlist_matrix(const MatrixType& m)
++itw;
}
v.resize(21);
v.resize(21, MatrixType::Zero(rows, cols));
set(v, 20, x);
VERIFY_IS_APPROX(*get(v, 20), x);
v.resize(22,y);

View File

@ -52,7 +52,7 @@ void check_stdvector_transform(const TransformType&)
{
typedef typename TransformType::MatrixType MatrixType;
TransformType x(MatrixType::Random()), y(MatrixType::Random());
std::vector<TransformType,Eigen::aligned_allocator<TransformType> > v(10), w(20, y);
std::vector<TransformType,Eigen::aligned_allocator<TransformType> > v(10, TransformType(MatrixType::Zero())), w(20, y);
v[5] = x;
w[6] = v[5];
VERIFY_IS_APPROX(w[6], v[5]);
@ -124,7 +124,7 @@ void std_vector_gcc_warning()
{
typedef Eigen::Vector3f T;
std::vector<T, Eigen::aligned_allocator<T> > v;
v.push_back(T());
v.push_back(T::Zero());
}
EIGEN_DECLARE_TEST(stdvector)

View File

@ -280,8 +280,8 @@ struct vectorization_logic_half
// EIGEN_UNALIGNED_VECTORIZE is 0 (the matrix is assumed unaligned).
// Adjust the matrix sizes to account for these alignment issues.
enum { PacketBytes = sizeof(Scalar)*PacketSize };
enum { MinVSize = EIGEN_UNALIGNED_VECTORIZE ? PacketSize
: PacketBytes >= EIGEN_MIN_ALIGN_BYTES ? PacketSize
enum { MinVSize = EIGEN_UNALIGNED_VECTORIZE ? int(PacketSize)
: int(PacketBytes) >= EIGEN_MIN_ALIGN_BYTES ? int(PacketSize)
: (EIGEN_MIN_ALIGN_BYTES + sizeof(Scalar) - 1) / sizeof(Scalar) };
typedef Matrix<Scalar,MinVSize,1> Vector1;

View File

@ -162,15 +162,16 @@ class FFT
typedef typename impl_type::Scalar Scalar;
typedef typename impl_type::Complex Complex;
enum Flag {
Default=0, // goof proof
Unscaled=1,
HalfSpectrum=2,
// SomeOtherSpeedOptimization=4
Speedy=32767
};
typedef int Flag;
static const Flag Default = 0;
static const Flag Unscaled = 1;
static const Flag HalfSpectrum = 2;
static const Flag Speedy = 32767;
FFT( const impl_type & impl=impl_type() , Flag flags=Default ) :m_impl(impl),m_flag(flags) { }
FFT(const impl_type& impl = impl_type(), Flag flags = Default) : m_impl(impl), m_flag(flags)
{
eigen_assert((flags == Default || flags == Unscaled || flags == HalfSpectrum || flags == Speedy) && "invalid flags argument");
}
inline
bool HasFlag(Flag f) const { return (m_flag & (int)f) == f;}