diff mbox

[4/6] enable -Woverloaded-virtual when available

Message ID 1397723842-29147-4-git-send-email-tsaunders@mozilla.com
State New
Headers show

Commit Message

Trevor Saunders April 17, 2014, 8:37 a.m. UTC
From: Trevor Saunders <tbsaunde@mozilla.com>

hi,

its a useful warning, and helps catch bugs in the next two patches.

bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Trev

2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>

	* configure.ac: Check for -Woverloaded-virtual and enable it if found.
	* configure: Regenerate.

Comments

Richard Biener April 17, 2014, 8:56 a.m. UTC | #1
On Thu, Apr 17, 2014 at 10:37 AM,  <tsaunders@mozilla.com> wrote:
> From: Trevor Saunders <tbsaunde@mozilla.com>
>
> hi,
>
> its a useful warning, and helps catch bugs in the next two patches.
>
> bootstrap + regtest passed on x86_64-unknown-linux-gnu, ok?

Ok.

Thanks,
Richard.

> Trev
>
> 2014-03-19  Trevor Saunders  <tsaunders@mozilla.com>
>
>         * configure.ac: Check for -Woverloaded-virtual and enable it if found.
>         * configure: Regenerate.
>
>
> diff --git a/gcc/configure b/gcc/configure
> index 415377a..1a48ca3 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -6427,6 +6427,50 @@ fi
>    done
>  CFLAGS="$save_CFLAGS"
>
> +save_CFLAGS="$CFLAGS"
> +for real_option in -Woverloaded-virtual; do
> +  # Do the check with the no- prefix removed since gcc silently
> +  # accepts any -Wno-* option on purpose
> +  case $real_option in
> +    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
> +    *) option=$real_option ;;
> +  esac
> +  as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
> +$as_echo_n "checking whether $CC supports $option... " >&6; }
> +if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  CFLAGS="$option"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +int
> +main ()
> +{
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  eval "$as_acx_Woption=yes"
> +else
> +  eval "$as_acx_Woption=no"
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +
> +fi
> +eval ac_res=\$$as_acx_Woption
> +              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
> +$as_echo "$ac_res" >&6; }
> +  if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
> +  strict_warn="$strict_warn${strict_warn:+ }$real_option"
> +fi
> +  done
> +CFLAGS="$save_CFLAGS"
> +
>  c_strict_warn=
>  save_CFLAGS="$CFLAGS"
>  for real_option in -Wold-style-definition -Wc++-compat; do
> @@ -17927,7 +17971,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 17930 "configure"
> +#line 17974 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> @@ -18033,7 +18077,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 18036 "configure"
> +#line 18080 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 0336066..b2726e5 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -340,6 +340,8 @@ ACX_PROG_CC_WARNING_OPTS(
>  ACX_PROG_CC_WARNING_OPTS(
>         m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
>  ACX_PROG_CC_WARNING_OPTS(
> +       m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn])
> +ACX_PROG_CC_WARNING_OPTS(
>         m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
>  ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
>         m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],
> --
> 1.9.2
>
diff mbox

Patch

diff --git a/gcc/configure b/gcc/configure
index 415377a..1a48ca3 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -6427,6 +6427,50 @@  fi
   done
 CFLAGS="$save_CFLAGS"
 
+save_CFLAGS="$CFLAGS"
+for real_option in -Woverloaded-virtual; do
+  # Do the check with the no- prefix removed since gcc silently
+  # accepts any -Wno-* option on purpose
+  case $real_option in
+    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
+    *) option=$real_option ;;
+  esac
+  as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
+$as_echo_n "checking whether $CC supports $option... " >&6; }
+if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS="$option"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_acx_Woption=yes"
+else
+  eval "$as_acx_Woption=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$$as_acx_Woption
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
+  strict_warn="$strict_warn${strict_warn:+ }$real_option"
+fi
+  done
+CFLAGS="$save_CFLAGS"
+
 c_strict_warn=
 save_CFLAGS="$CFLAGS"
 for real_option in -Wold-style-definition -Wc++-compat; do
@@ -17927,7 +17971,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17930 "configure"
+#line 17974 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18033,7 +18077,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18036 "configure"
+#line 18080 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 0336066..b2726e5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -340,6 +340,8 @@  ACX_PROG_CC_WARNING_OPTS(
 ACX_PROG_CC_WARNING_OPTS(
 	m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
 ACX_PROG_CC_WARNING_OPTS(
+	m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn])
+ACX_PROG_CC_WARNING_OPTS(
 	m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
 	m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],