فهرست منبع

Use -Qunused-arguments to hide -I unused warnings with clang

Bryan Drewery 12 سال پیش
والد
کامیت
2ec9f5f697
2فایلهای تغییر یافته به همراه58 افزوده شده و 0 حذف شده
  1. 1 0
      build/autotools/configure.ac
  2. 57 0
      configure

+ 1 - 0
build/autotools/configure.ac

@@ -31,6 +31,7 @@ AC_CACHE_SAVE
 EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
 CXX_FLAG_CHECK([CXXFLAGS], [-fcolor-diagnostics], [colordiagnostics])
+CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
 CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotector])
 
 EGG_CHECK_DEPMODE

+ 57 - 0
configure

@@ -3737,6 +3737,63 @@ EOF
   fi
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -Qunused-arguments" >&5
+$as_echo_n "checking whether the compiler understands -Qunused-arguments... " >&6; }
+if ${egg_cv_prog_cc_unusedarguments+:} 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 -Qunused-arguments"
+    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 :
+  egg_cv_prog_cc_unusedarguments="yes"
+else
+  egg_cv_prog_cc_unusedarguments="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: $egg_cv_prog_cc_unusedarguments" >&5
+$as_echo "$egg_cv_prog_cc_unusedarguments" >&6; }
+
+  if [ "$egg_cv_prog_cc_unusedarguments" = "yes" ]; then
+    CXXFLAGS="$CXXFLAGS -Qunused-arguments"
+  elif [ -n "" ]; then
+      cat << 'EOF' >&2
+configure: error:
+
+  Your OS or C++ compiler does not support -Qunused-arguments.
+  This compile flag is required.
+
+EOF
+    exit 1
+  fi
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -fstack-protector-all" >&5
 $as_echo_n "checking whether the compiler understands -fstack-protector-all... " >&6; }
 if ${egg_cv_prog_cc_stackprotector+:} false; then :