Bug 31349 - [4.3 Regression] gcc -v --help returns no options for C, C++
Summary: [4.3 Regression] gcc -v --help returns no options for C, C++
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.3.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-25 22:42 UTC by Brooks Moses
Modified: 2008-02-19 16:15 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-01-22 07:51:20


Attachments
Improve --help= output (2.31 KB, patch)
2008-01-23 13:13 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brooks Moses 2007-03-25 22:42:37 UTC
To quote from the output of gcc -v --help on 
gcc (GCC) 4.3.0 20070323 (experimental):

----------------------------------
The following options are specific to the language Ada:
  -gnat<options>              Specify options to GNAT

The following options are specific to the language C:
 No options with the desired characteristics were found

The following options are specific to the language C++:
 No options with the desired characteristics were found
----------------------------------

As can be seen by comparing this to the output from 4.2, something seems to be missing.  (What's missing from Ada is all the options shared with C, specifically.)

Similarly, on the Fortran output, while the Fortran-specific options are present, the ones shared with C and C++ aren't listed.  4.3 currently gives
----------------------------------
The following options are specific to the language Fortran:
  -J<directory>               Put MODULE files in 'directory'
  -Waliasing                  Warn about possible aliasing of dummy arguments
[...]
----------------------------------

However, 4.2 gives:
----------------------------------
The Fortran front end recognizes the following options:

  -I, -Wall, -Wconversion, -fopenmp, -fpreprocessed, -fshort-enums

  -J<directory>               Put MODULE files in 'directory'
  -Waliasing                  Warn about possible aliasing of dummy arguments
[...]
----------------------------------

The same problem with the missing shared options in the output occurs for other languages as well.
Comment 1 Andrew Pinski 2007-03-25 22:48:12 UTC
This was caused by:
2007-02-12  Nick Clifton  <nickc@redhat.com> 

        * doc/invoke.texi (Overall Options): Document --help=.
....

Confirmed.
Comment 2 Mark Mitchell 2007-06-29 18:05:39 UTC
Nick, would you be able to look into this?
Comment 3 Nick Clifton 2007-07-03 10:59:01 UTC
Subject: Re:  [4.3 Regression] gcc -v --help returns no options
 for C, C++

Hi Mark,

> Nick, would you be able to look into this?

Certainly - I'll get on it today.

Cheers
   Nick


Comment 4 Nick Clifton 2007-07-03 16:26:58 UTC
Hi Brooks,

  I do not think that this is a bug, but rather a feature.  The command line options are all still in the "--help -v" otuput, they are just in different locations.  For example the -Wall option is now listed in the 'language related options' list rather than the Fortran list, because it is supported by more than one language front end.  (Note: you need to have specified -Wextra on the gcc command line before --help in order to see the -Wall option being listed.  This is because the -Wall has no description associated with it).

  As far as I can tell there are no missing options in the help output, it is just that their location in the output has changed, with all the options shared by more than one language front end being listed together in one lump, rather than being listed multiple times, once per supported language.

Cheers
  Nick
Comment 5 Brooks Moses 2007-07-03 19:45:00 UTC
Nick -

So, if I understand correctly: all of the options are listed somewhere, but we no longer provide any information about which of the shared options under  "language related options" are supported by a given language's front end?

While this may have been intentional, I do not think it counts as a feature -- the listing of the "common" options without definitions at the top of the option listing did not take up a significant amount of space, and it provided very useful information that's now not absent.

(On the other hand, moving the _descriptions_ of the shared options to a single listing is a good thing, IMO -- I want to make it clear that I'm not objecting to the bulk of this change!)
Comment 6 Brooks Moses 2007-07-03 19:46:12 UTC
Er, "that's now absent", I mean.  An extraneous "not" crept into the second paragraph of my last comment when I was editing it.
Comment 7 Nick Clifton 2007-07-04 13:40:15 UTC
Subject: Re:  [4.3 Regression] gcc -v --help returns no options
 for C, C++

Hi Brooks,

> So, if I understand correctly: all of the options are listed somewhere, but we
> no longer provide any information about which of the shared options under 
> "language related options" are supported by a given language's front end?

Correct.

Well by default anyway.  See below.

> While this may have been intentional, I do not think it counts as a feature -
> the listing of the "common" options without definitions at the top of the
> option listing did not take up a significant amount of space, and it provided
> very useful information that's now absent.

OK.

> (On the other hand, moving the _descriptions_ of the shared options to a single
> listing is a good thing, IMO -- I want to make it clear that I'm not objecting
> to the bulk of this change!)

You can find out all the options supported by a given language, 
including the ones that it shares with other languages and including 
those that do not have a description by using the --help=<language> 
feature.  For example:

   % gcc --help=java
   The following options are supported by the language Java:
   -I                          This switch lacks documentation
   -M                          This switch lacks documentation
   -MD_                        This switch lacks documentation
   -MF                         This switch lacks documentation
   -MM                         This switch lacks documentation
   -MMD_                       This switch lacks documentation
   -MP                         This switch lacks documentation
   -MT                         This switch lacks documentation
   -Wall                       This switch lacks documentation
   -Wall-deprecation           This switch lacks documentation
   -Wall-javadoc               This switch lacks documentation
   -Wassert-identifier         This switch lacks documentation
   -Wchar-concat               This switch lacks documentation
   -Wcondition-assign          This switch lacks documentation
   -Wconstructor-name          This switch lacks documentation
   -Wdep-ann                   This switch lacks documentation
   -Wdeprecated                Warn if a deprecated compiler feature, class,
                               method, or field is used
   [etc...]

So I think that the bone of contention here is what should be listed by 
"--help -v".  I think that leaving out options which have no description 
is a good default.  If for no other reason than to encourage people to 
write descriptions for the options so that they are then listed in the 
--help output.

Do you still feel that "--help -v" should list undocumented options ?

Cheers
   Nick
Comment 8 Manuel López-Ibáñez 2008-01-22 07:51:19 UTC
Can't  we get this fixed soon? It is marked as a P2 regression.

(In reply to comment #7)
> Subject: Re:  [4.3 Regression] gcc -v --help returns no options

> You can find out all the options supported by a given language, 
> including the ones that it shares with other languages and including 
> those that do not have a description by using the --help=<language> 
> feature.  For example:

So, instead of the current:

The following options are specific to the language C:
 No options with the desired characteristics were found

can't be said better:

No options are specific to the language C:
 Use --help=c to list options supported by the language C.


>    % gcc --help=java
>    The following options are supported by the language Java:

I should note that 

% gcc -v --help=c

returns the following for me

The following options are language-independent:
  --help                      Display this information
  --help=<class>              Display descriptions of a specific class of
                              options.  <class> is one or more of optimizers,
                              target, warnings, undocumented, params

I think it should say "The following options are supported by the language C". Yes, some of those options may work on other languages, but they also may not work in all of them. Language-independent is ambiguous.

> So I think that the bone of contention here is what should be listed by 
> "--help -v".  I think that leaving out options which have no description 
> is a good default.  If for no other reason than to encourage people to 
> write descriptions for the options so that they are then listed in the 
> --help output.

I don't think it works like this. Few GCC devs would bother to use --help to find options. On the other hand, users will likely report a bug whenever they find "This switch lacks documentation".

> Do you still feel that "--help -v" should list undocumented options ?

I understand Brooks was asking to list options supported by each language rather than options specific to each language. Either way seems correct as long as you can get the other. He also was asking to list supported options without its description (independently whether they are documented or not) at the top as in:

The Fortran front end recognizes the following options:

  -I, -Wall, -Wconversion, -fopenmp, -fpreprocessed, -fshort-enums

  -J<directory>               Put MODULE files in 'directory'
  -Waliasing                  Warn about possible aliasing of dummy arguments


My proposal would be:

1) Change the current empty message to mention --help=<language> as described above.

2) List all options with --help -v, even if they are undocumented (abusing of -Wextra for this seems unjustified to me). I would further propose that if checking is enabled, then show the message "This switch lacks documentation", otherwise (for releases) just show the empty string "".

Can we agree on this?
Comment 9 Nick Clifton 2008-01-23 13:13:22 UTC
Created attachment 15007 [details]
Improve --help= output
Comment 10 Nick Clifton 2008-01-23 13:13:53 UTC
Subject: Re:  [4.3 Regression] gcc -v --help returns no options
 for C, C++

Hi Manuel,

> % gcc -v --help=c
> 
> returns the following for me
> 
> The following options are language-independent:
>   --help                      Display this information
>   --help=<class>              Display descriptions of a specific class of
>                               options.  <class> is one or more of optimizers,
>                               target, warnings, undocumented, params
> 
> I think it should say "The following options are supported by the language C".

It should - that was a bug.

> My proposal would be:
> 
> 1) Change the current empty message to mention --help=<language> as described
> above.
> 
> 2) List all options with --help -v, even if they are undocumented (abusing of
> -Wextra for this seems unjustified to me). I would further propose that if
> checking is enabled, then show the message "This switch lacks documentation",
> otherwise (for releases) just show the empty string "".
> 
> Can we agree on this?

