]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test for bogus mipspro warning.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 23 Apr 2004 15:46:08 +0000 (15:46 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 23 Apr 2004 15:46:08 +0000 (15:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@9099 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure
deal.II/configure.in

index f45a48127c2c8f4a01c7d335ee06f2e6128b3e5a..675f04a32a38aa73aebe93f41c1006b87949f69c 100644 (file)
@@ -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<int dim> class Point
+     {
+       public:
+         Point() {};
+     };
+     
+     class GridTools {
+       public:
+         template <int dim> static void shift (const Point<dim> &s);
+         
+         template <typename Predicate>
+         static void transform (const Predicate    &predicate);
+     };
+     
+     namespace {
+       template <int dim> class ShiftPoint {
+         public:
+           ShiftPoint (const Point<dim>   &) {};
+           void g() const;
+       };
+     
+       template<int dim> void ShiftPoint<dim>::g() const {}
+     }
+     
+     template <typename Predicate>
+     void GridTools::transform (const Predicate &predicate)
+     { predicate.g(); }
+     
+     template <int dim>
+     void GridTools::shift (const Point<dim>   &s)
+     { transform (ShiftPoint<dim>(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
index eb9aa1dc34168d6623034a0f9f53bfc6356d0eb6..8cc36d02cbe531687899c73355fc2316935780aa 100755 (executable)
@@ -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<int dim> class Point
+     {
+       public:
+         Point() {};
+     };
+
+     class GridTools {
+       public:
+         template <int dim> static void shift (const Point<dim> &s);
+
+         template <typename Predicate>
+         static void transform (const Predicate    &predicate);
+     };
+
+     namespace {
+       template <int dim> class ShiftPoint {
+         public:
+           ShiftPoint (const Point<dim>   &) {};
+           void g() const;
+       };
+
+       template<int dim> void ShiftPoint<dim>::g() const {}
+     }
+
+     template <typename Predicate>
+     void GridTools::transform (const Predicate &predicate)
+     { predicate.g(); }
+
+     template <int dim>
+     void GridTools::shift (const Point<dim>   &s)
+     { transform (ShiftPoint<dim>(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
index 8fcb523d0887d523a23f9fdef91470d5ff9e85bf..d35a5893b83175ea96dc110f6cef85cf4114b113 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.