Commit 4f469be3 by Vincent Celier Committed by Arnaud Charlet

prj.adb (Hash (Project_Id)): New function

2008-05-20  Vincent Celier  <celier@adacore.com>

	* prj.adb (Hash (Project_Id)): New function
	(Project_Empty): Add new component Interfaces_Defined

	* prj.ads (Source_Data): New component Object_Linked
	(Language_Config): New components Object_Generated and Objects_Linked
	(Hash (Project_Id)): New function
	(Source_Data): New Boolean components In_Interfaces and
	Declared_In_Interfaces.
	(Project_Data): New Boolean component Interfaces_Defined

	* prj-attr.adb: 
	New project level attribute Object_Generated and Objects_Linked
	Add new project level attribute Interfaces

	* prj-dect.adb: Use functions Present and No throughout
	(Parse_Variable_Declaration): If a string type is specified as a simple
	name and is not found in the current project, look for it also in the
	ancestors of the project.

	* prj-makr.adb: 
	Replace procedure Make with procedures Initialize, Process and Finalize
	to implement H414-023: process different directories with different
	patterns.
	Use functions Present and No throughout

	* prj-makr.ads: 
	Replace procedure Make with procedures Initialize, Process and Finalize

	* prj-nmsc.adb
	(Add_Source): Set component Object_Exists and Object_Linked accordnig to
	the language configuration.
	(Process_Project_Level_Array_Attributes): Process new attributes
	Object_Generated and Object_Linked.
	(Report_No_Sources): New Boolean parameter Continuation, defaulted to
	False, to indicate that the erreor/warning is a continuation.
	(Check): Call Report_No_Sources with Contnuation = True after the first
	call.
	(Error_Msg): Process successively contnuation character and warning
	character.
	(Find_Explicit_Sources): Check that all declared sources have been found
	(Check_File): Indicate in hash table Source_Names when a declared source
	is found.
	(Check_File): Set Other_Part when found
	(Find_Explicit_Sources): In multi language mode, check if all exceptions
	to the naming scheme have been found. For Ada, report an error if an
	exception has not been found. Otherwise, disregard the exception.
	(Check_Interfaces): New procedure
	(Add_Source): When Other_Part is defined, set mutual pointers in spec
	and body.
	(Check): In multi-language mode, call Check_Interfaces
	(Process_Sources_In_Multi_Language_Mode): Set In_Interfaces to False
	for an excluded source.
	(Remove_Source): A source replacing a source in the interfaces is also
	in the interfaces.

	* prj-pars.adb: Use function Present

	* prj-part.adb: Use functions Present and No throughout
	(Parse_Single_Project): Set the parent project for child projects
	(Create_Virtual_Extending_Project): Register project with no qualifier
	(Parse_Single_Project): Allow an abstract project to be extend several
	times. Do not allow an abstract project to extend a non abstract
	project.

	* prj-pp.adb: Use functions Present and No throughout
	(Print): Take into account the full associative array attribute
	declarations.

	* prj-proc.adb: Use functions Present and No throughout
	(Expression): Call itself with the same From_Project_Node for the
	default value of an external reference.

	* prj-strt.adb: Use functions Present and No throughout
	(Parse_Variable_Reference): If a variable is specified as a simple name
	and is not found in the current project, look for it also in the
	ancestors of the project.

	* prj-tree.ads, prj-tree.adb (Present): New function
	(No): New function
	Use functions Present and No throughout
	(Parent_Project_Of): New function
	(Set_Parent_Project_Of): New procedure

	* snames.ads, snames.adb: 
	Add new standard names Object_Generated and Objects_Linked

