From e085d3ec30fabf3e7329001c4130bb353392882d Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 23 Apr 2004 15:46:08 +0000 Subject: [PATCH] New test for bogus mipspro warning. git-svn-id: https://svn.dealii.org/trunk@9099 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 77 +++++++++++++++++++++++++++++++ deal.II/configure | 106 +++++++++++++++++++++++++++++++++++++++++++ deal.II/configure.in | 1 + 3 files changed, 184 insertions(+) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index f45a48127c..675f04a32a 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -2729,6 +2729,83 @@ AC_DEFUN(DEAL_II_CHECK_ANON_NAMESPACE_BUG2, dnl +dnl ------------------------------------------------------------- +dnl A third test: MIPSpro gives a bogus warning about unused code +dnl on code that is clearly used, when inline member functions +dnl are in classes in anonymous namespaces. Check for this to allow +dnl us to work around this problem +dnl +dnl Usage: DEAL_II_CHECK_ANON_NAMESPACE_BUG3 +dnl +dnl ------------------------------------------------------------- +AC_DEFUN(DEAL_II_CHECK_ANON_NAMESPACE_BUG3, dnl +[ + AC_MSG_CHECKING(for bogus warning with anonymous namespaces) + + AC_LANG(C++) + CXXFLAGS="$CXXFLAGSG" + case "$GXXVERSION" in + gcc*) + CXXFLAGS="$CXXFLAGS -Werror" + ;; + MIPSpro*) + CXXFLAGS="$CXXFLAGS -diagerror" + ;; + esac + + AC_TRY_COMPILE( + [ + template class Point + { + public: + Point() {}; + }; + + class GridTools { + public: + template static void shift (const Point &s); + + template + static void transform (const Predicate &predicate); + }; + + namespace { + template class ShiftPoint { + public: + ShiftPoint (const Point &) {}; + void g() const; + }; + + template void ShiftPoint::g() const {} + } + + template + void GridTools::transform (const Predicate &predicate) + { predicate.g(); } + + template + void GridTools::shift (const Point &s) + { transform (ShiftPoint(s)); } + + template void GridTools::shift (const Point<1> &); + ], + [ + ; + ], + [ + AC_MSG_RESULT(no) + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(DEAL_II_ANON_NAMESPACE_BOGUS_WARNING, 1 + [Flag indicating whether there is a bug in the + compiler that leads to bogus warnings for + inline class members in anonymous namespaces]) + ]) +]) + + + dnl ------------------------------------------------------------- dnl We have so many templates in deal.II that sometimes we need dnl to make it clear with which types a template parameter can diff --git a/deal.II/configure b/deal.II/configure index eb9aa1dc34..8cc36d02cb 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -5174,6 +5174,112 @@ _ACEOF rm -f conftest.$ac_objext + echo "$as_me:$LINENO: checking for bogus warning with anonymous namespaces" >&5 +echo $ECHO_N "checking for bogus warning with anonymous namespaces... $ECHO_C" >&6 + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + CXXFLAGS="$CXXFLAGSG" + case "$GXXVERSION" in + gcc*) + CXXFLAGS="$CXXFLAGS -Werror" + ;; + MIPSpro*) + CXXFLAGS="$CXXFLAGS -diagerror" + ;; + esac + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + template class Point + { + public: + Point() {}; + }; + + class GridTools { + public: + template static void shift (const Point &s); + + template + static void transform (const Predicate &predicate); + }; + + namespace { + template class ShiftPoint { + public: + ShiftPoint (const Point &) {}; + void g() const; + }; + + template void ShiftPoint::g() const {} + } + + template + void GridTools::transform (const Predicate &predicate) + { predicate.g(); } + + template + void GridTools::shift (const Point &s) + { transform (ShiftPoint(s)); } + + template void GridTools::shift (const Point<1> &); + +int +main () +{ + + ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define DEAL_II_ANON_NAMESPACE_BOGUS_WARNING 1 + Flag indicating whether there is a bug in the + compiler that leads to bogus warnings for + inline class members in anonymous namespaces +_ACEOF + + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + echo "$as_me:$LINENO: checking for SFINAE bug" >&5 echo $ECHO_N "checking for SFINAE bug... $ECHO_C" >&6 ac_ext=cc diff --git a/deal.II/configure.in b/deal.II/configure.in index 8fcb523d08..d35a5893b8 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -180,6 +180,7 @@ DEAL_II_CHECK_MEMBER_TEMPLATE_SPECIALIZATION_BUG DEAL_II_CHECK_LONG_DOUBLE_LOOP_BUG DEAL_II_CHECK_ANON_NAMESPACE_BUG DEAL_II_CHECK_ANON_NAMESPACE_BUG2 +DEAL_II_CHECK_ANON_NAMESPACE_BUG3 DEAL_II_CHECK_SFINAE_BUG DEAL_II_CHECK_TEMPL_OP_DISAMBIGUATION_BUG DEAL_II_CHECK_ARRAY_CONDITIONAL_DECAY_BUG -- 2.39.5