diff options
author | knarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2013-05-06 17:14:36 +0000 |
---|---|---|
committer | knarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2013-05-06 17:14:36 +0000 |
commit | 6a91f108b6330d73335692f9a4f695c64645e15f (patch) | |
tree | a6ef6952ccdbe762980f9949acd05f5793a7837a | |
parent | a3cb4c5d02f0ee75094fc27814c71f8a025d034b (diff) |
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
-rw-r--r-- | lib/make/cctk_Config.h.in | 26 |
1 files 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 |