From-SVN: r135623
parent 3ddca462
......@@ -86,6 +86,7 @@ package body Prj.Attr is
"LVlocally_removed_files#" &
"LVexcluded_source_files#" &
"SVsource_list_file#" &
"LVinterfaces#" &
-- Libraries
......@@ -109,6 +110,8 @@ package body Prj.Attr is
"LVrun_path_option#" &
"Satoolchain_version#" &
"Satoolchain_description#" &
"Saobject_generated#" &
"Saobjects_linked#" &
-- Configuration - Libraries
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
-- --
-- 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- --
......@@ -25,44 +25,58 @@
-- Support for procedure Gnatname
-- For arbitrary naming schemes, create or update a project file,
-- or create a configuration pragmas file.
-- For arbitrary naming schemes, create or update a project file, or create a
-- configuration pragmas file.
with System.Regexp; use System.Regexp;
package Prj.Makr is
procedure Make
procedure Initialize
(File_Path : String;
Project_File : Boolean;
Directories : Argument_List;
Name_Patterns : Argument_List;
Excluded_Patterns : Argument_List;
Foreign_Patterns : Argument_List;
Preproc_Switches : Argument_List;
Very_Verbose : Boolean);
-- Create a project file or a configuration pragmas file
-- Start the creation of a configuration pragmas file or the creation or
-- modification of a project file, for gnatname.
--
-- When Project_File is False, File_Path is the name of a configuration
-- pragmas file to create. When Project_File is True, File_Path is the name
-- of a project file to create if it does not exist or to modify if it
-- already exists.
--
-- Preproc_Switches is a list of switches to be used when invoking the
-- compiler to get the name and kind of unit of a source file.
--
-- Very_Verbose controls the verbosity of the output, in conjunction with
-- Opt.Verbose_Mode.
type Regexp_List is array (Positive range <>) of Regexp;
procedure Process
(Directories : Argument_List;
Name_Patterns : Regexp_List;
Excluded_Patterns : Regexp_List;
Foreign_Patterns : Regexp_List);
-- Look for source files in the specified directories, with the specified
-- patterns.
--
-- Directories is the list of source directories where to look for sources.
--
-- Project_File is the path name of the project file. If the project
-- file already exists parse it and keep all the elements that are not
-- automatically generated.
-- Name_Patterns is a potentially empty list of file name patterns to check
-- for Ada Sources.
--
-- Directory_List_File is the path name of a text file that
-- contains on each non empty line the path names of the source
-- directories for the project file. The source directories
-- are relative to the directory of the project file.
-- Excluded_Patterns is a potentially empty list of file name patterns that
-- should not be checked for Ada or non Ada sources.
--
-- File_Name_Patterns is a GNAT.Regexp string pattern such as
-- ".*\.ads|.*\.adb" or any other pattern.
-- Foreign_Patterns is a potentially empty list of file name patterns to
-- check for non Ada sources.
--
-- A project file (without any sources) is automatically generated
-- with the name <project>_naming. It contains a package Naming with
-- all the specs and bodies for the project.
-- A file containing the source file names is automatically
-- generated and used as the Source_File_List for the project file.
-- It includes all sources that follow the Foreign_Patterns (except those
-- that follow Excluded_Patterns).
-- At least one of Name_Patterns and Foreign_Patterns is not empty
-- Preproc_switches is a list of optional preprocessor switches -gnatep=
-- and -gnateD that are used when invoking the compiler to find the
-- unit name and kind.
procedure Finalize;
-- Write the configuration pragmas file or the project file indicated in a
-- call to procedure Initialize, after one or several calls to procedure
-- Process.
end Prj.Makr;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
-- --
-- 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- --
......@@ -70,7 +70,7 @@ package body Prj.Pars is
-- If there were no error, process the tree
if Project_Node /= Empty_Node then
if Present (Project_Node) then
Prj.Proc.Process
(In_Tree => In_Tree,
Project => The_Project,
......
......@@ -319,13 +319,13 @@ package body Prj.PP is
procedure Print (Node : Project_Node_Id; Indent : Natural) is
begin
if Node /= Empty_Node then
if Present (Node) then
case Kind_Of (Node, In_Tree) is
when N_Project =>
pragma Debug (Indicate_Tested (N_Project));
if First_With_Clause_Of (Node, In_Tree) /= Empty_Node then
if Present (First_With_Clause_Of (Node, In_Tree)) then
-- with clause(s)
......@@ -424,7 +424,7 @@ package body Prj.PP is
pragma Debug (Indicate_Tested (N_Project_Declaration));
if
First_Declarative_Item_Of (Node, In_Tree) /= Empty_Node
Present (First_Declarative_Item_Of (Node, In_Tree))
then
Print
(First_Declarative_Item_Of (Node, In_Tree),
......@@ -498,12 +498,12 @@ package body Prj.PP is
First_Literal_String (Node, In_Tree);
begin
while String_Node /= Empty_Node loop
while Present (String_Node) loop
Output_String (String_Value_Of (String_Node, In_Tree));
String_Node :=
Next_Literal_String (String_Node, In_Tree);
if String_Node /= Empty_Node then
if Present (String_Node) then
Write_String (", ");
end if;
end loop;
......@@ -543,7 +543,44 @@ package body Prj.PP is
end if;
Write_String (" use ");
if Present (Expression_Of (Node, In_Tree)) then
Print (Expression_Of (Node, In_Tree), Indent);
else
-- Full associative array declaration
if
Present (Associative_Project_Of (Node, In_Tree))
then
Output_Name
(Name_Of
(Associative_Project_Of (Node, In_Tree),
In_Tree));
if
Present (Associative_Package_Of (Node, In_Tree))
then
Write_String (".");
Output_Name
(Name_Of
(Associative_Package_Of (Node, In_Tree),
In_Tree));
end if;
elsif
Present (Associative_Package_Of (Node, In_Tree))
then
Output_Name
(Name_Of
(Associative_Package_Of (Node, In_Tree),
In_Tree));
end if;
Write_String ("'");
Output_Attribute_Name (Name_Of (Node, In_Tree));
end if;
Write_String (";");
Write_End_Of_Line_Comment (Node);
Print (First_Comment_After (Node, In_Tree), Indent);
......@@ -580,11 +617,11 @@ package body Prj.PP is
Term : Project_Node_Id := First_Term (Node, In_Tree);
begin
while Term /= Empty_Node loop
while Present (Term) loop
Print (Term, Indent);
Term := Next_Term (Term, In_Tree);
if Term /= Empty_Node then
if Present (Term) then
Write_String (" & ");
end if;
end loop;
......@@ -603,12 +640,12 @@ package body Prj.PP is
First_Expression_In_List (Node, In_Tree);
begin
while Expression /= Empty_Node loop
while Present (Expression) loop
Print (Expression, Indent);
Expression :=
Next_Expression_In_List (Expression, In_Tree);
if Expression /= Empty_Node then
if Present (Expression) then
Write_String (", ");
end if;
end loop;
......@@ -618,13 +655,13 @@ package body Prj.PP is
when N_Variable_Reference =>
pragma Debug (Indicate_Tested (N_Variable_Reference));
if Project_Node_Of (Node, In_Tree) /= Empty_Node then
if Present (Project_Node_Of (Node, In_Tree)) then
Output_Name
(Name_Of (Project_Node_Of (Node, In_Tree), In_Tree));
Write_String (".");
end if;
if Package_Node_Of (Node, In_Tree) /= Empty_Node then
if Present (Package_Node_Of (Node, In_Tree)) then
Output_Name
(Name_Of (Package_Node_Of (Node, In_Tree), In_Tree));
Write_String (".");
......@@ -637,7 +674,7 @@ package body Prj.PP is
Write_String ("external (");
Print (External_Reference_Of (Node, In_Tree), Indent);
if External_Default_Of (Node, In_Tree) /= Empty_Node then
if Present (External_Default_Of (Node, In_Tree)) then
Write_String (", ");
Print (External_Default_Of (Node, In_Tree), Indent);
end if;
......@@ -647,19 +684,19 @@ package body Prj.PP is
when N_Attribute_Reference =>
pragma Debug (Indicate_Tested (N_Attribute_Reference));
if Project_Node_Of (Node, In_Tree) /= Empty_Node
if Present (Project_Node_Of (Node, In_Tree))
and then Project_Node_Of (Node, In_Tree) /= Project
then
Output_Name
(Name_Of (Project_Node_Of (Node, In_Tree), In_Tree));
if Package_Node_Of (Node, In_Tree) /= Empty_Node then
if Present (Package_Node_Of (Node, In_Tree)) then
Write_String (".");
Output_Name
(Name_Of (Package_Node_Of (Node, In_Tree), In_Tree));
end if;
elsif Package_Node_Of (Node, In_Tree) /= Empty_Node then
elsif Present (Package_Node_Of (Node, In_Tree)) then
Output_Name
(Name_Of (Package_Node_Of (Node, In_Tree), In_Tree));
......@@ -691,9 +728,9 @@ package body Prj.PP is
begin
Case_Item := First_Case_Item_Of (Node, In_Tree);
while Case_Item /= Empty_Node loop
if First_Declarative_Item_Of (Case_Item, In_Tree) /=
Empty_Node
while Present (Case_Item) loop
if Present
(First_Declarative_Item_Of (Case_Item, In_Tree))
or else not Eliminate_Empty_Case_Constructions
then
Is_Non_Empty := True;
......@@ -721,7 +758,7 @@ package body Prj.PP is
Case_Item : Project_Node_Id :=
First_Case_Item_Of (Node, In_Tree);
begin
while Case_Item /= Empty_Node loop
while Present (Case_Item) loop
pragma Assert
(Kind_Of (Case_Item, In_Tree) = N_Case_Item);
Print (Case_Item, Indent + Increment);
......@@ -742,7 +779,7 @@ package body Prj.PP is
when N_Case_Item =>
pragma Debug (Indicate_Tested (N_Case_Item));
if First_Declarative_Item_Of (Node, In_Tree) /= Empty_Node
if Present (First_Declarative_Item_Of (Node, In_Tree))
or else not Eliminate_Empty_Case_Constructions
then
Write_Empty_Line;
......@@ -750,7 +787,7 @@ package body Prj.PP is
Start_Line (Indent);
Write_String ("when ");
if First_Choice_Of (Node, In_Tree) = Empty_Node then
if No (First_Choice_Of (Node, In_Tree)) then
Write_String ("others");
else
......@@ -758,11 +795,11 @@ package body Prj.PP is
Label : Project_Node_Id :=
First_Choice_Of (Node, In_Tree);
begin
while Label /= Empty_Node loop
while Present (Label) loop
Print (Label, Indent);
Label := Next_Literal_String (Label, In_Tree);
if Label /= Empty_Node then
if Present (Label) then
Write_String (" | ");
end if;
end loop;
......@@ -779,7 +816,7 @@ package body Prj.PP is
First : constant Project_Node_Id :=
First_Declarative_Item_Of (Node, In_Tree);
begin
if First = Empty_Node then
if No (First) then
Write_Empty_Line;
else
Print (First, Indent + Increment);
......
......@@ -463,7 +463,7 @@ package body Prj.Proc is
-- Process each term of the expression, starting with First_Term
while The_Term /= Empty_Node loop
while Present (The_Term) loop
The_Current_Term := Current_Term (The_Term, From_Project_Node_Tree);
case Kind_Of (The_Current_Term, From_Project_Node_Tree) is
......@@ -535,7 +535,7 @@ package body Prj.Proc is
Value : Variable_Value;
begin
if String_Node /= Empty_Node then
if Present (String_Node) then
-- If String_Node is nil, it is an empty list,
-- there is nothing to do
......@@ -586,7 +586,7 @@ package body Prj.Proc is
Next_Expression_In_List
(String_Node, From_Project_Node_Tree);
exit when String_Node = Empty_Node;
exit when No (String_Node);
Value :=
Expression
......@@ -637,7 +637,7 @@ package body Prj.Proc is
Index : Name_Id := No_Name;
begin
if Term_Project /= Empty_Node and then
if Present (Term_Project) and then
Term_Project /= From_Project_Node
then
-- This variable or attribute comes from another project
......@@ -650,7 +650,7 @@ package body Prj.Proc is
With_Name => The_Name);
end if;
if Term_Package /= Empty_Node then
if Present (Term_Package) then
-- This is an attribute of a package
......@@ -1003,11 +1003,11 @@ package body Prj.Proc is
-- If there is a default value for the external reference,
-- get its value.
if Default_Node /= Empty_Node then
if Present (Default_Node) then
Def_Var := Expression
(Project => Project,
In_Tree => In_Tree,
From_Project_Node => Default_Node,
From_Project_Node => From_Project_Node,
From_Project_Node_Tree => From_Project_Node_Tree,
Pkg => Pkg,
First_Term =>
......@@ -1252,7 +1252,7 @@ package body Prj.Proc is
Current_Item := Empty_Node;
Current_Declarative_Item := Item;
while Current_Declarative_Item /= Empty_Node loop
while Present (Current_Declarative_Item) loop
-- Get its data
......@@ -1314,7 +1314,7 @@ package body Prj.Proc is
In_Tree.Packages.Table (New_Pkg) :=
The_New_Package;
if Project_Of_Renamed_Package /= Empty_Node then
if Present (Project_Of_Renamed_Package) then
-- Renamed package
......@@ -1515,8 +1515,8 @@ package body Prj.Proc is
pragma Assert (Orig_Project /= No_Project,
"original project not found");
if Associative_Package_Of
(Current_Item, From_Project_Node_Tree) = Empty_Node
if No (Associative_Package_Of
(Current_Item, From_Project_Node_Tree))
then
Orig_Array :=
In_Tree.Projects.Table
......@@ -1732,7 +1732,7 @@ package body Prj.Proc is
(String_Type_Of (Current_Item,
From_Project_Node_Tree),
From_Project_Node_Tree);
while Current_String /= Empty_Node
while Present (Current_String)
and then
String_Value_Of
(Current_String, From_Project_Node_Tree) /=
......@@ -1746,7 +1746,7 @@ package body Prj.Proc is
-- Report an error if the string value is not
-- one for the string type.
if Current_String = Empty_Node then
if No (Current_String) then
Error_Msg_Name_1 := New_Value.Value;
Error_Msg_Name_2 :=
Name_Of
......@@ -2068,8 +2068,8 @@ package body Prj.Proc is
-- If a project was specified for the case variable,
-- get its id.
if Project_Node_Of
(Variable_Node, From_Project_Node_Tree) /= Empty_Node
if Present (Project_Node_Of
(Variable_Node, From_Project_Node_Tree))
then
Name :=
Name_Of
......@@ -2084,8 +2084,8 @@ package body Prj.Proc is
-- If a package were specified for the case variable,
-- get its id.
if Package_Node_Of
(Variable_Node, From_Project_Node_Tree) /= Empty_Node
if Present (Package_Node_Of
(Variable_Node, From_Project_Node_Tree))
then
Name :=
Name_Of
......@@ -2121,8 +2121,8 @@ package body Prj.Proc is
if Var_Id = No_Variable
and then
Package_Node_Of
(Variable_Node, From_Project_Node_Tree) = Empty_Node
No (Package_Node_Of
(Variable_Node, From_Project_Node_Tree))
then
Var_Id := In_Tree.Projects.Table
(The_Project).Decl.Variables;
......@@ -2172,14 +2172,14 @@ package body Prj.Proc is
Case_Item :=
First_Case_Item_Of (Current_Item, From_Project_Node_Tree);
Case_Item_Loop :
while Case_Item /= Empty_Node loop
while Present (Case_Item) loop
Choice_String :=
First_Choice_Of (Case_Item, From_Project_Node_Tree);
-- When Choice_String is nil, it means that it is
-- the "when others =>" alternative.
if Choice_String = Empty_Node then
if No (Choice_String) then
Decl_Item :=
First_Declarative_Item_Of
(Case_Item, From_Project_Node_Tree);
......@@ -2189,7 +2189,7 @@ package body Prj.Proc is
-- Look into all the alternative of this case item
Choice_Loop :
while Choice_String /= Empty_Node loop
while Present (Choice_String) loop
if Case_Value =
String_Value_Of
(Choice_String, From_Project_Node_Tree)
......@@ -2211,7 +2211,7 @@ package body Prj.Proc is
-- If there is an alternative, then we process it
if Decl_Item /= Empty_Node then
if Present (Decl_Item) then
Process_Declarative_Items
(Project => Project,
In_Tree => In_Tree,
......@@ -2486,7 +2486,7 @@ package body Prj.Proc is
With_Clause : Project_Node_Id;
begin
if From_Project_Node = Empty_Node then
if No (From_Project_Node) then
Project := No_Project;
else
......@@ -2591,7 +2591,7 @@ package body Prj.Proc is
With_Clause :=
First_With_Clause_Of (From_Project_Node, From_Project_Node_Tree);
while With_Clause /= Empty_Node loop
while Present (With_Clause) loop
declare
New_Project : Project_Id;
New_Data : Project_Data;
......@@ -2602,7 +2602,7 @@ package body Prj.Proc is
Non_Limited_Project_Node_Of
(With_Clause, From_Project_Node_Tree);
if Proj_Node /= Empty_Node then
if Present (Proj_Node) then
Recursive_Process
(In_Tree => In_Tree,
Project => New_Project,
......@@ -2799,7 +2799,7 @@ package body Prj.Proc is
With_Clause :=
First_With_Clause_Of
(From_Project_Node, From_Project_Node_Tree);
while With_Clause /= Empty_Node loop
while Present (With_Clause) loop
declare
New_Project : Project_Id;
New_Data : Project_Data;
......@@ -2810,7 +2810,7 @@ package body Prj.Proc is
Non_Limited_Project_Node_Of
(With_Clause, From_Project_Node_Tree);
if Proj_Node = Empty_Node then
if No (Proj_Node) then
Recursive_Process
(In_Tree => In_Tree,
Project => New_Project,
......
......@@ -90,6 +90,14 @@ package Prj.Tree is
-- of the fields in each node of Project_Node_Kind, look at package
-- Tree_Private_Part.
function Present (Node : Project_Node_Id) return Boolean;
pragma Inline (Present);
-- Return True iff Node /= Empty_Node
function No (Node : Project_Node_Id) return Boolean;
pragma Inline (No);
-- Return True iff Node = Empty_Node
procedure Initialize (Tree : Project_Node_Tree_Ref);
-- Initialize the Project File tree: empty the Project_Nodes table
-- and reset the Projects_Htable.
......@@ -262,10 +270,15 @@ package Prj.Tree is
In_Tree : Project_Node_Tree_Ref) return Boolean;
-- Valid only for N_Comment nodes
function Parent_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Parent_Project_Of);
-- Valid only for N_Project nodes
function Project_File_Includes_Unkept_Comments
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref)
return Boolean;
In_Tree : Project_Node_Tree_Ref) return Boolean;
-- Valid only for N_Project nodes
function Directory_Of
......@@ -631,6 +644,11 @@ package Prj.Tree is
To : Project_Node_Id);
pragma Inline (Set_Next_Comment);
procedure Set_Parent_Project_Of
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
To : Project_Node_Id);
procedure Set_Project_File_Includes_Unkept_Comments
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref;
......@@ -972,6 +990,9 @@ package Prj.Tree is
Field3 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field4 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Flag1 : Boolean := False;
-- This flag is significant only for:
-- N_Attribute_Declaration and N_Attribute_Reference
......@@ -1019,6 +1040,7 @@ package Prj.Tree is
-- -- Field1: first with clause
-- -- Field2: project declaration
-- -- Field3: first string type
-- -- Field4: parent project, if any
-- -- Value: extended project path name (if any)
-- N_With_Clause,
......@@ -1028,6 +1050,7 @@ package Prj.Tree is
-- -- Field1: project node
-- -- Field2: next with clause
-- -- Field3: project node or empty if "limited with"
-- -- Field4: not used
-- -- Value: literal string withed
-- N_Project_Declaration,
......@@ -1037,6 +1060,7 @@ package Prj.Tree is
-- -- Field1: first declarative item
-- -- Field2: extended project
-- -- Field3: extending project
-- -- Field4: not used
-- -- Value: not used
-- N_Declarative_Item,
......@@ -1046,6 +1070,7 @@ package Prj.Tree is
-- -- Field1: current item node
-- -- Field2: next declarative item
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Package_Declaration,
......@@ -1055,6 +1080,7 @@ package Prj.Tree is
-- -- Field1: project of renamed package (if any)
-- -- Field2: first declarative item
-- -- Field3: next package in project
-- -- Field4: not used
-- -- Value: not used
-- N_String_Type_Declaration,
......@@ -1064,6 +1090,7 @@ package Prj.Tree is
-- -- Field1: first literal string
-- -- Field2: next string type
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Literal_String,
......@@ -1073,6 +1100,7 @@ package Prj.Tree is
-- -- Field1: next literal string
-- -- Field2: not used
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: string value
-- N_Attribute_Declaration,
......@@ -1082,6 +1110,7 @@ package Prj.Tree is
-- -- Field1: expression
-- -- Field2: project of full associative array
-- -- Field3: package of full associative array
-- -- Field4: not used
-- -- Value: associative array index
-- -- (if an associative array element)
......@@ -1092,6 +1121,7 @@ package Prj.Tree is
-- -- Field1: expression
-- -- Field2: type of variable (N_String_Type_Declaration)
-- -- Field3: next variable
-- -- Field4: not used
-- -- Value: not used
-- N_Variable_Declaration,
......@@ -1105,6 +1135,7 @@ package Prj.Tree is
-- -- N_Variable_Declaration and
-- -- N_Typed_Variable_Declaration
-- -- Field3: next variable
-- -- Field4: not used
-- -- Value: not used
-- N_Expression,
......@@ -1123,6 +1154,7 @@ package Prj.Tree is
-- -- Field1: current term
-- -- Field2: next term in the expression
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Literal_String_List,
......@@ -1135,6 +1167,7 @@ package Prj.Tree is
-- -- Field1: first expression
-- -- Field2: not used
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Variable_Reference,
......@@ -1144,6 +1177,7 @@ package Prj.Tree is
-- -- Field1: project (if specified)
-- -- Field2: package (if specified)
-- -- Field3: type of variable (N_String_Type_Declaration), if any
-- -- Field4: not used
-- -- Value: not used
-- N_External_Value,
......@@ -1162,6 +1196,7 @@ package Prj.Tree is
-- -- Field1: project
-- -- Field2: package (if attribute of a package)
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: associative array index
-- -- (if an associative array element)
......@@ -1172,6 +1207,7 @@ package Prj.Tree is
-- -- Field1: case variable reference
-- -- Field2: first case item
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: not used
-- N_Case_Item
......@@ -1182,6 +1218,7 @@ package Prj.Tree is
-- -- for when others
-- -- Field2: first declarative item
-- -- Field3: next case item
-- -- Field4: not used
-- -- Value: not used
-- N_Comment_zones
......@@ -1192,6 +1229,7 @@ package Prj.Tree is
-- -- Field2: comment after the construct
-- -- Field3: comment before the "end" of the construct
-- -- Value: end of line comment
-- -- Field4: not used
-- -- Comments: comment after the "end" of the construct
-- N_Comment
......@@ -1201,6 +1239,7 @@ package Prj.Tree is
-- -- Field1: not used
-- -- Field2: not used
-- -- Field3: not used
-- -- Field4: not used
-- -- Value: comment
-- -- Flag1: comment is preceded by an empty line
-- -- Flag2: comment is followed by an empty line
......@@ -1229,13 +1268,17 @@ package Prj.Tree is
Extended : Boolean;
-- True when the project is being extended by another project
Proj_Qualifier : Project_Qualifier;
-- The project qualifier of the project, if any
end record;
No_Project_Name_And_Node : constant Project_Name_And_Node :=
(Name => No_Name,
Node => Empty_Node,
Canonical_Path => No_Path,
Extended => True);
Extended => True,
Proj_Qualifier => Unspecified);
package Projects_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
......
......@@ -122,6 +122,7 @@ package body Prj is
Sources => Nil_String,
First_Source => No_Source,
Last_Source => No_Source,
Interfaces_Defined => False,
Unit_Based_Language_Name => No_Name,
Unit_Based_Language_Index => No_Language_Index,
Imported_Directories_Switches => null,
......@@ -599,6 +600,11 @@ package body Prj is
return Hash (Get_Name_String (Name));
end Hash;
function Hash (Project : Project_Id) return Header_Num is
begin
return Header_Num (Project mod Max_Header_Num);
end Hash;
-----------
-- Image --
-----------
......
......@@ -307,7 +307,8 @@ package Prj is
Language : Language_Index);
-- Output the name of a language
type Header_Num is range 0 .. 6150;
Max_Header_Num : constant := 6150;
type Header_Num is range 0 .. Max_Header_Num;
-- Size for hash table below. The upper bound is an arbitrary value, the
-- value here was chosen after testing to determine a good compromise
-- between speed of access and memory usage.
......@@ -317,6 +318,9 @@ package Prj is
function Hash (Name : Path_Name_Type) return Header_Num;
-- Used for computing hash values for names put into above hash table
function Hash (Project : Project_Id) return Header_Num;
-- Used for hash tables where Project_Id is the Key
type Language_Kind is (File_Based, Unit_Based);
-- Type for the kind of language. All languages are file based, except Ada
-- which is unit based.
......@@ -420,6 +424,13 @@ package Prj is
-- shared libraries. Specified in the configuration. When not specified,
-- there is no need for such switch.
Object_Generated : Boolean := True;
-- False in no object file is generated
Objects_Linked : Boolean := True;
-- False if object files are not use to link executables and build
-- libraries.
Runtime_Library_Dir : Name_Id := No_Name;
-- Path name of the runtime library directory, if any
......@@ -527,6 +538,8 @@ package Prj is
Compiler_Driver_Path => null,
Compiler_Required_Switches => No_Name_List,
Compilation_PIC_Option => No_Name_List,
Object_Generated => True,
Objects_Linked => True,
Runtime_Library_Dir => No_Name,
Mapping_File_Switches => No_Name_List,
Mapping_Spec_Suffix => No_File,
......@@ -616,6 +629,13 @@ package Prj is
Compiled : Boolean := True;
-- False when there is no compiler for the language
In_Interfaces : Boolean := True;
-- False when the source is not included in interfaces, when attribute
-- Interfaces is declared.
Declared_In_Interfaces : Boolean := False;
-- True when source is declared in attribute Interfaces
Alternate_Languages : Alternate_Language_Id := No_Alternate_Language;
-- List of languages a header file may also be, in addition of
-- language Language_Name.
......@@ -667,6 +687,10 @@ package Prj is
Object_Exists : Boolean := True;
-- True if an object file exists
Object_Linked : Boolean := True;
-- False if the object file is not use to link executables or included
-- in libraries.
Object : File_Name_Type := No_File;
-- File name of the object file
......@@ -719,6 +743,8 @@ package Prj is
Language => No_Language_Index,
Lang_Kind => File_Based,
Compiled => True,
In_Interfaces => True,
Declared_In_Interfaces => False,
Alternate_Languages => No_Alternate_Language,
Kind => Spec,
Dependency => None,
......@@ -735,6 +761,7 @@ package Prj is
Source_TS => Empty_Time_Stamp,
Object_Project => No_Project,
Object_Exists => True,
Object_Linked => True,
Object => No_File,
Current_Object_Path => No_Path,
Object_Path => No_Path,
......@@ -1267,9 +1294,6 @@ package Prj is
Dir_Path : String_Access;
-- Same as Directory, but as an access to String
Library : Boolean := False;
-- True if this is a library project
Library_Dir : Path_Name_Type := No_Path;
-- If a library project, path name of the directory where the library
-- resides.
......@@ -1303,6 +1327,9 @@ package Prj is
-- be different from Library_ALI_Dir for platforms where the file names
-- are case-insensitive.
Library : Boolean := False;
-- True if this is a library project
Library_Name : Name_Id := No_Name;
-- If a library project, name of the library
......@@ -1339,6 +1366,10 @@ package Prj is
Last_Source : Source_Id := No_Source;
-- Head and tail of the list of sources
Interfaces_Defined : Boolean := False;
-- True if attribute Interfaces is declared for the project or any
-- project it extends.
Unit_Based_Language_Name : Name_Id := No_Name;
Unit_Based_Language_Index : Language_Index := No_Language_Index;
-- The name and index, if any, of the unit-based language of some
......
......@@ -771,6 +771,8 @@ package body Snames is
"mapping_body_suffix#" &
"metrics#" &
"naming#" &
"object_generated#" &
"objects_linked#" &
"objects_path#" &
"objects_path_file#" &
"object_dir#" &
......
......@@ -1092,56 +1092,58 @@ package Snames is
Name_Mapping_Body_Suffix : constant Name_Id := N + 710;
Name_Metrics : constant Name_Id := N + 711;
Name_Naming : constant Name_Id := N + 712;
Name_Objects_Path : constant Name_Id := N + 713;
Name_Objects_Path_File : constant Name_Id := N + 714;
Name_Object_Dir : constant Name_Id := N + 715;
Name_Pic_Option : constant Name_Id := N + 716;
Name_Pretty_Printer : constant Name_Id := N + 717;
Name_Prefix : constant Name_Id := N + 718;
Name_Project : constant Name_Id := N + 719;
Name_Roots : constant Name_Id := N + 720;
Name_Required_Switches : constant Name_Id := N + 721;
Name_Run_Path_Option : constant Name_Id := N + 722;
Name_Runtime_Project : constant Name_Id := N + 723;
Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 724;
Name_Shared_Library_Prefix : constant Name_Id := N + 725;
Name_Shared_Library_Suffix : constant Name_Id := N + 726;
Name_Separate_Suffix : constant Name_Id := N + 727;
Name_Source_Dirs : constant Name_Id := N + 728;
Name_Source_Files : constant Name_Id := N + 729;
Name_Source_List_File : constant Name_Id := N + 730;
Name_Spec : constant Name_Id := N + 731;
Name_Spec_Suffix : constant Name_Id := N + 732;
Name_Specification : constant Name_Id := N + 733;
Name_Specification_Exceptions : constant Name_Id := N + 734;
Name_Specification_Suffix : constant Name_Id := N + 735;
Name_Stack : constant Name_Id := N + 736;
Name_Switches : constant Name_Id := N + 737;
Name_Symbolic_Link_Supported : constant Name_Id := N + 738;
Name_Sync : constant Name_Id := N + 739;
Name_Synchronize : constant Name_Id := N + 740;
Name_Toolchain_Description : constant Name_Id := N + 741;
Name_Toolchain_Version : constant Name_Id := N + 742;
Name_Runtime_Library_Dir : constant Name_Id := N + 743;
Name_Object_Generated : constant Name_Id := N + 713;
Name_Objects_Linked : constant Name_Id := N + 714;
Name_Objects_Path : constant Name_Id := N + 715;
Name_Objects_Path_File : constant Name_Id := N + 716;
Name_Object_Dir : constant Name_Id := N + 717;
Name_Pic_Option : constant Name_Id := N + 718;
Name_Pretty_Printer : constant Name_Id := N + 719;
Name_Prefix : constant Name_Id := N + 720;
Name_Project : constant Name_Id := N + 721;
Name_Roots : constant Name_Id := N + 722;
Name_Required_Switches : constant Name_Id := N + 723;
Name_Run_Path_Option : constant Name_Id := N + 724;
Name_Runtime_Project : constant Name_Id := N + 725;
Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 726;
Name_Shared_Library_Prefix : constant Name_Id := N + 727;
Name_Shared_Library_Suffix : constant Name_Id := N + 728;
Name_Separate_Suffix : constant Name_Id := N + 729;
Name_Source_Dirs : constant Name_Id := N + 730;
Name_Source_Files : constant Name_Id := N + 731;
Name_Source_List_File : constant Name_Id := N + 732;
Name_Spec : constant Name_Id := N + 733;
Name_Spec_Suffix : constant Name_Id := N + 734;
Name_Specification : constant Name_Id := N + 735;
Name_Specification_Exceptions : constant Name_Id := N + 736;
Name_Specification_Suffix : constant Name_Id := N + 737;
Name_Stack : constant Name_Id := N + 738;
Name_Switches : constant Name_Id := N + 739;
Name_Symbolic_Link_Supported : constant Name_Id := N + 740;
Name_Sync : constant Name_Id := N + 741;
Name_Synchronize : constant Name_Id := N + 742;
Name_Toolchain_Description : constant Name_Id := N + 743;
Name_Toolchain_Version : constant Name_Id := N + 744;
Name_Runtime_Library_Dir : constant Name_Id := N + 745;
-- Other miscellaneous names used in front end
Name_Unaligned_Valid : constant Name_Id := N + 744;
Name_Unaligned_Valid : constant Name_Id := N + 746;
-- Ada 2005 reserved words
First_2005_Reserved_Word : constant Name_Id := N + 745;
Name_Interface : constant Name_Id := N + 745;
Name_Overriding : constant Name_Id := N + 746;
Name_Synchronized : constant Name_Id := N + 747;
Last_2005_Reserved_Word : constant Name_Id := N + 747;
First_2005_Reserved_Word : constant Name_Id := N + 747;
Name_Interface : constant Name_Id := N + 747;
Name_Overriding : constant Name_Id := N + 748;
Name_Synchronized : constant Name_Id := N + 749;
Last_2005_Reserved_Word : constant Name_Id := N + 749;
subtype Ada_2005_Reserved_Words is
Name_Id range First_2005_Reserved_Word .. Last_2005_Reserved_Word;
-- Mark last defined name for consistency check in Snames body
Last_Predefined_Name : constant Name_Id := N + 747;
Last_Predefined_Name : constant Name_Id := N + 749;
---------------------------------------
-- Subtypes Defining Name Categories --
......
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