Commit 132410cb by Robert Dewar Committed by Arnaud Charlet

mlib-prj.adb, [...]: Minor reformatting Minor code reorganization

2009-04-29  Robert Dewar  <dewar@adacore.com>

	* mlib-prj.adb, mlib-tgt.adb, mlib-tgt.ads, prj-nmsc.adb,
	prj-proc.adb: Minor reformatting
	Minor code reorganization

From-SVN: r146933
parent 9d8a2a07
2009-04-29 Robert Dewar <dewar@adacore.com>
* mlib-prj.adb, mlib-tgt.adb, mlib-tgt.ads, prj-nmsc.adb,
prj-proc.adb: Minor reformatting
Minor code reorganization
2009-04-29 Bob Duff <duff@adacore.com> 2009-04-29 Bob Duff <duff@adacore.com>
* exp_ch7.adb (Build_Final_List): For an access type that designates a * exp_ch7.adb (Build_Final_List): For an access type that designates a
......
...@@ -480,8 +480,10 @@ package body MLib.Prj is ...@@ -480,8 +480,10 @@ package body MLib.Prj is
elsif P /= No_Project then elsif P /= No_Project then
declare declare
Proj : Project_Id := For_Project; Proj : Project_Id;
begin begin
Proj := For_Project;
while Proj.Extends /= No_Project loop while Proj.Extends /= No_Project loop
if P = Proj.Extends then if P = Proj.Extends then
return True; return True;
...@@ -518,12 +520,12 @@ package body MLib.Prj is ...@@ -518,12 +520,12 @@ package body MLib.Prj is
Lib_File := Name_Find; Lib_File := Name_Find;
Text := Read_Library_Info (Lib_File, True); Text := Read_Library_Info (Lib_File, True);
Id := ALI.Scan_ALI Id := ALI.Scan_ALI
(F => Lib_File, (F => Lib_File,
T => Text, T => Text,
Ignore_ED => False, Ignore_ED => False,
Err => True, Err => True,
Read_Lines => "D"); Read_Lines => "D");
Free (Text); Free (Text);
-- Look for s-osinte.ads in the dependencies -- Look for s-osinte.ads in the dependencies
...@@ -2069,7 +2071,7 @@ package body MLib.Prj is ...@@ -2069,7 +2071,7 @@ package body MLib.Prj is
if For_Project.Library then if For_Project.Library then
declare declare
Lib_Name : constant File_Name_Type := Lib_Name : constant File_Name_Type :=
Library_File_Name_For (For_Project, In_Tree); Library_File_Name_For (For_Project, In_Tree);
begin begin
Change_Dir (Get_Name_String (For_Project.Library_Dir.Name)); Change_Dir (Get_Name_String (For_Project.Library_Dir.Name));
Lib_TS := File_Stamp (Lib_Name); Lib_TS := File_Stamp (Lib_Name);
......
...@@ -317,7 +317,8 @@ package body MLib.Tgt is ...@@ -317,7 +317,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
return Library_Exists_For_Ptr (Project, In_Tree); return Library_Exists_For_Ptr (Project, In_Tree);
...@@ -328,9 +329,11 @@ package body MLib.Tgt is ...@@ -328,9 +329,11 @@ package body MLib.Tgt is
-------------------------------- --------------------------------
function Library_Exists_For_Default function Library_Exists_For_Default
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
pragma Unreferenced (In_Tree); pragma Unreferenced (In_Tree);
begin begin
if not Project.Library then if not Project.Library then
Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " & Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2008, AdaCore -- -- Copyright (C) 2001-2009, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -140,7 +140,8 @@ package MLib.Tgt is ...@@ -140,7 +140,8 @@ package MLib.Tgt is
-- are ignored. -- are ignored.
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean; (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean;
-- Return True if the library file for a library project already exists. -- Return True if the library file for a library project already exists.
-- This function can only be called for library projects. -- This function can only be called for library projects.
...@@ -166,6 +167,7 @@ private ...@@ -166,6 +167,7 @@ private
type Is_Ext_Function is access function (Ext : String) return Boolean; type Is_Ext_Function is access function (Ext : String) return Boolean;
type String_List_Access_Function is access function type String_List_Access_Function is access function
return String_List_Access; return String_List_Access;
type Build_Dynamic_Library_Function is access procedure type Build_Dynamic_Library_Function is access procedure
(Ofiles : Argument_List; (Ofiles : Argument_List;
Options : Argument_List; Options : Argument_List;
...@@ -176,11 +178,15 @@ private ...@@ -176,11 +178,15 @@ private
Driver_Name : Name_Id := No_Name; Driver_Name : Name_Id := No_Name;
Lib_Version : String := ""; Lib_Version : String := "";
Auto_Init : Boolean := False); Auto_Init : Boolean := False);
type Library_Exists_For_Function is access function type Library_Exists_For_Function is access function
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean; (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean;
type Library_File_Name_For_Function is access function type Library_File_Name_For_Function is access function
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref) return File_Name_Type; In_Tree : Project_Tree_Ref) return File_Name_Type;
type Boolean_Function is access function return Boolean; type Boolean_Function is access function return Boolean;
type Library_Support_Function is access function return Library_Support; type Library_Support_Function is access function return Library_Support;
...@@ -233,12 +239,14 @@ private ...@@ -233,12 +239,14 @@ private
Libgnat_Ptr : String_Function := Libgnat_Default'Access; Libgnat_Ptr : String_Function := Libgnat_Default'Access;
function Library_Exists_For_Default function Library_Exists_For_Default
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean; (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean;
Library_Exists_For_Ptr : Library_Exists_For_Function := Library_Exists_For_Ptr : Library_Exists_For_Function :=
Library_Exists_For_Default'Access; Library_Exists_For_Default'Access;
function Library_File_Name_For_Default function Library_File_Name_For_Default
(Project : Project_Id; In_Tree : Project_Tree_Ref) return File_Name_Type; (Project : Project_Id;
In_Tree : Project_Tree_Ref) return File_Name_Type;
Library_File_Name_For_Ptr : Library_File_Name_For_Function := Library_File_Name_For_Ptr : Library_File_Name_For_Function :=
Library_File_Name_For_Default'Access; Library_File_Name_For_Default'Access;
......
...@@ -3147,7 +3147,7 @@ package body Prj.Nmsc is ...@@ -3147,7 +3147,7 @@ package body Prj.Nmsc is
-- Check Body_Suffix -- Check Body_Suffix
if Is_Illegal_Suffix if Is_Illegal_Suffix
(Body_Suffix, Project.Naming.Dot_Replacement) (Body_Suffix, Project.Naming.Dot_Replacement)
then then
Err_Vars.Error_Msg_File_1 := Body_Suffix; Err_Vars.Error_Msg_File_1 := Body_Suffix;
Error_Msg Error_Msg
...@@ -3468,6 +3468,7 @@ package body Prj.Nmsc is ...@@ -3468,6 +3468,7 @@ package body Prj.Nmsc is
-- Special case of extending project -- Special case of extending project
if Project.Extends /= No_Project then if Project.Extends /= No_Project then
-- If the project extended is a library project, we inherit the -- If the project extended is a library project, we inherit the
-- library name, if it is not redefined; we check that the library -- library name, if it is not redefined; we check that the library
-- directory is specified. -- directory is specified.
...@@ -3686,7 +3687,7 @@ package body Prj.Nmsc is ...@@ -3686,7 +3687,7 @@ package body Prj.Nmsc is
Project.Library := Project.Library :=
Project.Library_Dir /= No_Path_Information Project.Library_Dir /= No_Path_Information
and then Project.Library_Name /= No_Name; and then Project.Library_Name /= No_Name;
if Project.Extends = No_Project then if Project.Extends = No_Project then
case Project.Qualifier is case Project.Qualifier is
...@@ -3741,6 +3742,7 @@ package body Prj.Nmsc is ...@@ -3741,6 +3742,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line ("No library ALI directory specified"); Write_Line ("No library ALI directory specified");
end if; end if;
Project.Library_ALI_Dir := Project.Library_Dir; Project.Library_ALI_Dir := Project.Library_Dir;
else else
...@@ -5763,11 +5765,11 @@ package body Prj.Nmsc is ...@@ -5763,11 +5765,11 @@ package body Prj.Nmsc is
else else
-- Remove source dir, if present -- Remove source dir, if present
List := Project.Source_Dirs;
Prev := Nil_String; Prev := Nil_String;
-- Look for source dir in current list -- Look for source dir in current list
List := Project.Source_Dirs;
while List /= Nil_String loop while List /= Nil_String loop
Element := In_Tree.String_Elements.Table (List); Element := In_Tree.String_Elements.Table (List);
exit when Element.Value = Path_Id; exit when Element.Value = Path_Id;
...@@ -5807,13 +5809,12 @@ package body Prj.Nmsc is ...@@ -5807,13 +5809,12 @@ package body Prj.Nmsc is
if (((not Source_Files.Default) if (((not Source_Files.Default)
and then Source_Files.Values = Nil_String) and then Source_Files.Values = Nil_String)
or else or else
((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String) ((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String)
or else or else
((not Languages.Default) and then Languages.Values = Nil_String)) ((not Languages.Default) and then Languages.Values = Nil_String))
and then Project.Extends = No_Project and then Project.Extends = No_Project
then then
Project.Object_Directory := No_Path_Information; Project.Object_Directory := No_Path_Information;
else else
Project.Object_Directory := Project.Directory; Project.Object_Directory := Project.Directory;
end if; end if;
...@@ -8208,7 +8209,7 @@ package body Prj.Nmsc is ...@@ -8208,7 +8209,7 @@ package body Prj.Nmsc is
and then UData.File_Names (Unit_Kind).Path.Name = Slash) and then UData.File_Names (Unit_Kind).Path.Name = Slash)
or else UData.File_Names (Unit_Kind).Name = No_File or else UData.File_Names (Unit_Kind).Name = No_File
or else Is_Extending or else Is_Extending
(Project.Extends, UData.File_Names (Unit_Kind).Project) (Project.Extends, UData.File_Names (Unit_Kind).Project)
then then
if UData.File_Names (Unit_Kind).Path.Name = Slash then if UData.File_Names (Unit_Kind).Path.Name = Slash then
Remove_Forbidden_File_Name Remove_Forbidden_File_Name
......
...@@ -1164,9 +1164,10 @@ package body Prj.Proc is ...@@ -1164,9 +1164,10 @@ package body Prj.Proc is
-- if the project is not imported directly. -- if the project is not imported directly.
declare declare
Proj : Project_Id := Result.Extends; Proj : Project_Id;
begin begin
Proj := Result.Extends;
while Proj /= No_Project loop while Proj /= No_Project loop
if Proj.Name = With_Name then if Proj.Name = With_Name then
Temp_Result := Result; Temp_Result := Result;
...@@ -1571,8 +1572,7 @@ package body Prj.Proc is ...@@ -1571,8 +1572,7 @@ package body Prj.Proc is
end loop; end loop;
Orig_Array := Orig_Array :=
In_Tree.Packages.Table In_Tree.Packages.Table (Orig_Package).Decl.Arrays;
(Orig_Package).Decl.Arrays;
end if; end if;
-- Now look for the array -- Now look for the array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment