From 7a7ca99a31effa462535d72b7c2e3e3442a91c1b Mon Sep 17 00:00:00 2001 From: Eamon Nerbonne Date: Fri, 3 Dec 2010 23:24:06 +0100 Subject: [PATCH] [mq]: Mingw32 fix intrin.h is not required nor supported by mingw32. It is present (and supported) on mingw-w64 builds, even those for 32-bit systems, but here too it's not required on 32-bit systems. So if we're on mingw, and it's 64-bit, then and only then is the intrin.h inclusion necessary. --- Eigen/Core | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Eigen/Core b/Eigen/Core index d38996754..2a77779f0 100644 --- a/Eigen/Core +++ b/Eigen/Core @@ -93,28 +93,29 @@ #endif // include files - #if (defined __GNUC__) && (defined __MINGW32__) - #include - //including intrin.h works around a MINGW bug http://sourceforge.net/tracker/?func=detail&atid=102435&aid=2962480&group_id=2435 - //in essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). However, - //intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations with conflicting linkage. The linkage for intrinsics - //doesn't matter, but at that stage the compiler doesn't know; so, to avoid compile errors when windows.h is included after Eigen/Core, - //include intrin here. - #endif - #include - #include - #ifdef EIGEN_VECTORIZE_SSE3 + + // This extern "C" works around a MINGW-w64 bug + // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354 + // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). + // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations + // with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know; + // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. + extern "C" { + #include + #include + #ifdef EIGEN_VECTORIZE_SSE3 #include - #endif - #ifdef EIGEN_VECTORIZE_SSSE3 + #endif + #ifdef EIGEN_VECTORIZE_SSSE3 #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_1 + #endif + #ifdef EIGEN_VECTORIZE_SSE4_1 #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_2 + #endif + #ifdef EIGEN_VECTORIZE_SSE4_2 #include - #endif + #endif + } // end extern "C" #elif defined __ALTIVEC__ #define EIGEN_VECTORIZE #define EIGEN_VECTORIZE_ALTIVEC