Patchwork PR 54789: Fix driver error when GCC_COMPARE_DEBUG is defined

login
register
mail settings
Submitter Dmitry Gorbachev
Date Oct. 5, 2012, 2:49 a.m.
Message ID <CAM=RVTZVA9ZaVvMs=4NVn_-0j9-0Ks5_SPMZQEAZPOyx24-QSQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/189410/
State New
Headers show

Comments

Dmitry Gorbachev - Oct. 5, 2012, 2:49 a.m.
This patch simplifies process_command a bit by using save_switch and
sets the "known" switch field to "true".


gcc/ChangeLog:

2012-10-05  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>

	PR driver/54789
	* gcc.c (process_command): Use save_switch for synthesized
	-fcompare-debug=* option; mark the switch as known.
Jakub Jelinek - Nov. 8, 2012, 8:13 p.m.
On Fri, Oct 05, 2012 at 06:49:25AM +0400, Dmitry Gorbachev wrote:
> This patch simplifies process_command a bit by using save_switch and
> sets the "known" switch field to "true".
> 
> 
> gcc/ChangeLog:
> 
> 2012-10-05  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
> 
> 	PR driver/54789
> 	* gcc.c (process_command): Use save_switch for synthesized
> 	-fcompare-debug=* option; mark the switch as known.

Applied after bootstrap/regtested on x86_64-linux and i686-linux and
testing with GCC_COMPARE_DEBUG in environment.

	Jakub

Patch

--- gcc/gcc.c
+++ gcc/gcc.c
@@ -3961,18 +3961,12 @@  process_command (unsigned int decoded_options_count,
   if (n_infiles == last_language_n_infiles && spec_lang != 0)
     warning (0, "%<-x %s%> after last input file has no effect", spec_lang);

+  /* Synthesize -fcompare-debug flag from the GCC_COMPARE_DEBUG
+     environment variable.  */
   if (compare_debug == 2 || compare_debug == 3)
     {
-      alloc_switch ();
-      switches[n_switches].part1 = concat ("fcompare-debug=",
-					   compare_debug_opt,
-					   NULL);
-      switches[n_switches].args = 0;
-      switches[n_switches].live_cond = 0;
-      switches[n_switches].validated = false;
-      switches[n_switches].known = false;
-      switches[n_switches].ordering = 0;
-      n_switches++;
+      const char *opt = concat ("-fcompare-debug=", compare_debug_opt, NULL);
+      save_switch (opt, 0, NULL, false, true);
       compare_debug = 1;
     }