diff mbox series

Filter out language specific options from --help=common.

Message ID 12cee0da-d812-1b60-6cfa-da8817be5dce@suse.cz
State New
Headers show
Series Filter out language specific options from --help=common. | expand

Commit Message

Martin Liška Jan. 23, 2020, 2:28 p.m. UTC
Hi.

The following is attempt to fix the PR. Idea is such that
all non-driver Common options that are also used in context
of a languages should not be printed in --help=common. An
exception would be an option that will be included in all languages.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2020-01-23  Martin Liska  <mliska@suse.cz>

	PR driver/91220
	* opts.c (print_filtered_help): Exclude language-specific
	options from --help=common unless enabled in all FEs.
---
  gcc/opts.c | 8 ++++++++
  1 file changed, 8 insertions(+)

Comments

Jeff Law Jan. 23, 2020, 7:59 p.m. UTC | #1
On Thu, 2020-01-23 at 15:28 +0100, Martin Liška wrote:
> Hi.
> 
> The following is attempt to fix the PR. Idea is such that
> all non-driver Common options that are also used in context
> of a languages should not be printed in --help=common. An
> exception would be an option that will be included in all languages.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2020-01-23  Martin Liska  <mliska@suse.cz>
> 
> 	PR driver/91220
> 	* opts.c (print_filtered_help): Exclude language-specific
> 	options from --help=common unless enabled in all FEs.
It's not marked as a regression, but one could argue this is a doc fix.

OK
jeff
diff mbox series

Patch

diff --git a/gcc/opts.c b/gcc/opts.c
index 3b2cc854af1..7affeb41a96 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1285,6 +1285,14 @@  print_filtered_help (unsigned int include_flags,
 			       | CL_COMMON | CL_TARGET)) == 0)
 	continue;
 
+      /* If an option contains a language specification,
+	 exclude it from common unless all languages are present.  */
+      if ((include_flags & CL_COMMON)
+	  && !(option->flags & CL_DRIVER)
+	  && (option->flags & CL_LANG_ALL)
+	  && (option->flags & CL_LANG_ALL) != CL_LANG_ALL)
+	continue;
+
       found = true;
       /* Skip switches that have already been printed.  */
       if (opts->x_help_printed[i])