Commit 43ccd04b by Arnaud Charlet

[multiple changes]

2009-11-30  Emmanuel Briot  <briot@adacore.com>

	* prj.adb, prj.ads, prj-nmsc.adb (Has_Multi_Unit_Sources): New field in
	project_data.

2009-11-30  Vincent Celier  <celier@adacore.com>

	* osint.adb (Executable_Name): Correctly decide if the executable
	suffix should be added when Only_If_No_Suffix is True.

2009-11-30  Robert Dewar  <dewar@adacore.com>

	* frontend.adb, gnatlink.adb, prj-conf.adb, prj-tree.adb,
	prj-tree.ads: Minor reformatting

From-SVN: r154793
parent 82878151
2009-11-30 Emmanuel Briot <briot@adacore.com>
* prj.adb, prj.ads, prj-nmsc.adb (Has_Multi_Unit_Sources): New field in
project_data.
2009-11-30 Vincent Celier <celier@adacore.com>
* osint.adb (Executable_Name): Correctly decide if the executable
suffix should be added when Only_If_No_Suffix is True.
2009-11-30 Robert Dewar <dewar@adacore.com>
* frontend.adb, gnatlink.adb, prj-conf.adb, prj-tree.adb,
prj-tree.ads: Minor reformatting
2009-11-30 Vincent Celier <celier@adacore.com> 2009-11-30 Vincent Celier <celier@adacore.com>
* gnatlink.adb (Process_Args): Call Executable_Name on argument of -o * gnatlink.adb (Process_Args): Call Executable_Name on argument of -o
......
...@@ -400,6 +400,7 @@ begin ...@@ -400,6 +400,7 @@ begin
then then
Initialize_Scalars := True; Initialize_Scalars := True;
end if; end if;
Next (Item); Next (Item);
end loop; end loop;
end; end;
......
...@@ -813,12 +813,16 @@ package body Osint is ...@@ -813,12 +813,16 @@ package body Osint is
end if; end if;
if Exec_Suffix'Length /= 0 then if Exec_Suffix'Length /= 0 then
Add_Suffix := not Only_If_No_Suffix;
if not Add_Suffix then
for J in 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Add_Suffix := True; Add_Suffix := True;
if Only_If_No_Suffix then
for J in reverse 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Add_Suffix := False;
exit;
elsif Name_Buffer (J) = '/' or else
Name_Buffer (J) = Directory_Separator
then
exit; exit;
end if; end if;
end loop; end loop;
...@@ -875,25 +879,34 @@ package body Osint is ...@@ -875,25 +879,34 @@ package body Osint is
Exec_Suffix := new String'(Name_Buffer (1 .. Name_Len)); Exec_Suffix := new String'(Name_Buffer (1 .. Name_Len));
end if; end if;
if Exec_Suffix'Length = 0 then
Free (Exec_Suffix);
return Name;
else
declare declare
Suffix : constant String := Exec_Suffix.all; Suffix : constant String := Exec_Suffix.all;
begin begin
Free (Exec_Suffix); Free (Exec_Suffix);
Canonical_Case_File_Name (Canonical_Name); Canonical_Case_File_Name (Canonical_Name);
Add_Suffix := not Only_If_No_Suffix;
if not Add_Suffix then
for J in 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Add_Suffix := True; Add_Suffix := True;
if Only_If_No_Suffix then
for J in reverse 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Add_Suffix := False;
exit;
elsif Name_Buffer (J) = '/' or else
Name_Buffer (J) = Directory_Separator
then
exit; exit;
end if; end if;
end loop; end loop;
end if; end if;
if Suffix'Length = 0 and then if Add_Suffix and then
Add_Suffix and then
(Canonical_Name'Length <= Suffix'Length (Canonical_Name'Length <= Suffix'Length
or else Canonical_Name (Canonical_Name'Last - Suffix'Length + 1 or else Canonical_Name (Canonical_Name'Last - Suffix'Length + 1
.. Canonical_Name'Last) /= Suffix) .. Canonical_Name'Last) /= Suffix)
...@@ -909,6 +922,7 @@ package body Osint is ...@@ -909,6 +922,7 @@ package body Osint is
return Name; return Name;
end if; end if;
end; end;
end if;
end Executable_Name; end Executable_Name;
----------------------- -----------------------
......
...@@ -1189,9 +1189,11 @@ package body Prj.Conf is ...@@ -1189,9 +1189,11 @@ package body Prj.Conf is
Pkg : Project_Node_Id := Empty_Node) Pkg : Project_Node_Id := Empty_Node)
is is
Attr : Project_Node_Id; Attr : Project_Node_Id;
Val, Expr : Name_Id := No_Name;
Parent : Project_Node_Id := Config_File;
pragma Unreferenced (Attr); pragma Unreferenced (Attr);
Expr : Name_Id := No_Name;
Val : Name_Id := No_Name;
Parent : Project_Node_Id := Config_File;
begin begin
if Index /= "" then if Index /= "" then
Name_Len := Index'Length; Name_Len := Index'Length;
...@@ -1216,6 +1218,8 @@ package body Prj.Conf is ...@@ -1216,6 +1218,8 @@ package body Prj.Conf is
Value => Create_Literal_String (Expr, Project_Tree)); Value => Create_Literal_String (Expr, Project_Tree));
end Create_Attribute; end Create_Attribute;
-- Local variables
Name : Name_Id; Name : Name_Id;
Naming : Project_Node_Id; Naming : Project_Node_Id;
......
...@@ -777,6 +777,10 @@ package body Prj.Nmsc is ...@@ -777,6 +777,10 @@ package body Prj.Nmsc is
Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, Path.Name, Id); Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, Path.Name, Id);
end if; end if;
if Index /= 0 then
Project.Has_Multi_Unit_Sources := True;
end if;
-- Add the source to the language list -- Add the source to the language list
Id.Next_In_Lang := Lang_Id.First_Source; Id.Next_In_Lang := Lang_Id.First_Source;
......
...@@ -3083,15 +3083,17 @@ package body Prj.Tree is ...@@ -3083,15 +3083,17 @@ package body Prj.Tree is
Optional_Index_Case_Insensitive_Associative_Array Optional_Index_Case_Insensitive_Associative_Array
then then
-- Results in: for Name ("index" at index) use "value"; -- Results in: for Name ("index" at index) use "value";
-- This is currently only used for executables -- This is currently only used for executables.
Set_Source_Index_Of (Node, Tree, To => Int (At_Index)); Set_Source_Index_Of (Node, Tree, To => Int (At_Index));
else else
-- Results in: for Name ("index") use "value" at index; -- Results in: for Name ("index") use "value" at index;
-- ??? This limitation makes no sense, we should be able to -- ??? This limitation makes no sense, we should be able to
-- set the source index on an expression -- set the source index on an expression.
pragma Assert (Kind_Of (Value, Tree) = N_Literal_String);
pragma Assert (Kind_Of (Value, Tree) = N_Literal_String);
Set_Source_Index_Of (Value, Tree, To => Int (At_Index)); Set_Source_Index_Of (Value, Tree, To => Int (At_Index));
end if; end if;
end if; end if;
......
...@@ -624,14 +624,15 @@ package Prj.Tree is ...@@ -624,14 +624,15 @@ package Prj.Tree is
-- Empty_Node. If Index_Name is not "", then if creates an attribute value -- Empty_Node. If Index_Name is not "", then if creates an attribute value
-- for a specific index. At_Index is used for the " at <idx>" in the naming -- for a specific index. At_Index is used for the " at <idx>" in the naming
-- exceptions. -- exceptions.
-- To set the value of the attribute, either provide a value for --
-- Value, or use Set_Expression_Of to set the value of the attribute -- To set the value of the attribute, either provide a value for Value, or
-- (in which case Enclose_In_Expression might be useful). The former is -- use Set_Expression_Of to set the value of the attribute (in which case
-- recommended since it will more correctly handle cases where the index -- Enclose_In_Expression might be useful). The former is recommended since
-- needs to be set on the expression rather than on the index of the -- it will more correctly handle cases where the index needs to be set on
-- attribute ('for Specification ("unit") use "file" at 3', versus -- the expression rather than on the index of the attribute (i.e. 'for
-- 'for Executable ("file" at 3) use "name"'). Value must be a -- Specification ("unit") use "file" at 3', versus 'for Executable ("file"
-- N_String_Literal if an index will be added to it -- at 3) use "name"'). Value must be a N_String_Literal if an index will be
-- added to it.
function Create_Literal_String function Create_Literal_String
(Str : Namet.Name_Id; (Str : Namet.Name_Id;
...@@ -657,7 +658,7 @@ package Prj.Tree is ...@@ -657,7 +658,7 @@ package Prj.Tree is
(Node : Project_Node_Id; (Node : Project_Node_Id;
Tree : Project_Node_Tree_Ref) return Project_Node_Id; Tree : Project_Node_Tree_Ref) return Project_Node_Id;
-- Enclose the Node inside a N_Expression node, and return this expression. -- Enclose the Node inside a N_Expression node, and return this expression.
-- This does nothing if Node is already a N_Expression -- This does nothing if Node is already a N_Expression.
-------------------- --------------------
-- Set Procedures -- -- Set Procedures --
......
...@@ -23,9 +23,6 @@ ...@@ -23,9 +23,6 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Unchecked_Deallocation;
with Debug; with Debug;
with Osint; use Osint; with Osint; use Osint;
with Output; use Output; with Output; use Output;
...@@ -34,6 +31,9 @@ with Prj.Err; use Prj.Err; ...@@ -34,6 +31,9 @@ with Prj.Err; use Prj.Err;
with Snames; use Snames; with Snames; use Snames;
with Uintp; use Uintp; with Uintp; use Uintp;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Unchecked_Deallocation;
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with System.Case_Util; use System.Case_Util; with System.Case_Util; use System.Case_Util;
...@@ -107,6 +107,7 @@ package body Prj is ...@@ -107,6 +107,7 @@ package body Prj is
Config_File_Temp => False, Config_File_Temp => False,
Config_Checked => False, Config_Checked => False,
Need_To_Build_Lib => False, Need_To_Build_Lib => False,
Has_Multi_Unit_Sources => False,
Depth => 0, Depth => 0,
Unkept_Comments => False); Unkept_Comments => False);
......
...@@ -1207,6 +1207,9 @@ package Prj is ...@@ -1207,6 +1207,9 @@ package Prj is
-- use this field directly outside of the project manager, use -- use this field directly outside of the project manager, use
-- Prj.Env.Ada_Include_Path instead. -- Prj.Env.Ada_Include_Path instead.
Has_Multi_Unit_Sources : Boolean := False;
-- Whether there is at least one source file containing multiple units
------------------- -------------------
-- Miscellaneous -- -- Miscellaneous --
------------------- -------------------
......
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