public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix -W* documentation, update to contrib/check_warning_flags.sh
@ 2008-02-20 21:32 Ralf Wildenhues
  2008-02-20 23:42 ` FX Coudert
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ralf Wildenhues @ 2008-02-20 21:32 UTC (permalink / raw)
  To: gcc-patches, fortran

The patch below enables check_warning_flags.sh to check that warnings
listed by 'gcc -v --help' are indeed accepted by the compiler, and
listed in at least one of the compiler manuals.

It turned up four warnings that needed treatment:

* -Werror-implicit-function-declaration is deprecated in favor of
  -Werror=implicit-function-declaration,
  Fixed in the check script by ignoring this flag.

* -Wsynth is void of semantics (PR #18644).
  Fixed by also ignoring, but also adjusting -v --help output to
  document this as deprecated

* warning -Wformat-contains-nul not documented
  warning -Wline-truncation not documented
  I have documented these two in the patch below.

OK for trunk?

Thanks,
Ralf

contrib/ChangeLog:
2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* check_warning_flags.sh: Instead of invoke.texi, take the path
	to the doc directory as argument.  Check that warnings listed in
	'gcc --help' are accepted by the compiler, and listed in the
	manuals.

gcc/ChangeLog:
2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* c.opt (Wsynth): Deprecate.
	* doc/invoke.texi (Option Summary, Warning Options): Document
	-Wno-format-contains-nul.

gcc/fortran/ChangeLog:
2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* invoke.texi (Error and Warning Options): Document
	-Wline-truncation.

diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 0a67785..b0f4bc4 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -455,6 +455,11 @@ non-whitespace character after the ampersand that initiated the continuation.
 @cindex warnings, character truncation
 Warn when a character assignment will truncate the assigned string.
 
+@item -Wline-truncation
+@opindex @code{Wline-truncation}
+@cindex warnings, line truncation
+Warn when a source code line will be truncated.
+
 @item -Wconversion
 @opindex @code{Wconversion}
 @cindex warnings, conversion
diff --git a/gcc/c.opt b/gcc/c.opt
index 3704519..bbe92e8 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -427,7 +427,7 @@ Warn if type signatures of candidate methods do not match exactly
 
 Wsynth
 C++ ObjC++ Var(warn_synth) Warning
-Warn when synthesis behavior differs from Cfront
+Deprecated.  This switch has no effect
 
 Wsystem-headers
 C ObjC C++ ObjC++ Warning
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 1cb14ea..79ddad9 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -235,7 +235,7 @@ Objective-C and Objective-C++ Dialects}.
 -Wempty-body  -Wno-endif-labels @gol
 -Werror  -Werror=* @gol
 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
--Wno-format-extra-args -Wformat-nonliteral @gol
+-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
 -Wformat-security  -Wformat-y2k -Wignored-qualifiers @gol
 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
 -Wimport  -Wno-import  -Winit-self  -Winline @gol
@@ -2808,6 +2808,12 @@ aspects of format checking, the options @option{-Wformat-y2k},
 If @option{-Wformat} is specified, also warn about @code{strftime}
 formats which may yield only a two-digit year.
 
+@item -Wno-format-contains-nul
+@opindex Wno-format-contains-nul
+@opindex Wformat-contains-nul
+If @option{-Wformat} is specified, do not warn about format strings that
+contain NUL bytes.
+
 @item -Wno-format-extra-args
 @opindex Wno-format-extra-args
 @opindex Wformat-extra-args
diff --git a/contrib/check_warning_flags.sh b/contrib/check_warning_flags.sh
index 95640f7..fcd0f37 100755
--- a/contrib/check_warning_flags.sh
+++ b/contrib/check_warning_flags.sh
@@ -18,7 +18,7 @@
 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
 }
@@ -28,7 +28,8 @@ LC_ALL=C
 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
@@ -133,4 +134,44 @@ for lang in c c++ objc obj-c++; do
   }
   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 ' ' '\n' |
+    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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix -W* documentation, update to contrib/check_warning_flags.sh
  2008-02-20 21:32 [PATCH] Fix -W* documentation, update to contrib/check_warning_flags.sh Ralf Wildenhues
@ 2008-02-20 23:42 ` FX Coudert
  2008-02-26 22:24 ` Ralf Wildenhues
  2008-03-08 13:25 ` Ralf Wildenhues
  2 siblings, 0 replies; 7+ messages in thread
From: FX Coudert @ 2008-02-20 23:42 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: gcc-patches, fortran

> gcc/fortran/ChangeLog:
> 2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
>
> 	* invoke.texi (Error and Warning Options): Document
> 	-Wline-truncation.

That part is OK.

