Commit b178461a by Robert Dewar Committed by Arnaud Charlet

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

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

	* mlib-prj.adb, prj-env.adb, prj-nmsc.adb, prj-proc.adb, make.adb,
	clean.adb: Minor reformatting.
	Minor code reorganization and message improvement.

From-SVN: r146732
parent e1c9f239
2009-04-24 Robert Dewar <dewar@adacore.com>
* mlib-prj.adb, prj-env.adb, prj-nmsc.adb, prj-proc.adb, make.adb,
clean.adb: Minor reformatting.
Minor code reorganization and message improvement.
2009-04-24 Emmanuel Briot <briot@adacore.com> 2009-04-24 Emmanuel Briot <briot@adacore.com>
* prj-proc.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-nmsc.ads * prj-proc.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-nmsc.ads
......
...@@ -1078,13 +1078,14 @@ package body Clean is ...@@ -1078,13 +1078,14 @@ package body Clean is
if All_Projects then if All_Projects then
declare declare
Imported : Project_List := Data.Imported_Projects; Imported : Project_List;
Process : Boolean; Process : Boolean;
begin begin
-- For each imported project, call Clean_Project if the project -- For each imported project, call Clean_Project if the project
-- has not been processed already. -- has not been processed already.
Imported := Data.Imported_Projects;
while Imported /= null loop while Imported /= null loop
Process := True; Process := True;
...@@ -1249,8 +1250,8 @@ package body Clean is ...@@ -1249,8 +1250,8 @@ package body Clean is
(Dir : String; (Dir : String;
Source : File_Name_Type) Source : File_Name_Type)
is is
Source_Name : constant String := Get_Name_String (Source); Source_Name : constant String := Get_Name_String (Source);
Current : constant String := Get_Current_Dir; Current : constant String := Get_Current_Dir;
Last : constant Positive := B_Start'Length + Source_Name'Length; Last : constant Positive := B_Start'Length + Source_Name'Length;
File_Name : String (1 .. Last + 4); File_Name : String (1 .. Last + 4);
...@@ -1415,8 +1416,8 @@ package body Clean is ...@@ -1415,8 +1416,8 @@ package body Clean is
end; end;
end if; end if;
-- If neither a project file nor an executable were specified, -- If neither a project file nor an executable were specified, output
-- output the usage and exit. -- the usage and exit.
if Main_Project = No_Project and then Osint.Number_Of_Files = 0 then if Main_Project = No_Project and then Osint.Number_Of_Files = 0 then
Usage; Usage;
...@@ -1443,8 +1444,8 @@ package body Clean is ...@@ -1443,8 +1444,8 @@ package body Clean is
Clean_Executables; Clean_Executables;
end if; end if;
-- In verbose mode, if Delete has not been called, indicate that -- In verbose mode, if Delete has not been called, indicate that no file
-- no file needs to be deleted. -- needs to be deleted.
if Verbose_Mode and (not File_Deleted) then if Verbose_Mode and (not File_Deleted) then
New_Line; New_Line;
...@@ -1889,8 +1890,7 @@ package body Clean is ...@@ -1889,8 +1890,7 @@ package body Clean is
Src : constant String := Get_Name_String (Source); Src : constant String := Get_Name_String (Source);
begin begin
-- If the source name has an extension, then replace it with -- If source name has an extension, then replace it with the tree suffix
-- the tree suffix.
for Index in reverse Src'First + 1 .. Src'Last loop for Index in reverse Src'First + 1 .. Src'Last loop
if Src (Index) = '.' then if Src (Index) = '.' then
......
...@@ -7136,8 +7136,7 @@ package body Make is ...@@ -7136,8 +7136,7 @@ package body Make is
Init_Q; Init_Q;
end if; end if;
-- And of course, we only insert in the Q if the source is not -- And of course, only insert in the Q if the source is not marked
-- marked.
if Sfile /= No_File and then not Is_Marked (Sfile, Index) then if Sfile /= No_File and then not Is_Marked (Sfile, Index) then
if Verbose_Mode then if Verbose_Mode then
...@@ -7253,8 +7252,8 @@ package body Make is ...@@ -7253,8 +7252,8 @@ package body Make is
Full_Lib_File : File_Name_Type) return Boolean Full_Lib_File : File_Name_Type) return Boolean
is is
begin begin
-- There is something to check only when using project files. -- There is something to check only when using project files. Otherwise,
-- Otherwise, this function returns True (last line of the function). -- this function returns True (last line of the function).
if Main_Project /= No_Project then if Main_Project /= No_Project then
declare declare
...@@ -7280,9 +7279,9 @@ package body Make is ...@@ -7280,9 +7279,9 @@ package body Make is
Path => Path_Name); Path => Path_Name);
Current_Verbosity := Saved_Verbosity; Current_Verbosity := Saved_Verbosity;
-- If this source is in a project, check that the ALI file is -- If this source is in a project, check that the ALI file is in
-- in its object directory. If it is not, return False, so that -- its object directory. If it is not, return False, so that the
-- the ALI file will not be skipped. -- ALI file will not be skipped.
if Project /= No_Project then if Project /= No_Project then
Data := Project_Tree.Projects.Table (Project); Data := Project_Tree.Projects.Table (Project);
...@@ -7548,10 +7547,9 @@ package body Make is ...@@ -7548,10 +7547,9 @@ package body Make is
Data.Depth := Depth; Data.Depth := Depth;
List := Data.Imported_Projects;
-- Visit each imported project -- Visit each imported project
List := Data.Imported_Projects;
while List /= null loop while List /= null loop
Proj := List.Project; Proj := List.Project;
List := List.Next; List := List.Next;
......
...@@ -679,7 +679,7 @@ package body MLib.Prj is ...@@ -679,7 +679,7 @@ package body MLib.Prj is
procedure Process_Project (Project : Project_Id) is procedure Process_Project (Project : Project_Id) is
Data : Project_Data := In_Tree.Projects.Table (Project); Data : Project_Data := In_Tree.Projects.Table (Project);
Imported : Project_List := Data.Imported_Projects; Imported : Project_List;
begin begin
-- Nothing to do if process has already been processed -- Nothing to do if process has already been processed
...@@ -691,6 +691,7 @@ package body MLib.Prj is ...@@ -691,6 +691,7 @@ package body MLib.Prj is
-- We first process the imported projects to guarantee that -- We first process the imported projects to guarantee that
-- we have a proper reverse order for the libraries. -- we have a proper reverse order for the libraries.
Imported := Data.Imported_Projects;
while Imported /= null loop while Imported /= null loop
if Imported.Project /= No_Project then if Imported.Project /= No_Project then
Process_Project (Imported.Project); Process_Project (Imported.Project);
...@@ -776,7 +777,6 @@ package body MLib.Prj is ...@@ -776,7 +777,6 @@ package body MLib.Prj is
end if; end if;
end if; end if;
end if; end if;
end if; end if;
end Process_Project; end Process_Project;
......
...@@ -549,7 +549,6 @@ package body Prj.Env is ...@@ -549,7 +549,6 @@ package body Prj.Env is
declare declare
Current : Project_List := Data.Imported_Projects; Current : Project_List := Data.Imported_Projects;
begin begin
while Current /= null loop while Current /= null loop
Check (Current.Project); Check (Current.Project);
......
...@@ -907,7 +907,6 @@ package body Prj.Nmsc is ...@@ -907,7 +907,6 @@ package body Prj.Nmsc is
or else Source.Language = Language; or else Source.Language = Language;
Alt_Lang := Source.Alternate_Languages; Alt_Lang := Source.Alternate_Languages;
while Alt_Lang /= null loop while Alt_Lang /= null loop
exit Source_Loop when Alt_Lang.Language = Language; exit Source_Loop when Alt_Lang.Language = Language;
Alt_Lang := Alt_Lang.Next; Alt_Lang := Alt_Lang.Next;
...@@ -5890,7 +5889,7 @@ package body Prj.Nmsc is ...@@ -5890,7 +5889,7 @@ package body Prj.Nmsc is
File_Name_Type (Object_Dir.Value); File_Name_Type (Object_Dir.Value);
Error_Msg Error_Msg
(Project, In_Tree, (Project, In_Tree,
"the object directory { cannot be found", "object directory { not found",
Data.Location); Data.Location);
end if; end if;
...@@ -5968,7 +5967,7 @@ package body Prj.Nmsc is ...@@ -5968,7 +5967,7 @@ package body Prj.Nmsc is
Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value); Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value);
Error_Msg Error_Msg
(Project, In_Tree, (Project, In_Tree,
"the exec directory { cannot be found", "exec directory { not found",
Data.Location); Data.Location);
end if; end if;
end if; end if;
...@@ -8607,7 +8606,7 @@ package body Prj.Nmsc is ...@@ -8607,7 +8606,7 @@ package body Prj.Nmsc is
Error_Msg Error_Msg
(Project, In_Tree, (Project, In_Tree,
"?source of spec of unit %% (%%)" & "?source of spec of unit %% (%%)" &
" cannot be found in this project", " not found in this project",
Location); Location);
end if; end if;
...@@ -8619,7 +8618,7 @@ package body Prj.Nmsc is ...@@ -8619,7 +8618,7 @@ package body Prj.Nmsc is
Error_Msg Error_Msg
(Project, In_Tree, (Project, In_Tree,
"?source of body of unit %% (%%)" & "?source of body of unit %% (%%)" &
" cannot be found in this project", " not found in this project",
Location); Location);
end if; end if;
end if; end if;
......
...@@ -63,6 +63,10 @@ package body Prj.Proc is ...@@ -63,6 +63,10 @@ package body Prj.Proc is
-- Concatenate two strings and returns another string if both -- Concatenate two strings and returns another string if both
-- arguments are not null string. -- arguments are not null string.
-- In the following procedures, we are expected to guess the meaning of
-- the parameters from their names, this is never a good idea, comments
-- should be added precisely defining every formal ???
procedure Add_Attributes procedure Add_Attributes
(Project : Project_Id; (Project : Project_Id;
Project_Name : Name_Id; Project_Name : Name_Id;
...@@ -71,8 +75,8 @@ package body Prj.Proc is ...@@ -71,8 +75,8 @@ package body Prj.Proc is
Decl : in out Declarations; Decl : in out Declarations;
First : Attribute_Node_Id; First : Attribute_Node_Id;
Project_Level : Boolean); Project_Level : Boolean);
-- Add all attributes, starting with First, with their default -- Add all attributes, starting with First, with their default values to
-- values to the package or project with declarations Decl. -- the package or project with declarations Decl.
procedure Check procedure Check
(In_Tree : Project_Tree_Ref; (In_Tree : Project_Tree_Ref;
...@@ -134,12 +138,12 @@ package body Prj.Proc is ...@@ -134,12 +138,12 @@ package body Prj.Proc is
From_Project_Node : Project_Node_Id; From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref; From_Project_Node_Tree : Project_Node_Tree_Ref;
Extended_By : Project_Id); Extended_By : Project_Id);
-- Process project with node From_Project_Node in the tree. -- Process project with node From_Project_Node in the tree. Do nothing if
-- Do nothing if From_Project_Node is Empty_Node. -- From_Project_Node is Empty_Node. If project has already been processed,
-- If project has already been processed, simply return its project id. -- simply return its project id. Otherwise create a new project id, mark it
-- Otherwise create a new project id, mark it as processed, call itself -- as processed, call itself recursively for all imported projects and a
-- recursively for all imported projects and a extended project, if any. -- extended project, if any. Then process the declarative items of the
-- Then process the declarative items of the project. -- project.
type Recursive_Check_Data is record type Recursive_Check_Data is record
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
...@@ -151,8 +155,8 @@ package body Prj.Proc is ...@@ -151,8 +155,8 @@ package body Prj.Proc is
-- Current_Dir is for optimization purposes, avoiding extra system calls. -- Current_Dir is for optimization purposes, avoiding extra system calls.
procedure Recursive_Check procedure Recursive_Check
(Project : Project_Id; (Project : Project_Id;
Data : in out Recursive_Check_Data); Data : in out Recursive_Check_Data);
-- Check_Naming_Scheme for the project -- Check_Naming_Scheme for the project
--------- ---------
...@@ -1608,12 +1612,12 @@ package body Prj.Proc is ...@@ -1608,12 +1612,12 @@ package body Prj.Proc is
if Orig_Array = No_Array then if Orig_Array = No_Array then
if Error_Report = null then if Error_Report = null then
Error_Msg Error_Msg
("associative array value cannot be found", ("associative array value not found",
Location_Of Location_Of
(Current_Item, From_Project_Node_Tree)); (Current_Item, From_Project_Node_Tree));
else else
Error_Report Error_Report
("associative array value cannot be found", ("associative array value not found",
Project, In_Tree); Project, In_Tree);
end if; end if;
...@@ -2469,8 +2473,8 @@ package body Prj.Proc is ...@@ -2469,8 +2473,8 @@ package body Prj.Proc is
--------------------- ---------------------
procedure Recursive_Check procedure Recursive_Check
(Project : Project_Id; (Project : Project_Id;
Data : in out Recursive_Check_Data) Data : in out Recursive_Check_Data)
is is
begin begin
if Verbose_Mode then if Verbose_Mode then
......
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