Commit bc405869 by Martin Liska Committed by Martin Liska

Support again multiple --help options (PR other/90315).

2019-05-28  Martin Liska  <mliska@suse.cz>

	PR other/90315
	* opts-global.c (decode_options): Print help for all
	help_option_arguments.
	* opts.c (print_help): Add new argument.
	(common_handle_option): Remember all values into
	help_option_arguments.
	* opts.h (print_help): Add new argument.

From-SVN: r271700
parent 392d2ff3
2019-05-28 Martin Liska <mliska@suse.cz> 2019-05-28 Martin Liska <mliska@suse.cz>
PR other/90315
* opts-global.c (decode_options): Print help for all
help_option_arguments.
* opts.c (print_help): Add new argument.
(common_handle_option): Remember all values into
help_option_arguments.
* opts.h (print_help): Add new argument.
2019-05-28 Martin Liska <mliska@suse.cz>
PR ipa/90555 PR ipa/90555
* ipa-icf-gimple.c (func_checker::compare_loops): New function. * ipa-icf-gimple.c (func_checker::compare_loops): New function.
* ipa-icf-gimple.h (func_checker::compare_loops): Likewise. * ipa-icf-gimple.h (func_checker::compare_loops): Likewise.
......
...@@ -317,8 +317,11 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set, ...@@ -317,8 +317,11 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
finish_options (opts, opts_set, loc); finish_options (opts, opts_set, loc);
/* Print --help=* if used. */ /* Print --help=* if used. */
if (help_option_argument != NULL) unsigned i;
print_help (opts, lang_mask); const char *arg;
FOR_EACH_VEC_ELT (help_option_arguments, i, arg)
print_help (opts, lang_mask, arg);
} }
/* Hold command-line options associated with stack limitation. */ /* Hold command-line options associated with stack limitation. */
......
...@@ -856,7 +856,7 @@ control_options_for_live_patching (struct gcc_options *opts, ...@@ -856,7 +856,7 @@ control_options_for_live_patching (struct gcc_options *opts,
} }
/* --help option argument if set. */ /* --help option argument if set. */
const char *help_option_argument = NULL; vec<const char *> help_option_arguments;
/* After all options at LOC have been read into OPTS and OPTS_SET, /* After all options at LOC have been read into OPTS and OPTS_SET,
...@@ -2062,7 +2062,8 @@ check_alignment_argument (location_t loc, const char *flag, const char *name) ...@@ -2062,7 +2062,8 @@ check_alignment_argument (location_t loc, const char *flag, const char *name)
/* Print help when OPT__help_ is set. */ /* Print help when OPT__help_ is set. */
void void
print_help (struct gcc_options *opts, unsigned int lang_mask) print_help (struct gcc_options *opts, unsigned int lang_mask,
const char *help_option_argument)
{ {
const char *a = help_option_argument; const char *a = help_option_argument;
unsigned int include_flags = 0; unsigned int include_flags = 0;
...@@ -2255,7 +2256,7 @@ common_handle_option (struct gcc_options *opts, ...@@ -2255,7 +2256,7 @@ common_handle_option (struct gcc_options *opts,
case OPT__help_: case OPT__help_:
{ {
help_option_argument = arg; help_option_arguments.safe_push (arg);
opts->x_exit_after_options = true; opts->x_exit_after_options = true;
break; break;
} }
......
...@@ -419,7 +419,8 @@ extern bool target_handle_option (struct gcc_options *opts, ...@@ -419,7 +419,8 @@ extern bool target_handle_option (struct gcc_options *opts,
extern void finish_options (struct gcc_options *opts, extern void finish_options (struct gcc_options *opts,
struct gcc_options *opts_set, struct gcc_options *opts_set,
location_t loc); location_t loc);
extern void print_help (struct gcc_options *opts, unsigned int lang_mask); extern void print_help (struct gcc_options *opts, unsigned int lang_mask, const
char *help_option_argument);
extern void default_options_optimization (struct gcc_options *opts, extern void default_options_optimization (struct gcc_options *opts,
struct gcc_options *opts_set, struct gcc_options *opts_set,
struct cl_decoded_option *decoded_options, struct cl_decoded_option *decoded_options,
...@@ -443,7 +444,7 @@ extern const struct sanitizer_opts_s ...@@ -443,7 +444,7 @@ extern const struct sanitizer_opts_s
bool can_recover; bool can_recover;
} sanitizer_opts[]; } sanitizer_opts[];
extern const char *help_option_argument; extern vec<const char *> help_option_arguments;
extern void add_misspelling_candidates (auto_vec<char *> *candidates, extern void add_misspelling_candidates (auto_vec<char *> *candidates,
const struct cl_option *option, const struct cl_option *option,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment