[Mesa-dev] [PATCH] include, auxiliary: Remove support for MSVC older then 2008.

Jose Fonseca jfonseca at vmware.com
Thu Feb 26 04:09:57 PST 2015


MSVC 2008 (shipped with Windows SDK 7.0.7600) is the oldest we
need to support.  At least on llvmpipe, gallium/auxiliary, and util
modules.  For the remaining modules (particular all OpenGL specific
code) can be built with MSVC 2013.
---
 include/c99_compat.h                | 11 +++---
 include/c99_math.h                  | 71 -------------------------------------
 src/gallium/auxiliary/util/u_math.h |  2 +-
 src/gallium/auxiliary/util/u_sse.h  | 27 --------------
 4 files changed, 7 insertions(+), 104 deletions(-)

diff --git a/include/c99_compat.h b/include/c99_compat.h
index e5d0ae4..f56f6f3 100644
--- a/include/c99_compat.h
+++ b/include/c99_compat.h
@@ -33,6 +33,11 @@
  * MSVC hacks.
  */
 #if defined(_MSC_VER)
+
+#  if _MSC_VER < 1500
+#    error "Microsoft Visual Studio 2008 or higher required"
+#  endif
+
    /*
     * Visual Studio 2012 will complain if we define the `inline` keyword, but
     * actually it only supports the keyword on C++.
@@ -116,11 +121,7 @@
 #  elif defined(__GNUC__)
 #    define __func__ __FUNCTION__
 #  elif defined(_MSC_VER)
-#    if _MSC_VER >= 1300
-#      define __func__ __FUNCTION__
-#    else
-#      define __func__ "<unknown>"
-#    endif
+#    define __func__ __FUNCTION__
 #  else
 #    define __func__ "<unknown>"
 #  endif
diff --git a/include/c99_math.h b/include/c99_math.h
index 9e31d06..5d4f535 100644
--- a/include/c99_math.h
+++ b/include/c99_math.h
@@ -40,81 +40,10 @@
 
 #if defined(_MSC_VER)
 
-#if _MSC_VER < 1400 && !defined(__cplusplus)
-
-static inline float cosf( float f )
-{
-   return (float) cos( (double) f );
-}
-
-static inline float sinf( float f )
-{
-   return (float) sin( (double) f );
-}
-
-static inline float ceilf( float f )
-{
-   return (float) ceil( (double) f );
-}
-
-static inline float floorf( float f )
-{
-   return (float) floor( (double) f );
-}
-
-static inline float powf( float f, float g )
-{
-   return (float) pow( (double) f, (double) g );
-}
-
-static inline float sqrtf( float f )
-{
-   return (float) sqrt( (double) f );
-}
-
-static inline float fabsf( float f )
-{
-   return (float) fabs( (double) f );
-}
-
-static inline float logf( float f )
-{
-   return (float) log( (double) f );
-}
-
-static inline float frexpf(float x, int *exp)
-{
-   return (float) frexp(x, exp);
-}
-
-static inline float ldexpf(float x, int exp)
-{
-   return (float) ldexp(x, exp);
-}
-
-static inline float logf(float x)
-{
-   return (float) log(x);
-}
-
-static inline float expf(float x)
-{
-   return (float) exp(x);
-}
-
-
-#else
-/* Work-around an extra semi-colon in VS 2005 logf definition */
-#ifdef logf
-#undef logf
-#define logf(x) ((float)log((double)(x)))
-#endif /* logf */
-
 #if _MSC_VER < 1800
 #define isfinite(x) _finite((double)(x))
 #define isnan(x) _isnan((double)(x))
 #endif /* _MSC_VER < 1800 */
-#endif /* _MSC_VER < 1400 && !defined(__cplusplus) */
 
 #if _MSC_VER < 1800
 static inline double log2( double x )
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index b4a65e4..959f76e 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -356,7 +356,7 @@ util_half_inf_sign(int16_t x)
 #ifndef FFS_DEFINED
 #define FFS_DEFINED 1
 
-#if defined(_MSC_VER) && _MSC_VER >= 1300 && (_M_IX86 || _M_AMD64 || _M_IA64)
+#if defined(_MSC_VER) && (_M_IX86 || _M_AMD64 || _M_IA64)
 unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
 #pragma intrinsic(_BitScanForward)
 static INLINE
diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h
index 642f96e..d4f5191 100644
--- a/src/gallium/auxiliary/util/u_sse.h
+++ b/src/gallium/auxiliary/util/u_sse.h
@@ -44,33 +44,6 @@
 #include <emmintrin.h>
 
 
-/* MSVC before VC8 does not support the _mm_castxxx_yyy */
-#if defined(_MSC_VER) && _MSC_VER < 1500
-
-union __declspec(align(16)) m128_types {
-   __m128 m128;
-   __m128i m128i;
-   __m128d m128d;
-};
-
-static __inline __m128
-_mm_castsi128_ps(__m128i a)
-{
-   union m128_types u;
-   u.m128i = a;
-   return u.m128;
-}
-
-static __inline __m128i
-_mm_castps_si128(__m128 a)
-{
-   union m128_types u;
-   u.m128 = a;
-   return u.m128i;
-}
-
-#endif /* defined(_MSC_VER) && _MSC_VER < 1500 */
-
 union m128i {
    __m128i m;
    ubyte ub[16];
-- 
2.1.0



More information about the mesa-dev mailing list