diff options
author | Olivier Hainque <hainque@adacore.com> | 2017-07-06 15:04:30 +0000 |
---|---|---|
committer | Olivier Hainque <hainque@gcc.gnu.org> | 2017-07-06 15:04:30 +0000 |
commit | 3ed93fc86ce9f8fa76d2df6aa1c802ac68eb09fa (patch) | |
tree | 6dca68ce74e72cdcddf89229b41b3db16edeecf3 | |
parent | c69f704cb42cadfb7055703d021af3b4f446bf59 (diff) | |
download | gcc-3ed93fc86ce9f8fa76d2df6aa1c802ac68eb09fa.zip gcc-3ed93fc86ce9f8fa76d2df6aa1c802ac68eb09fa.tar.gz gcc-3ed93fc86ce9f8fa76d2df6aa1c802ac68eb09fa.tar.bz2 |
gcc.c (spec_undefvar_allowed): New global.
2017-07-06 Olivier Hainque <hainque@adacore.com>
* gcc.c (spec_undefvar_allowed): New global.
(process_command): Set to true when running for --version or --help
alone, or together.
(getenv_spec_function): When the variable is not defined, use the
variable name as the variable value if we're allowed not to issue
a fatal error.
From-SVN: r250027
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/gcc.c | 26 |
2 files changed, 22 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4fd19e6..9d4b01f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-07-06 Olivier Hainque <hainque@adacore.com> + + * gcc.c (spec_undefvar_allowed): New global. + (process_command): Set to true when running for --version or --help + alone, or together. + (getenv_spec_function): When the variable is not defined, use the + variable name as the variable value if we're allowed not to issue + a fatal error. + 2017-07-06 Jan Hubicka <hubicka@ucw.cz> * auto-profile.c (afdo_set_bb_count, afdo_propagate_edge, @@ -4615,23 +4615,23 @@ process_command (unsigned int decoded_options_count, /* Decide if undefined variable references are allowed in specs. */ - /* --version and --help alone or together are safe. Note that -v would - make them unsafe, as they'd then be run for subprocesses as well, the - location of which might depend on variables possibly coming from - self-specs. + /* -v alone is safe. --version and --help alone or together are safe. Note + that -v would make them unsafe, as they'd then be run for subprocesses as + well, the location of which might depend on variables possibly coming + from self-specs. Note also that the command name is counted in + decoded_options_count. */ - Count the number of options we have for which undefined variables - are harmless for sure, and check that nothing else is set. */ - - unsigned n_varsafe_options = 0; + unsigned help_version_count = 0; if (print_version) - n_varsafe_options++; - + help_version_count++; + if (print_help_list) - n_varsafe_options++; - - spec_undefvar_allowed = (n_varsafe_options == decoded_options_count - 1); + help_version_count++; + + spec_undefvar_allowed = + ((verbose_flag && decoded_options_count == 2) + || help_version_count == decoded_options_count - 1); alloc_switch (); switches[n_switches].part1 = 0; |