diff mbox

Fix Ada bootstrap (canonical -I option form)

Message ID Pine.LNX.4.64.1009031301070.26960@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Sept. 3, 2010, 1:01 p.m. UTC
This patch fixes an Ada bootstrap issue caused by my options aliases
changes.  When gnat1 reconstitutes an argv array, it needs to generate
-I options in joined form for the sake of Ada-language code requiring
that form, and it is now possible for (ignored) options to have empty
canonical form (although this should only arise if gnat1 is called
directly with such an option or specs somehow generate such an
option).

Tested on i686-pc-linux-gnu to fix Ada-enabled bootstrap.  OK to
commit?

2010-09-03  Joseph Myers  <joseph@codesourcery.com>

	PR ada/45499
	* gcc-interface/misc.c (gnat_init_options): Allow options with
	empty canonical form.  Generate a single save_argv element from -I
	options.

Comments

Arnaud Charlet Sept. 3, 2010, 1:07 p.m. UTC | #1
> This patch fixes an Ada bootstrap issue caused by my options aliases
> changes.  When gnat1 reconstitutes an argv array, it needs to generate
> -I options in joined form for the sake of Ada-language code requiring
> that form, and it is now possible for (ignored) options to have empty
> canonical form (although this should only arise if gnat1 is called
> directly with such an option or specs somehow generate such an
> option).
> 
> Tested on i686-pc-linux-gnu to fix Ada-enabled bootstrap.  OK to
> commit?

OK, thanks.
diff mbox

Patch

Index: gcc/ada/gcc-interface/misc.c
===================================================================
--- gcc/ada/gcc-interface/misc.c	(revision 163785)
+++ gcc/ada/gcc-interface/misc.c	(working copy)
@@ -273,13 +273,24 @@  gnat_init_options (unsigned int decoded_
   for (i = 0; i < decoded_options_count; i++)
     {
       if (decoded_options[i].errors
-	  || decoded_options[i].opt_index == OPT_SPECIAL_unknown)
+	  || decoded_options[i].opt_index == OPT_SPECIAL_unknown
+	  || decoded_options[i].canonical_option_num_elements == 0)
 	continue;
-      gcc_assert (decoded_options[i].canonical_option_num_elements >= 1
-		  && decoded_options[i].canonical_option_num_elements <= 2);
-      save_argv[save_argc++] = decoded_options[i].canonical_option[0];
-      if (decoded_options[i].canonical_option_num_elements >= 2)
-	save_argv[save_argc++] = decoded_options[i].canonical_option[1];
+      if (decoded_options[i].opt_index == OPT_I)
+	{
+	  gcc_assert (decoded_options[i].canonical_option_num_elements == 2);
+	  save_argv[save_argc++]
+	    = concat (decoded_options[i].canonical_option[0],
+		      decoded_options[i].canonical_option[1], NULL);
+	}
+      else
+	{
+	  gcc_assert (decoded_options[i].canonical_option_num_elements >= 1
+		      && decoded_options[i].canonical_option_num_elements <= 2);
+	  save_argv[save_argc++] = decoded_options[i].canonical_option[0];
+	  if (decoded_options[i].canonical_option_num_elements >= 2)
+	    save_argv[save_argc++] = decoded_options[i].canonical_option[1];
+	}
     }
   save_argv[save_argc] = NULL;