From 6a91f108b6330d73335692f9a4f695c64645e15f Mon Sep 17 00:00:00 2001 From: knarf Date: Mon, 6 May 2013 17:14:36 +0000 Subject: Workaround for compiler-bug with Intel compiler and 'restrict'. See https://trac.einsteintoolkit.org/ticket/1276 Add conditional on the version of the (Intel) compiler for all CCODE. Then, for C and CXX separately, skip the autoconf-provided values for 'restrict' if the compiler was found to be bad, and instead let HAVE_CCTK_CXX_RESTRICT remain undefined and set CCTK_CXX_RESTRICT to empty, which later defines 'restrict' to empty too (similarly for C). Because someone might actually want to overwrite this, CCTK_INTEL_COMPILER_DONT_DISABLE_RESTRICT is checked, and if set, doesn't disable restrict even for bad compilers. Also, now all Intel compilers with build dates between 20121010 and 20130313 are flagged 'bad'. Others might need to be added later. git-svn-id: http://svn.cactuscode.org/flesh/trunk@5001 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/cctk_Config.h.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/make/cctk_Config.h.in b/lib/make/cctk_Config.h.in index 2de9fd0a..9805c839 100644 --- a/lib/make/cctk_Config.h.in +++ b/lib/make/cctk_Config.h.in @@ -169,6 +169,14 @@ #undef CCTK_REAL8 #undef CCTK_REAL4 +/* Disable 'restrict' for compiler versions known to be buggy */ +# if (defined __INTEL_COMPILER && \ + __INTEL_COMPILER_BUILD_DATE >= 20121010 && \ + __INTEL_COMPILER_BUILD_DATE <= 20130313 && \ + !defined CCTK_INTEL_COMPILER_DONT_DISABLE_RESTRICT ) + #define CCTK_DISABLE_RESTRICT 1 +#endif + /****************************************************************************/ /* C specific stuff */ /****************************************************************************/ @@ -187,8 +195,13 @@ #undef const /* Define to empty if the 'restrict' keyword does not work. */ -#undef HAVE_CCTK_C_RESTRICT -#undef CCTK_C_RESTRICT +#ifdef CCTK_DISABLE_RESTRICT +# define CCTK_C_RESTRICT +#else +# undef HAVE_CCTK_C_RESTRICT +# undef CCTK_C_RESTRICT +#endif + #ifdef CCTK_C_RESTRICT # define restrict CCTK_C_RESTRICT #endif @@ -583,9 +596,14 @@ typedef enum {false, true} bool; #endif /* Some C++ compilers recognise the restrict keyword */ -#undef HAVE_CCTK_CXX_RESTRICT -#undef CCTK_CXX_RESTRICT /* Define to empty if the keyword does not work. */ +#ifdef CCTK_DISABLE_RESTRICT +# define CCTK_CXX_RESTRICT +#else +# undef HAVE_CCTK_CXX_RESTRICT +# undef CCTK_CXX_RESTRICT +#endif + #ifdef CCTK_CXX_RESTRICT # define restrict CCTK_CXX_RESTRICT #endif -- cgit v1.2.3