From: maier Date: Fri, 14 Sep 2012 21:04:12 +0000 (+0000) Subject: Implement a bugtest to be able to compile with clang X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0948dcda257d94c50b0acbebb6393c12d56fd94a;p=dealii-svn.git Implement a bugtest to be able to compile with clang git-svn-id: https://svn.dealii.org/branches/branch_cmake@26393 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/bugs.m4 b/deal.II/bugs.m4 index dab1092d67..0f65774b90 100644 --- a/deal.II/bugs.m4 +++ b/deal.II/bugs.m4 @@ -406,60 +406,6 @@ AC_DEFUN(DEAL_II_CHECK_TEMPLATE_SPEC_ACCESS, dnl ]) - -dnl ------------------------------------------------------------- -dnl Some compiler versions, notably ICC, have trouble with the -dnl following code in which we explicitly call a destructor. -dnl This has to be worked around with a typedef. The problem is -dnl that the workaround fails with some other compilers, so that -dnl we can not unconditionally use the workaround... -dnl -dnl Usage: DEAL_II_CHECK_EXPLICIT_DESTRUCTOR_BUG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_EXPLICIT_DESTRUCTOR_BUG, dnl -[ - AC_MSG_CHECKING(for explicit destructor call bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ - namespace dealii - { - namespace FEValuesViews - { - template struct Scalar {}; - } - - template - struct X - { - FEValuesViews::Scalar scalars[dim*spacedim]; - - void f() - { - scalars[0].dealii::FEValuesViews::Scalar::~Scalar (); - } - }; - - template struct X<2,2>; - } - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE_UNQUOTED(DEAL_II_EXPLICIT_DESTRUCTOR_BUG, 1, - [Define if we have to work around a bug where the - compiler doesn't accept an explicit destructor call. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - dnl ------------------------------------------------------------- dnl Versions of GCC before 3.0 had a problem with the following dnl code: diff --git a/deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake b/deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake index 69bab9e436..e2293a41b6 100644 --- a/deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake +++ b/deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake @@ -46,3 +46,38 @@ IF(DEAL_II_MEMBER_OP_TEMPLATE_INST_OK) ELSE() SET(DEAL_II_MEMBER_OP_TEMPLATE_INST "template") ENDIF() + + + +# +# Some compiler versions, notably ICC, have trouble with the +# following code in which we explicitly call a destructor. +# This has to be worked around with a typedef. The problem is +# that the workaround fails with some other compilers, so that +# we can not unconditionally use the workaround... +# +CHECK_CXX_COMPILER_BUG( + " + namespace dealii + { + namespace FEValuesViews + { + template struct Scalar {}; + } + + template + struct X + { + FEValuesViews::Scalar scalars[dim*spacedim]; + + void f() + { + scalars[0].dealii::FEValuesViews::Scalar::~Scalar (); + } + }; + + template struct X<2,2>; + } + int main() { return 0; } + " + DEAL_II_EXPLICIT_DESTRUCTOR_BUG) diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index d68451ff2c..09df9bcc65 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -257,6 +257,12 @@ */ #define DEAL_II_MEMBER_OP_TEMPLATE_INST @DEAL_II_MEMBER_OP_TEMPLATE_INST@ +/* Define if we have to work around a bug where the compiler doesn't accept + * an explicit destructor call. See the aclocal.m4 file in the top-level + * directory for a description of this bug. + */ +#cmakedefine DEAL_II_EXPLICIT_DESTRUCTOR_BUG + diff --git a/deal.II/include/deal.II/base/config.h.in.old b/deal.II/include/deal.II/base/config.h.in.old index 5670bd3b3d..1d08801e38 100644 --- a/deal.II/include/deal.II/base/config.h.in.old +++ b/deal.II/include/deal.II/base/config.h.in.old @@ -54,11 +54,6 @@ constructors. */ #cmakedefine DEAL_II_EXPLICIT_CONSTRUCTOR_BUG -/* Define if we have to work around a bug where the compiler doesn't accept an - explicit destructor call. See the aclocal.m4 file in the top-level - directory for a description of this bug. */ -#cmakedefine DEAL_II_EXPLICIT_DESTRUCTOR_BUG - /* Defined if the compiler needs a workaround for certain problems with taking the address of template template functions. For the details, look at aclocal.m4 in the top-level directory. */