summaryrefslogtreecommitdiff
path: root/gcc/ada/gnatcmd.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-03 09:36:24 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-03 09:36:24 +0000
commite25d6578ecf2d26418b86b597ff326de2e0244d0 (patch)
tree26be5ac589a2f9898be35b1657335ce04c95f003 /gcc/ada/gnatcmd.adb
parenta6320c6507e6e4491a47bc359082e9e1acc7f66d (diff)
downloadgcc-e25d6578ecf2d26418b86b597ff326de2e0244d0.tar.gz
2011-08-03 Emmanuel Briot <briot@adacore.com>
* gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb, prj-part.ads, switch-m.adb, switch-m.ads, prj-makr.adb, clean.adb, prj-pars.adb, prj-pars.ads, prj-conf.adb, prj-conf.ads, prj-tree.adb, prj-tree.ads (Prj.Tree.Environment): new type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177248 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r--gcc/ada/gnatcmd.adb51
1 files changed, 11 insertions, 40 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 09b95488a12..2f72c8d584c 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -58,6 +58,7 @@ with GNAT.OS_Lib; use GNAT.OS_Lib;
procedure GNATCmd is
Project_Node_Tree : Project_Node_Tree_Ref;
+ Root_Environment : Prj.Tree.Environment;
Project_File : String_Access;
Project : Prj.Project_Id;
Current_Verbosity : Prj.Verbosity := Prj.Default;
@@ -246,9 +247,6 @@ procedure GNATCmd is
-- Get the sources in the closure of the ASIS_Main and add them to the
-- list of arguments.
- function Index (Char : Character; Str : String) return Natural;
- -- Returns first occurrence of Char in Str, returns 0 if Char not in Str
-
procedure Non_VMS_Usage;
-- Display usage for platforms other than VMS
@@ -922,21 +920,6 @@ procedure GNATCmd is
end if;
end Get_Closure;
- -----------
- -- Index --
- -----------
-
- function Index (Char : Character; Str : String) return Natural is
- begin
- for Index in Str'Range loop
- if Str (Index) = Char then
- return Index;
- end if;
- end loop;
-
- return 0;
- end Index;
-
------------------
-- Mapping_File --
------------------
@@ -1364,10 +1347,11 @@ begin
Csets.Initialize;
Snames.Initialize;
- Project_Node_Tree := new Project_Node_Tree_Data;
+ Prj.Tree.Initialize (Root_Environment, Gnatmake_Flags);
Prj.Env.Initialize_Default_Project_Path
- (Project_Node_Tree.Project_Path, Target_Name => "");
+ (Root_Environment.Project_Path, Target_Name => "");
+ Project_Node_Tree := new Project_Node_Tree_Data;
Prj.Tree.Initialize (Project_Node_Tree);
Prj.Initialize (Project_Tree);
@@ -1725,7 +1709,7 @@ begin
and then Argv (Argv'First + 1 .. Argv'First + 2) = "aP"
then
Prj.Env.Add_Directories
- (Project_Node_Tree.Project_Path,
+ (Root_Environment.Project_Path,
Argv (Argv'First + 3 .. Argv'Last));
Remove_Switch (Arg_Num);
@@ -1813,25 +1797,12 @@ begin
elsif Argv'Length >= 5
and then Argv (Argv'First + 1) = 'X'
then
- declare
- Equal_Pos : constant Natural :=
- Index
- ('=',
- Argv (Argv'First + 2 .. Argv'Last));
- begin
- if Equal_Pos >= Argv'First + 3
- and then Equal_Pos /= Argv'Last
- then
- Add (Project_Node_Tree.External,
- External_Name =>
- Argv (Argv'First + 2 .. Equal_Pos - 1),
- Value => Argv (Equal_Pos + 1 .. Argv'Last));
- else
- Fail
- (Argv.all
+ if not Check (Root_Environment.External,
+ Argv (Argv'First + 2 .. Argv'Last))
+ then
+ Fail (Argv.all
& " is not a valid external assignment.");
- end if;
- end;
+ end if;
Remove_Switch (Arg_Num);
@@ -1884,7 +1855,7 @@ begin
In_Tree => Project_Tree,
In_Node_Tree => Project_Node_Tree,
Project_File_Name => Project_File.all,
- Flags => Gnatmake_Flags,
+ Env => Root_Environment,
Packages_To_Check => Packages_To_Check);
if Project = Prj.No_Project then