diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-20 12:45:54 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-20 12:45:54 +0000 |
commit | ba381ae5404608221a17b0f895bade166e5cb587 (patch) | |
tree | 4f65013f967ac2ea1c063adc21103b17e57712c4 /gcc/ada/prj-strt.adb | |
parent | 4ef962616dc83114d9e1312777963c0ce6e9b97a (diff) | |
download | gcc-ba381ae5404608221a17b0f895bade166e5cb587.tar.gz |
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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135623 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-strt.adb')
-rw-r--r-- | gcc/ada/prj-strt.adb | 94 |
1 files changed, 56 insertions, 38 deletions
diff --git a/gcc/ada/prj-strt.adb b/gcc/ada/prj-strt.adb index 28c5b34a304..862b6ff6302 100644 --- a/gcc/ada/prj-strt.adb +++ b/gcc/ada/prj-strt.adb @@ -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- -- @@ -244,7 +244,7 @@ package body Prj.Strt is -- Change name of obsolete attributes - if Reference /= Empty_Node then + if Present (Reference) then case Name_Of (Reference, In_Tree) is when Snames.Name_Specification => Set_Name_Of (Reference, In_Tree, To => Snames.Name_Spec); @@ -716,7 +716,7 @@ package body Prj.Strt is (Current_Project, In_Tree, Names.Table (1).Name); end if; - if The_Project = Empty_Node then + if No (The_Project) then -- If it is neither a project name nor a package name, -- report an error. @@ -734,7 +734,7 @@ package body Prj.Strt is The_Package := First_Package_Of (Current_Project, In_Tree); - while The_Package /= Empty_Node + while Present (The_Package) and then Name_Of (The_Package, In_Tree) /= Names.Table (1).Name loop @@ -745,7 +745,7 @@ package body Prj.Strt is -- If it has not been already declared, report an -- error. - if The_Package = Empty_Node then + if No (The_Package) then Error_Msg_Name_1 := Names.Table (1).Name; Error_Msg ("package % not yet defined", Names.Table (1).Location); @@ -820,7 +820,7 @@ package body Prj.Strt is -- If the long project exists, then this is the prefix -- of the attribute. - if The_Project /= Empty_Node then + if Present (The_Project) then First_Attribute := Attribute_First; The_Package := Empty_Node; @@ -841,7 +841,7 @@ package body Prj.Strt is -- If short project does not exist, report an error - if The_Project = Empty_Node then + if No (The_Project) then Error_Msg_Name_1 := Long_Project; Error_Msg_Name_2 := Short_Project; Error_Msg ("unknown projects % or %", @@ -855,7 +855,7 @@ package body Prj.Strt is The_Package := First_Package_Of (The_Project, In_Tree); - while The_Package /= Empty_Node + while Present (The_Package) and then Name_Of (The_Package, In_Tree) /= Names.Table (Names.Last).Name loop @@ -865,7 +865,7 @@ package body Prj.Strt is -- If it has not, then we report an error - if The_Package = Empty_Node then + if No (The_Package) then Error_Msg_Name_1 := Names.Table (Names.Last).Name; Error_Msg_Name_2 := Short_Project; @@ -926,7 +926,7 @@ package body Prj.Strt is The_Package := First_Package_Of (Current_Project, In_Tree); - while The_Package /= Empty_Node + while Present (The_Package) and then Name_Of (The_Package, In_Tree) /= Names.Table (1).Name loop @@ -939,10 +939,10 @@ package body Prj.Strt is The_Project := Imported_Or_Extended_Project_Of (Current_Project, In_Tree, Names.Table (1).Name); - if The_Project /= Empty_Node then + if Present (The_Project) then Specified_Project := The_Project; - elsif The_Package = Empty_Node then + elsif No (The_Package) then Error_Msg_Name_1 := Names.Table (1).Name; Error_Msg ("unknown package or project %", Names.Table (1).Location); @@ -1004,7 +1004,7 @@ package body Prj.Strt is The_Project := Imported_Or_Extended_Project_Of (Current_Project, In_Tree, Long_Project); - if The_Project /= Empty_Node then + if Present (The_Project) then Specified_Project := The_Project; else @@ -1017,7 +1017,7 @@ package body Prj.Strt is Imported_Or_Extended_Project_Of (Current_Project, In_Tree, Short_Project); - if The_Project = Empty_Node then + if No (The_Project) then -- Unknown prefix, report an error Error_Msg_Name_1 := Long_Project; @@ -1034,7 +1034,7 @@ package body Prj.Strt is The_Package := First_Package_Of (The_Project, In_Tree); - while The_Package /= Empty_Node + while Present (The_Package) and then Name_Of (The_Package, In_Tree) /= Names.Table (Names.Last - 1).Name loop @@ -1042,7 +1042,7 @@ package body Prj.Strt is Next_Package_In_Project (The_Package, In_Tree); end loop; - if The_Package = Empty_Node then + if No (The_Package) then -- The package does not exist, report an error @@ -1065,7 +1065,7 @@ package body Prj.Strt is Set_Project_Node_Of (Variable, In_Tree, To => Specified_Project); Set_Package_Node_Of (Variable, In_Tree, To => Specified_Package); - if Specified_Project /= Empty_Node then + if Present (Specified_Project) then The_Project := Specified_Project; else The_Project := Current_Project; @@ -1078,10 +1078,10 @@ package body Prj.Strt is -- If a package was specified, check if the variable has been -- declared in this package. - if Specified_Package /= Empty_Node then + if Present (Specified_Package) then Current_Variable := First_Variable_Of (Specified_Package, In_Tree); - while Current_Variable /= Empty_Node + while Present (Current_Variable) and then Name_Of (Current_Variable, In_Tree) /= Variable_Name loop @@ -1093,12 +1093,12 @@ package body Prj.Strt is -- a package, first check if the variable has been declared in -- the package. - if Specified_Project = Empty_Node - and then Current_Package /= Empty_Node + if No (Specified_Project) + and then Present (Current_Package) then Current_Variable := First_Variable_Of (Current_Package, In_Tree); - while Current_Variable /= Empty_Node + while Present (Current_Variable) and then Name_Of (Current_Variable, In_Tree) /= Variable_Name loop Current_Variable := @@ -1107,29 +1107,47 @@ package body Prj.Strt is end if; -- If we have not found the variable in the package, check if the - -- variable has been declared in the project. + -- variable has been declared in the project, or in any of its + -- ancestors. - if Current_Variable = Empty_Node then - Current_Variable := First_Variable_Of (The_Project, In_Tree); - while Current_Variable /= Empty_Node - and then Name_Of (Current_Variable, In_Tree) /= Variable_Name - loop - Current_Variable := - Next_Variable (Current_Variable, In_Tree); - end loop; + if No (Current_Variable) then + declare + Proj : Project_Node_Id := The_Project; + + begin + loop + Current_Variable := First_Variable_Of (Proj, In_Tree); + while + Present (Current_Variable) + and then + Name_Of (Current_Variable, In_Tree) /= Variable_Name + loop + Current_Variable := + Next_Variable (Current_Variable, In_Tree); + end loop; + + exit when Present (Current_Variable); + + Proj := Parent_Project_Of (Proj, In_Tree); + + Set_Project_Node_Of (Variable, In_Tree, To => Proj); + + exit when No (Proj); + end loop; + end; end if; end if; -- If the variable was not found, report an error - if Current_Variable = Empty_Node then + if No (Current_Variable) then Error_Msg_Name_1 := Variable_Name; Error_Msg ("unknown variable %", Names.Table (Names.Last).Location); end if; end if; - if Current_Variable /= Empty_Node then + if Present (Current_Variable) then Set_Expression_Kind_Of (Variable, In_Tree, To => Expression_Kind_Of (Current_Variable, In_Tree)); @@ -1185,9 +1203,9 @@ package body Prj.Strt is -- Add the literal of the string type to the Choices table - if String_Type /= Empty_Node then + if Present (String_Type) then Current_String := First_Literal_String (String_Type, In_Tree); - while Current_String /= Empty_Node loop + while Present (Current_String) loop Add (This_String => String_Value_Of (Current_String, In_Tree)); Current_String := Next_Literal_String (Current_String, In_Tree); end loop; @@ -1290,7 +1308,7 @@ package body Prj.Strt is -- If Current_Expression is empty, it means that the -- expression is the first in the string list. - if Current_Expression = Empty_Node then + if No (Current_Expression) then Set_First_Expression_In_List (Term_Id, In_Tree, To => Next_Expression); else @@ -1382,7 +1400,7 @@ package body Prj.Strt is Current_Package => Current_Package); Set_Current_Term (Term, In_Tree, To => Reference); - if Reference /= Empty_Node then + if Present (Reference) then -- If we don't know the expression kind (first term), then it -- has the kind of the variable or attribute reference. @@ -1425,7 +1443,7 @@ package body Prj.Strt is -- Same checks as above for the expression kind - if Reference /= Empty_Node then + if Present (Reference) then if Expr_Kind = Undefined then Expr_Kind := Expression_Kind_Of (Reference, In_Tree); |