prj.adb, [...] (Project_Data.Unit_Based_Language_*): Two fields removed.
[gcc.git] / gcc / ada / prj.adb
index 6c26bc182a35853476c4b94451ed2cc48e234b9e..db6ea7f81fafa8c6784cc6e81e13890cd235b385 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2009, 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- --
@@ -73,14 +73,10 @@ package body Prj is
 
    Std_Naming_Data : constant Naming_Data :=
                        (Dot_Replacement           => Standard_Dot_Replacement,
-                        Dot_Repl_Loc              => No_Location,
                         Casing                    => All_Lower_Case,
                         Spec_Suffix               => No_Array_Element,
-                        Ada_Spec_Suffix_Loc       => No_Location,
                         Body_Suffix               => No_Array_Element,
-                        Ada_Body_Suffix_Loc       => No_Location,
                         Separate_Suffix           => No_File,
-                        Sep_Suffix_Loc            => No_Location,
                         Specs                     => No_Array_Element,
                         Bodies                    => No_Array_Element,
                         Specification_Exceptions  => No_Array_Element,
@@ -91,7 +87,6 @@ package body Prj is
                       Externally_Built               => False,
                       Config                         => Default_Project_Config,
                       Languages                      => No_Name_List,
-                      First_Referred_By              => No_Project,
                       Name                           => No_Name,
                       Display_Name                   => No_Name,
                       Path                           => No_Path_Information,
@@ -118,8 +113,6 @@ package body Prj is
                       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,
                       Include_Path                   => null,
                       Include_Data_Set               => False,
@@ -161,6 +154,9 @@ package body Prj is
    --  Table to store the path name of all the created temporary files, so that
    --  they can be deleted at the end, or when the program is interrupted.
 
+   procedure Free (Project : in out Project_Data);
+   --  Free memory allocated for Project
+
    -------------------
    -- Add_To_Buffer --
    -------------------
@@ -706,11 +702,18 @@ package body Prj is
    -----------------
 
    function Object_Name
-     (Source_File_Name : File_Name_Type)
+     (Source_File_Name   : File_Name_Type;
+      Object_File_Suffix : Name_Id := No_Name)
       return File_Name_Type
    is
    begin
-      return Extend_Name (Source_File_Name, Object_Suffix);
+      if Object_File_Suffix = No_Name then
+         return Extend_Name
+           (Source_File_Name, Object_Suffix);
+      else
+         return Extend_Name
+           (Source_File_Name, Get_Name_String (Object_File_Suffix));
+      end if;
    end Object_Name;
 
    ----------------------
@@ -831,6 +834,19 @@ package body Prj is
    -- Free --
    ----------
 
+   procedure Free (Project : in out Project_Data) is
+   begin
+      Free (Project.Dir_Path);
+      Free (Project.Include_Path);
+      Free (Project.Ada_Include_Path);
+      Free (Project.Objects_Path);
+      Free (Project.Ada_Objects_Path);
+   end Free;
+
+   ----------
+   -- Free --
+   ----------
+
    procedure Free (Tree : in out Project_Tree_Ref) is
       procedure Unchecked_Free is new Ada.Unchecked_Deallocation
         (Project_Tree_Data, Project_Tree_Ref);
@@ -844,7 +860,6 @@ package body Prj is
          Array_Table.Free (Tree.Arrays);
          Package_Table.Free (Tree.Packages);
          Project_List_Table.Free (Tree.Project_Lists);
-         Project_Table.Free (Tree.Projects);
          Source_Data_Table.Free (Tree.Sources);
          Alternate_Language_Table.Free (Tree.Alt_Langs);
          Unit_Table.Free (Tree.Units);
@@ -853,6 +868,14 @@ package body Prj is
          Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
          Unit_Sources_Htable.Reset (Tree.Unit_Sources_HT);
 
+         for P in Project_Table.First ..
+           Project_Table.Last (Tree.Projects)
+         loop
+            Free (Tree.Projects.Table (P));
+         end loop;
+
+         Project_Table.Free (Tree.Projects);
+
          --  Private part
 
          Naming_Table.Free (Tree.Private_Part.Namings);
@@ -885,7 +908,6 @@ package body Prj is
       Array_Table.Init              (Tree.Arrays);
       Package_Table.Init            (Tree.Packages);
       Project_List_Table.Init       (Tree.Project_Lists);
-      Project_Table.Init            (Tree.Projects);
       Source_Data_Table.Init        (Tree.Sources);
       Alternate_Language_Table.Init (Tree.Alt_Langs);
       Unit_Table.Init               (Tree.Units);
@@ -894,6 +916,16 @@ package body Prj is
       Source_Paths_Htable.Reset     (Tree.Source_Paths_HT);
       Unit_Sources_Htable.Reset     (Tree.Unit_Sources_HT);
 
+      if not Project_Table."=" (Tree.Projects.Table, null) then
+         for P in Project_Table.First ..
+           Project_Table.Last (Tree.Projects)
+         loop
+            Free (Tree.Projects.Table (P));
+         end loop;
+      end if;
+
+      Project_Table.Init            (Tree.Projects);
+
       --  Private part table
 
       Naming_Table.Init             (Tree.Private_Part.Namings);