]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use -Wno-return-type if the flag -Wreturn-type (otherwise included in -Wall) would...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 26 Jan 2007 20:22:51 +0000 (20:22 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 26 Jan 2007 20:22:51 +0000 (20:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@14387 0785d39b-7218-0410-832d-ea1e28bc413d

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

index cd16f80f13d5c034c590a644ed0a1b09fffa425a..5a89da4a0820430ce81c8edf175999e45fd86b94 100644 (file)
@@ -384,6 +384,25 @@ AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl
     dnl BOOST uses long long, so don't warn about this
     CXXFLAGSG="$CXXFLAGSG -Wno-long-long"
 
+    dnl On some gcc 4.3 snapshots, a 'const' qualifier on a return type triggers a
+    dnl warning. This is unfortunate, since we happen to stumble on this
+    dnl in some of our template trickery with iterator classes. If necessary,
+    dnl do not use the relevant warning flag
+    CXXFLAGS="-Wreturn-type -Werror"
+    AC_MSG_CHECKING(whether qualifiers in return types lead to a warning)
+    AC_TRY_COMPILE(
+          [
+            const double foo() { return 1.; }
+          ],
+          [;],
+          [
+            AC_MSG_RESULT(no)
+          ],
+          [
+            AC_MSG_RESULT(yes)
+            CXXFLAGSG="$CXXFLAGSG -Wno-return-type"
+          ])
+
     dnl Set PIC flags. On some systems, -fpic/PIC is implied, so don't set
     dnl anything to avoid a warning. on AIX make sure we always pass -lpthread
     dnl because this seems to be somehow required to make things work. Likewise
index 8b04ea886ac2522940dcc7df17bdf39a33a4b35d..50ec668ac667f0626d6c2006c55684a76d0379c1 100755 (executable)
@@ -3227,6 +3227,64 @@ echo "${ECHO_T}Unrecognized C++ compiler -- Try to go ahead and get help from de
 
         CXXFLAGSG="$CXXFLAGSG -Wno-long-long"
 
+                    CXXFLAGS="-Wreturn-type -Werror"
+    echo "$as_me:$LINENO: checking whether qualifiers in return types lead to a warning" >&5
+echo $ECHO_N "checking whether qualifiers in return types lead to a warning... $ECHO_C" >&6
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+            const double foo() { return 1.; }
+
+int
+main ()
+{
+;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (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); }; } &&
+        { 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
+            CXXFLAGSG="$CXXFLAGSG -Wno-return-type"
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
                     case "$target" in
       *aix* )
        CXXFLAGSPIC=

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.