* [PATCH 0/N] Fix --help output.
@ 2009-03-01 7:10 Ralf Wildenhues
2009-03-01 7:11 ` [PATCH, doc] Restore dropped sentence in options.texi (Option file format) Ralf Wildenhues
` (8 more replies)
0 siblings, 9 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:10 UTC (permalink / raw)
To: gcc-patches
Hello,
I do not like to read:
This switch lacks documentation
I dislike documentation that gets worse. On i686-pc-linux-gnu:
$ gcc -v --help 2>/dev/null | grep "This switch lacks documentation" | wc -l
trunk has 147,
gcc-4.2.4 had 108,
gcc-3.4.6 had 57.
Several of the now-undocumented switches used to be documented!
I have a set of patches to fix various related bugs in this area, but
I need help: how can I add test cases to the testsuite that just run the
compiler driver with some extra flags, and test its output against some
regexes, ideally multi-line? I'm not very fluent in GCC dejagnu.
All patches have been bootstrapped and regtested on i686-pc-linux-gnu,
unless stated otherwise.
Thanks,
Ralf
PS: I meant to only send documentation patches, which is why I foolishly
assumed that this time of the cycle might still be a good time ... sorry
for the bad timing.
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH, doc] Restore dropped sentence in options.texi (Option file format)
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
@ 2009-03-01 7:11 ` Ralf Wildenhues
2009-03-01 10:44 ` Richard Guenther
2009-03-01 7:12 ` [PATCH, doc] Improve state of check_warning_flags.sh warnings Ralf Wildenhues
` (7 subsequent siblings)
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:11 UTC (permalink / raw)
To: gcc-patches
This patch
| 2008-07-23 Michael Meissner <gnu@the-meissners.org>
| Karthik Kumar <karthikkumar@gmail.com>
[...]
| * doc/options.texi (TargetSave): Document TargetSave syntax.
| (UInteger): Document UInteger must be used for certain flags.
| (Save): Document Save option to create target specific options
| that can be saved/restored on a function specific context.
borked up 'info gccint -n "Option file format"' a bit:
| The files can contain the following types of record:
[...]
| * A target specific save record to save additional information. These
| records have two fields: the string `TargetSave', and a
| declaration type to go in the `cl_target_option' structure.
|
| * 1. the name of the option, with the leading "-" removed
|
| 2. a space-separated list of option properties (*note Option
| properties::)
[...]
|
| By default, all options beginning with "f", "W" or "m" are
| implicitly assumed to take a "no-" form. This form should not be
[...]
This patch undoes the breakage. Tested 'make info html pdf'. OK?
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* doc/options.texi (Option file format): Fix bad indentation,
restoring dropped sentence.
diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index 4581ead..913e2e2 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -40,6 +40,7 @@ records have two fields: the string @samp{TargetSave}, and a
declaration type to go in the @code{cl_target_option} structure.
@item
+An option definition record. These records have the following fields:
@enumerate
@item
the name of the option, with the leading ``-'' removed
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH, doc] Improve state of check_warning_flags.sh warnings.
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
2009-03-01 7:11 ` [PATCH, doc] Restore dropped sentence in options.texi (Option file format) Ralf Wildenhues
@ 2009-03-01 7:12 ` Ralf Wildenhues
2009-03-01 10:45 ` Richard Guenther
2009-03-01 11:13 ` Gerald Pfeifer
2009-03-01 7:14 ` [PATCH] Fix --help -v output for duplicate options Ralf Wildenhues
` (6 subsequent siblings)
8 siblings, 2 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:12 UTC (permalink / raw)
To: gcc-patches
This fixes most warnings output from the check_warning_flags.sh script
for current trunk.
OK for 4.4? This is a doc+contrib only patch.
Tested 'make info html pdf' of course.
Thanks,
Ralf
contrib/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* check_warning_flags.sh: Update flag exceptions.
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* doc/invoke.texi (Warning Options): -Wsync-nand is C/C++ only.
-Wno-pedantic-ms-format is for MinGW targets only.
diff --git a/contrib/check_warning_flags.sh b/contrib/check_warning_flags.sh
index fcd0f37..adbc0d6 100755
--- a/contrib/check_warning_flags.sh
+++ b/contrib/check_warning_flags.sh
@@ -39,9 +39,12 @@ stderr=check_warning_flags_stderr$$
remove_problematic_flags='
/-Wlarger-than-/d
+ /-Wframe-larger-than/d
+ /-Wdisallowed-function-list/d
/-W[alp],/d
/-Werror/d
/-Wpadded/d
+ /pedantic-ms-format/d
/=/d'
# Ensure that indexed warnings are accepted.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6d36794..99790b2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3129,7 +3129,7 @@ and lacks a @code{case} for one or more of the named codes of that
enumeration. @code{case} labels outside the enumeration range also
provoke warnings when this option is used.
-@item -Wsync-nand
+@item -Wsync-nand @r{(C and C++ only)}
@opindex Wsync-nand
@opindex Wno-sync-nand
Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
@@ -3583,7 +3583,7 @@ assume anything on the bounds of the loop indices. With
@option{-funsafe-loop-optimizations} warn if the compiler made
such assumptions.
-@item -Wno-pedantic-ms-format
+@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
@opindex Wno-pedantic-ms-format
@opindex Wpedantic-ms-format
Disables the warnings about non-ISO @code{printf} / @code{scanf} format
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH] Fix --help -v output for duplicate options.
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
2009-03-01 7:11 ` [PATCH, doc] Restore dropped sentence in options.texi (Option file format) Ralf Wildenhues
2009-03-01 7:12 ` [PATCH, doc] Improve state of check_warning_flags.sh warnings Ralf Wildenhues
@ 2009-03-01 7:14 ` Ralf Wildenhues
2009-03-01 10:46 ` Richard Guenther
2009-03-01 7:17 ` [PATCH] grab all contents of multiline help in *.opt Ralf Wildenhues
` (5 subsequent siblings)
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:14 UTC (permalink / raw)
To: gcc-patches
The patch below fixes the problem that, if more than one *.opt file
listed a switch, and not all of them had a help text, options.c gets at
least one of the help texts. Still bad: the last one wins, which is a
pretty arbitrary choice.
One question is whether optc-gen.awk should be modified to just barf
when it reads multiple unequal help texts. But since the set of
options is target-dependent, it doesn't seem like a good idea to do so
now; maybe later?
OK for 4.5?
What about 4.4? This is not a regression in the optc-gen code AFAICS,
but it is a regression in the sense that 4.4 has many more options that
are listed in more than one *.opt file, thus causing more options
without help text.
(The second hunk of the patch is a trivial optimization and code
clarification.)
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* optc-gen.awk: No need to duplicate option flags twice.
Reuse help texts for duplicate options which do not have
any.
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 2e22016..860810a 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
# Contributed by Kelley Cook, June 2004.
# Original code from Neil Booth, May 2003.
#
@@ -145,6 +145,8 @@ for (i = 0; i < n_opts; i++) {
# ends, for example.
while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
flags[i + 1] = flags[i] " " flags[i + 1];
+ if (help[i + 1] == "")
+ help[i + 1] = help[i]
i++;
back_chain[i] = "N_OPTS";
indices[opts[i]] = j;
@@ -153,11 +155,10 @@ for (i = 0; i < n_opts; i++) {
}
for (i = 0; i < n_opts; i++) {
- # Combine the flags of identical switches. Switches
- # appear many times if they are handled by many front
- # ends, for example.
+ # With identical flags, pick only the last one. The
+ # earlier loop ensured that it has all flags merged,
+ # and a nonempty help text if one of the texts was nonempty.
while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
- flags[i + 1] = flags[i] " " flags[i + 1];
i++;
}
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH, java, fortran] Merge help texts for duplicate options.
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
` (3 preceding siblings ...)
2009-03-01 7:17 ` [PATCH] grab all contents of multiline help in *.opt Ralf Wildenhues
@ 2009-03-01 7:17 ` Ralf Wildenhues
2009-03-18 18:55 ` Ralf Wildenhues
2009-03-01 7:19 ` [PATCH] Fix output race in --help -v Ralf Wildenhues
` (3 subsequent siblings)
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:17 UTC (permalink / raw)
To: gcc-patches; +Cc: java-patches, fortran
Hello,
Currently, some switches are documented more than once. The opt*.awk
machinery currently picks one arbitrarily, for -v --help output (see
the other patch on gcc-patches that ensures that at least one of them
is picked).
This patch attempts to sort out the duplicates manually. I found this
a bit nontrivial to do, as for other languages, the help may sound
confusing or may not even be true, so please read carefully.
Changes address Fortran, C, and Java front-ends.
These are the current duplicates found on i686-pc-linux-gnu:
I:
c: -I <dir> Add <dir> to the end of the main include path
fortran: -I<directory> Add a directory for INCLUDE and MODULE searching
Wconversion:
c: Warn for implicit type conversions that may change a value
fortran: Warn about implicit conversion
Wdeprecated:
c: Warn about deprecated compiler features
java: Warn if a deprecated compiler feature, class, method, or field is used
Wsystem-headers:
common: Do not suppress warnings from system headers
c: Do not suppress warnings from system headers
d:
common: -d<letters> Enable dumps from specific passes of the compiler
fortran: -d[DIMNU] Dump details about macro names and definitions during preprocessing
fopenmp:
c: Enable OpenMP
fortran: Enable OpenMP (also sets frecursive)
fpreprocessed:
c: Treat the input file as already preprocessed
fortran: Treat the input file as preprocessed
fshort-enums:
c: Use the narrowest integer type possible for enumeration types
fortran: Use the narrowest integer type possible for enumeration types
OK for 4.5?
What about 4.4 (asking because this is more of a doc patch)?
bootregged i686-pc-linux-gnu (like all the other patches).
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* c.opt: Unify help texts for -Wdeprecated, -Wsystem-headers,
and -fopenmp.
gcc/fortran/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lang.opt: Unify help texts for -I, -Wconversion, -d, -fopenmp,
and -fpreprocessed.
gcc/java/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lang.opt: Unify help text for -Wdeprecated.
diff --git a/gcc/c.opt b/gcc/c.opt
index 5f07aea..40681bd 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -185,7 +185,7 @@ Warn when a declaration is found after a statement
Wdeprecated
C C++ ObjC ObjC++ Var(warn_deprecated) Init(1) Warning
-Warn about deprecated compiler features
+Warn if a deprecated compiler feature, class, method, or field is used
Wdiv-by-zero
C ObjC C++ ObjC++ Var(warn_div_by_zero) Init(1) Warning
@@ -446,7 +446,7 @@ Deprecated. This switch has no effect
Wsystem-headers
C ObjC C++ ObjC++ Warning
-Do not suppress warnings from system headers
+; Documented in common.opt
Wtraditional
C ObjC Var(warn_traditional) Warning
@@ -691,7 +691,7 @@ Enable Objective-C setjmp exception handling runtime
fopenmp
C ObjC C++ ObjC++ Var(flag_openmp)
-Enable OpenMP
+Enable OpenMP (implies -frecursive in Fortran)
foperator-names
C++ ObjC++
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index e49ff76..64fd486 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -1,5 +1,5 @@
; Options for the Fortran 95 front end.
-; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
; Free Software Foundation, Inc.
;
; This file is part of GCC.
@@ -50,7 +50,7 @@ Fortran
I
Fortran Joined Separate
--I<directory> Add a directory for INCLUDE and MODULE searching
+; Documented in C
J
Fortran Joined Separate
@@ -90,7 +90,7 @@ Warn about truncated character expressions
Wconversion
Fortran Warning
-Warn about implicit conversion
+; Documented in C
Wimplicit-interface
Fortran Warning
@@ -134,7 +134,7 @@ Disable preprocessing
d
Fortran Joined
--d[DIMNU] Dump details about macro names and definitions during preprocessing
+; Documented in common.opt
falign-commons
Fortran
@@ -310,7 +310,7 @@ Set default accessibility of module entities to PRIVATE.
fopenmp
Fortran
-Enable OpenMP (also sets frecursive)
+; Documented in C
fpack-derived
Fortran
@@ -318,7 +318,7 @@ Try to lay out derived types as compactly as possible
fpreprocessed
Fortran
-Treat the input file as preprocessed
+; Documented in C
frange-check
Fortran
diff --git a/gcc/java/lang.opt b/gcc/java/lang.opt
index 7947a1a..8af1bd5 100644
--- a/gcc/java/lang.opt
+++ b/gcc/java/lang.opt
@@ -1,5 +1,5 @@
; Options for the Java front end.
-; Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
+; Copyright (C) 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
@@ -62,7 +62,7 @@ Java
Wdeprecated
Java Var(warn_deprecated) VarExists
-Warn if a deprecated compiler feature, class, method, or field is used
+; Documented for C
Wextraneous-semicolon
Java Var(flag_extraneous_semicolon)
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH] grab all contents of multiline help in *.opt
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
` (2 preceding siblings ...)
2009-03-01 7:14 ` [PATCH] Fix --help -v output for duplicate options Ralf Wildenhues
@ 2009-03-01 7:17 ` Ralf Wildenhues
2009-03-01 10:24 ` Gerald Pfeifer
2009-03-01 7:17 ` [PATCH, java, fortran] Merge help texts for duplicate options Ralf Wildenhues
` (4 subsequent siblings)
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:17 UTC (permalink / raw)
To: gcc-patches
Multi-line help texts are currently cut off, see for example:
(GNU sed-specific notation)
$ gcc -v --help 2>/dev/null | sed '/-std=c++0x/{N;N;p;}; d'
This patch fixes it.
I think this is no regression, but a long-standing bug; it may be that
older GCC simply didn't have multi-line help strings in .opt files; I
haven't checked.
So, OK for 4.5?
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* optc-gen.awk: Assign all remaining fields to help string,
space-separated, for multi-line help in *.opt.
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 860810a..3e644a5 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -53,6 +53,8 @@ BEGIN {
opts[n_opts] = $1
flags[n_opts] = $2
help[n_opts] = $3
+ for (i = 4; i <= NF; i++)
+ help[n_opts] = help[n_opts] " " $i
n_opts++;
}
}
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH] Fix output race in --help -v
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
` (4 preceding siblings ...)
2009-03-01 7:17 ` [PATCH, java, fortran] Merge help texts for duplicate options Ralf Wildenhues
@ 2009-03-01 7:19 ` Ralf Wildenhues
2009-03-01 10:50 ` Richard Guenther
2009-03-01 7:20 ` [PATCH] Document --version in --help output Ralf Wildenhues
` (2 subsequent siblings)
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:19 UTC (permalink / raw)
To: gcc-patches
On my system, in the output of 'gcc --help -v', the Ada part begins
before the driver part ends. The effect depends on stdio buffering etc.
The patch below fixes that, and adds a newline between the parts,
to match the formatting between the other subprocesses' output.
Before:
| Usage: gcc [options] file...
| Options:
| -pass-exit-codes Exit with highest error code from a phase
[...]
| -o <file> Place the output into <file>
| -x <language> Specify the language of the following input files
| Permissible languages include: c c++ assembler none
| The following options are specific to just the language Ada:
| -fRTS= This switch lacks documentation
[... options for languages, as, ld, etc. ]
| -z KEYWORD Ignored for Solaris compatibility
|
| Report bugs to <http://www.sourceware.org/bugzilla/>
| 'none' means revert to the default behavior of
| guessing the language based on the file's extension
|
| Options starting with -g, -f, -m, -O, -W, or --param are automatically
| passed on to the various sub-processes invoked by gcc. In order to pass
| other options on to these processes the -W<letter> options must be used.
|
| For bug reporting instructions, please see:
| <http://gcc.gnu.org/bugs.html>
After:
| Usage: xgcc [options] file...
| Options:
| -pass-exit-codes Exit with highest error code from a phase
[...]
| -o <file> Place the output into <file>
| -x <language> Specify the language of the following input files
| Permissible languages include: c c++ assembler none
| 'none' means revert to the default behavior of
| guessing the language based on the file's extension
|
| Options starting with -g, -f, -m, -O, -W, or --param are automatically
| passed on to the various sub-processes invoked by xgcc. In order to pass
| other options on to these processes the -W<letter> options must be used.
|
| The following options are specific to just the language Ada:
| -fRTS= This switch lacks documentation
[... options for languages, as, ld, etc. ]
| -z KEYWORD Ignored for Solaris compatibility
|
| Report bugs to <http://www.sourceware.org/bugzilla/>
|
| For bug reporting instructions, please see:
| <http://gcc.gnu.org/bugs.html>
AFAICS this is a regression over 4.2, since the new style verbose help
output was only added since then. OK for 4.4?
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gcc.c (main): If print_help_list and verbose_flag, ensure
driver output comes before subprocess output.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index b8691f9..c2850bf 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6601,7 +6601,10 @@ main (int argc, char **argv)
/* We do not exit here. Instead we have created a fake input file
called 'help-dummy' which needs to be compiled, and we pass this
- on the various sub-processes, along with the --help switch. */
+ on the various sub-processes, along with the --help switch.
+ Ensure their output appears after ours. */
+ fputc ('\n', stdout);
+ fflush (stdout);
}
if (verbose_flag)
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH] Document --version in --help output.
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
` (5 preceding siblings ...)
2009-03-01 7:19 ` [PATCH] Fix output race in --help -v Ralf Wildenhues
@ 2009-03-01 7:20 ` Ralf Wildenhues
2009-03-01 10:52 ` Richard Guenther
2009-03-01 10:13 ` [PATCH] PR middle-end/37805: --help=...,joined,undocumented Ralf Wildenhues
2009-03-01 21:52 ` [PATCH 0/N] Fix --help output Ben Elliston
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 7:20 UTC (permalink / raw)
To: gcc-patches
$ gcc --help
does not document --version at all.
$ gcc -v --help 2>/dev/null | grep -e '-version '
-version This switch lacks documentation
-ftree-vect-loop-version Enable loop versioning when doing loop
--version This switch lacks documentation
--version print assembler version number and exit
-v, --version Print version information
--no-undefined-version Disallow undefined version
The first line is from the Java specific section; jc1 accepts only
-version, gcj accepts only --version. With the other patch to fix
bogusly lacking entries, the line becomes
-version Display the compiler's version
The third line from the language-independent section, failing to
document --version, then as, then ld.
I suggest this patch to document --version in --help.
Surprisingly, this is not a regression AFAICS. So I guess unless you
find that trivial enough to warrant applying now, or this is too bad on
translators: OK for 4.5?
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gcc.c (display_help): Document --version.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index c2850bf..cf85618 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3232,6 +3232,7 @@ display_help (void)
fputs (_(" Display specific types of command line options\n"), stdout);
if (! verbose_flag)
fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
+ fputs (_(" --version Display compiler version information\n"), stdout);
fputs (_(" -dumpspecs Display all of the built in spec strings\n"), stdout);
fputs (_(" -dumpversion Display the version of the compiler\n"), stdout);
fputs (_(" -dumpmachine Display the compiler's target processor\n"), stdout);
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH] PR middle-end/37805: --help=...,joined,undocumented
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
` (6 preceding siblings ...)
2009-03-01 7:20 ` [PATCH] Document --version in --help output Ralf Wildenhues
@ 2009-03-01 10:13 ` Ralf Wildenhues
2009-03-02 20:51 ` Ralf Wildenhues
2009-03-01 21:52 ` [PATCH 0/N] Fix --help output Ben Elliston
8 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 10:13 UTC (permalink / raw)
To: gcc-patches
gcc.info documents:
--help=warnings,^joined,^undocumented
(and 'gcc --help' lists those, too), but joined and undocumented don't
work any more since the PR 37805 patch. This patch reverts that patch
and redoes it.
It is not a minimal change in the sense that: a minimal patch could just
remove the corresponding documentation along with the non-working
feature. But it is pretty minimal in terms of changed code. The
documentation is cleaned up a bit, too.
This is a regression over 4.3, which supported the above options, but
of course also had the ICE-on-invalid-arguments documented in the PR.
The 'len == 0' hunk fixes another glitch in that
--help=,
--help=,joined
currently assumes the first word before the comma to be 'optimizers'.
This patch is currently still bootstrapping & regtesting on
i686-pc-linux-gnu; 'make info html pdf' was successful and looks ok.
Note that the "undocumented" qualifier is pretty useless at the
moment. AFAICS fixing that is a larger chunk of work, though.
And yes, this code dearly needs testsuite exposure.
Thanks,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR middle-end/37805
* opts.c (print_specific_help): Accept `separate' and `joined'
as separate flags.
(common_handle_option): Skip over empty strings.
* gcc.c (display_help): Fix help string for `--help='.
* doc/invoke.texi (Option Summary, Overall Options): With
`--help=', classes and qualifiers can both be repeated, but
only the latter can be negated. Fix markup and examples.
Revert
2008-10-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37805
* opts.c (common_handle_option): Don't ICE on -fhelp=joined
and -fhelp=separate.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 043cc98..97b41f4 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -163,7 +163,7 @@ in the following sections.
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
--x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol
+-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
--version -wrapper@@@var{file}}
@item C Language Options
@@ -1158,11 +1158,10 @@ Print (on the standard output) a description of target-specific command
line options for each tool. For some targets extra target-specific
information may also be printed.
-@item --help=@var{class}@r{[},@var{qualifier}@r{]}
+@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
Print (on the standard output) a description of the command line
-options understood by the compiler that fit into a specific class.
-The class can be one of @samp{optimizers}, @samp{warnings}, @samp{target},
-@samp{params}, or @var{language}:
+options understood by the compiler that fit into all specified classes
+and qualifiers. These are the supported classes:
@table @asis
@item @samp{optimizers}
@@ -1192,9 +1191,7 @@ version of GCC.
This will display the options that are common to all languages.
@end table
-It is possible to further refine the output of the @option{--help=}
-option by adding a comma separated list of qualifiers after the
-class. These can be any from the following list:
+These are the supported qualifiers:
@table @asis
@item @samp{undocumented}
@@ -1218,7 +1215,7 @@ switches supported by the compiler the following can be used:
@end smallexample
The sense of a qualifier can be inverted by prefixing it with the
-@var{^} character, so for example to display all binary warning
+@samp{^} character, so for example to display all binary warning
options (i.e., ones that are either on or off and that do not take an
argument), which have a description the following can be used:
@@ -1226,7 +1223,7 @@ argument), which have a description the following can be used:
--help=warnings,^joined,^undocumented
@end smallexample
-A class can also be used as a qualifier, although this usually
+Combining several classes is possible, although this usually
restricts the output by so much that there is nothing to display. One
case where it does work however is when one of the classes is
@var{target}. So for example to display all the target-specific
@@ -1262,7 +1259,7 @@ options, so for example it is possible to find out which optimizations
are enabled at @option{-O2} by using:
@smallexample
--O2 --help=optimizers
+-Q -O2 --help=optimizers
@end smallexample
Alternatively you can discover which binary optimizations are enabled
diff --git a/gcc/gcc.c b/gcc/gcc.c
index c2850bf..3270372 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3228,7 +3228,7 @@ display_help (void)
fputs (_(" -pass-exit-codes Exit with highest error code from a phase\n"), stdout);
fputs (_(" --help Display this information\n"), stdout);
fputs (_(" --target-help Display target specific command line options\n"), stdout);
- fputs (_(" --help={target|optimizers|warnings|undocumented|params}[,{[^]joined|[^]separate}]\n"), stdout);
+ fputs (_(" --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]\n"), stdout);
fputs (_(" Display specific types of command line options\n"), stdout);
if (! verbose_flag)
fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
diff --git a/gcc/opts.c b/gcc/opts.c
index 8ae79ae..ff6f69c 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1411,6 +1411,10 @@ print_specific_help (unsigned int include_flags,
{
if (include_flags == CL_UNDOCUMENTED)
description = _("The following options are not documented");
+ else if (include_flags == CL_SEPARATE)
+ description = _("The following options take separate arguments");
+ else if (include_flags == CL_JOINED)
+ description = _("The following options take joined arguments");
else
{
internal_error ("unrecognized include_flags 0x%x passed to print_specific_help",
@@ -1514,6 +1518,8 @@ common_handle_option (size_t scode, const char *arg, int value,
{ "target", CL_TARGET },
{ "warnings", CL_WARNING },
{ "undocumented", CL_UNDOCUMENTED },
+ { "joined", CL_JOINED },
+ { "separate", CL_SEPARATE },
{ "params", CL_PARAMS },
{ "common", CL_COMMON },
{ NULL, 0 }
@@ -1537,6 +1543,11 @@ common_handle_option (size_t scode, const char *arg, int value,
len = strlen (a);
else
len = comma - a;
+ if (len == 0)
+ {
+ a = comma + 1;
+ continue;
+ }
/* Check to see if the string matches an option class name. */
for (i = 0, specific_flag = 0; specifics[i].string != NULL; i++)
@@ -1545,7 +1556,7 @@ common_handle_option (size_t scode, const char *arg, int value,
specific_flag = specifics[i].flag;
break;
}
-
+
/* Check to see if the string matches a language name.
Note - we rely upon the alpha-sorted nature of the entries in
the lang_names array, specifically that shorter names appear
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] grab all contents of multiline help in *.opt
2009-03-01 7:17 ` [PATCH] grab all contents of multiline help in *.opt Ralf Wildenhues
@ 2009-03-01 10:24 ` Gerald Pfeifer
2009-03-01 10:49 ` Richard Guenther
0 siblings, 1 reply; 49+ messages in thread
From: Gerald Pfeifer @ 2009-03-01 10:24 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches
On Sun, 1 Mar 2009, Ralf Wildenhues wrote:
> Multi-line help texts are currently cut off, see for example:
> (GNU sed-specific notation)
> [...]
> So, OK for 4.5?
Yes. I believe this should go in for GCC 4.4, too. It may not be a
regression but really is more of a documentation bug than anything
else, and the change cannot cause any change (and thus bug) in code
generation whatsoever.
Gerald
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, doc] Restore dropped sentence in options.texi (Option file format)
2009-03-01 7:11 ` [PATCH, doc] Restore dropped sentence in options.texi (Option file format) Ralf Wildenhues
@ 2009-03-01 10:44 ` Richard Guenther
0 siblings, 0 replies; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 10:44 UTC (permalink / raw)
To: Ralf Wildenhues, gcc-patches
On Sun, Mar 1, 2009 at 8:11 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> This patch
>
> | 2008-07-23 Michael Meissner <gnu@the-meissners.org>
> | Karthik Kumar <karthikkumar@gmail.com>
> [...]
> | * doc/options.texi (TargetSave): Document TargetSave syntax.
> | (UInteger): Document UInteger must be used for certain flags.
> | (Save): Document Save option to create target specific options
> | that can be saved/restored on a function specific context.
>
> borked up 'info gccint -n "Option file format"' a bit:
>
> | The files can contain the following types of record:
> [...]
> | * A target specific save record to save additional information. These
> | records have two fields: the string `TargetSave', and a
> | declaration type to go in the `cl_target_option' structure.
> |
> | * 1. the name of the option, with the leading "-" removed
> |
> | 2. a space-separated list of option properties (*note Option
> | properties::)
> [...]
> |
> | By default, all options beginning with "f", "W" or "m" are
> | implicitly assumed to take a "no-" form. This form should not be
> [...]
>
> This patch undoes the breakage. Tested 'make info html pdf'. OK?
Ok.
Thanks,
Richard.
> Thanks,
> Ralf
>
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * doc/options.texi (Option file format): Fix bad indentation,
> restoring dropped sentence.
>
> diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
> index 4581ead..913e2e2 100644
> --- a/gcc/doc/options.texi
> +++ b/gcc/doc/options.texi
> @@ -40,6 +40,7 @@ records have two fields: the string @samp{TargetSave}, and a
> declaration type to go in the @code{cl_target_option} structure.
>
> @item
> +An option definition record. These records have the following fields:
> @enumerate
> @item
> the name of the option, with the leading ``-'' removed
>
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, doc] Improve state of check_warning_flags.sh warnings.
2009-03-01 7:12 ` [PATCH, doc] Improve state of check_warning_flags.sh warnings Ralf Wildenhues
@ 2009-03-01 10:45 ` Richard Guenther
2009-03-01 11:13 ` Gerald Pfeifer
1 sibling, 0 replies; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 10:45 UTC (permalink / raw)
To: Ralf Wildenhues, gcc-patches
On Sun, Mar 1, 2009 at 8:11 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> This fixes most warnings output from the check_warning_flags.sh script
> for current trunk.
>
> OK for 4.4? This is a doc+contrib only patch.
> Tested 'make info html pdf' of course.
Ok.
Thanks,
Richard.
> Thanks,
> Ralf
>
> contrib/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * check_warning_flags.sh: Update flag exceptions.
>
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * doc/invoke.texi (Warning Options): -Wsync-nand is C/C++ only.
> -Wno-pedantic-ms-format is for MinGW targets only.
>
> diff --git a/contrib/check_warning_flags.sh b/contrib/check_warning_flags.sh
> index fcd0f37..adbc0d6 100755
> --- a/contrib/check_warning_flags.sh
> +++ b/contrib/check_warning_flags.sh
> @@ -39,9 +39,12 @@ stderr=check_warning_flags_stderr$$
>
> remove_problematic_flags='
> /-Wlarger-than-/d
> + /-Wframe-larger-than/d
> + /-Wdisallowed-function-list/d
> /-W[alp],/d
> /-Werror/d
> /-Wpadded/d
> + /pedantic-ms-format/d
> /=/d'
>
> # Ensure that indexed warnings are accepted.
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 6d36794..99790b2 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -3129,7 +3129,7 @@ and lacks a @code{case} for one or more of the named codes of that
> enumeration. @code{case} labels outside the enumeration range also
> provoke warnings when this option is used.
>
> -@item -Wsync-nand
> +@item -Wsync-nand @r{(C and C++ only)}
> @opindex Wsync-nand
> @opindex Wno-sync-nand
> Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
> @@ -3583,7 +3583,7 @@ assume anything on the bounds of the loop indices. With
> @option{-funsafe-loop-optimizations} warn if the compiler made
> such assumptions.
>
> -@item -Wno-pedantic-ms-format
> +@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
> @opindex Wno-pedantic-ms-format
> @opindex Wpedantic-ms-format
> Disables the warnings about non-ISO @code{printf} / @code{scanf} format
>
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Fix --help -v output for duplicate options.
2009-03-01 7:14 ` [PATCH] Fix --help -v output for duplicate options Ralf Wildenhues
@ 2009-03-01 10:46 ` Richard Guenther
2009-03-01 11:11 ` Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 10:46 UTC (permalink / raw)
To: Ralf Wildenhues, gcc-patches
On Sun, Mar 1, 2009 at 8:14 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> The patch below fixes the problem that, if more than one *.opt file
> listed a switch, and not all of them had a help text, options.c gets at
> least one of the help texts. Still bad: the last one wins, which is a
> pretty arbitrary choice.
>
> One question is whether optc-gen.awk should be modified to just barf
> when it reads multiple unequal help texts. But since the set of
> options is target-dependent, it doesn't seem like a good idea to do so
> now; maybe later?
Can you state an example for which option is affected?
Thanks,
Richard.
> OK for 4.5?
>
> What about 4.4? This is not a regression in the optc-gen code AFAICS,
> but it is a regression in the sense that 4.4 has many more options that
> are listed in more than one *.opt file, thus causing more options
> without help text.
>
> (The second hunk of the patch is a trivial optimization and code
> clarification.)
>
> Thanks,
> Ralf
>
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * optc-gen.awk: No need to duplicate option flags twice.
> Reuse help texts for duplicate options which do not have
> any.
>
> diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
> index 2e22016..860810a 100644
> --- a/gcc/optc-gen.awk
> +++ b/gcc/optc-gen.awk
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
> +# Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
> # Contributed by Kelley Cook, June 2004.
> # Original code from Neil Booth, May 2003.
> #
> @@ -145,6 +145,8 @@ for (i = 0; i < n_opts; i++) {
> # ends, for example.
> while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
> flags[i + 1] = flags[i] " " flags[i + 1];
> + if (help[i + 1] == "")
> + help[i + 1] = help[i]
> i++;
> back_chain[i] = "N_OPTS";
> indices[opts[i]] = j;
> @@ -153,11 +155,10 @@ for (i = 0; i < n_opts; i++) {
> }
>
> for (i = 0; i < n_opts; i++) {
> - # Combine the flags of identical switches. Switches
> - # appear many times if they are handled by many front
> - # ends, for example.
> + # With identical flags, pick only the last one. The
> + # earlier loop ensured that it has all flags merged,
> + # and a nonempty help text if one of the texts was nonempty.
> while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
> - flags[i + 1] = flags[i] " " flags[i + 1];
> i++;
> }
>
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] grab all contents of multiline help in *.opt
2009-03-01 10:24 ` Gerald Pfeifer
@ 2009-03-01 10:49 ` Richard Guenther
0 siblings, 0 replies; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 10:49 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: Ralf Wildenhues, gcc-patches
On Sun, Mar 1, 2009 at 11:24 AM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> On Sun, 1 Mar 2009, Ralf Wildenhues wrote:
>> Multi-line help texts are currently cut off, see for example:
>> (GNU sed-specific notation)
>> [...]
>> So, OK for 4.5?
>
> Yes. I believe this should go in for GCC 4.4, too. It may not be a
> regression but really is more of a documentation bug than anything
> else, and the change cannot cause any change (and thus bug) in code
> generation whatsoever.
I agree. Btw, even if it wasn't documented anywhere the docs were
restricted to a single line and bugs with that were occasionally
corrected.
Richard.
> Gerald
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Fix output race in --help -v
2009-03-01 7:19 ` [PATCH] Fix output race in --help -v Ralf Wildenhues
@ 2009-03-01 10:50 ` Richard Guenther
0 siblings, 0 replies; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 10:50 UTC (permalink / raw)
To: Ralf Wildenhues, gcc-patches
On Sun, Mar 1, 2009 at 8:19 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> On my system, in the output of 'gcc --help -v', the Ada part begins
> before the driver part ends. The effect depends on stdio buffering etc.
>
> The patch below fixes that, and adds a newline between the parts,
> to match the formatting between the other subprocesses' output.
>
> Before:
>
> | Usage: gcc [options] file...
> | Options:
> | -pass-exit-codes Exit with highest error code from a phase
> [...]
>
> | -o <file> Place the output into <file>
> | -x <language> Specify the language of the following input files
> | Permissible languages include: c c++ assembler none
> | The following options are specific to just the language Ada:
> | -fRTS= This switch lacks documentation
> [... options for languages, as, ld, etc. ]
>
> | -z KEYWORD Ignored for Solaris compatibility
> |
> | Report bugs to <http://www.sourceware.org/bugzilla/>
> | 'none' means revert to the default behavior of
> | guessing the language based on the file's extension
> |
> | Options starting with -g, -f, -m, -O, -W, or --param are automatically
> | passed on to the various sub-processes invoked by gcc. In order to pass
> | other options on to these processes the -W<letter> options must be used.
> |
> | For bug reporting instructions, please see:
> | <http://gcc.gnu.org/bugs.html>
>
> After:
>
> | Usage: xgcc [options] file...
> | Options:
> | -pass-exit-codes Exit with highest error code from a phase
> [...]
>
> | -o <file> Place the output into <file>
> | -x <language> Specify the language of the following input files
> | Permissible languages include: c c++ assembler none
> | 'none' means revert to the default behavior of
> | guessing the language based on the file's extension
> |
> | Options starting with -g, -f, -m, -O, -W, or --param are automatically
> | passed on to the various sub-processes invoked by xgcc. In order to pass
> | other options on to these processes the -W<letter> options must be used.
> |
> | The following options are specific to just the language Ada:
> | -fRTS= This switch lacks documentation
> [... options for languages, as, ld, etc. ]
>
> | -z KEYWORD Ignored for Solaris compatibility
> |
> | Report bugs to <http://www.sourceware.org/bugzilla/>
> |
> | For bug reporting instructions, please see:
> | <http://gcc.gnu.org/bugs.html>
>
> AFAICS this is a regression over 4.2, since the new style verbose help
> output was only added since then. OK for 4.4?
Ok.
Thanks,
Richard.
> Thanks,
> Ralf
>
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * gcc.c (main): If print_help_list and verbose_flag, ensure
> driver output comes before subprocess output.
>
> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index b8691f9..c2850bf 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -6601,7 +6601,10 @@ main (int argc, char **argv)
>
> /* We do not exit here. Instead we have created a fake input file
> called 'help-dummy' which needs to be compiled, and we pass this
> - on the various sub-processes, along with the --help switch. */
> + on the various sub-processes, along with the --help switch.
> + Ensure their output appears after ours. */
> + fputc ('\n', stdout);
> + fflush (stdout);
> }
>
> if (verbose_flag)
>
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Document --version in --help output.
2009-03-01 7:20 ` [PATCH] Document --version in --help output Ralf Wildenhues
@ 2009-03-01 10:52 ` Richard Guenther
0 siblings, 0 replies; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 10:52 UTC (permalink / raw)
To: Ralf Wildenhues, gcc-patches
On Sun, Mar 1, 2009 at 8:19 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> $ gcc --help
>
> does not document --version at all.
>
> $ gcc -v --help 2>/dev/null | grep -e '-version '
> -version This switch lacks documentation
> -ftree-vect-loop-version Enable loop versioning when doing loop
> --version This switch lacks documentation
> --version print assembler version number and exit
> -v, --version Print version information
> --no-undefined-version Disallow undefined version
>
> The first line is from the Java specific section; jc1 accepts only
> -version, gcj accepts only --version. With the other patch to fix
> bogusly lacking entries, the line becomes
> -version Display the compiler's version
>
> The third line from the language-independent section, failing to
> document --version, then as, then ld.
>
> I suggest this patch to document --version in --help.
>
> Surprisingly, this is not a regression AFAICS. So I guess unless you
> find that trivial enough to warrant applying now, or this is too bad on
> translators: OK for 4.5?
Ok for trunk.
Thanks,
Richard.
> Thanks,
> Ralf
>
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * gcc.c (display_help): Document --version.
>
> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index c2850bf..cf85618 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -3232,6 +3232,7 @@ display_help (void)
> fputs (_(" Display specific types of command line options\n"), stdout);
> if (! verbose_flag)
> fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
> + fputs (_(" --version Display compiler version information\n"), stdout);
> fputs (_(" -dumpspecs Display all of the built in spec strings\n"), stdout);
> fputs (_(" -dumpversion Display the version of the compiler\n"), stdout);
> fputs (_(" -dumpmachine Display the compiler's target processor\n"), stdout);
>
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Fix --help -v output for duplicate options.
2009-03-01 10:46 ` Richard Guenther
@ 2009-03-01 11:11 ` Ralf Wildenhues
2009-03-01 11:58 ` Richard Guenther
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 11:11 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc-patches
* Richard Guenther wrote on Sun, Mar 01, 2009 at 11:46:34AM CET:
> On Sun, Mar 1, 2009 at 8:14 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> > The patch below fixes the problem that, if more than one *.opt file
> > listed a switch, and not all of them had a help text, options.c gets at
> > least one of the help texts. Â Still bad: the last one wins, which is a
> > pretty arbitrary choice.
> >
> > One question is whether optc-gen.awk should be modified to just barf
> > when it reads multiple unequal help texts. Â But since the set of
> > options is target-dependent, it doesn't seem like a good idea to do so
> > now; maybe later?
>
> Can you state an example for which option is affected?
Sure. These are affected on my system:
-A -C -CC -D -H -I -M -MF -MM -MP -MT -P -U -Wall -Wconversion
-Wdeprecated -Wreturn-type -d -finline-functions -fopenmp -fpreprocessed
-fworking-directory -idirafter -imultilib -iprefix -iquote -isysroot
-isystem -nostdinc -o -undef -v -version
Cheers,
Ralf
> > OK for 4.5?
> > gcc/ChangeLog:
> > 2009-03-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
> >
> > Â Â Â Â * optc-gen.awk: No need to duplicate option flags twice.
> > Â Â Â Â Reuse help texts for duplicate options which do not have
> > Â Â Â Â any.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, doc] Improve state of check_warning_flags.sh warnings.
2009-03-01 7:12 ` [PATCH, doc] Improve state of check_warning_flags.sh warnings Ralf Wildenhues
2009-03-01 10:45 ` Richard Guenther
@ 2009-03-01 11:13 ` Gerald Pfeifer
1 sibling, 0 replies; 49+ messages in thread
From: Gerald Pfeifer @ 2009-03-01 11:13 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches
On Sun, 1 Mar 2009, Ralf Wildenhues wrote:
> contrib/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * check_warning_flags.sh: Update flag exceptions.
Please also update the copyright year.
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * doc/invoke.texi (Warning Options): -Wsync-nand is C/C++ only.
> -Wno-pedantic-ms-format is for MinGW targets only.
Looks good, thanks.
Gerald
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Fix --help -v output for duplicate options.
2009-03-01 11:11 ` Ralf Wildenhues
@ 2009-03-01 11:58 ` Richard Guenther
2009-03-01 12:39 ` Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 11:58 UTC (permalink / raw)
To: Ralf Wildenhues, Richard Guenther, gcc-patches
On Sun, Mar 1, 2009 at 12:11 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> * Richard Guenther wrote on Sun, Mar 01, 2009 at 11:46:34AM CET:
>> On Sun, Mar 1, 2009 at 8:14 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
>> > The patch below fixes the problem that, if more than one *.opt file
>> > listed a switch, and not all of them had a help text, options.c gets at
>> > least one of the help texts. Still bad: the last one wins, which is a
>> > pretty arbitrary choice.
>> >
>> > One question is whether optc-gen.awk should be modified to just barf
>> > when it reads multiple unequal help texts. But since the set of
>> > options is target-dependent, it doesn't seem like a good idea to do so
>> > now; maybe later?
Maybe optc-gen.awk could output a warning instead.
>> Can you state an example for which option is affected?
>
> Sure. These are affected on my system:
>
> -A -C -CC -D -H -I -M -MF -MM -MP -MT -P -U -Wall -Wconversion
> -Wdeprecated -Wreturn-type -d -finline-functions -fopenmp -fpreprocessed
> -fworking-directory -idirafter -imultilib -iprefix -iquote -isysroot
> -isystem -nostdinc -o -undef -v -version
Ah, I see. This is ok for trunk.
Thanks,
Richard.
> Cheers,
> Ralf
>
>> > OK for 4.5?
>
>> > gcc/ChangeLog:
>> > 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>> >
>> > * optc-gen.awk: No need to duplicate option flags twice.
>> > Reuse help texts for duplicate options which do not have
>> > any.
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Fix --help -v output for duplicate options.
2009-03-01 11:58 ` Richard Guenther
@ 2009-03-01 12:39 ` Ralf Wildenhues
2009-03-01 12:44 ` Richard Guenther
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-01 12:39 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc-patches
Hello Richard,
* Richard Guenther wrote on Sun, Mar 01, 2009 at 12:58:42PM CET:
> On Sun, Mar 1, 2009 at 12:11 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> > * Richard Guenther wrote on Sun, Mar 01, 2009 at 11:46:34AM CET:
> >> On Sun, Mar 1, 2009 at 8:14 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> >> >
> >> > One question is whether optc-gen.awk should be modified to just barf
> >> > when it reads multiple unequal help texts. Â But since the set of
> >> > options is target-dependent, it doesn't seem like a good idea to do so
> >> > now; maybe later?
>
> Maybe optc-gen.awk could output a warning instead.
Yes. I had to peek at the gawk manual to find out how to portably write
to stderr in POSIX/SVR4 awk. OK for the patch below to do this, too,
if regtesting finishes on i686-pc-linux-gnu?
> >> Can you state an example for which option is affected?
> >
> > Sure. Â These are affected on my system:
> >
> > -A -C -CC -D -H -I -M -MF -MM -MP -MT -P -U -Wall -Wconversion
> > -Wdeprecated -Wreturn-type -d -finline-functions -fopenmp -fpreprocessed
> > -fworking-directory -idirafter -imultilib -iprefix -iquote -isysroot
> > -isystem -nostdinc -o -undef -v -version
>
> Ah, I see. This is ok for trunk.
Applied. Thanks to Gerhard and you for all the quick reviews!
Cheers,
Ralf
gcc/ChangeLog:
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* optc-gen.awk: Warn if an option flag has multiple different
help strings.
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 3e644a5..2117150 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -149,6 +149,10 @@ for (i = 0; i < n_opts; i++) {
flags[i + 1] = flags[i] " " flags[i + 1];
if (help[i + 1] == "")
help[i + 1] = help[i]
+ else if (help[i] != "" && help[i + 1] != help[i])
+ print "warning: multiple different help strings for " \
+ opts[i] ":\n\t" help[i] "\n\t" help[i + 1] \
+ | "cat 1>&2"
i++;
back_chain[i] = "N_OPTS";
indices[opts[i]] = j;
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] Fix --help -v output for duplicate options.
2009-03-01 12:39 ` Ralf Wildenhues
@ 2009-03-01 12:44 ` Richard Guenther
0 siblings, 0 replies; 49+ messages in thread
From: Richard Guenther @ 2009-03-01 12:44 UTC (permalink / raw)
To: Ralf Wildenhues, Richard Guenther, gcc-patches
On Sun, Mar 1, 2009 at 1:39 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> Hello Richard,
>
> * Richard Guenther wrote on Sun, Mar 01, 2009 at 12:58:42PM CET:
>> On Sun, Mar 1, 2009 at 12:11 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
>> > * Richard Guenther wrote on Sun, Mar 01, 2009 at 11:46:34AM CET:
>> >> On Sun, Mar 1, 2009 at 8:14 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
>> >> >
>> >> > One question is whether optc-gen.awk should be modified to just barf
>> >> > when it reads multiple unequal help texts. But since the set of
>> >> > options is target-dependent, it doesn't seem like a good idea to do so
>> >> > now; maybe later?
>>
>> Maybe optc-gen.awk could output a warning instead.
>
> Yes. I had to peek at the gawk manual to find out how to portably write
> to stderr in POSIX/SVR4 awk. OK for the patch below to do this, too,
> if regtesting finishes on i686-pc-linux-gnu?
Yes, that's ok for 4.5
Thanks,
Richard.
>> >> Can you state an example for which option is affected?
>> >
>> > Sure. These are affected on my system:
>> >
>> > -A -C -CC -D -H -I -M -MF -MM -MP -MT -P -U -Wall -Wconversion
>> > -Wdeprecated -Wreturn-type -d -finline-functions -fopenmp -fpreprocessed
>> > -fworking-directory -idirafter -imultilib -iprefix -iquote -isysroot
>> > -isystem -nostdinc -o -undef -v -version
>>
>> Ah, I see. This is ok for trunk.
>
> Applied. Thanks to Gerhard and you for all the quick reviews!
>
> Cheers,
> Ralf
>
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * optc-gen.awk: Warn if an option flag has multiple different
> help strings.
>
> diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
> index 3e644a5..2117150 100644
> --- a/gcc/optc-gen.awk
> +++ b/gcc/optc-gen.awk
> @@ -149,6 +149,10 @@ for (i = 0; i < n_opts; i++) {
> flags[i + 1] = flags[i] " " flags[i + 1];
> if (help[i + 1] == "")
> help[i + 1] = help[i]
> + else if (help[i] != "" && help[i + 1] != help[i])
> + print "warning: multiple different help strings for " \
> + opts[i] ":\n\t" help[i] "\n\t" help[i + 1] \
> + | "cat 1>&2"
> i++;
> back_chain[i] = "N_OPTS";
> indices[opts[i]] = j;
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 0/N] Fix --help output.
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
` (7 preceding siblings ...)
2009-03-01 10:13 ` [PATCH] PR middle-end/37805: --help=...,joined,undocumented Ralf Wildenhues
@ 2009-03-01 21:52 ` Ben Elliston
2009-03-05 21:20 ` tests for --help (was: [PATCH 0/N] Fix --help output.) Ralf Wildenhues
8 siblings, 1 reply; 49+ messages in thread
From: Ben Elliston @ 2009-03-01 21:52 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches
> I have a set of patches to fix various related bugs in this area, but
> I need help: how can I add test cases to the testsuite that just run the
> compiler driver with some extra flags, and test its output against some
> regexes, ideally multi-line? I'm not very fluent in GCC dejagnu.
Take a look at testsuite/gcc.misc-tests/options.exp. That may be
sufficient, or could be adapted.
Cheers, Ben
--
Ben Elliston <bje@au.ibm.com>
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] PR middle-end/37805: --help=...,joined,undocumented
2009-03-01 10:13 ` [PATCH] PR middle-end/37805: --help=...,joined,undocumented Ralf Wildenhues
@ 2009-03-02 20:51 ` Ralf Wildenhues
2009-03-05 21:20 ` Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-02 20:51 UTC (permalink / raw)
To: gcc-patches
* Ralf Wildenhues wrote on Sun, Mar 01, 2009 at 11:13:03AM CET:
> gcc.info documents:
>
> --help=warnings,^joined,^undocumented
[...]
This patch is not good enough yet. Will re-redo the opts.c part.
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> PR middle-end/37805
> * opts.c (print_specific_help): Accept `separate' and `joined'
> as separate flags.
> (common_handle_option): Skip over empty strings.
> * gcc.c (display_help): Fix help string for `--help='.
> * doc/invoke.texi (Option Summary, Overall Options): With
> `--help=', classes and qualifiers can both be repeated, but
> only the latter can be negated. Fix markup and examples.
>
> Revert
> 2008-10-14 Jakub Jelinek <jakub@redhat.com>
> PR middle-end/37805
> * opts.c (common_handle_option): Don't ICE on -fhelp=joined
> and -fhelp=separate.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] PR middle-end/37805: --help=...,joined,undocumented
2009-03-02 20:51 ` Ralf Wildenhues
@ 2009-03-05 21:20 ` Ralf Wildenhues
2009-03-14 9:43 ` Ralf Wildenhues
2009-03-17 14:08 ` Ian Lance Taylor
0 siblings, 2 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-05 21:20 UTC (permalink / raw)
To: gcc-patches
* Ralf Wildenhues wrote on Mon, Mar 02, 2009 at 09:51:33PM CET:
> > gcc.info documents:
> >
> > --help=warnings,^joined,^undocumented
> [...]
>
> This patch is not good enough yet. Will re-redo the opts.c part.
Next try. When the user passes more than one of the qualifiers
undocumented joined separate
but no classes, then the description sentence is taken from the first
matched one in that list that is used. I think that should be good
enough. It avoids the ICE from the PR, and with other combinations
of these qualifiers; see other patch introducing testsuite coverage.
OK for 4.4? regtested i686-pc-linux-gnu.
Thanks,
Ralf
gcc/ChangeLog:
2009-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Revert
2008-10-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37805
* opts.c (common_handle_option): Don't ICE on -fhelp=joined
and -fhelp=separate.
diff --git a/gcc/opts.c b/gcc/opts.c
index 8ae79ae..7788b02 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1515,6 +1515,8 @@ common_handle_option (size_t scode, const char *arg, int value,
{ "warnings", CL_WARNING },
{ "undocumented", CL_UNDOCUMENTED },
{ "params", CL_PARAMS },
+ { "joined", CL_JOINED },
+ { "separate", CL_SEPARATE },
{ "common", CL_COMMON },
{ NULL, 0 }
};
gcc/ChangeLog:
2009-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR middle-end/37805
* opts.c (print_specific_help): In addition to `undocumented',
accept `separate' and `joined' flags if passed alone. Describe
output by the first matched one of those.
(common_handle_option): Skip over empty strings.
* gcc.c (display_help): Fix help string for `--help='.
* doc/invoke.texi (Option Summary, Overall Options): With
`--help=', classes and qualifiers can both be repeated, but
only the latter can be negated. One should not pass only
negated qualifiers. Fix markup and examples.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 043cc98..14b2871 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -163,7 +163,7 @@ in the following sections.
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
--x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol
+-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
--version -wrapper@@@var{file}}
@item C Language Options
@@ -1158,11 +1158,10 @@ Print (on the standard output) a description of target-specific command
line options for each tool. For some targets extra target-specific
information may also be printed.
-@item --help=@var{class}@r{[},@var{qualifier}@r{]}
+@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
Print (on the standard output) a description of the command line
-options understood by the compiler that fit into a specific class.
-The class can be one of @samp{optimizers}, @samp{warnings}, @samp{target},
-@samp{params}, or @var{language}:
+options understood by the compiler that fit into all specified classes
+and qualifiers. These are the supported classes:
@table @asis
@item @samp{optimizers}
@@ -1192,9 +1191,7 @@ version of GCC.
This will display the options that are common to all languages.
@end table
-It is possible to further refine the output of the @option{--help=}
-option by adding a comma separated list of qualifiers after the
-class. These can be any from the following list:
+These are the supported qualifiers:
@table @asis
@item @samp{undocumented}
@@ -1218,7 +1215,7 @@ switches supported by the compiler the following can be used:
@end smallexample
The sense of a qualifier can be inverted by prefixing it with the
-@var{^} character, so for example to display all binary warning
+@samp{^} character, so for example to display all binary warning
options (i.e., ones that are either on or off and that do not take an
argument), which have a description the following can be used:
@@ -1226,7 +1223,10 @@ argument), which have a description the following can be used:
--help=warnings,^joined,^undocumented
@end smallexample
-A class can also be used as a qualifier, although this usually
+The argument to @option{--help=} should not consist solely of inverted
+qualifiers.
+
+Combining several classes is possible, although this usually
restricts the output by so much that there is nothing to display. One
case where it does work however is when one of the classes is
@var{target}. So for example to display all the target-specific
@@ -1262,7 +1262,7 @@ options, so for example it is possible to find out which optimizations
are enabled at @option{-O2} by using:
@smallexample
--O2 --help=optimizers
+-Q -O2 --help=optimizers
@end smallexample
Alternatively you can discover which binary optimizations are enabled
diff --git a/gcc/gcc.c b/gcc/gcc.c
index cf85618..ee95366 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3228,7 +3228,7 @@ display_help (void)
fputs (_(" -pass-exit-codes Exit with highest error code from a phase\n"), stdout);
fputs (_(" --help Display this information\n"), stdout);
fputs (_(" --target-help Display target specific command line options\n"), stdout);
- fputs (_(" --help={target|optimizers|warnings|undocumented|params}[,{[^]joined|[^]separate}]\n"), stdout);
+ fputs (_(" --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]\n"), stdout);
fputs (_(" Display specific types of command line options\n"), stdout);
if (! verbose_flag)
fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
diff --git a/gcc/opts.c b/gcc/opts.c
index 7788b02..6319770 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1396,7 +1396,7 @@ print_specific_help (unsigned int include_flags,
default:
if (i >= cl_lang_count)
break;
- if ((exclude_flags & ((1U << cl_lang_count) - 1)) != 0)
+ if (exclude_flags & all_langs_mask)
description = _("The following options are specific to just the language ");
else
description = _("The following options are supported by the language ");
@@ -1409,8 +1409,12 @@ print_specific_help (unsigned int include_flags,
{
if (any_flags == 0)
{
- if (include_flags == CL_UNDOCUMENTED)
+ if (include_flags & CL_UNDOCUMENTED)
description = _("The following options are not documented");
+ else if (include_flags & CL_SEPARATE)
+ description = _("The following options take separate arguments");
+ else if (include_flags & CL_JOINED)
+ description = _("The following options take joined arguments");
else
{
internal_error ("unrecognized include_flags 0x%x passed to print_specific_help",
@@ -1539,6 +1543,11 @@ common_handle_option (size_t scode, const char *arg, int value,
len = strlen (a);
else
len = comma - a;
+ if (len == 0)
+ {
+ a = comma + 1;
+ continue;
+ }
/* Check to see if the string matches an option class name. */
for (i = 0, specific_flag = 0; specifics[i].string != NULL; i++)
@@ -1547,7 +1556,7 @@ common_handle_option (size_t scode, const char *arg, int value,
specific_flag = specifics[i].flag;
break;
}
-
+
/* Check to see if the string matches a language name.
Note - we rely upon the alpha-sorted nature of the entries in
the lang_names array, specifically that shorter names appear
^ permalink raw reply [flat|nested] 49+ messages in thread
* tests for --help (was: [PATCH 0/N] Fix --help output.)
2009-03-01 21:52 ` [PATCH 0/N] Fix --help output Ben Elliston
@ 2009-03-05 21:20 ` Ralf Wildenhues
2009-03-06 0:14 ` Ben Elliston
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-05 21:20 UTC (permalink / raw)
To: Ben Elliston; +Cc: gcc-patches
Hi Ben,
* Ben Elliston wrote on Sun, Mar 01, 2009 at 10:52:07PM CET:
> > I have a set of patches to fix various related bugs in this area, but
> > I need help: how can I add test cases to the testsuite that just run the
> > compiler driver with some extra flags, and test its output against some
> > regexes, ideally multi-line? I'm not very fluent in GCC dejagnu.
>
> Take a look at testsuite/gcc.misc-tests/options.exp. That may be
> sufficient, or could be adapted.
Thank you! That helped me find more issues with my other proposed patch.
How about this? OK for 4.5?
Do I need to take into account localization issues here? If yes, how
would I go about it?
Here's how I tested it: with the compiler before my patch set, I get
these failures:
Running /tmp/gcc/gcc/testsuite/gcc.misc-tests/help.exp ...
FAIL: compiler driver --help option(s): --version
FAIL: compiler driver -v --help option(s): are likely to\n -std
FAIL: compiler driver --help=joined option(s): Wformat=
FAIL: compiler driver --help=separate option(s): -MF
FAIL: compiler driver --help=warnings,joined option(s): Wtrigraphs
FAIL: compiler driver --help=warnings,^joined option(s): Wformat=
FAIL: compiler driver --help=^joined,separate option(s): --param
=== gcc Summary ===
# of expected passes 54
# of unexpected failures 7
# of expected failures 4
while with trunk plus the proposed patch for PR 37805, things are as
expected.
(BTW, I did leave in copyright years from options.exp due to remaining
common ground.)
Cheers,
Ralf
gcc/testsuite/ChangeLog:
2009-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gcc.misc-tests/help.exp: New file.
diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp
new file mode 100644
index 0000000..2027da5
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/help.exp
@@ -0,0 +1,123 @@
+# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
+# output to make sure that they match the newline-separated patterns
+# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
+# In case of failure, xfail if XFAIL is nonempty.
+
+proc check_for_help_options {language gcc_options compiler_patterns compiler_non_patterns xfail} {
+ set filename test-[pid]
+ set fd [open $filename.c w]
+ puts $fd "int main (void) \{ return 0; \}"
+ close $fd
+ remote_download host $filename.c
+
+ set test "compiler driver $gcc_options option(s):"
+ set gcc_options "\{additional_flags=$gcc_options\}"
+
+ switch "$language" {
+ "c" { set compiler cc1 }
+ default { error "unknown language" }
+ }
+ set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
+ remote_file build delete $filename.c $filename.x $filename.gcno
+
+ foreach pattern [split $compiler_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {[regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$xfail ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ foreach pattern [split $compiler_non_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {![regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$xfail ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ pass $test
+}
+
+# Document --version. No undocumented switches in --help.
+check_for_help_options c {--help} {--version} {This switch lacks documentation} {}
+
+# No intermingled output; pick up help strings from duplicate option flags
+check_for_help_options c {-v --help} {} {
+[^\n]The following options
+-Wconversion[^\n]*lacks documentation
+" -g "
+} {}
+
+# There are still undocumented switches in -v --help.
+check_for_help_options c {-v --help} {} {This switch lacks documentation} {xfail}
+
+# Multiline conversion in optc-gen.
+check_for_help_options c {-v --help} {} {are likely to\n -std} {}
+
+# --help= classes and qualifiers.
+check_for_help_options c {--help=optimizers} {-O} { -g } {}
+check_for_help_options c {--help=params} {maximum number of} {-Wunsafe-loop-optimizations} {}
+check_for_help_options c {--help=C} {-ansi} {-gnatO} {}
+check_for_help_options c {--help=C++} {-std=c\+\+} {-gnatO} {}
+check_for_help_options c {--help=common} {-dumpbase} {-gnatO} {}
+check_for_help_options c {--help=undocumented} {This switch lacks documentation} {} {}
+
+# undocumented flags are not yet consistently marked as such.
+check_for_help_options c {--help=^undocumented} {-Wall} {This switch lacks documentation} {xfail}
+
+# Examples from the manual.
+check_for_help_options c {--help=target,undocumented} {} {} {}
+check_for_help_options c {--help=target,optimizers} {} {} {}
+check_for_help_options c {--help=warnings,^joined,^undocumented} {} {} {}
+check_for_help_options c {-Q -O2 --help=optimizers} {
+-O
+-ftree-vectorize[^\n]*disabled
+} { -g } {}
+check_for_help_options c {-Q -O3 --help=optimizers} {
+-O
+-ftree-vectorize[^\n]*enabled
+} { -g } {}
+# Repeated --help=
+check_for_help_options c {--help=params --help=optimizers} {
+maximum number of
+-O
+} {} {}
+
+# PR 37805
+check_for_help_options c {--help=joined} {Wformat=} {-fstrict-prototype} {}
+check_for_help_options c {--help=separate} {-MF} {-fstrict-prototype} {}
+check_for_help_options c {--help=warnings,joined} {Wformat=} {Wtrigraphs} {}
+check_for_help_options c {--help=warnings,^joined} {Wtrigraphs} {Wformat=} {}
+check_for_help_options c {--help=joined,separate} {-I} {} {}
+check_for_help_options c {--help=^joined,separate} {--param } {} {}
+check_for_help_options c {--help=joined,^separate} {--help=} {} {}
+check_for_help_options c {--help=joined,undocumented} {} {} {}
+# Listing only excludes gives empty results.
+check_for_help_options c {--help=^joined,^separate} {} {} {}
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help (was: [PATCH 0/N] Fix --help output.)
2009-03-05 21:20 ` tests for --help (was: [PATCH 0/N] Fix --help output.) Ralf Wildenhues
@ 2009-03-06 0:14 ` Ben Elliston
2009-03-06 19:00 ` Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: Ben Elliston @ 2009-03-06 0:14 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches
On Thu, 2009-03-05 at 22:20 +0100, Ralf Wildenhues wrote:
> Do I need to take into account localization issues here? If yes, how
> would I go about it?
What if you set the relevant locale environment variables in the expect
script to force the translation you want? (Which leaves other locales
untested, admittedly).
Ben
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help (was: [PATCH 0/N] Fix --help output.)
2009-03-06 0:14 ` Ben Elliston
@ 2009-03-06 19:00 ` Ralf Wildenhues
2009-04-01 20:36 ` tests for --help Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-06 19:00 UTC (permalink / raw)
To: Ben Elliston; +Cc: gcc-patches
* Ben Elliston wrote on Fri, Mar 06, 2009 at 01:14:45AM CET:
> On Thu, 2009-03-05 at 22:20 +0100, Ralf Wildenhues wrote:
>
> > Do I need to take into account localization issues here? If yes, how
> > would I go about it?
>
> What if you set the relevant locale environment variables in the expect
> script to force the translation you want? (Which leaves other locales
> untested, admittedly).
Well, it doesn't matter much here to test only the C locale.
The thing I don't understand though is: the only locale settings
I find in the current testsuite are in
g++.exp gcc-dg.exp gfortran.exp objc.exp
and I cannot see how they can possibly affect the locale on a remote
target; dejagnu itself doesn't seem to have such settings in its .exp
file either.
Other than that, nothing breaks if I add this early in the script:
# We set LC_ALL and LANG to C so that we get the same error messages as
# expected.
setenv LC_ALL C
setenv LANG C
but OTOH I cannot get my uninstalled compiler to output localized
messages anyway, so what would I need to do to have an effective
way to ensure the above works?
Thanks,
Ralf
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] PR middle-end/37805: --help=...,joined,undocumented
2009-03-05 21:20 ` Ralf Wildenhues
@ 2009-03-14 9:43 ` Ralf Wildenhues
2009-03-17 14:08 ` Ian Lance Taylor
1 sibling, 0 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-14 9:43 UTC (permalink / raw)
To: gcc-patches
Even if the P2 count is already < 100, you can lower it even further
with this: ping <http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00318.html>
;-)
* Ralf Wildenhues wrote on Thu, Mar 05, 2009 at 10:20:00PM CET:
>
> Next try. When the user passes more than one of the qualifiers
> undocumented joined separate
>
> but no classes, then the description sentence is taken from the first
> matched one in that list that is used. I think that should be good
> enough. It avoids the ICE from the PR, and with other combinations
> of these qualifiers; see other patch introducing testsuite coverage.
>
> OK for 4.4? regtested i686-pc-linux-gnu.
> gcc/ChangeLog:
> 2009-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> Revert
> 2008-10-14 Jakub Jelinek <jakub@redhat.com>
> PR middle-end/37805
> * opts.c (common_handle_option): Don't ICE on -fhelp=joined
> and -fhelp=separate.
> PR middle-end/37805
> * opts.c (print_specific_help): In addition to `undocumented',
> accept `separate' and `joined' flags if passed alone. Describe
> output by the first matched one of those.
> (common_handle_option): Skip over empty strings.
> * gcc.c (display_help): Fix help string for `--help='.
> * doc/invoke.texi (Option Summary, Overall Options): With
> `--help=', classes and qualifiers can both be repeated, but
> only the latter can be negated. One should not pass only
> negated qualifiers. Fix markup and examples.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH] PR middle-end/37805: --help=...,joined,undocumented
2009-03-05 21:20 ` Ralf Wildenhues
2009-03-14 9:43 ` Ralf Wildenhues
@ 2009-03-17 14:08 ` Ian Lance Taylor
1 sibling, 0 replies; 49+ messages in thread
From: Ian Lance Taylor @ 2009-03-17 14:08 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> gcc/ChangeLog:
> 2009-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> Revert
> 2008-10-14 Jakub Jelinek <jakub@redhat.com>
> PR middle-end/37805
> * opts.c (common_handle_option): Don't ICE on -fhelp=joined
> and -fhelp=separate.
> 2009-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> PR middle-end/37805
> * opts.c (print_specific_help): In addition to `undocumented',
> accept `separate' and `joined' flags if passed alone. Describe
> output by the first matched one of those.
> (common_handle_option): Skip over empty strings.
> * gcc.c (display_help): Fix help string for `--help='.
> * doc/invoke.texi (Option Summary, Overall Options): With
> `--help=', classes and qualifiers can both be repeated, but
> only the latter can be negated. One should not pass only
> negated qualifiers. Fix markup and examples.
This is OK.
Thanks.
Ian
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, java, fortran] Merge help texts for duplicate options.
2009-03-01 7:17 ` [PATCH, java, fortran] Merge help texts for duplicate options Ralf Wildenhues
@ 2009-03-18 18:55 ` Ralf Wildenhues
2009-03-18 20:06 ` Andrew Haley
2009-03-18 20:42 ` Joseph S. Myers
0 siblings, 2 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-03-18 18:55 UTC (permalink / raw)
To: gcc-patches, java-patches, fortran
Ping <http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00014.html>
* Ralf Wildenhues wrote on Sun, Mar 01, 2009 at 08:16:46AM CET:
> Currently, some switches are documented more than once. The opt*.awk
> machinery currently picks one arbitrarily, for -v --help output (see
> the other patch on gcc-patches that ensures that at least one of them
> is picked).
>
> This patch attempts to sort out the duplicates manually.
[...]
> Changes address Fortran, C, and Java front-ends.
[...]
> gcc/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * c.opt: Unify help texts for -Wdeprecated, -Wsystem-headers,
> and -fopenmp.
>
> gcc/fortran/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * lang.opt: Unify help texts for -I, -Wconversion, -d, -fopenmp,
> and -fpreprocessed.
>
> gcc/java/ChangeLog:
> 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * lang.opt: Unify help text for -Wdeprecated.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, java, fortran] Merge help texts for duplicate options.
2009-03-18 18:55 ` Ralf Wildenhues
@ 2009-03-18 20:06 ` Andrew Haley
2009-03-18 20:42 ` Joseph S. Myers
1 sibling, 0 replies; 49+ messages in thread
From: Andrew Haley @ 2009-03-18 20:06 UTC (permalink / raw)
To: Ralf Wildenhues, gcc-patches, java-patches, fortran
Ralf Wildenhues wrote:
> Ping <http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00014.html>
>
> * Ralf Wildenhues wrote on Sun, Mar 01, 2009 at 08:16:46AM CET:
>> Currently, some switches are documented more than once. The opt*.awk
>> machinery currently picks one arbitrarily, for -v --help output (see
>> the other patch on gcc-patches that ensures that at least one of them
>> is picked).
OK for Java.
Andrew.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, java, fortran] Merge help texts for duplicate options.
2009-03-18 18:55 ` Ralf Wildenhues
2009-03-18 20:06 ` Andrew Haley
@ 2009-03-18 20:42 ` Joseph S. Myers
2009-03-18 20:59 ` Steve Kargl
1 sibling, 1 reply; 49+ messages in thread
From: Joseph S. Myers @ 2009-03-18 20:42 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches, java-patches, fortran
On Wed, 18 Mar 2009, Ralf Wildenhues wrote:
> > gcc/ChangeLog:
> > 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
> >
> > * c.opt: Unify help texts for -Wdeprecated, -Wsystem-headers,
> > and -fopenmp.
The C changes are OK. The rest are OK (approving them as a docs
maintainer) if there are no objections from the front-end maintainers
within 24 hours.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH, java, fortran] Merge help texts for duplicate options.
2009-03-18 20:42 ` Joseph S. Myers
@ 2009-03-18 20:59 ` Steve Kargl
0 siblings, 0 replies; 49+ messages in thread
From: Steve Kargl @ 2009-03-18 20:59 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: Ralf Wildenhues, gcc-patches, java-patches, fortran
On Wed, Mar 18, 2009 at 07:59:47PM +0000, Joseph S. Myers wrote:
> On Wed, 18 Mar 2009, Ralf Wildenhues wrote:
>
> > > gcc/ChangeLog:
> > > 2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
> > >
> > > * c.opt: Unify help texts for -Wdeprecated, -Wsystem-headers,
> > > and -fopenmp.
>
> The C changes are OK. The rest are OK (approving them as a docs
> maintainer) if there are no objections from the front-end maintainers
> within 24 hours.
>
Fortran part is OK.
--
Steve
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-03-06 19:00 ` Ralf Wildenhues
@ 2009-04-01 20:36 ` Ralf Wildenhues
2009-04-08 12:37 ` Rafael Espindola
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-01 20:36 UTC (permalink / raw)
To: Ben Elliston, gcc-patches
Ping <http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00319.html>
including the fix from
<http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00402.html>
resulting in the patch below, plus the outstanding question quoted.
* Ralf Wildenhues wrote on Fri, Mar 06, 2009 at 08:00:20PM CET:
> Well, it doesn't matter much here to test only the C locale.
>
> The thing I don't understand though is: the only locale settings
> I find in the current testsuite are in
> g++.exp gcc-dg.exp gfortran.exp objc.exp
>
> and I cannot see how they can possibly affect the locale on a remote
> target; dejagnu itself doesn't seem to have such settings in its .exp
> file either.
gcc/testsuite/ChangeLog:
2009-03-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gcc.misc-tests/help.exp: New file.
diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp
new file mode 100644
index 0000000..2b9da94
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/help.exp
@@ -0,0 +1,127 @@
+# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# We set LC_ALL and LANG to C so that we get the same error messages as expected.
+setenv LC_ALL C
+setenv LANG C
+
+# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
+# output to make sure that they match the newline-separated patterns
+# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
+# In case of failure, xfail if XFAIL is nonempty.
+
+proc check_for_help_options {language gcc_options compiler_patterns compiler_non_patterns xfail} {
+ set filename test-[pid]
+ set fd [open $filename.c w]
+ puts $fd "int main (void) \{ return 0; \}"
+ close $fd
+ remote_download host $filename.c
+
+ set test "compiler driver $gcc_options option(s):"
+ set gcc_options "\{additional_flags=$gcc_options\}"
+
+ switch "$language" {
+ "c" { set compiler cc1 }
+ default { error "unknown language" }
+ }
+ set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
+ remote_file build delete $filename.c $filename.x $filename.gcno
+
+ foreach pattern [split $compiler_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {[regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$xfail ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ foreach pattern [split $compiler_non_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {![regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$xfail ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ pass $test
+}
+
+# Document --version. No undocumented switches in --help.
+check_for_help_options c {--help} {--version} {This switch lacks documentation} {}
+
+# No intermingled output; pick up help strings from duplicate option flags
+check_for_help_options c {-v --help} {} {
+[^\n]The following options
+-Wconversion[^\n]*lacks documentation
+" -g "
+} {}
+
+# There are still undocumented switches in -v --help.
+check_for_help_options c {-v --help} {} {This switch lacks documentation} {xfail}
+
+# Multiline conversion in optc-gen.
+check_for_help_options c {-v --help} {} {are likely to\n -std} {}
+
+# --help= classes and qualifiers.
+check_for_help_options c {--help=optimizers} {-O} { -g } {}
+check_for_help_options c {--help=params} {maximum number of} {-Wunsafe-loop-optimizations} {}
+check_for_help_options c {--help=C} {-ansi} {-gnatO} {}
+check_for_help_options c {--help=C++} {-std=c\+\+} {-gnatO} {}
+check_for_help_options c {--help=common} {-dumpbase} {-gnatO} {}
+check_for_help_options c {--help=undocumented} {This switch lacks documentation} {} {}
+
+# undocumented flags are not yet consistently marked as such.
+check_for_help_options c {--help=^undocumented} {-Wall} {This switch lacks documentation} {xfail}
+
+# Examples from the manual.
+check_for_help_options c {--help=target,undocumented} {} {} {}
+check_for_help_options c {--help=target,optimizers} {} {} {}
+check_for_help_options c {--help=warnings,^joined,^undocumented} {} {} {}
+check_for_help_options c {-Q -O2 --help=optimizers} {
+-O
+-ftree-vectorize[^\n]*disabled
+} { -g } {}
+check_for_help_options c {-Q -O3 --help=optimizers} {
+-O
+-ftree-vectorize[^\n]*enabled
+} { -g } {}
+# Repeated --help=
+check_for_help_options c {--help=params --help=optimizers} {
+maximum number of
+-O
+} {} {}
+
+# PR 37805
+check_for_help_options c {--help=joined} {Wformat=} {-fstrict-prototype} {}
+check_for_help_options c {--help=separate} {-MF} {-fstrict-prototype} {}
+check_for_help_options c {--help=warnings,joined} {Wformat=} {Wtrigraphs} {}
+check_for_help_options c {--help=warnings,^joined} {Wtrigraphs} {Wformat=} {}
+check_for_help_options c {--help=joined,separate} {-I} {} {}
+check_for_help_options c {--help=^joined,separate} {--param } {} {}
+check_for_help_options c {--help=joined,^separate} {--help=} {} {}
+check_for_help_options c {--help=joined,undocumented} {} {} {}
+# Listing only excludes gives empty results.
+check_for_help_options c {--help=^joined,^separate} {} {} {}
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-01 20:36 ` tests for --help Ralf Wildenhues
@ 2009-04-08 12:37 ` Rafael Espindola
2009-04-08 21:48 ` Ralf Wildenhues
2009-04-08 22:25 ` Janis Johnson
0 siblings, 2 replies; 49+ messages in thread
From: Rafael Espindola @ 2009-04-08 12:37 UTC (permalink / raw)
To: Ralf Wildenhues, Ben Elliston, gcc-patches, Diego Novillo
[-- Attachment #1: Type: text/plain, Size: 495 bytes --]
May I proposed the attached patch instead? It is just a small
refactoring so that I can use it for testing plugins' support for
--help and --version.
2009-04-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Rafael Avila de Espindola <espindola@google.com>
* gcc.misc-tests/help.exp: New file.
* lib/options.exp: New file.
Thanks,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
[-- Attachment #2: help.patch --]
[-- Type: text/x-patch, Size: 5829 bytes --]
diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp
new file mode 100644
index 0000000..b686d28
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/help.exp
@@ -0,0 +1,74 @@
+# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+load_lib options.exp
+
+# Document --version. No undocumented switches in --help.
+check_for_options c {--help} {--version} {This switch lacks documentation} {}
+
+# No intermingled output; pick up help strings from duplicate option flags
+check_for_options c {-v --help} {} {
+[^\n]The following options
+-Wconversion[^\n]*lacks documentation
+" -g "
+} {}
+
+# There are still undocumented switches in -v --help.
+check_for_options c {-v --help} {} {This switch lacks documentation} {xfail}
+
+# Multiline conversion in optc-gen.
+check_for_options c {-v --help} {} {are likely to\n -std} {}
+
+# --help= classes and qualifiers.
+check_for_options c {--help=optimizers} {-O} { -g } {}
+check_for_options c {--help=params} {maximum number of} {-Wunsafe-loop-optimizations} {}
+check_for_options c {--help=C} {-ansi} {-gnatO} {}
+check_for_options c {--help=C++} {-std=c\+\+} {-gnatO} {}
+check_for_options c {--help=common} {-dumpbase} {-gnatO} {}
+check_for_options c {--help=undocumented} {This switch lacks documentation} {} {}
+
+# undocumented flags are not yet consistently marked as such.
+check_for_options c {--help=^undocumented} {-Wall} {This switch lacks documentation} {xfail}
+
+# Examples from the manual.
+check_for_options c {--help=target,undocumented} {} {} {}
+check_for_options c {--help=target,optimizers} {} {} {}
+check_for_options c {--help=warnings,^joined,^undocumented} {} {} {}
+check_for_options c {-Q -O2 --help=optimizers} {
+-O
+-ftree-vectorize[^\n]*disabled
+} { -g } {}
+check_for_options c {-Q -O3 --help=optimizers} {
+-O
+-ftree-vectorize[^\n]*enabled
+} { -g } {}
+# Repeated --help=
+check_for_options c {--help=params --help=optimizers} {
+maximum number of
+-O
+} {} {}
+
+# PR 37805
+check_for_options c {--help=joined} {Wformat=} {-fstrict-prototype} {}
+check_for_options c {--help=separate} {-MF} {-fstrict-prototype} {}
+check_for_options c {--help=warnings,joined} {Wformat=} {Wtrigraphs} {}
+check_for_options c {--help=warnings,^joined} {Wtrigraphs} {Wformat=} {}
+check_for_options c {--help=joined,separate} {-I} {} {}
+check_for_options c {--help=^joined,separate} {--param } {} {}
+check_for_options c {--help=joined,^separate} {--help=} {} {}
+check_for_options c {--help=joined,undocumented} {} {} {}
+# Listing only excludes gives empty results.
+check_for_options c {--help=^joined,^separate} {} {} {}
diff --git a/gcc/testsuite/lib/options.exp b/gcc/testsuite/lib/options.exp
new file mode 100644
index 0000000..ec07a68
--- /dev/null
+++ b/gcc/testsuite/lib/options.exp
@@ -0,0 +1,70 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# We set LC_ALL and LANG to C so that we get the same error messages as expected.
+setenv LC_ALL C
+setenv LANG C
+
+# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
+# output to make sure that they match the newline-separated patterns
+# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
+# In case of failure, xfail if XFAIL is nonempty.
+
+proc check_for_options {language gcc_options compiler_patterns compiler_non_patterns xfail} {
+ set filename test-[pid]
+ set fd [open $filename.c w]
+ puts $fd "int main (void) \{ return 0; \}"
+ close $fd
+ remote_download host $filename.c
+
+ set test "compiler driver $gcc_options option(s):"
+ set gcc_options "\{additional_flags=$gcc_options\}"
+
+ switch "$language" {
+ "c" { set compiler cc1 }
+ default { error "unknown language" }
+ }
+ set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
+ remote_file build delete $filename.c $filename.x $filename.gcno
+
+ foreach pattern [split $compiler_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {[regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$xfail ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ foreach pattern [split $compiler_non_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {![regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$xfail ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ pass $test
+}
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-08 12:37 ` Rafael Espindola
@ 2009-04-08 21:48 ` Ralf Wildenhues
2009-04-08 22:25 ` Janis Johnson
1 sibling, 0 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-08 21:48 UTC (permalink / raw)
To: Rafael Espindola; +Cc: Ben Elliston, gcc-patches, Diego Novillo
* Rafael Espindola wrote on Wed, Apr 08, 2009 at 02:37:46PM CEST:
> May I proposed the attached patch instead? It is just a small
> refactoring so that I can use it for testing plugins' support for
> --help and --version.
>
> 2009-04-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
> Rafael Avila de Espindola <espindola@google.com>
>
> * gcc.misc-tests/help.exp: New file.
> * lib/options.exp: New file.
Fine with me, but I cannot approve it.
Thanks!
Ralf
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-08 12:37 ` Rafael Espindola
2009-04-08 21:48 ` Ralf Wildenhues
@ 2009-04-08 22:25 ` Janis Johnson
2009-04-09 8:44 ` Rafael Espindola
1 sibling, 1 reply; 49+ messages in thread
From: Janis Johnson @ 2009-04-08 22:25 UTC (permalink / raw)
To: Rafael Espindola
Cc: Ralf Wildenhues, Ben Elliston, gcc-patches, Diego Novillo
On Wed, 2009-04-08 at 13:37 +0100, Rafael Espindola wrote:
> May I proposed the attached patch instead? It is just a small
> refactoring so that I can use it for testing plugins' support for
> --help and --version.
>
> 2009-04-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
> Rafael Avila de Espindola <espindola@google.com>
>
> * gcc.misc-tests/help.exp: New file.
> * lib/options.exp: New file.
Usually a .exp file is infrastructure for tests from other files, so
help.exp deserves a comment at the start that it is a set of tests.
Some of the comments are not full sentences, some don't start with a
capitalized word, and some don't end with a period. Some are missing
(meaning it would be helpful to have additional comments as well).
In help.exp, it would be easier to read the calls to check_for_options
if the arguments were passed as strings instead of within braces; I'm
pretty sure that would work.
It shouldn't be necessary to use "\{" for puts; in other files "{"
comes through just fine.
In proc check_for_options it's confusing to have an argument called
xfail when the proc calls a procedure of that name; please rename the
argument to lessen the chances for confusion.
Why is there an unconditional "pass $test" at the end of options.exp?
Janis
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-08 22:25 ` Janis Johnson
@ 2009-04-09 8:44 ` Rafael Espindola
2009-04-09 16:32 ` Janis Johnson
2009-04-09 17:23 ` Ralf Wildenhues
0 siblings, 2 replies; 49+ messages in thread
From: Rafael Espindola @ 2009-04-09 8:44 UTC (permalink / raw)
To: janis187; +Cc: Ralf Wildenhues, Ben Elliston, gcc-patches, Diego Novillo
[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]
> Usually a .exp file is infrastructure for tests from other files, so
> help.exp deserves a comment at the start that it is a set of tests.
Done.
> Some of the comments are not full sentences, some don't start with a
> capitalized word, and some don't end with a period. Some are missing
> (meaning it would be helpful to have additional comments as well).
I fixed the capitalized words and missing periods. Ralf, can you take
a look at the missing comments?
> In help.exp, it would be easier to read the calls to check_for_options
> if the arguments were passed as strings instead of within braces; I'm
> pretty sure that would work.
It does except for strings with newlines or +. I changed all other strings.
> It shouldn't be necessary to use "\{" for puts; in other files "{"
> comes through just fine.
Done.
> In proc check_for_options it's confusing to have an argument called
> xfail when the proc calls a procedure of that name; please rename the
> argument to lessen the chances for confusion.
Done.
> Why is there an unconditional "pass $test" at the end of options.exp?
No idea. Ralf?
> Janis
>
>
Thanks,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
[-- Attachment #2: help.patch --]
[-- Type: text/x-patch, Size: 5958 bytes --]
diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp
new file mode 100644
index 0000000..f9c395c
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/help.exp
@@ -0,0 +1,77 @@
+# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file contains a set of test that check that gcc options are
+# documented in --help.
+
+load_lib options.exp
+
+# Document --version. No undocumented switches in --help.
+check_for_options c "--help" "--version" "This switch lacks documentation" ""
+
+# No intermingled output; pick up help strings from duplicate option flags.
+check_for_options c "-v --help" "" {
+[^\n]The following options
+-Wconversion[^\n]*lacks documentation
+" -g "
+} ""
+
+# There are still undocumented switches in -v --help.
+check_for_options c "-v --help" "" "This switch lacks documentation" "xfail"
+
+# Multiline conversion in optc-gen.
+check_for_options c "-v --help" "" {are likely to\n -std} ""
+
+# --help= classes and qualifiers.
+check_for_options c "--help=optimizers" "-O" " -g " ""
+check_for_options c "--help=params" "maximum number of" "-Wunsafe-loop-optimizations" ""
+check_for_options c "--help=C" "-ansi" "-gnatO" ""
+check_for_options c {--help=C++} {-std=c\+\+} "-gnatO" ""
+check_for_options c "--help=common" "-dumpbase" "-gnatO" ""
+check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
+
+# Undocumented flags are not yet consistently marked as such.
+check_for_options c "--help=^undocumented" "-Wall" "This switch lacks documentation" "xfail"
+
+# Examples from the manual.
+check_for_options c "--help=target,undocumented" "" "" ""
+check_for_options c "--help=target,optimizers" "" "" ""
+check_for_options c "--help=warnings,^joined,^undocumented" "" "" ""
+check_for_options c "-Q -O2 --help=optimizers" {
+-O
+-ftree-vectorize[^\n]*disabled
+} " -g " ""
+check_for_options c "-Q -O3 --help=optimizers" {
+-O
+-ftree-vectorize[^\n]*enabled
+} " -g " ""
+# Repeated --help=.
+check_for_options c "--help=params --help=optimizers" {
+maximum number of
+-O
+} "" ""
+
+# PR 37805.
+check_for_options c "--help=joined" "Wformat=" "-fstrict-prototype" ""
+check_for_options c "--help=separate" "-MF" "-fstrict-prototype" ""
+check_for_options c "--help=warnings,joined" "Wformat=" "Wtrigraphs" ""
+check_for_options c "--help=warnings,^joined" "Wtrigraphs" "Wformat=" ""
+check_for_options c "--help=joined,separate" "-I" "" ""
+check_for_options c "--help=^joined,separate" "--param " "" ""
+check_for_options c "--help=joined,^separate" "--help=" "" ""
+check_for_options c "--help=joined,undocumented" "" "" ""
+# Listing only excludes gives empty results.
+check_for_options c "--help=^joined,^separate" "" "" ""
diff --git a/gcc/testsuite/lib/options.exp b/gcc/testsuite/lib/options.exp
new file mode 100644
index 0000000..9178c98
--- /dev/null
+++ b/gcc/testsuite/lib/options.exp
@@ -0,0 +1,70 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# We set LC_ALL and LANG to C so that we get the same error messages as expected.
+setenv LC_ALL C
+setenv LANG C
+
+# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
+# output to make sure that they match the newline-separated patterns
+# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
+# In case of failure, xfail if XFAIL is nonempty.
+
+proc check_for_options {language gcc_options compiler_patterns compiler_non_patterns expected_failure} {
+ set filename test-[pid]
+ set fd [open $filename.c w]
+ puts $fd "int main (void) { return 0; }"
+ close $fd
+ remote_download host $filename.c
+
+ set test "compiler driver $gcc_options option(s):"
+ set gcc_options "\{additional_flags=$gcc_options\}"
+
+ switch "$language" {
+ "c" { set compiler cc1 }
+ default { error "unknown language" }
+ }
+ set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
+ remote_file build delete $filename.c $filename.x $filename.gcno
+
+ foreach pattern [split $compiler_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {[regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$expected_failure ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ foreach pattern [split $compiler_non_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {![regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$expected_failure ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ pass $test
+}
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-09 8:44 ` Rafael Espindola
@ 2009-04-09 16:32 ` Janis Johnson
2009-04-09 17:23 ` Ralf Wildenhues
1 sibling, 0 replies; 49+ messages in thread
From: Janis Johnson @ 2009-04-09 16:32 UTC (permalink / raw)
To: Rafael Espindola
Cc: Ralf Wildenhues, Ben Elliston, gcc-patches, Diego Novillo
On Thu, 2009-04-09 at 09:44 +0100, Rafael Espindola wrote:
> > Usually a .exp file is infrastructure for tests from other files, so
> > help.exp deserves a comment at the start that it is a set of tests.
> Done.
>
> > Some of the comments are not full sentences, some don't start with a
> > capitalized word, and some don't end with a period. Some are missing
> > (meaning it would be helpful to have additional comments as well).
>
> I fixed the capitalized words and missing periods. Ralf, can you take
> a look at the missing comments?
>
> > In help.exp, it would be easier to read the calls to check_for_options
> > if the arguments were passed as strings instead of within braces; I'm
> > pretty sure that would work.
>
> It does except for strings with newlines or +. I changed all other strings.
>
> > It shouldn't be necessary to use "\{" for puts; in other files "{"
> > comes through just fine.
>
> Done.
>
> > In proc check_for_options it's confusing to have an argument called
> > xfail when the proc calls a procedure of that name; please rename the
> > argument to lessen the chances for confusion.
>
> Done.
>
> > Why is there an unconditional "pass $test" at the end of options.exp?
>
> No idea. Ralf?
Take a look at the "pass $test", but otherwise it looks good.
Janis
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-09 8:44 ` Rafael Espindola
2009-04-09 16:32 ` Janis Johnson
@ 2009-04-09 17:23 ` Ralf Wildenhues
2009-04-10 1:15 ` H.J. Lu
1 sibling, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-09 17:23 UTC (permalink / raw)
To: Rafael Espindola; +Cc: janis187, Ben Elliston, gcc-patches, Diego Novillo
* Rafael Espindola wrote on Thu, Apr 09, 2009 at 10:44:02AM CEST:
> > Some of the comments are not full sentences, some don't start with a
> > capitalized word, and some don't end with a period. ÃÂÃÂ Some are missing
> > (meaning it would be helpful to have additional comments as well).
>
> I fixed the capitalized words and missing periods.
Thanks.
> Ralf, can you take a look at the missing comments?
Done.
> > In help.exp, it would be easier to read the calls to check_for_options
> > if the arguments were passed as strings instead of within braces; I'm
> > pretty sure that would work.
>
> It does except for strings with newlines or +. I changed all other strings.
Thanks. I don't really know dejagnu, so I was glad to have somethink
working at all.
> > Why is there an unconditional "pass $test" at the end of options.exp?
>
> No idea. Ralf?
Because when I tried to put "fail $test" there, several tests would
fail? :-)
No, seriously, it was a leftover from an early version of the procedure.
I've dropped it now.
Here's the updated patch which I committed to trunk now. Thanks again
Rafael for your help on this, and Janis for the review.
Cheers,
Ralf
gcc/testsuite/ChangeLog:
2009-04-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Rafael Avila de Espindola <espindola@google.com>
* gcc.misc-tests/help.exp: New file.
* lib/options.exp: New file.
diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp
new file mode 100644
index 0000000..6c38c8f
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/help.exp
@@ -0,0 +1,80 @@
+# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file contains a set of test that check that gcc options are
+# documented in --help, and that the various --help* options work.
+
+load_lib options.exp
+
+# Document --version. Ideally, there should be no undocumented switches
+# in --help.
+check_for_options c "--help" "--version" "This switch lacks documentation" ""
+
+# Output from different subprocesses should not be intermingled
+# (we check for some patterns that could be seen with a missing
+# fflush in gcc.c).
+check_for_options c "-v --help" "" {
+[^\n]The following options
+-Wconversion[^\n]*lacks documentation
+" -g "
+} ""
+
+# There are still undocumented switches in -v --help.
+check_for_options c "-v --help" "" "This switch lacks documentation" "xfail"
+
+# Check whether multiline conversion in optc-gen is broken.
+check_for_options c "-v --help" "" {are likely to\n -std} ""
+
+# Try various --help= classes and qualifiers.
+check_for_options c "--help=optimizers" "-O" " -g " ""
+check_for_options c "--help=params" "maximum number of" "-Wunsafe-loop-optimizations" ""
+check_for_options c "--help=C" "-ansi" "-gnatO" ""
+check_for_options c {--help=C++} {-std=c\+\+} "-gnatO" ""
+check_for_options c "--help=common" "-dumpbase" "-gnatO" ""
+check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
+
+# Undocumented flags are not yet consistently marked as such.
+check_for_options c "--help=^undocumented" "-Wall" "This switch lacks documentation" "xfail"
+
+# Try some --help=* examples from the manual.
+check_for_options c "--help=target,undocumented" "" "" ""
+check_for_options c "--help=target,optimizers" "" "" ""
+check_for_options c "--help=warnings,^joined,^undocumented" "" "" ""
+check_for_options c "-Q -O2 --help=optimizers" {
+-O
+-ftree-vectorize[^\n]*disabled
+} " -g " ""
+check_for_options c "-Q -O3 --help=optimizers" {
+-O
+-ftree-vectorize[^\n]*enabled
+} " -g " ""
+# Try repeated --help=.
+check_for_options c "--help=params --help=optimizers" {
+maximum number of
+-O
+} "" ""
+
+# Ensure PR 37805 is fixed.
+check_for_options c "--help=joined" "Wformat=" "-fstrict-prototype" ""
+check_for_options c "--help=separate" "-MF" "-fstrict-prototype" ""
+check_for_options c "--help=warnings,joined" "Wformat=" "Wtrigraphs" ""
+check_for_options c "--help=warnings,^joined" "Wtrigraphs" "Wformat=" ""
+check_for_options c "--help=joined,separate" "-I" "" ""
+check_for_options c "--help=^joined,separate" "--param " "" ""
+check_for_options c "--help=joined,^separate" "--help=" "" ""
+check_for_options c "--help=joined,undocumented" "" "" ""
+# Listing only excludes gives empty results.
+check_for_options c "--help=^joined,^separate" "" "" ""
diff --git a/gcc/testsuite/lib/options.exp b/gcc/testsuite/lib/options.exp
new file mode 100644
index 0000000..c63fd66
--- /dev/null
+++ b/gcc/testsuite/lib/options.exp
@@ -0,0 +1,69 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# We set LC_ALL and LANG to C so that we get the same error messages as expected.
+setenv LC_ALL C
+setenv LANG C
+
+# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
+# output to make sure that they match the newline-separated patterns
+# in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
+# In case of failure, xfail if XFAIL is nonempty.
+
+proc check_for_options {language gcc_options compiler_patterns compiler_non_patterns expected_failure} {
+ set filename test-[pid]
+ set fd [open $filename.c w]
+ puts $fd "int main (void) { return 0; }"
+ close $fd
+ remote_download host $filename.c
+
+ set test "compiler driver $gcc_options option(s):"
+ set gcc_options "\{additional_flags=$gcc_options\}"
+
+ switch "$language" {
+ "c" { set compiler cc1 }
+ default { error "unknown language" }
+ }
+ set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
+ remote_file build delete $filename.c $filename.x $filename.gcno
+
+ foreach pattern [split $compiler_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {[regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$expected_failure ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+ foreach pattern [split $compiler_non_patterns "\n"] {
+ if {$pattern ne ""} {
+ if {![regexp -- "$pattern" $gcc_output]} {
+ pass "$test $pattern"
+ } else {
+ if {$expected_failure ne ""} {
+ xfail "$test $pattern"
+ } else {
+ fail "$test $pattern"
+ }
+ }
+ }
+ }
+}
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-09 17:23 ` Ralf Wildenhues
@ 2009-04-10 1:15 ` H.J. Lu
2009-04-10 6:12 ` Ralf Wildenhues
2009-04-11 0:56 ` H.J. Lu
0 siblings, 2 replies; 49+ messages in thread
From: H.J. Lu @ 2009-04-10 1:15 UTC (permalink / raw)
To: Ralf Wildenhues, Rafael Espindola, janis187, Ben Elliston,
gcc-patches, Diego Novillo
On Thu, Apr 9, 2009 at 10:23 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> * Rafael Espindola wrote on Thu, Apr 09, 2009 at 10:44:02AM CEST:
>> > Some of the comments are not full sentences, some don't start with a
>> > capitalized word, and some don't end with a period. Some are missing
>> > (meaning it would be helpful to have additional comments as well).
>>
>> I fixed the capitalized words and missing periods.
>
> Thanks.
>
>> Ralf, can you take a look at the missing comments?
>
> Done.
This caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39710
--
H.J.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 1:15 ` H.J. Lu
@ 2009-04-10 6:12 ` Ralf Wildenhues
2009-04-10 7:03 ` Joseph S. Myers
2009-04-11 0:56 ` H.J. Lu
1 sibling, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-10 6:12 UTC (permalink / raw)
To: H.J. Lu
Cc: Rafael Espindola, janis187, Ben Elliston, gcc-patches, Diego Novillo
* H.J. Lu wrote on Fri, Apr 10, 2009 at 03:15:00AM CEST:
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39710
Thanks for the report. OK to apply this fix?
Cheers,
Ralf
gcc/testsuite/ChangeLog:
2009-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR testsuite/39710
* gcc.misc-tests/help.exp: Do not test for string that may not
be printed with --enable-checking=assert.
Index: gcc/testsuite/gcc.misc-tests/help.exp
===================================================================
--- gcc/testsuite/gcc.misc-tests/help.exp (revision 145851)
+++ gcc/testsuite/gcc.misc-tests/help.exp (working copy)
@@ -44,7 +44,9 @@
check_for_options c "--help=C" "-ansi" "-gnatO" ""
check_for_options c {--help=C++} {-std=c\+\+} "-gnatO" ""
check_for_options c "--help=common" "-dumpbase" "-gnatO" ""
-check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
+# Do not check for "This switch lacks documentation" here, because
+# ENABLE_CHECKING may turn that off.
+check_for_options c "--help=undocumented" "" "" ""
# Undocumented flags are not yet consistently marked as such.
check_for_options c "--help=^undocumented" "-Wall" "This switch lacks documentation" "xfail"
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 6:12 ` Ralf Wildenhues
@ 2009-04-10 7:03 ` Joseph S. Myers
2009-04-10 7:29 ` Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: Joseph S. Myers @ 2009-04-10 7:03 UTC (permalink / raw)
To: Ralf Wildenhues
Cc: H.J. Lu, Rafael Espindola, janis187, Ben Elliston, gcc-patches,
Diego Novillo
On Fri, 10 Apr 2009, Ralf Wildenhues wrote:
> -check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
> +# Do not check for "This switch lacks documentation" here, because
> +# ENABLE_CHECKING may turn that off.
> +check_for_options c "--help=undocumented" "" "" ""
I think the actual bug is that this observable behavior depends on
--enable-checking; the "This switch lacks documentation" should be used
unconditionally, rather than depending on how the compiler was configured.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 7:03 ` Joseph S. Myers
@ 2009-04-10 7:29 ` Ralf Wildenhues
2009-04-10 13:29 ` H.J. Lu
0 siblings, 1 reply; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-10 7:29 UTC (permalink / raw)
To: Joseph S. Myers
Cc: H.J. Lu, Rafael Espindola, janis187, Ben Elliston, gcc-patches,
Diego Novillo
* Joseph S. Myers wrote on Fri, Apr 10, 2009 at 09:02:42AM CEST:
> On Fri, 10 Apr 2009, Ralf Wildenhues wrote:
>
> > -check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
> > +# Do not check for "This switch lacks documentation" here, because
> > +# ENABLE_CHECKING may turn that off.
> > +check_for_options c "--help=undocumented" "" "" ""
>
> I think the actual bug is that this observable behavior depends on
> --enable-checking; the "This switch lacks documentation" should be used
> unconditionally, rather than depending on how the compiler was configured.
That was added as part of
2008-02-19 Nick Clifton <nickc@redhat.com>
PR other/31349
* opts.c (undocumented_msg): Leave blank unless checking is
enabled.
[...]
and the discussion in <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31349>
leaves me wondering whether the result was a good consensus.
I personally find "This switch lacks documentation" ugly, too, but I
assume GCC developers don't read --help output anyway, and it has the
advantages that users might be more likely to report a bug, and not
assume that a switch without documentation in --help is a no-op.
Here's the alternative patch I'm testing right now.
Cheers,
Ralf
gcc/ChangeLog:
2009-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR testsuite/39710
* opts.c (undocumented_msg): Do not leave blank even with
ENABLE_CHECKING.
Index: gcc/opts.c
===================================================================
--- gcc/opts.c (Revision 145850)
+++ gcc/opts.c (Arbeitskopie)
@@ -338,11 +338,7 @@
struct visibility_flags visibility_options;
/* What to print when a switch has no documentation. */
-#ifdef ENABLE_CHECKING
static const char undocumented_msg[] = N_("This switch lacks documentation");
-#else
-static const char undocumented_msg[] = "";
-#endif
/* Used for bookkeeping on whether user set these flags so
-fprofile-use/-fprofile-generate does not use them. */
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 7:29 ` Ralf Wildenhues
@ 2009-04-10 13:29 ` H.J. Lu
2009-04-10 14:58 ` Ralf Wildenhues
0 siblings, 1 reply; 49+ messages in thread
From: H.J. Lu @ 2009-04-10 13:29 UTC (permalink / raw)
To: Ralf Wildenhues, Joseph S. Myers, H.J. Lu, Rafael Espindola,
janis187, Ben Elliston, gcc-patches, Diego Novillo
On Fri, Apr 10, 2009 at 12:28 AM, Ralf Wildenhues
<Ralf.Wildenhues@gmx.de> wrote:
> * Joseph S. Myers wrote on Fri, Apr 10, 2009 at 09:02:42AM CEST:
>> On Fri, 10 Apr 2009, Ralf Wildenhues wrote:
>>
>> > -check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
>> > +# Do not check for "This switch lacks documentation" here, because
>> > +# ENABLE_CHECKING may turn that off.
>> > +check_for_options c "--help=undocumented" "" "" ""
>>
>> I think the actual bug is that this observable behavior depends on
>> --enable-checking; the "This switch lacks documentation" should be used
>> unconditionally, rather than depending on how the compiler was configured.
>
> That was added as part of
>
> 2008-02-19 Nick Clifton <nickc@redhat.com>
>
> PR other/31349
> * opts.c (undocumented_msg): Leave blank unless checking is
> enabled.
> [...]
>
> and the discussion in <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31349>
> leaves me wondering whether the result was a good consensus.
>
> I personally find "This switch lacks documentation" ugly, too, but I
> assume GCC developers don't read --help output anyway, and it has the
> advantages that users might be more likely to report a bug, and not
> assume that a switch without documentation in --help is a no-op.
>
> Here's the alternative patch I'm testing right now.
>
> Cheers,
> Ralf
>
> gcc/ChangeLog:
> 2009-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> PR testsuite/39710
> * opts.c (undocumented_msg): Do not leave blank even with
^^^^ without?
> ENABLE_CHECKING.
>
> Index: gcc/opts.c
> ===================================================================
> --- gcc/opts.c (Revision 145850)
> +++ gcc/opts.c (Arbeitskopie)
> @@ -338,11 +338,7 @@
> struct visibility_flags visibility_options;
>
> /* What to print when a switch has no documentation. */
> -#ifdef ENABLE_CHECKING
> static const char undocumented_msg[] = N_("This switch lacks documentation");
> -#else
> -static const char undocumented_msg[] = "";
> -#endif
>
> /* Used for bookkeeping on whether user set these flags so
> -fprofile-use/-fprofile-generate does not use them. */
>
--
H.J.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 13:29 ` H.J. Lu
@ 2009-04-10 14:58 ` Ralf Wildenhues
2009-04-25 8:13 ` Ralf Wildenhues
2009-04-25 22:41 ` Ian Lance Taylor
0 siblings, 2 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-10 14:58 UTC (permalink / raw)
To: H.J. Lu
Cc: Joseph S. Myers, Rafael Espindola, janis187, Ben Elliston,
gcc-patches, Diego Novillo
* H.J. Lu wrote on Fri, Apr 10, 2009 at 03:29:09PM CEST:
> On Fri, Apr 10, 2009 at 12:28 AM, Ralf Wildenhues
> <Ralf.Wildenhues@gmx.de> wrote:
> > Â Â Â Â PR testsuite/39710
> > Â Â Â Â * opts.c (undocumented_msg): Do not leave blank even with
>
> ^^^^ without?
> > Â Â Â Â ENABLE_CHECKING.
Thanks. Updated ChangeLog entry below. Testing succeeded. OK to
commit?
Cheers,
Ralf
gcc/ChangeLog:
2009-04-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
PR testsuite/39710
* opts.c (undocumented_msg): Do not leave blank even without
ENABLE_CHECKING.
> > Index: gcc/opts.c
> > ===================================================================
> > --- gcc/opts.c  (Revision 145850)
> > +++ gcc/opts.c  (Arbeitskopie)
> > @@ -338,11 +338,7 @@
> > Â struct visibility_flags visibility_options;
> >
> > Â /* What to print when a switch has no documentation. Â */
> > -#ifdef ENABLE_CHECKING
> > Â static const char undocumented_msg[] = N_("This switch lacks documentation");
> > -#else
> > -static const char undocumented_msg[] = "";
> > -#endif
> >
> > Â /* Used for bookkeeping on whether user set these flags so
> > Â Â -fprofile-use/-fprofile-generate does not use them. Â */
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 1:15 ` H.J. Lu
2009-04-10 6:12 ` Ralf Wildenhues
@ 2009-04-11 0:56 ` H.J. Lu
1 sibling, 0 replies; 49+ messages in thread
From: H.J. Lu @ 2009-04-11 0:56 UTC (permalink / raw)
To: Ralf Wildenhues, Rafael Espindola, janis187, Ben Elliston,
gcc-patches, Diego Novillo
On Thu, Apr 9, 2009 at 6:15 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Apr 9, 2009 at 10:23 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
>> * Rafael Espindola wrote on Thu, Apr 09, 2009 at 10:44:02AM CEST:
>>> > Some of the comments are not full sentences, some don't start with a
>>> > capitalized word, and some don't end with a period. Some are missing
>>> > (meaning it would be helpful to have additional comments as well).
>>>
>>> I fixed the capitalized words and missing periods.
>>
>> Thanks.
>>
>>> Ralf, can you take a look at the missing comments?
>>
>> Done.
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39710
>
It also caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39733
--
H.J.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 14:58 ` Ralf Wildenhues
@ 2009-04-25 8:13 ` Ralf Wildenhues
2009-04-25 22:41 ` Ian Lance Taylor
1 sibling, 0 replies; 49+ messages in thread
From: Ralf Wildenhues @ 2009-04-25 8:13 UTC (permalink / raw)
To: H.J. Lu, Joseph S. Myers, Rafael Espindola, janis187,
Ben Elliston, gcc-patches, Diego Novillo
Ping <http://gcc.gnu.org/ml/gcc-patches/2009-04/msg00823.html>
as fix of <http://gcc.gnu.org/ml/gcc-patches/2009-04/msg00774.html>
* Ralf Wildenhues wrote on Fri, Apr 10, 2009 at 04:58:13PM CEST:
> gcc/ChangeLog:
> 2009-04-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
>
> PR testsuite/39710
> * opts.c (undocumented_msg): Do not leave blank even without
> ENABLE_CHECKING.
>
> > > Index: gcc/opts.c
> > > ===================================================================
> > > --- gcc/opts.c  (Revision 145850)
> > > +++ gcc/opts.c  (Arbeitskopie)
> > > @@ -338,11 +338,7 @@
> > > Â struct visibility_flags visibility_options;
> > >
> > > Â /* What to print when a switch has no documentation. Â */
> > > -#ifdef ENABLE_CHECKING
> > > Â static const char undocumented_msg[] = N_("This switch lacks documentation");
> > > -#else
> > > -static const char undocumented_msg[] = "";
> > > -#endif
> > >
> > > Â /* Used for bookkeeping on whether user set these flags so
> > > Â Â -fprofile-use/-fprofile-generate does not use them. Â */
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: tests for --help
2009-04-10 14:58 ` Ralf Wildenhues
2009-04-25 8:13 ` Ralf Wildenhues
@ 2009-04-25 22:41 ` Ian Lance Taylor
1 sibling, 0 replies; 49+ messages in thread
From: Ian Lance Taylor @ 2009-04-25 22:41 UTC (permalink / raw)
To: Ralf Wildenhues
Cc: H.J. Lu, Joseph S. Myers, Rafael Espindola, janis187,
Ben Elliston, gcc-patches, Diego Novillo
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> gcc/ChangeLog:
> 2009-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> PR testsuite/39710
> * opts.c (undocumented_msg): Do not leave blank even without
> ENABLE_CHECKING.
This is OK.
Thanks.
Ian
^ permalink raw reply [flat|nested] 49+ messages in thread
end of thread, other threads:[~2009-04-25 22:39 UTC | newest]
Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-01 7:10 [PATCH 0/N] Fix --help output Ralf Wildenhues
2009-03-01 7:11 ` [PATCH, doc] Restore dropped sentence in options.texi (Option file format) Ralf Wildenhues
2009-03-01 10:44 ` Richard Guenther
2009-03-01 7:12 ` [PATCH, doc] Improve state of check_warning_flags.sh warnings Ralf Wildenhues
2009-03-01 10:45 ` Richard Guenther
2009-03-01 11:13 ` Gerald Pfeifer
2009-03-01 7:14 ` [PATCH] Fix --help -v output for duplicate options Ralf Wildenhues
2009-03-01 10:46 ` Richard Guenther
2009-03-01 11:11 ` Ralf Wildenhues
2009-03-01 11:58 ` Richard Guenther
2009-03-01 12:39 ` Ralf Wildenhues
2009-03-01 12:44 ` Richard Guenther
2009-03-01 7:17 ` [PATCH] grab all contents of multiline help in *.opt Ralf Wildenhues
2009-03-01 10:24 ` Gerald Pfeifer
2009-03-01 10:49 ` Richard Guenther
2009-03-01 7:17 ` [PATCH, java, fortran] Merge help texts for duplicate options Ralf Wildenhues
2009-03-18 18:55 ` Ralf Wildenhues
2009-03-18 20:06 ` Andrew Haley
2009-03-18 20:42 ` Joseph S. Myers
2009-03-18 20:59 ` Steve Kargl
2009-03-01 7:19 ` [PATCH] Fix output race in --help -v Ralf Wildenhues
2009-03-01 10:50 ` Richard Guenther
2009-03-01 7:20 ` [PATCH] Document --version in --help output Ralf Wildenhues
2009-03-01 10:52 ` Richard Guenther
2009-03-01 10:13 ` [PATCH] PR middle-end/37805: --help=...,joined,undocumented Ralf Wildenhues
2009-03-02 20:51 ` Ralf Wildenhues
2009-03-05 21:20 ` Ralf Wildenhues
2009-03-14 9:43 ` Ralf Wildenhues
2009-03-17 14:08 ` Ian Lance Taylor
2009-03-01 21:52 ` [PATCH 0/N] Fix --help output Ben Elliston
2009-03-05 21:20 ` tests for --help (was: [PATCH 0/N] Fix --help output.) Ralf Wildenhues
2009-03-06 0:14 ` Ben Elliston
2009-03-06 19:00 ` Ralf Wildenhues
2009-04-01 20:36 ` tests for --help Ralf Wildenhues
2009-04-08 12:37 ` Rafael Espindola
2009-04-08 21:48 ` Ralf Wildenhues
2009-04-08 22:25 ` Janis Johnson
2009-04-09 8:44 ` Rafael Espindola
2009-04-09 16:32 ` Janis Johnson
2009-04-09 17:23 ` Ralf Wildenhues
2009-04-10 1:15 ` H.J. Lu
2009-04-10 6:12 ` Ralf Wildenhues
2009-04-10 7:03 ` Joseph S. Myers
2009-04-10 7:29 ` Ralf Wildenhues
2009-04-10 13:29 ` H.J. Lu
2009-04-10 14:58 ` Ralf Wildenhues
2009-04-25 8:13 ` Ralf Wildenhues
2009-04-25 22:41 ` Ian Lance Taylor
2009-04-11 0:56 ` H.J. Lu
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).