summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-19 16:24:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-19 16:24:17 +0000
commit0cd59c118d696092aaead1d09db59591ce085e3b (patch)
treea44749e3f074425c00c87c4a0ca9db1580651b37 /gcc/ada
parent3558902e0e9d43e1c4c6ecf6f9997e5784fb4d04 (diff)
downloadgcc-0cd59c118d696092aaead1d09db59591ce085e3b.tar.gz
2007-12-19 Vincent Celier <celier@adacore.com>
* prj-attr.adb (Package_Node_Id_Of): Returns Unknown_Package when package is not known * prj-attr.ads (Unknown_Package): New constant Do not crash when an unknown package is in several projects * prj-dect.adb (Parse_Package_Declaration): Mark an unknown package as ignored * prj-nmsc.adb (Check): Remove obsolete code related to no longer existing package Language_Processing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131078 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/prj-attr.adb7
-rw-r--r--gcc/ada/prj-attr.ads13
-rw-r--r--gcc/ada/prj-dect.adb15
-rw-r--r--gcc/ada/prj-nmsc.adb29
4 files changed, 25 insertions, 39 deletions
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index bb5cfb44f06..0f3fef4a722 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -602,7 +602,11 @@ package body Prj.Attr is
begin
for Index in Package_Attributes.First .. Package_Attributes.Last loop
if Package_Attributes.Table (Index).Name = Name then
- return (Value => Index);
+ if Package_Attributes.Table (Index).Known then
+ return (Value => Index);
+ else
+ return Unknown_Package;
+ end if;
end if;
end loop;
@@ -689,6 +693,7 @@ package body Prj.Attr is
Attr_Kind => Real_Attr_Kind,
Read_Only => False,
Next => First_Attr);
+
Package_Attributes.Table (In_Package.Value).First_Attribute :=
Attrs.Last;
end Register_New_Attribute;
diff --git a/gcc/ada/prj-attr.ads b/gcc/ada/prj-attr.ads
index 69a922bd644..135878e25c2 100644
--- a/gcc/ada/prj-attr.ads
+++ b/gcc/ada/prj-attr.ads
@@ -171,6 +171,9 @@ package Prj.Attr is
Empty_Package : constant Package_Node_Id;
-- Default value of Package_Node_Id objects
+ Unknown_Package : constant Package_Node_Id;
+ -- Value of an unknown package that has been found but is unknown.
+
procedure Register_New_Package (Name : String; Id : out Package_Node_Id);
-- Add a new package. Fails if Name (the package name) is empty or is
-- already the name of a package, and set Id to Empty_Package,
@@ -250,11 +253,11 @@ private
end record;
-- Full declaration of self-initialized private type
- Empty_Pkg : constant Pkg_Node_Id := Package_Node_Low_Bound;
-
- Empty_Package : constant Package_Node_Id := (Value => Empty_Pkg);
-
- First_Package : constant Pkg_Node_Id := Package_Node_Low_Bound + 1;
+ Empty_Pkg : constant Pkg_Node_Id := Package_Node_Low_Bound;
+ Empty_Package : constant Package_Node_Id := (Value => Empty_Pkg);
+ Unknown_Pkg : constant Pkg_Node_Id := Package_Node_High_Bound;
+ Unknown_Package : constant Package_Node_Id := (Value => Unknown_Pkg);
+ First_Package : constant Pkg_Node_Id := Package_Node_Low_Bound + 1;
First_Package_Node_Id : constant Package_Node_Id :=
(Value => First_Package);
diff --git a/gcc/ada/prj-dect.adb b/gcc/ada/prj-dect.adb
index 7e367a7e146..24c312e70ee 100644
--- a/gcc/ada/prj-dect.adb
+++ b/gcc/ada/prj-dect.adb
@@ -981,10 +981,7 @@ package body Prj.Dect is
Current_Package := Package_Node_Id_Of (Token_Name);
- if Current_Package /= Empty_Package then
- First_Attribute := First_Attribute_Of (Current_Package);
-
- else
+ if Current_Package = Empty_Package then
if not Quiet_Output then
Error_Msg ("?""" &
Get_Name_String
@@ -1001,6 +998,16 @@ package body Prj.Dect is
-- Add the unknown package in the list of packages
Add_Unknown_Package (Token_Name, Current_Package);
+
+ elsif Current_Package = Unknown_Package then
+
+ -- Set the package declaration to "ignored" so that it is not
+ -- processed by Prj.Proc.Process.
+
+ Set_Expression_Kind_Of (Package_Declaration, In_Tree, Ignored);
+
+ else
+ First_Attribute := First_Attribute_Of (Current_Package);
end if;
Set_Package_Id_Of
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index f6a37b657dd..128913b8822 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -714,8 +714,6 @@ package body Prj.Nmsc is
is
Data : Project_Data := In_Tree.Projects.Table (Project);
Extending : Boolean := False;
- Lang_Proc_Pkg : Package_Id;
- Linker_Name : Variable_Value;
begin
Nmsc.When_No_Sources := When_No_Sources;
@@ -840,33 +838,6 @@ package body Prj.Nmsc is
Get_Mains (Project, In_Tree, Data);
- -- In multi-language mode, check if there is a linker specified
-
- if Get_Mode = Multi_Language then
- Lang_Proc_Pkg :=
- Value_Of (Name_Language_Processing, Data.Decl.Packages, In_Tree);
-
- if Lang_Proc_Pkg /= No_Package then
- Linker_Name :=
- Value_Of
- (Variable_Name => Name_Linker,
- In_Variables =>
- In_Tree.Packages.Table (Lang_Proc_Pkg).Decl.Attributes,
- In_Tree => In_Tree);
-
- if Linker_Name /= Nil_Variable_Value then
- Get_Name_String (Linker_Name.Value);
-
- if Name_Len > 0 then
- -- A non empty linker name was specified
-
- Data.Linker_Name := File_Name_Type (Linker_Name.Value);
-
- end if;
- end if;
- end if;
- end if;
-
-- Update the project data in the Projects table
In_Tree.Projects.Table (Project) := Data;