Commit 23cc1ace by Emmanuel Briot Committed by Arnaud Charlet

makeutl.adb (Compute_Builder_Switches): no longer accept a unit name as an index…

makeutl.adb (Compute_Builder_Switches): no longer accept a unit name as an index for Builder'Switches.

2011-08-04  Emmanuel Briot  <briot@adacore.com>

	* makeutl.adb (Compute_Builder_Switches): no longer accept a unit name
	as an index for Builder'Switches. This conforms to the documentation.
	* make.adb (Insert_Project_Sources): avoid duplicate code

From-SVN: r177375
parent cef14201
2011-08-04 Emmanuel Briot <briot@adacore.com> 2011-08-04 Emmanuel Briot <briot@adacore.com>
* makeutl.adb (Compute_Builder_Switches): no longer accept a unit name
as an index for Builder'Switches. This conforms to the documentation.
* make.adb (Insert_Project_Sources): avoid duplicate code
2011-08-04 Emmanuel Briot <briot@adacore.com>
* makeutl.adb (Complete_Mains): if the user has passed a relative file * makeutl.adb (Complete_Mains): if the user has passed a relative file
name on the command line (for instance "../dummy"), never assume it can name on the command line (for instance "../dummy"), never assume it can
be a unit name. be a unit name.
......
...@@ -5831,7 +5831,7 @@ package body Make is ...@@ -5831,7 +5831,7 @@ package body Make is
-- Get the first executable. -- Get the first executable.
-- ??? This needs to be done early, because Osint.Next_Main_File also -- ??? This needs to be done early, because Osint.Next_Main_File also
-- initializes the primary search directory, used below to initiliaze -- initializes the primary search directory, used below to initialize
-- the "-I" parameter -- the "-I" parameter
Main_Source_File := Next_Main_Source; -- No directory information Main_Source_File := Next_Main_Source; -- No directory information
...@@ -6610,41 +6610,6 @@ package body Make is ...@@ -6610,41 +6610,6 @@ package body Make is
Index : Int; Index : Int;
Project : Project_Id; Project : Project_Id;
Extending : constant Boolean := The_Project.Extends /= No_Project;
function Check_Project (P : Project_Id) return Boolean;
-- Returns True if P is The_Project or a project extended by The_Project
-------------------
-- Check_Project --
-------------------
function Check_Project (P : Project_Id) return Boolean is
begin
if All_Projects or else P = The_Project then
return True;
elsif Extending then
declare
Proj : Project_Id;
begin
Proj := The_Project;
while Proj /= null loop
if P = Proj.Extends then
return True;
end if;
Proj := Proj.Extends;
end loop;
end;
end if;
return False;
end Check_Project;
-- Start of processing for Insert_Project_Sources
begin begin
-- Loop through all the sources in the project files -- Loop through all the sources in the project files
...@@ -6662,7 +6627,10 @@ package body Make is ...@@ -6662,7 +6627,10 @@ package body Make is
then then
-- And it is a source for the specified project -- And it is a source for the specified project
if Check_Project (Unit.File_Names (Impl).Project) then if All_Projects
or else
Is_Extending (The_Project, Unit.File_Names (Impl).Project)
then
Project := Unit.File_Names (Impl).Project; Project := Unit.File_Names (Impl).Project;
-- If we don't have a spec, we cannot consider the source -- If we don't have a spec, we cannot consider the source
...@@ -6707,7 +6675,10 @@ package body Make is ...@@ -6707,7 +6675,10 @@ package body Make is
elsif Unit.File_Names (Spec) /= null elsif Unit.File_Names (Spec) /= null
and then not Unit.File_Names (Spec).Locally_Removed and then not Unit.File_Names (Spec).Locally_Removed
and then Check_Project (Unit.File_Names (Spec).Project) and then
(All_Projects
or else
Is_Extending (The_Project, Unit.File_Names (Spec).Project))
then then
-- If there is no source for the body, but there is one for the -- If there is no source for the body, but there is one for the
-- spec which has not been locally removed, then we take this one. -- spec which has not been locally removed, then we take this one.
......
...@@ -2988,21 +2988,6 @@ package body Makeutl is ...@@ -2988,21 +2988,6 @@ package body Makeutl is
Shared => Project_Tree.Shared, Shared => Project_Tree.Shared,
Force_Lower_Case_Index => False, Force_Lower_Case_Index => False,
Allow_Wildcards => True); Allow_Wildcards => True);
-- If not found, try without extension ???
-- That's because gnatmake accepts unit names in Switches
if Switches_For_Main = Nil_Variable_Value
and then Source.Unit /= null
then
Switches_For_Main := Value_Of
(Name => Source.Unit.Name,
Attribute_Or_Array_Name => Name_Switches,
In_Package => Builder_Package,
Shared => Project_Tree.Shared,
Force_Lower_Case_Index => False,
Allow_Wildcards => True);
end if;
end if; end if;
if Index = 1 then if Index = 1 then
...@@ -3084,8 +3069,8 @@ package body Makeutl is ...@@ -3084,8 +3069,8 @@ package body Makeutl is
if Switches_For_Lang /= Nil_Variable_Value then if Switches_For_Lang /= Nil_Variable_Value then
Write_Line Write_Line
("Warning: using Builder'Default_Switches" ("Warning: using Builder'Switches("""
& "(""" & Get_Name_String (Lang) & Get_Name_String (Lang)
& """), as there are several mains"); & """), as there are several mains");
elsif Other_Switches /= Nil_Variable_Value then elsif Other_Switches /= Nil_Variable_Value 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