Commit 3c2815d8 by Robert Dewar Committed by Arnaud Charlet

opt.ads, [...]: Minor reformatting

2009-07-13  Robert Dewar  <dewar@adacore.com>

	* opt.ads, prj-conf.adb, prj-env.adb, prj-ext.adb, prj-nmsc.adb,
	prj-proc.adb, prj-tree.adb, prj-tree.ads: Minor reformatting

From-SVN: r149570
parent 197e4514
2009-07-13 Robert Dewar <dewar@adacore.com>
* opt.ads, prj-conf.adb, prj-env.adb, prj-ext.adb, prj-nmsc.adb,
prj-proc.adb, prj-tree.adb, prj-tree.ads: Minor reformatting
2009-07-13 Emmanuel Briot <briot@adacore.com> 2009-07-13 Emmanuel Briot <briot@adacore.com>
* prj.adb, prj.ads, prj-env.adb, prj-conf.adb, prj-tree.adb, * prj.adb, prj.ads, prj-env.adb, prj-conf.adb, prj-tree.adb,
......
...@@ -640,10 +640,9 @@ package Opt is ...@@ -640,10 +640,9 @@ package Opt is
Inspector_Mode : Boolean renames Debug.Debug_Flag_Dot_II; Inspector_Mode : Boolean renames Debug.Debug_Flag_Dot_II;
-- GNAT -- GNAT
-- Set True to activate Inspector mode (-gnatd.I switch). In particular -- Set True to activate Inspector mode (-gnatd.I switch). In particular
-- this enables SCIL generation. -- this enables SCIL generation. When VM_Target /= None, the compiler will
-- When VM_Target /= None, the compiler will also attempt to -- also attempt to generate code even in case of unsupported construct
-- generate code even in case of unsupported construct instead of -- instead of displaying an error.
-- displaying an error.
Invalid_Value_Used : Boolean := False; Invalid_Value_Used : Boolean := False;
-- GNAT -- GNAT
...@@ -651,17 +650,17 @@ package Opt is ...@@ -651,17 +650,17 @@ package Opt is
Follow_Links_For_Files : Boolean := False; Follow_Links_For_Files : Boolean := False;
-- PROJECT MANAGER -- PROJECT MANAGER
-- Set to True (-eL) to process the project files in trusted mode. -- Set to True (-eL) to process the project files in trusted mode. If
-- If Follow_Links is False, it is assumed that the project doesn't contain -- Follow_Links is False, it is assumed that the project doesn't contain
-- any file duplicated through symbolic links (although the latter are -- any file duplicated through symbolic links (although the latter are
-- still valid if they point to a file which is outside of the project), -- still valid if they point to a file which is outside of the project),
-- and that no directory has a name which is a valid source name. -- and that no directory has a name which is a valid source name.
Follow_Links_For_Dirs : Boolean := True; Follow_Links_For_Dirs : Boolean := True;
-- PROJECT MANAGER -- PROJECT MANAGER
-- Whether directories can be links in this project, and therefore -- Set to True if directories can be links in this project, and therefore
-- additional system calls should be performed to ensure we always see the -- additional system calls must be performed to ensure that we always see
-- same full name for each directory. -- the same full name for each directory.
Front_End_Inlining : Boolean := False; Front_End_Inlining : Boolean := False;
-- GNAT -- GNAT
...@@ -669,9 +668,9 @@ package Opt is ...@@ -669,9 +668,9 @@ package Opt is
Inline_Processing_Required : Boolean := False; Inline_Processing_Required : Boolean := False;
-- GNAT -- GNAT
-- Set True if inline processing is required. Inline processing is -- Set True if inline processing is required. Inline processing is required
-- required if an active Inline pragma is processed. The flag is set -- if an active Inline pragma is processed. The flag is set for a pragma
-- for a pragma Inline or Inline_Always that is actually active. -- Inline or Inline_Always that is actually active.
In_Place_Mode : Boolean := False; In_Place_Mode : Boolean := False;
-- GNATMAKE -- GNATMAKE
...@@ -681,8 +680,8 @@ package Opt is ...@@ -681,8 +680,8 @@ package Opt is
Keep_Going : Boolean := False; Keep_Going : Boolean := False;
-- GNATMAKE, GPRMAKE, GPRBUILD -- GNATMAKE, GPRMAKE, GPRBUILD
-- When True signals to ignore compilation errors and keep -- When True signals to ignore compilation errors and keep processing
-- processing sources until there is no more work. -- sources until there is no more work.
Keep_Temporary_Files : Boolean := False; Keep_Temporary_Files : Boolean := False;
-- GNATCMD -- GNATCMD
...@@ -696,8 +695,8 @@ package Opt is ...@@ -696,8 +695,8 @@ package Opt is
Link_Only : Boolean := False; Link_Only : Boolean := False;
-- GNATMAKE, GPRMAKE, GPRBUILD -- GNATMAKE, GPRMAKE, GPRBUILD
-- Set to True to skip compile and bind steps -- Set to True to skip compile and bind steps (except when Bind_Only is
-- (except when Bind_Only is set to True). -- set to True).
List_Restrictions : Boolean := False; List_Restrictions : Boolean := False;
-- GNATBIND -- GNATBIND
...@@ -730,21 +729,21 @@ package Opt is ...@@ -730,21 +729,21 @@ package Opt is
List_Representation_Info_To_File : Boolean := False; List_Representation_Info_To_File : Boolean := False;
-- GNAT -- GNAT
-- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3 -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3 to be
-- to be written to file.rep (where file is the name of the source -- written to file.rep (where file is the name of the source file) instead
-- file) instead of stdout. For example, if file x.adb is compiled -- of stdout. For example, if file x.adb is compiled using -gnatR2s then
-- using -gnatR2s then representation info is written to x.adb.ref. -- representation info is written to x.adb.ref.
List_Representation_Info_Mechanisms : Boolean := False; List_Representation_Info_Mechanisms : Boolean := False;
-- GNAT -- GNAT
-- Set true by -gnatRm switch. Causes information on mechanisms to -- Set true by -gnatRm switch. Causes information on mechanisms to be
-- be included in the representation output information. -- included in the representation output information.
List_Preprocessing_Symbols : Boolean := False; List_Preprocessing_Symbols : Boolean := False;
-- GNAT, GNATPREP -- GNAT, GNATPREP
-- Set to True if symbols for preprocessing a source are to be listed -- Set to True if symbols for preprocessing a source are to be listed
-- before preprocessing occurs. Set to True by switch -s of gnatprep -- before preprocessing occurs. Set to True by switch -s of gnatprep or
-- or -s in preprocessing data file for the compiler. -- -s in preprocessing data file for the compiler.
type Create_Repinfo_File_Proc is access procedure (Src : String); type Create_Repinfo_File_Proc is access procedure (Src : String);
type Write_Repinfo_Line_Proc is access procedure (Info : String); type Write_Repinfo_Line_Proc is access procedure (Info : String);
...@@ -755,12 +754,11 @@ package Opt is ...@@ -755,12 +754,11 @@ package Opt is
Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null; Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null; Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
-- GNAT -- GNAT
-- These three locations are left null when operating in non-compiler -- These three locations are left null when operating in non-compiler (e.g.
-- (e.g. ASIS mode), but when operating in compiler mode, they are -- ASIS mode), but when operating in compiler mode, they are set to point
-- set to point to the three corresponding procedures in Osint-C. The -- to the three corresponding procedures in Osint-C. The reason for this
-- reason for this slightly strange interface is to prevent Repinfo -- slightly strange interface is to stop Repinfo from dragging in Osint in
-- from dragging in Osint in ASIS mode, which would include a lot of -- ASIS mode, which would include lots of unwanted units in the ASIS build.
-- unwanted units in the ASIS build.
type Create_List_File_Proc is access procedure (S : String); type Create_List_File_Proc is access procedure (S : String);
type Write_List_Info_Proc is access procedure (S : String); type Write_List_Info_Proc is access procedure (S : String);
...@@ -776,25 +774,25 @@ package Opt is ...@@ -776,25 +774,25 @@ package Opt is
-- set to point to the three corresponding procedures in Osint-C. The -- set to point to the three corresponding procedures in Osint-C. The
-- reason for this slightly strange interface is to prevent Repinfo -- reason for this slightly strange interface is to prevent Repinfo
-- from dragging in Osint-C in the binder, which would include unwanted -- from dragging in Osint-C in the binder, which would include unwanted
-- units in the binder. -- units in the binder.
Locking_Policy : Character := ' '; Locking_Policy : Character := ' ';
-- GNAT, GNATBIND -- GNAT, GNATBIND
-- Set to ' ' for the default case (no locking policy specified). -- Set to ' ' for the default case (no locking policy specified). Reset to
-- Reset to first character (uppercase) of locking policy name if a -- first character (uppercase) of locking policy name if a valid pragma
-- valid pragma Locking_Policy is encountered. -- Locking_Policy is encountered.
Locking_Policy_Sloc : Source_Ptr := No_Location; Locking_Policy_Sloc : Source_Ptr := No_Location;
-- GNAT, GNATBIND -- GNAT, GNATBIND
-- Remember location of previous Locking_Policy pragma. This is used -- Remember location of previous Locking_Policy pragma. This is used for
-- for inconsistency error messages. A value of System_Location is -- inconsistency error messages. A value of System_Location is used if the
-- used if the policy is set in package System. -- policy is set in package System.
Look_In_Primary_Dir : Boolean := True; Look_In_Primary_Dir : Boolean := True;
-- GNAT, GNATBIND, GNATMAKE, GNATCLEAN -- GNAT, GNATBIND, GNATMAKE, GNATCLEAN
-- Set to False if a -I- was present on the command line. -- Set to False if a -I- was present on the command line. When True we are
-- When True we are allowed to look in the primary directory to locate -- allowed to look in the primary directory to locate other source or
-- other source or library files. -- library files.
Make_Steps : Boolean := False; Make_Steps : Boolean := False;
-- GNATMAKE -- GNATMAKE
...@@ -902,9 +900,9 @@ package Opt is ...@@ -902,9 +900,9 @@ package Opt is
Original_Operating_Mode : Operating_Mode_Type := Generate_Code; Original_Operating_Mode : Operating_Mode_Type := Generate_Code;
-- GNAT -- GNAT
-- Indicates the original operating mode of the compiler as set by -- Indicates the original operating mode of the compiler as set by compiler
-- compiler options. This is identical to Operating_Mode except that -- options. This is identical to Operating_Mode except that this is not
-- this is not affected by errors. -- affected by errors.
Optimization_Level : Int; Optimization_Level : Int;
pragma Import (C, Optimization_Level, "optimize"); pragma Import (C, Optimization_Level, "optimize");
...@@ -934,7 +932,7 @@ package Opt is ...@@ -934,7 +932,7 @@ package Opt is
Overflow_Checks_Unsuppressed : Boolean := False; Overflow_Checks_Unsuppressed : Boolean := False;
-- GNAT -- GNAT
-- Set to True if at least one pragma Unsuppress -- Set to True if at least one occurrence of pragma Unsuppress
-- (All_Checks|Overflow_Checks) has been processed. -- (All_Checks|Overflow_Checks) has been processed.
Persistent_BSS_Mode : Boolean := False; Persistent_BSS_Mode : Boolean := False;
...@@ -974,20 +972,20 @@ package Opt is ...@@ -974,20 +972,20 @@ package Opt is
type Usage is (Unknown, Not_In_Use, In_Use); type Usage is (Unknown, Not_In_Use, In_Use);
Project_File_In_Use : Usage := Unknown; Project_File_In_Use : Usage := Unknown;
-- GNAT -- GNAT
-- Indicates if a project file is used or not. -- Indicates if a project file is used or not. Set to In_Use by the first
-- Set to In_Use by the first SFNP pragma. -- SFNP pragma.
Queuing_Policy : Character := ' '; Queuing_Policy : Character := ' ';
-- GNAT, GNATBIND -- GNAT, GNATBIND
-- Set to ' ' for the default case (no queuing policy specified). -- Set to ' ' for the default case (no queuing policy specified). Reset to
-- Reset to first character (uppercase) of locking policy name if a valid -- first character (uppercase) of locking policy name if a valid
-- Queuing_Policy pragma is encountered. -- Queuing_Policy pragma is encountered.
Queuing_Policy_Sloc : Source_Ptr := No_Location; Queuing_Policy_Sloc : Source_Ptr := No_Location;
-- GNAT, GNATBIND -- GNAT, GNATBIND
-- Remember location of previous Queuing_Policy pragma. This is used -- Remember location of previous Queuing_Policy pragma. This is used for
-- for inconsistency error messages. A value of System_Location is -- inconsistency error messages. A value of System_Location is used if the
-- used if the policy is set in package System. -- policy is set in package System.
Quiet_Output : Boolean := False; Quiet_Output : Boolean := False;
-- GNATMAKE, GNATCLEAN, GPRMAKE, GPRBUILD, GPRCLEAN -- GNATMAKE, GNATCLEAN, GPRMAKE, GPRBUILD, GPRCLEAN
...@@ -1014,17 +1012,17 @@ package Opt is ...@@ -1014,17 +1012,17 @@ package Opt is
Search_Directory_Present : Boolean := False; Search_Directory_Present : Boolean := False;
-- GNAT -- GNAT
-- Set to True when argument is -I. Reset to False when next argument, -- Set to True when argument is -I. Reset to False when next argument, a
-- a search directory path is taken into account. Note that this is -- search directory path is taken into account. Note that this is quite
-- quite different from other switches in this section in that it is -- different from other switches in this section in that it is only set in
-- only set in a transitory manner as a result of scanning a -I switch -- a transitory manner as a result of scanning a -I switch with no file
-- with no file name, and if set, is an indication that the next argument -- name, and if set, is an indication that the next argument is to be
-- is to be treated as a file name. -- treated as a file name.
Sec_Stack_Used : Boolean := False; Sec_Stack_Used : Boolean := False;
-- GNAT, GBATBIND -- GNAT, GBATBIND
-- Set True if generated code uses the System.Secondary_Stack package. -- Set True if generated code uses the System.Secondary_Stack package. For
-- For the binder, set if any unit uses the secondary stack package. -- the binder, set if any unit uses the secondary stack package.
Setup_Projects : Boolean := False; Setup_Projects : Boolean := False;
-- GNAT DRIVER -- GNAT DRIVER
...@@ -1033,9 +1031,9 @@ package Opt is ...@@ -1033,9 +1031,9 @@ package Opt is
Shared_Libgnat : Boolean; Shared_Libgnat : Boolean;
-- GNATBIND -- GNATBIND
-- Set to True if a shared libgnat is requested by using the -shared -- Set to True if a shared libgnat is requested by using the -shared option
-- option for GNATBIND and to False when using the -static option. The -- for GNATBIND and to False when using the -static option. The value of
-- value of this flag is set by Gnatbind.Scan_Bind_Arg. -- this flag is set by Gnatbind.Scan_Bind_Arg.
Sprint_Line_Limit : Nat := 72; Sprint_Line_Limit : Nat := 72;
-- Limit values for chopping long lines in Sprint output, can be reset -- Limit values for chopping long lines in Sprint output, can be reset
...@@ -1052,9 +1050,9 @@ package Opt is ...@@ -1052,9 +1050,9 @@ package Opt is
Style_Check : Boolean := False; Style_Check : Boolean := False;
-- GNAT -- GNAT
-- Set True to perform style checks. Activates checks carried out -- Set True to perform style checks. Activates checks carried out in
-- in package Style (see body of this package for details of checks) -- package Style (see body of this package for details of checks) This
-- This flag is set True by either the -gnatg or -gnaty switches. -- flag is set True by either the -gnatg or -gnaty switches.
Suppress_All_Inlining : Boolean := False; Suppress_All_Inlining : Boolean := False;
-- GNAT -- GNAT
...@@ -1113,9 +1111,9 @@ package Opt is ...@@ -1113,9 +1111,9 @@ package Opt is
Tagged_Type_Expansion : Boolean := True; Tagged_Type_Expansion : Boolean := True;
-- GNAT -- GNAT
-- Set True if tagged types and interfaces should be expanded by the -- Set True if tagged types and interfaces should be expanded by the
-- front-end. If False, the original tree is left unexpanded for -- front-end. If False, the original tree is left unexpanded for tagged
-- tagged types and dispatching calls, assuming the underlying target -- types and dispatching calls, assuming the underlying target supports
-- supports it (e.g. case of JVM). -- it (e.g. in the JVM case).
Task_Dispatching_Policy : Character := ' '; Task_Dispatching_Policy : Character := ' ';
-- GNAT, GNATBIND -- GNAT, GNATBIND
......
...@@ -1176,6 +1176,8 @@ package body Prj.Conf is ...@@ -1176,6 +1176,8 @@ package body Prj.Conf is
Name : Name_Id; Name : Name_Id;
Naming : Project_Node_Id; Naming : Project_Node_Id;
-- Start of processing for Add_Default_GNAT_Naming_Scheme
begin begin
if Config_File = Empty_Node then if Config_File = Empty_Node then
...@@ -1186,6 +1188,7 @@ package body Prj.Conf is ...@@ -1186,6 +1188,7 @@ package body Prj.Conf is
Name := Name_Find; Name := Name_Find;
-- An invalid project name to avoid conflicts with user-created ones -- An invalid project name to avoid conflicts with user-created ones
Name_Len := 5; Name_Len := 5;
Name_Buffer (1 .. Name_Len) := "_auto"; Name_Buffer (1 .. Name_Len) := "_auto";
...@@ -1215,8 +1218,8 @@ package body Prj.Conf is ...@@ -1215,8 +1218,8 @@ package body Prj.Conf is
Create_Attribute (Name_Library_Auto_Init_Supported, "false"); Create_Attribute (Name_Library_Auto_Init_Supported, "false");
end if; end if;
-- Setup Ada support (Ada is the default language here, since this is -- Setup Ada support (Ada is the default language here, since this
-- only called when no config file existed initially, ie for -- is only called when no config file existed initially, ie for
-- gnatmake). -- gnatmake).
Create_Attribute (Name_Default_Language, "ada"); Create_Attribute (Name_Default_Language, "ada");
...@@ -1234,7 +1237,6 @@ package body Prj.Conf is ...@@ -1234,7 +1237,6 @@ package body Prj.Conf is
(Project => Config_File, (Project => Config_File,
In_Tree => Project_Tree, In_Tree => Project_Tree,
Backward_Compatibility => False); Backward_Compatibility => False);
end if; end if;
end if; end if;
end Add_Default_GNAT_Naming_Scheme; end Add_Default_GNAT_Naming_Scheme;
......
...@@ -126,8 +126,11 @@ package body Prj.Env is ...@@ -126,8 +126,11 @@ package body Prj.Env is
Dummy : Boolean := False; Dummy : Boolean := False;
-- Start of processing for Ada_Include_Path
begin begin
if Recursive then if Recursive then
-- If it is the first time we call this function for -- If it is the first time we call this function for
-- this project, compute the source path -- this project, compute the source path
...@@ -161,7 +164,7 @@ package body Prj.Env is ...@@ -161,7 +164,7 @@ package body Prj.Env is
(Project : Project_Id; (Project : Project_Id;
Including_Libraries : Boolean := True) return String_Access Including_Libraries : Boolean := True) return String_Access
is is
Buffer : String_Access; Buffer : String_Access;
Buffer_Last : Natural := 0; Buffer_Last : Natural := 0;
procedure Add (Project : Project_Id; Dummy : in out Boolean); procedure Add (Project : Project_Id; Dummy : in out Boolean);
...@@ -186,6 +189,7 @@ package body Prj.Env is ...@@ -186,6 +189,7 @@ package body Prj.Env is
procedure For_All_Projects is procedure For_All_Projects is
new For_Every_Project_Imported (Boolean, Add); new For_Every_Project_Imported (Boolean, Add);
Dummy : Boolean := False; Dummy : Boolean := False;
-- Start of processing for Ada_Objects_Path -- Start of processing for Ada_Objects_Path
...@@ -899,7 +903,8 @@ package body Prj.Env is ...@@ -899,7 +903,8 @@ package body Prj.Env is
procedure Create_New_Path_File procedure Create_New_Path_File
(In_Tree : Project_Tree_Ref; (In_Tree : Project_Tree_Ref;
Path_FD : out File_Descriptor; Path_FD : out File_Descriptor;
Path_Name : out Path_Name_Type) is Path_Name : out Path_Name_Type)
is
begin begin
Create_Temp_File (In_Tree, Path_FD, Path_Name, "path file"); Create_Temp_File (In_Tree, Path_FD, Path_Name, "path file");
end Create_New_Path_File; end Create_New_Path_File;
......
...@@ -244,6 +244,7 @@ package body Prj.Ext is ...@@ -244,6 +244,7 @@ package body Prj.Ext is
if Add_Default_Dir then if Add_Default_Dir then
declare declare
Prefix : String_Ptr := Sdefault.Search_Dir_Prefix; Prefix : String_Ptr := Sdefault.Search_Dir_Prefix;
begin begin
if Prefix = null then if Prefix = null then
Prefix := new String'(Executable_Prefix_Path); Prefix := new String'(Executable_Prefix_Path);
......
...@@ -287,10 +287,9 @@ package body Prj.Nmsc is ...@@ -287,10 +287,9 @@ package body Prj.Nmsc is
Data : Tree_Processing_Data); Data : Tree_Processing_Data);
-- Output an error message. If Data.Error_Report is null, simply call -- Output an error message. If Data.Error_Report is null, simply call
-- Prj.Err.Error_Msg. Otherwise, disregard Flag_Location and use -- Prj.Err.Error_Msg. Otherwise, disregard Flag_Location and use
-- Error_Report. -- Error_Report. If Msg starts with "?", this is a warning, and the
-- If Msg starts with "?", this is a warning, and Warning: is adding at the -- string "Warning :" is adding at the beginning. If Msg starts with "<",
-- beginning. If Msg starts with "<", see comment -- see comment for Err_Vars.Error_Msg_Warn
-- for Err_Vars.Error_Msg_Warn
procedure Search_Directories procedure Search_Directories
(Project : in out Project_Processing_Data; (Project : in out Project_Processing_Data;
...@@ -4155,7 +4154,7 @@ package body Prj.Nmsc is ...@@ -4155,7 +4154,7 @@ package body Prj.Nmsc is
while Prj.Element (Iter) /= No_Source while Prj.Element (Iter) /= No_Source
and then and then
(Prj.Element (Iter).Unit = null (Prj.Element (Iter).Unit = null
or else Prj.Element (Iter).Unit.Name /= Unit) or else Prj.Element (Iter).Unit.Name /= Unit)
loop loop
Next (Iter); Next (Iter);
end loop; end loop;
......
...@@ -453,13 +453,14 @@ package body Prj.Proc is ...@@ -453,13 +453,14 @@ package body Prj.Proc is
Index : Name_Id) return Name_Id Index : Name_Id) return Name_Id
is is
Lower : Boolean; Lower : Boolean;
begin begin
Get_Name_String (Index); Get_Name_String (Index);
Lower := Case_Insensitive (Attr, Tree); Lower := Case_Insensitive (Attr, Tree);
-- The index is always case insensitive if it does not include any dot. -- The index is always case insensitive if it does not include any dot.
-- ??? Why not use the properties from prj-attr, simply, maybe because -- ??? Why not use the properties from prj-attr, simply, maybe because
-- we don't know whether we have a file as an index ? -- we don't know whether we have a file as an index?
if not Lower then if not Lower then
Lower := True; Lower := True;
......
...@@ -2877,6 +2877,7 @@ package body Prj.Tree is ...@@ -2877,6 +2877,7 @@ package body Prj.Tree is
Real_Parent : Project_Node_Id; Real_Parent : Project_Node_Id;
New_Decl, Decl, Next : Project_Node_Id; New_Decl, Decl, Next : Project_Node_Id;
Last, L : Project_Node_Id; Last, L : Project_Node_Id;
begin begin
if Kind_Of (Expr, Tree) /= N_Declarative_Item then if Kind_Of (Expr, Tree) /= N_Declarative_Item then
New_Decl := Default_Project_Node (Tree, N_Declarative_Item); New_Decl := Default_Project_Node (Tree, N_Declarative_Item);
...@@ -2900,17 +2901,18 @@ package body Prj.Tree is ...@@ -2900,17 +2901,18 @@ package body Prj.Tree is
Next := Next_Declarative_Item (Decl, Tree); Next := Next_Declarative_Item (Decl, Tree);
exit when Next = Empty_Node exit when Next = Empty_Node
or else or else
(Add_Before_First_Pkg (Add_Before_First_Pkg
and then Kind_Of (Current_Item_Node (Next, Tree), Tree) and then Kind_Of (Current_Item_Node (Next, Tree), Tree) =
= N_Package_Declaration) N_Package_Declaration)
or else or else
(Add_Before_First_Case (Add_Before_First_Case
and then Kind_Of (Current_Item_Node (Next, Tree), Tree) and then Kind_Of (Current_Item_Node (Next, Tree), Tree) =
= N_Case_Construction); N_Case_Construction);
Decl := Next; Decl := Next;
end loop; end loop;
-- In case Expr is in fact a range of declarative items -- In case Expr is in fact a range of declarative items
Last := New_Decl; Last := New_Decl;
loop loop
L := Next_Declarative_Item (Last, Tree); L := Next_Declarative_Item (Last, Tree);
...@@ -2919,6 +2921,7 @@ package body Prj.Tree is ...@@ -2919,6 +2921,7 @@ package body Prj.Tree is
end loop; end loop;
-- In case Expr is in fact a range of declarative items -- In case Expr is in fact a range of declarative items
Last := New_Decl; Last := New_Decl;
loop loop
L := Next_Declarative_Item (Last, Tree); L := Next_Declarative_Item (Last, Tree);
...@@ -2937,8 +2940,7 @@ package body Prj.Tree is ...@@ -2937,8 +2940,7 @@ package body Prj.Tree is
function Create_Literal_String function Create_Literal_String
(Str : Namet.Name_Id; (Str : Namet.Name_Id;
Tree : Project_Node_Tree_Ref) Tree : Project_Node_Tree_Ref) return Project_Node_Id
return Project_Node_Id
is is
Node : Project_Node_Id; Node : Project_Node_Id;
begin begin
...@@ -2957,7 +2959,7 @@ package body Prj.Tree is ...@@ -2957,7 +2959,7 @@ package body Prj.Tree is
Tree : Project_Node_Tree_Ref) return Project_Node_Id Tree : Project_Node_Tree_Ref) return Project_Node_Id
is is
Expr : constant Project_Node_Id := Expr : constant Project_Node_Id :=
Default_Project_Node (Tree, N_Expression, Single); Default_Project_Node (Tree, N_Expression, Single);
begin begin
Set_First_Term (Expr, Tree, Default_Project_Node (Tree, N_Term, Single)); Set_First_Term (Expr, Tree, Default_Project_Node (Tree, N_Term, Single));
Set_Current_Term (First_Term (Expr, Tree), Tree, Node); Set_Current_Term (First_Term (Expr, Tree), Tree, Node);
...@@ -2975,6 +2977,7 @@ package body Prj.Tree is ...@@ -2975,6 +2977,7 @@ package body Prj.Tree is
is is
Pack : Project_Node_Id; Pack : Project_Node_Id;
N : Name_Id; N : Name_Id;
begin begin
Name_Len := Pkg'Length; Name_Len := Pkg'Length;
Name_Buffer (1 .. Name_Len) := Pkg; Name_Buffer (1 .. Name_Len) := Pkg;
...@@ -2983,7 +2986,6 @@ package body Prj.Tree is ...@@ -2983,7 +2986,6 @@ package body Prj.Tree is
-- Check if the package already exists -- Check if the package already exists
Pack := First_Package_Of (Project, Tree); Pack := First_Package_Of (Project, Tree);
while Pack /= Empty_Node loop while Pack /= Empty_Node loop
if Prj.Tree.Name_Of (Pack, Tree) = N then if Prj.Tree.Name_Of (Pack, Tree) = N then
return Pack; return Pack;
...@@ -3002,6 +3004,7 @@ package body Prj.Tree is ...@@ -3002,6 +3004,7 @@ package body Prj.Tree is
Set_Package_Id_Of (Pack, Tree, Package_Node_Id_Of (N)); Set_Package_Id_Of (Pack, Tree, Package_Node_Id_Of (N));
-- Add it to the list of packages -- Add it to the list of packages
Set_Next_Package_In_Project Set_Next_Package_In_Project
(Pack, Tree, First_Package_Of (Project, Tree)); (Pack, Tree, First_Package_Of (Project, Tree));
Set_First_Package_Of (Project, Tree, Pack); Set_First_Package_Of (Project, Tree, Pack);
...@@ -3019,16 +3022,18 @@ package body Prj.Tree is ...@@ -3019,16 +3022,18 @@ package body Prj.Tree is
(Tree : Project_Node_Tree_Ref; (Tree : Project_Node_Tree_Ref;
Prj_Or_Pkg : Project_Node_Id; Prj_Or_Pkg : Project_Node_Id;
Name : Name_Id; Name : Name_Id;
Index_Name : Name_Id := No_Name; Index_Name : Name_Id := No_Name;
Kind : Variable_Kind := List; Kind : Variable_Kind := List;
At_Index : Integer := 0) return Project_Node_Id At_Index : Integer := 0) return Project_Node_Id
is is
Node : constant Project_Node_Id := Node : constant Project_Node_Id :=
Default_Project_Node (Tree, N_Attribute_Declaration, Kind); Default_Project_Node (Tree, N_Attribute_Declaration, Kind);
Case_Insensitive : Boolean; Case_Insensitive : Boolean;
Pkg : Package_Node_Id; Pkg : Package_Node_Id;
Start_At : Attribute_Node_Id; Start_At : Attribute_Node_Id;
begin begin
Set_Name_Of (Node, Tree, Name); Set_Name_Of (Node, Tree, Name);
......
...@@ -599,38 +599,34 @@ package Prj.Tree is ...@@ -599,38 +599,34 @@ package Prj.Tree is
Full_Path : Path_Name_Type; Full_Path : Path_Name_Type;
Is_Config_File : Boolean := False) return Project_Node_Id; Is_Config_File : Boolean := False) return Project_Node_Id;
-- Create a new node for a project and register it in the tree so that it -- Create a new node for a project and register it in the tree so that it
-- can be retrieved later on -- can be retrieved later on.
function Create_Package function Create_Package
(Tree : Project_Node_Tree_Ref; (Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id; Project : Project_Node_Id;
Pkg : String) return Project_Node_Id; Pkg : String) return Project_Node_Id;
-- Create a new package in Project. If the package already exists, it is -- Create a new package in Project. If the package already exists, it is
-- returned. -- returned. The name of the package *must* be lower-cases, or none of its
-- The name of the package *must* be lower-cases, or none of its attributes -- attributes will be recognized.
-- will be recognized.
function Create_Attribute function Create_Attribute
(Tree : Project_Node_Tree_Ref; (Tree : Project_Node_Tree_Ref;
Prj_Or_Pkg : Project_Node_Id; Prj_Or_Pkg : Project_Node_Id;
Name : Name_Id; Name : Name_Id;
Index_Name : Name_Id := No_Name; Index_Name : Name_Id := No_Name;
Kind : Variable_Kind := List; Kind : Variable_Kind := List;
At_Index : Integer := 0) return Project_Node_Id; At_Index : Integer := 0) return Project_Node_Id;
-- Create a new attribute. -- Create a new attribute. The new declaration is added at the end of the
-- The new declaration is added at the end of the declarative item list for -- declarative item list for Prj_Or_Pkg (a project or a package), but
-- Prj_Or_Pkg (a project or a package), but before any package -- before any package declaration). No addition is done if Prj_Or_Pkg is
-- declaration). No addition is done if Prj_Or_Pkg is Empty_Node. -- Empty_Node. If Index_Name is not "", then if creates an attribute value
-- If Index_Name is not "", then if creates an attribute value for a -- for a specific index. At_Index is used for the " at <idx>" in the naming
-- specific index. -- exceptions. Use Set_Expression_Of to set the value of the attribute (in
-- At_Index is used for the " at <idx>" in the naming exceptions. -- which case Enclose_In_Expression might be useful)
-- Use Set_Expression_Of to set the value of the attribute (in which case
-- Enclose_In_Expression might be useful)
function Create_Literal_String function Create_Literal_String
(Str : Namet.Name_Id; (Str : Namet.Name_Id;
Tree : Project_Node_Tree_Ref) Tree : Project_Node_Tree_Ref) return Project_Node_Id;
return Project_Node_Id;
-- Create a literal string whose value is Str -- Create a literal string whose value is Str
procedure Add_At_End procedure Add_At_End
...@@ -639,15 +635,14 @@ package Prj.Tree is ...@@ -639,15 +635,14 @@ package Prj.Tree is
Expr : Project_Node_Id; Expr : Project_Node_Id;
Add_Before_First_Pkg : Boolean := False; Add_Before_First_Pkg : Boolean := False;
Add_Before_First_Case : Boolean := False); Add_Before_First_Case : Boolean := False);
-- Add a new declarative item in the list in Parent. -- Add a new declarative item in the list in Parent. This new declarative
-- This new declarative item will contain Expr (unless Expr is already a -- item will contain Expr (unless Expr is already a declarative item, in
-- declarative item, in which case it is added directly to the list). The -- which case it is added directly to the list). The new item is inserted
-- new item is inserted at the end of the list, unless Add_Before_First_Pkg -- at the end of the list, unless Add_Before_First_Pkg is True. In the
-- is True. In the latter case, it is added just before the first case -- latter case, it is added just before the first case construction is
-- construction is seen, or before the first package (this assumes that all -- seen, or before the first package (this assumes that all packages are
-- packages are found at the end of the project, which isn't true in the -- found at the end of the project, which isn't true in the general case
-- general case unless you have normalized the project to match this -- unless you have normalized the project to match this description).
-- description).
function Enclose_In_Expression function Enclose_In_Expression
(Node : Project_Node_Id; (Node : Project_Node_Id;
...@@ -660,6 +655,7 @@ package Prj.Tree is ...@@ -660,6 +655,7 @@ package Prj.Tree is
-- The following procedures are part of the abstract interface of the -- The following procedures are part of the abstract interface of the
-- Project File tree. -- Project File tree.
-- Each Set_* procedure is valid only for the same Project_Node_Kind -- Each Set_* procedure is valid only for the same Project_Node_Kind
-- nodes as the corresponding query function above. -- nodes as the corresponding query function above.
-- These are very low-level, and manipulate the tree itself directly. You -- These are very low-level, and manipulate the tree itself directly. You
......
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