We can and the uploaded patch implements this.  If you are happy with it I will 
submit it to the list for official approval.

Cheers
   Nick


Comment 11 Nick Clifton 2008-02-19 10:35:01 UTC
Subject: Bug 31349

Author: nickc
Date: Tue Feb 19 10:33:41 2008
New Revision: 132427

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132427
Log:
        PR other/31349
        * opts.c (undocumented_msg): Leave blank unless checking is
        enabled.
        (handle_options): Fix indentation.
        (print_filtered_help): If no language-specific options were
        displayed tell the user how to list all the options supported by
        the language's front-end.
        (print_specific_help): Fix indentation and remove duplicate line.
        (common_handle_option): Handle the -v option.
        For --help enable the display of undocumented options if the -v
        switch has been included on the command line.
        For --help= check for overlaps in the arguments between the option
        classes and the language names and issue a warning when they
        cannot be disambiguated.
        * c.opt (v): Pass on to the common option handler.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c.opt
    trunk/gcc/opts.c

Comment 12 Manuel López-Ibáñez 2008-02-19 11:20:49 UTC
Nick,

Didn't this got approved for GCC 4.3? Notice that you committed the patch *after* GCC 4.3 branched. Also:

+	    description = _("The following options are specific to the just the language ");

should be:

+	    description = _("The following options are specific to just the language ");


(You don't need to ask approval for this little change, it is an obvious fix).
Comment 13 Nick Clifton 2008-02-19 14:12:23 UTC
Subject: Re:  [4.3 Regression] gcc -v --help returns no options
 for C, C++

Hi Manu,

> Didn't this got approved for GCC 4.3?

No. :-(

> Also:
> 
> +           description = _("The following options are specific to the just the
> language ");
> 
> should be:
> 
> +           description = _("The following options are specific to just the
> language ");

Oops - I'll fix this.

Cheers
   Nick


Comment 14 Manuel López-Ibáñez 2008-02-19 14:44:39 UTC
> > Didn't this got approved for GCC 4.3?
> 
> No. :-(
> 

Too bad. On the other hand, we can close this, can't we?
Comment 15 Nick Clifton 2008-02-19 15:11:44 UTC
Subject: Re:  [4.3 Regression] gcc -v --help returns no options
 for C, C++

Hi Manu,

> Too bad. On the other hand, we can close this, can't we?

Yes I agree.

Cheers
   Nick


Comment 16 Manuel López-Ibáñez 2008-02-19 16:15:03 UTC
Fixed in GCC 4.4.