From: bangerth Date: Tue, 2 Oct 2012 05:32:32 +0000 (+0000) Subject: Take over patches 26839 to 26844 from Matthias' branch for cmake conversion. These... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae204a977bc8385997c801690a75465bc1c86d7b;p=dealii-svn.git Take over patches 26839 to 26844 from Matthias' branch for cmake conversion. These patches clean up compiler bug tests that are from the gcc 2.95 and 3.x era and almost certainly no longer apply to the current crop of compilers we have. git-svn-id: https://svn.dealii.org/trunk@26920 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index e7b4b3cd41..9fb7765dff 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -3070,108 +3070,6 @@ int i=rand_r(&i); -dnl ------------------------------------------------------------- -dnl On some systems (well, DEC Alphas are the only ones we know of), -dnl gcc2.95 throws the hands in the air if it sees one of the AssertThrow -dnl calls, and dies with an internal compiler error. If this is the case, -dnl we disable AssertThrow and simply replace it with an `abort' if the -dnl condition is not satisfied. -dnl -dnl Usage: DEAL_II_CHECK_ASSERT_THROW("description of options set", -dnl "compiler options set", -dnl action if compiler crashes) -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_ASSERT_THROW, dnl -[ - AC_MSG_CHECKING(whether AssertThrow works with $1 flags) - AC_LANG(C++) - CXXFLAGS="$2" - AC_TRY_COMPILE( - [ -#include -#include -#include - -#ifndef __GNUC__ -# define __PRETTY_FUNCTION__ "(unknown)" -#endif -class ExceptionBase : public std::exception { - public: - ExceptionBase (); - ExceptionBase (const char* f, const int l, const char *func, - const char* c, const char *e); - virtual ~ExceptionBase () throw(); - void SetFields (const char *f, const int l, const char *func, - const char *c, const char *e); - void PrintExcData (std::ostream &out) const; - virtual void PrintInfo (std::ostream &out) const; - virtual const char * what () const throw (); - protected: - const char *file; - unsigned int line; - const char *function, *cond, *exc; -}; - -template -void __IssueError_Assert (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e){ - e.SetFields (file, line, function, cond, exc_name); - std::cerr << "--------------------------------------------------------" - << std::endl; - e.PrintExcData (std::cerr); - e.PrintInfo (std::cerr); - std::cerr << "--------------------------------------------------------" - << std::endl; - std::abort (); -} - -template -void __IssueError_Throw (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e) { - // Fill the fields of the exception object - e.SetFields (file, line, function, cond, exc_name); - throw e; -} - -#define AssertThrow(cond, exc) \ - { \ - if (!(cond)) \ - __IssueError_Throw (__FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, #cond, #exc, exc); \ - } - -#define DeclException0(Exception0) \ -class Exception0 : public ExceptionBase {} - -namespace StandardExceptions -{ - DeclException0 (ExcInternalError); -} -using namespace StandardExceptions; - ], - [ - AssertThrow (false, ExcInternalError()); - ], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - $3 - ]) -]) - - dnl ------------------------------------------------------------- dnl Gcc and some other compilers have __PRETTY_FUNCTION__, showing @@ -3464,148 +3362,6 @@ AC_DEFUN(DEAL_II_CHECK_EXPLICIT_DESTRUCTOR_BUG, dnl ]) -dnl ------------------------------------------------------------- -dnl Versions of GCC before 3.0 had a problem with the following -dnl code: -dnl -dnl /* ----------------------------------------------- */ -dnl namespace NS { -dnl template class C { -dnl template friend class C; -dnl }; -dnl }; -dnl /* ----------------------------------------------- */ -dnl -dnl This is fixed with gcc at least in snapshots before version 3.1, -dnl but the following bug remains: -dnl -dnl /* ----------------------------------------------- */ -dnl namespace NS { template class C; }; -dnl -dnl template class X { -dnl template friend class NS::C; -dnl }; -dnl -dnl template class X; -dnl /* ----------------------------------------------- */ -dnl -dnl The compiler gets an internal error for these cases. Since we need this -dnl construct at various places, we check for it and if the compiler -dnl dies, we use a workaround that is non-ISO C++ but works for these -dnl compilers. -dnl -dnl Usage: DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG, dnl -[ - AC_MSG_CHECKING(for 1st template friend in namespace bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG" - AC_TRY_COMPILE( - [ - namespace NS { - template class C { - C(const C&); - template friend class C; - }; - } - - namespace NS2 { template class C; } - - template class X { - template friend class NS2::C; - template friend class NS::C; - }; - - template class X; - - namespace NS { - template - inline C::C(const C&) - {} - } - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE_UNQUOTED(DEAL_II_NAMESP_TEMPL_FRIEND_BUG, 1, - [Define if we have to work around a bug in gcc with - marking all instances of a template class as friends - to this class if the class is inside a namespace. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - - -dnl ------------------------------------------------------------- -dnl Another bug in gcc with template and namespaces (fixed since 3.2, -dnl but present in 3.0): -dnl -dnl /* ----------------------------------------------- */ -dnl namespace NS { -dnl template struct Foo; -dnl } -dnl -dnl class Bar { -dnl template friend struct NS::Foo; -dnl }; -dnl -dnl namespace NS { -dnl template struct Foo { Foo (); }; -dnl } -dnl -dnl template struct NS::Foo; -dnl /* ----------------------------------------------- */ -dnl -dnl gcc2.95 provides a really unhelpful error message, 3.0 gets an -dnl internal compiler error. -dnl -dnl Usage: DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG2 -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG2, dnl -[ - AC_MSG_CHECKING(for 2nd template friend in namespace bug) - AC_LANG(C++) - CXXFLAGS="$CXXFLAGSG -Werror" - AC_TRY_COMPILE( - [ - namespace NS { - template struct Foo; - } - - class Bar { - template friend struct NS::Foo; - }; - - namespace NS { - template struct Foo { Foo (); }; - } - - template struct NS::Foo; - ], - [], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes. using workaround) - AC_DEFINE_UNQUOTED(DEAL_II_NAMESP_TEMPL_FRIEND_BUG2, 1, - [Define if we have to work around another bug in gcc with - marking all instances of a template class as friends - to this class if the class is inside a namespace. - See the aclocal.m4 file in the top-level directory - for a description of this bug.]) - ]) -]) - - dnl ------------------------------------------------------------- dnl In some cases, we would like to name partial specializations @@ -3720,177 +3476,6 @@ AC_DEFUN(DEAL_II_CHECK_IMPLEMENTED_PURE_FUNCTION_BUG, dnl -dnl ------------------------------------------------------------- -dnl gcc 2.95 dies on this construct: -dnl ----------------------------- -dnl template struct TT { typedef int type; }; -dnl -dnl template