From 75b6d2b2f84384457c1031d88fa606116d7016df Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 25 Jun 2010 13:20:34 +0200 Subject: [PATCH] fix very annoying warning (gcc 4.3): type qualifiers ignored on function return type --- Eigen/src/Core/DenseCoeffsBase.h | 7 +++++-- Eigen/src/Core/arch/SSE/PacketMath.h | 4 ++++ Eigen/src/Core/util/Meta.h | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h index 7d57d5abc..6802cea24 100644 --- a/Eigen/src/Core/DenseCoeffsBase.h +++ b/Eigen/src/Core/DenseCoeffsBase.h @@ -33,8 +33,11 @@ class DenseCoeffsBase : public EigenBase typedef typename ei_traits::Index Index; typedef typename ei_traits::Scalar Scalar; typedef typename ei_packet_traits::type PacketScalar; - typedef typename ei_meta_if::ret, const Scalar&, const Scalar>::ret CoeffReturnType; - typedef typename ei_makeconst::type>::type PacketReturnType; + typedef typename ei_meta_if::ret, + const Scalar&, + typename ei_meta_if::ret, Scalar, const Scalar>::ret + >::ret CoeffReturnType; + typedef typename ei_makeconst_return_type::type>::type PacketReturnType; typedef EigenBase Base; using Base::rows; diff --git a/Eigen/src/Core/arch/SSE/PacketMath.h b/Eigen/src/Core/arch/SSE/PacketMath.h index 754379891..29375bdae 100644 --- a/Eigen/src/Core/arch/SSE/PacketMath.h +++ b/Eigen/src/Core/arch/SSE/PacketMath.h @@ -33,6 +33,10 @@ typedef __m128 Packet4f; typedef __m128i Packet4i; typedef __m128d Packet2d; +template<> struct ei_is_arithmetic<__m128> { enum { ret = true }; }; +template<> struct ei_is_arithmetic<__m128i> { enum { ret = true }; }; +template<> struct ei_is_arithmetic<__m128d> { enum { ret = true }; }; + #define ei_vec4f_swizzle1(v,p,q,r,s) \ (_mm_castsi128_ps(_mm_shuffle_epi32( _mm_castps_si128(v), ((s)<<6|(r)<<4|(q)<<2|(p))))) diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 318664869..481b0ceb2 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -64,6 +64,21 @@ template struct ei_cleantype { typedef typename ei_cleant template struct ei_cleantype { typedef typename ei_cleantype::type type; }; template struct ei_cleantype { typedef typename ei_cleantype::type type; }; +template struct ei_is_arithmetic { enum { ret = false }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic{ enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; +template<> struct ei_is_arithmetic { enum { ret = true }; }; + template struct ei_makeconst { typedef const T type; }; template struct ei_makeconst { typedef const T type; }; template struct ei_makeconst { typedef const T& type; }; @@ -71,6 +86,11 @@ template struct ei_makeconst { typedef const T& type; }; template struct ei_makeconst { typedef const T* type; }; template struct ei_makeconst { typedef const T* type; }; +template struct ei_makeconst_return_type +{ + typedef typename ei_meta_if::ret, T, typename ei_makeconst::type>::ret type; +}; + /** \internal Allows to enable/disable an overload * according to a compile time condition. */