RFC: --help for Driver options (was: [Patch] gcc.c: Add -foffload= to display_help)

Tobias Burnus tobias@codesourcery.com
Wed Jun 30 12:43:44 GMT 2021


RFC for this topic. Comments are welcome as is someone volunteering to
cleanup this mess :-)

On 30.06.21 14:24, Tobias Burnus wrote:
> This is a side effect of removing 'foffload=' from Common
> as Driver only does not show up with --help=... but only
> as hard-coded list via display_help.

While looking at that issue, Jakub and I wondered whether there
should be some warning if a Driver option has a help text,
which never appears.

Jakub mentioned
   -dumpdir
but that's also in Common and, hence, shows up with
   --help=common
but admittedly not with --help

  * * *

However, the following items are Drivar and neither LTO, C, Fortran nor
Common and do have a help text (that never shows up).

(Extracted with the first attached patch, as we wondered whether a
warning could make sense.)

* Those appear with --help as they have a puts line in gcc.c's display_help():
common.opt      no-pie
common.opt      pie
common.opt      shared
common.opt      static-pie

* While those don't but they also cannot be added to gcc.c
as they are FE specific driver options:
c-family/c.opt  static-libmpx
c-family/c.opt  static-libmpxwrappers
common.opt      foffload=
d/lang.opt      debuglib=
d/lang.opt      defaultlib=
d/lang.opt      dstartfiles
d/lang.opt      nophoboslib
d/lang.opt      shared-libphobos
d/lang.opt      static-libphobos

  * * *

Additionally, I was wondering whether having --help=driver makes sense.

That I tried with the following patch, but it looks as if I missed some
fineprint as Driver-only flags were still not printed, if I recall
correctly.

BTW: -help='s helptext differs between the hard-coded one in gcc.c
(used by --help) and the one in common.opt (shown, e.g., by --help=common).

Even with that patch applied, --help= does not really have a useful
error message while --help=something-invalid has.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: driver-help.diff
Type: text/x-patch
Size: 897 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210630/19a74882/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opts.diff
Type: text/x-patch
Size: 3975 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210630/19a74882/attachment-0001.bin>


More information about the Gcc-patches mailing list