Patchwork [Ada] GNAT driver command line

login
register
mail settings
Submitter Arnaud Charlet
Date Sept. 10, 2010, 10:28 a.m.
Message ID <20100910102853.GA30488@adacore.com>
Download mbox | patch
Permalink /patch/64371/
State New
Headers show

Comments

Arnaud Charlet - Sept. 10, 2010, 10:28 a.m.
The GNAT driver put the command line it has been invoked with in
environment variable GNAT_DRIVER_COMMAND_LINE, so that the spawned tool
may know the way the GNAT driver was invoked. No visible change of
behavior, so no test.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-09-10  Vincent Celier  <celier@adacore.com>

	* gnatcmd.adb (GNATCmd): Put the command line in environment variable
	GNAT_DRIVER_COMMAND_LINE.

Patch

Index: gnatcmd.adb
===================================================================
--- gnatcmd.adb	(revision 164149)
+++ gnatcmd.adb	(working copy)
@@ -1349,6 +1349,19 @@ 
 
    Targparm.Get_Target_Parameters;
 
+   --  Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE,
+   --  so that the spawned tool may know the way the GNAT driver was invoked.
+
+   Name_Len := 0;
+   Add_Str_To_Name_Buffer (Command_Name);
+
+   for J in 1 .. Argument_Count loop
+      Add_Char_To_Name_Buffer (' ');
+      Add_Str_To_Name_Buffer (Argument (J));
+   end loop;
+
+   Setenv ("GNAT_DRIVER_COMMAND_LINE", Name_Buffer (1 .. Name_Len));
+
    --  Add the directory where the GNAT driver is invoked in front of the path,
    --  if the GNAT driver is invoked with directory information. Do not do this
    --  for VMS, where the notion of path does not really exist.