OSDN Git Service

* config/sol2.c (solaris_assemble_visibility): Declare decl, vis
[pf3gnuchains/gcc-fork.git] / contrib / check_warning_flags.sh
index 95640f7..d9c5735 100755 (executable)
@@ -3,7 +3,7 @@
 # Check that the warning flags documented in invoke.texi match up
 # with what the compiler accepts.
 #
 # Check that the warning flags documented in invoke.texi match up
 # with what the compiler accepts.
 #
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
 #
 # This script is Free Software, and it can be copied, distributed and
 # Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
 #
 # This script is Free Software, and it can be copied, distributed and
@@ -18,7 +18,7 @@
 progname=`echo "$0" | sed 's,.*/,,'`
 usage ()
 {
 progname=`echo "$0" | sed 's,.*/,,'`
 usage ()
 {
-  echo "usage: $progname path/to/invoke.texi"
+  echo "usage: $progname path/to/gcc/doc"
   echo "set \$CC to the compiler to be checked"
   exit 1
 }
   echo "set \$CC to the compiler to be checked"
   exit 1
 }
@@ -28,7 +28,8 @@ LC_ALL=C
 export LC_ALL
 : ${CC=gcc}
 test $# = 1 || usage
 export LC_ALL
 : ${CC=gcc}
 test $# = 1 || usage
-invoke_texi=$1
+gcc_docdir=$1
+invoke_texi=$gcc_docdir/invoke.texi
 test -r "$invoke_texi" || {
   echo "$progname: error: cannot read '$invoke_texi'" >&2
   usage
 test -r "$invoke_texi" || {
   echo "$progname: error: cannot read '$invoke_texi'" >&2
   usage
@@ -38,9 +39,12 @@ stderr=check_warning_flags_stderr$$
 
 remove_problematic_flags='
   /-Wlarger-than-/d
 
 remove_problematic_flags='
   /-Wlarger-than-/d
+  /-Wframe-larger-than/d
+  /-Wdisallowed-function-list/d
   /-W[alp],/d
   /-Werror/d
   /-Wpadded/d
   /-W[alp],/d
   /-Werror/d
   /-Wpadded/d
+  /pedantic-ms-format/d
   /=/d'
 
 # Ensure that indexed warnings are accepted.
   /=/d'
 
 # Ensure that indexed warnings are accepted.
@@ -133,4 +137,44 @@ for lang in c c++ objc obj-c++; do
   }
   rm -f $file $filebase.o $filebase.obj $stderr
 done
   }
   rm -f $file $filebase.o $filebase.obj $stderr
 done
+
+
+remove_problematic_help_flags='
+  /^W$/d
+  /^W[alp]$/d
+  /^Werror-implicit-function-declaration$/d
+  /^Wsynth$/d
+  /-$/d
+  /=/d'
+help_flags=`
+  $CC --help -v 2>/dev/null | tr ' ' '\012' |
+    sed -n '
+      b a
+      :a
+      s/^-\(W[^<,]*\).*/\1/
+      t x
+      d
+      :x
+      '"$remove_problematic_help_flags"'
+      p' | sort -u`
+: >$filebase.c
+for flag in $help_flags; do
+  $CC -c $filebase.c -$flag 2>/dev/null || {
+    echo "warning -$flag not supported" >&2
+    ret=1
+  }
+  grep "@item.*$flag" $gcc_docdir/../*/*.texi >/dev/null || {
+    # For @item, we are satisfied with either -Wfoo or -Wno-foo.
+    inverted_flag=`echo "$flag" | sed '
+      s/^Wno-/W/
+      t
+      s/^W/Wno-/'`
+    grep "@item.*$inverted_flag" $gcc_docdir/../*/*.texi >/dev/null || {
+      echo "warning -$flag not documented in $gcc_docdir/../*/*.texi" >&2
+      ret=1
+    }
+  }
+done
+rm -f $filebase.c $filebase.o
+
 exit $ret
 exit $ret