FX

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix -W* documentation, update to  contrib/check_warning_flags.sh
  2008-02-20 21:32 [PATCH] Fix -W* documentation, update to contrib/check_warning_flags.sh Ralf Wildenhues
  2008-02-20 23:42 ` FX Coudert
@ 2008-02-26 22:24 ` Ralf Wildenhues
  2008-03-08 13:25 ` Ralf Wildenhues
  2 siblings, 0 replies; 7+ messages in thread
From: Ralf Wildenhues @ 2008-02-26 22:24 UTC (permalink / raw)
  To: gcc-patches, fortran

Ping <http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00882.html>
The bits below still need approval.  Thanks FX for the quick Fortran
approval!

> contrib/ChangeLog:
> 2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
> 
> 	* check_warning_flags.sh: Instead of invoke.texi, take the path
> 	to the doc directory as argument.  Check that warnings listed in
> 	'gcc --help' are accepted by the compiler, and listed in the
> 	manuals.
> 
> gcc/ChangeLog:
> 2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
> 
> 	* c.opt (Wsynth): Deprecate.
> 	* doc/invoke.texi (Option Summary, Warning Options): Document
> 	-Wno-format-contains-nul.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix -W* documentation, update to  contrib/check_warning_flags.sh
  2008-02-20 21:32 [PATCH] Fix -W* documentation, update to contrib/check_warning_flags.sh Ralf Wildenhues
  2008-02-20 23:42 ` FX Coudert
  2008-02-26 22:24 ` Ralf Wildenhues
@ 2008-03-08 13:25 ` Ralf Wildenhues
  2008-03-08 21:13   ` Gerald Pfeifer
  2 siblings, 1 reply; 7+ messages in thread
From: Ralf Wildenhues @ 2008-03-08 13:25 UTC (permalink / raw)
  To: gcc-patches, fortran

PING^2 <http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00882.html>
OK for trunk also for the non-Fortran bits?

Thanks!
Ralf

* Ralf Wildenhues wrote on Wed, Feb 20, 2008 at 10:12:36PM CET:
> contrib/ChangeLog:
> 2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
> 
> 	* check_warning_flags.sh: Instead of invoke.texi, take the path
> 	to the doc directory as argument.  Check that warnings listed in
> 	'gcc --help' are accepted by the compiler, and listed in the
> 	manuals.
> 
> gcc/ChangeLog:
> 2008-02-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
> 
> 	* c.opt (Wsynth): Deprecate.
> 	* doc/invoke.texi (Option Summary, Warning Options): Document
> 	-Wno-format-contains-nul.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix -W* documentation, update to   contrib/check_warning_flags.sh
  2008-03-08 13:25 ` Ralf Wildenhues
@ 2008-03-08 21:13   ` Gerald Pfeifer
  2008-03-09 17:43     ` Ralf Wildenhues
  0 siblings, 1 reply; 7+ messages in thread
From: Gerald Pfeifer @ 2008-03-08 21:13 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: gcc-patches, fortran

On Sat, 8 Mar 2008, Ralf Wildenhues wrote:
> PING^2 <http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00882.html>
> OK for trunk also for the non-Fortran bits?

Yep.  The one to c.opt looks obvious, and the rest is just docs.

+@item -Wno-format-contains-nul
+@opindex Wno-format-contains-nul
+@opindex Wformat-contains-nul
+If @option{-Wformat} is specified, do not warn about format strings that
+contain NUL bytes.

I guess if someone really wanted to, she could use -Wformat-contains-nul 
alone (without -Wformat) as well, right?

Gerald

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix -W* documentation, update to  contrib/check_warning_flags.sh
  2008-03-08 21:13   ` Gerald Pfeifer
@ 2008-03-09 17:43     ` Ralf Wildenhues
  2008-03-16 23:49       ` Gerald Pfeifer
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Wildenhues @ 2008-03-09 17:43 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: gcc-patches, fortran

Hello Gerald,

* Gerald Pfeifer wrote on Sat, Mar 08, 2008 at 10:12:40PM CET:
> On Sat, 8 Mar 2008, Ralf Wildenhues wrote:
> > PING^2 <http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00882.html>
> > OK for trunk also for the non-Fortran bits?
> 
> Yep.  The one to c.opt looks obvious, and the rest is just docs.

Thanks, committed.

> +@item -Wno-format-contains-nul
> +@opindex Wno-format-contains-nul
> +@opindex Wformat-contains-nul
> +If @option{-Wformat} is specified, do not warn about format strings that
> +contain NUL bytes.
> 
> I guess if someone really wanted to, she could use -Wformat-contains-nul 
> alone (without -Wformat) as well, right?

Yes, but this formulation is just in line with how
-Wno-format-extra-args and -Wno-format-zero-length are described, too.
Terse, but not illogical, no?

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix -W* documentation, update to  contrib/check_warning_flags.sh
  2008-03-09 17:43     ` Ralf Wildenhues
@ 2008-03-16 23:49       ` Gerald Pfeifer
  0 siblings, 0 replies; 7+ messages in thread
From: Gerald Pfeifer @ 2008-03-16 23:49 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: gcc-patches, fortran

On Sun, 9 Mar 2008, Ralf Wildenhues wrote:
>> +@item -Wno-format-contains-nul
>> +@opindex Wno-format-contains-nul
>> +@opindex Wformat-contains-nul
>> +If @option{-Wformat} is specified, do not warn about format strings that
>> +contain NUL bytes.
>> I guess if someone really wanted to, she could use -Wformat-contains-nul 
>> alone (without -Wformat) as well, right?
> 
> Yes, but this formulation is just in line with how
> -Wno-format-extra-args and -Wno-format-zero-length are described, too.
> Terse, but not illogical, no?

Not illogical, just not completely and I've seen your attention to detail
(which is good), which is why I pointed it out. :-)

Gerald

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-03-16 23:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20 21:32 [PATCH] Fix -W* documentation, update to contrib/check_warning_flags.sh Ralf Wildenhues
2008-02-20 23:42 ` FX Coudert
2008-02-26 22:24 ` Ralf Wildenhues
2008-03-08 13:25 ` Ralf Wildenhues
2008-03-08 21:13   ` Gerald Pfeifer
2008-03-09 17:43     ` Ralf Wildenhues
2008-03-16 23:49       ` Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).