diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 2568d541196..87cbea11ae1 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -3851,7 +3851,7 @@ alloc_switch (void) static void save_switch (const char *opt, size_t n_args, const char *const *args, - bool validated, bool known) + bool validated, bool known, bool driver = false) { alloc_switch (); switches[n_switches].part1 = opt + 1; @@ -3868,6 +3868,7 @@ save_switch (const char *opt, size_t n_args, const char *const *args, switches[n_switches].validated = validated; switches[n_switches].known = known; switches[n_switches].ordering = 0; + switches[n_switches].driver = driver; n_switches++; } @@ -4575,7 +4576,8 @@ driver_handle_option (struct gcc_options *opts, if (do_save) save_switch (decoded->canonical_option[0], decoded->canonical_option_num_elements - 1, - &decoded->canonical_option[1], validated, true); + &decoded->canonical_option[1], validated, true, + cl_options[opt_index].flags == CL_DRIVER); return true; } @@ -7465,7 +7467,8 @@ check_live_switch (int switchnum, int prefix_length) static void give_switch (int switchnum, int omit_first_word) { - if ((switches[switchnum].live_cond & SWITCH_IGNORE) != 0) + if ((switches[switchnum].live_cond & SWITCH_IGNORE) != 0 + || switches[switchnum].driver) return; if (!omit_first_word) diff --git a/gcc/opts.h b/gcc/opts.h index ce4fd5c39b9..2900f0d9168 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -561,6 +561,7 @@ struct switchstr bool known; bool validated; bool ordering; + bool driver; }; #endif