فهرست منبع

Merge branch 'maint'

* maint:
  Reduce GCC compiler spam from -Wcast-function-type
  Fix detection of -Wno flags to not spam on errors

Conflicts:
	build/autotools/configure.ac
	configure
Bryan Drewery 8 سال پیش
والد
کامیت
f09dc3af5e
4فایلهای تغییر یافته به همراه99 افزوده شده و 10 حذف شده
  1. 3 2
      build/autotools/configure.ac
  2. 30 0
      build/autotools/includes/acinclude.m4
  3. 65 8
      configure
  4. 1 0
      doc/UPDATES.md

+ 3 - 2
build/autotools/configure.ac

@@ -32,8 +32,9 @@ EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
 CXX_FLAG_CHECK([CXXFLAGS], [-fcolor-diagnostics], [colordiagnostics])
 #CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
-CXX_FLAG_CHECK([CXXFLAGS], [-Wno-invalid-source-encoding], [invalid_source_encoding])
-CXX_FLAG_CHECK([CXXFLAGS], [-Wno-narrowing], [wnonarrowing])
+CXX_FLAG_CHECK_NO([CXXFLAGS], [-Winvalid-source-encoding], [-Wno-invalid-source-encoding], [invalid_source_encoding])
+CXX_FLAG_CHECK_NO([CXXFLAGS], [-Wnarrowing], [-Wno-narrowing], [nonarrowing])
+CXX_FLAG_CHECK_NO([CXXFLAGS], [-Wcast-function-type], [-Wno-cast-function-type], [no_cast_function_type])
 CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector], [stackprotector])
 CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector-strong], [stackprotectorstrong])
 if [[ "${ax_cv_prog_cc_stackprotectorstrong}" = "yes" ]]; then

+ 30 - 0
build/autotools/includes/acinclude.m4

@@ -211,6 +211,36 @@ EOF
   fi
 ])
 
+dnl @synopsis CXX_FLAG_CHECK_NO [var] [compiler flags] [no flag] [cache name] [required]
+dnl @summary check whether compiler supports given C++ flags or not
+AC_DEFUN([CXX_FLAG_CHECK_NO],
+[
+  AC_CACHE_CHECK([whether the compiler understands $3], ax_cv_prog_cc_$4, [
+    AC_LANG_PUSH([C++])
+    ac_saved_flags="$CXXFLAGS"
+    CXXFLAGS="-Werror $2"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+      [ax_cv_prog_cc_$4="yes"],
+      [ax_cv_prog_cc_$4="no"],
+    )
+    CXXFLAGS="$ac_saved_flags"
+    AC_LANG_POP([C++])
+  ])
+
+  if [[ "$ax_cv_prog_cc_$4" = "yes" ]]; then
+    $1="$$1 $3"
+  elif [[ -n "$5" ]]; then
+      cat << 'EOF' >&2
+configure: error:
+
+  Your OS or C++ compiler does not support $3.
+  This compile flag is required.
+
+EOF
+    exit 1
+  fi
+])
+
 dnl @synopsis CXX_FLAG_CHECK_LINK [var] [compiler flags] [cache name] [required]
 dnl @summary check whether linker supports given C++ flags or not
 AC_DEFUN([CXX_FLAG_CHECK_LINK],

+ 65 - 8
configure

@@ -3590,7 +3590,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
     ac_saved_flags="$CXXFLAGS"
-    CXXFLAGS="-Werror -Wno-invalid-source-encoding"
+    CXXFLAGS="-Werror -Winvalid-source-encoding"
     cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end build/confdefs.h.  */
 
@@ -3636,7 +3636,7 @@ EOF
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -Wno-narrowing" >&5
 $as_echo_n "checking whether the compiler understands -Wno-narrowing... " >&6; }
-if ${ax_cv_prog_cc_wnonarrowing+:} false; then :
+if ${ax_cv_prog_cc_nonarrowing+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -3647,7 +3647,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
     ac_saved_flags="$CXXFLAGS"
-    CXXFLAGS="-Werror -Wno-narrowing"
+    CXXFLAGS="-Werror -Wnarrowing"
     cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end build/confdefs.h.  */
 
@@ -3660,9 +3660,9 @@ main ()
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_prog_cc_wnonarrowing="yes"
+  ax_cv_prog_cc_nonarrowing="yes"
 else
-  ax_cv_prog_cc_wnonarrowing="no"
+  ax_cv_prog_cc_nonarrowing="no"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     CXXFLAGS="$ac_saved_flags"
@@ -3674,10 +3674,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cc_wnonarrowing" >&5
-$as_echo "$ax_cv_prog_cc_wnonarrowing" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cc_nonarrowing" >&5
+$as_echo "$ax_cv_prog_cc_nonarrowing" >&6; }
 
-  if [ "$ax_cv_prog_cc_wnonarrowing" = "yes" ]; then
+  if [ "$ax_cv_prog_cc_nonarrowing" = "yes" ]; then
     CXXFLAGS="$CXXFLAGS -Wno-narrowing"
   elif [ -n "" ]; then
       cat << 'EOF' >&2
@@ -3691,6 +3691,63 @@ EOF
   fi
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -Wno-cast-function-type" >&5
+$as_echo_n "checking whether the compiler understands -Wno-cast-function-type... " >&6; }
+if ${ax_cv_prog_cc_no_cast_function_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    ac_ext=cpp
+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
+
+    ac_saved_flags="$CXXFLAGS"
+    CXXFLAGS="-Werror -Wcast-function-type"
+    cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end build/confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_prog_cc_no_cast_function_type="yes"
+else
+  ax_cv_prog_cc_no_cast_function_type="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    CXXFLAGS="$ac_saved_flags"
+    ac_ext=cpp
+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
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cc_no_cast_function_type" >&5
+$as_echo "$ax_cv_prog_cc_no_cast_function_type" >&6; }
+
+  if [ "$ax_cv_prog_cc_no_cast_function_type" = "yes" ]; then
+    CXXFLAGS="$CXXFLAGS -Wno-cast-function-type"
+  elif [ -n "" ]; then
+      cat << 'EOF' >&2
+configure: error:
+
+  Your OS or C++ compiler does not support -Wno-cast-function-type.
+  This compile flag is required.
+
+EOF
+    exit 1
+  fi
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -fstack-protector" >&5
 $as_echo_n "checking whether the compiler understands -fstack-protector... " >&6; }
 if ${ax_cv_prog_cc_stackprotector+:} false; then :

+ 1 - 0
doc/UPDATES.md

@@ -6,6 +6,7 @@
   * Fix ptrace detection on OpenBSD (after 1.4.6 regression for the Linux fix)
   * Update server list, 'set -yes servers -' and 'set -yes servers6 -' to get new list.
   * Fix command executions.
+  * Reduce compilation spam.
 
 # 1.4.8
   * Support Debian/Ubuntu's libssl1.0.0[:i386] package.