From 8a912a6e1046ad6137c0792522787d66ed24bb0d Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 15 Apr 2009 14:57:34 +0200 Subject: [multiple changes] 2009-04-15 Hristian Kirtchev * exp_ch9.adb: Comment improvements. (Build_Entry_Family_Name): Add parentheses around the index of a entry family member. 2009-04-15 Bob Duff * sem_warn.adb (Check_Infinite_Loop_Warning): Catch cases like "while X /= null loop" where X is unchanged inside the loop. We were not warning in this case, because of the pointers -- we feared that the loop variable could be updated via a pointer, if there are any pointers around the place. But that is impossible in this case. * sem_util.adb (May_Be_Lvalue): This routine was overly pessimistic in the case of dereferences. In X.all, X cannot be an l-value. We now catch that case (and implicit dereferences, too). 2009-04-15 Vincent Celier * sinput-p.ads, sinput-p.adb (Clear_Source_File_Table): New procedure 2009-04-15 Ed Schonberg * sem_ch12.adb (Is_Actual_Of_Previous_Formal): Make fully recursive. From code reading. (Analyze_Package_Instantiation): If generic unit in child instance is the same as generic unit in parent instance, look for an outer homonym to locate the desired generic. From-SVN: r146112 --- gcc/ada/sinput-p.adb | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'gcc/ada/sinput-p.adb') diff --git a/gcc/ada/sinput-p.adb b/gcc/ada/sinput-p.adb index b57c73b..7bf1be2 100644 --- a/gcc/ada/sinput-p.adb +++ b/gcc/ada/sinput-p.adb @@ -23,9 +23,14 @@ -- -- ------------------------------------------------------------------------------ +with Ada.Unchecked_Conversion; +with Ada.Unchecked_Deallocation; + with Prj.Err; with Sinput.C; +with System; + package body Sinput.P is First : Boolean := True; @@ -34,6 +39,56 @@ package body Sinput.P is -- The flag is reset to False at the first call to Load_Project_File. -- Calling Reset_First sets it back to True. + procedure Free is new Ada.Unchecked_Deallocation + (Lines_Table_Type, Lines_Table_Ptr); + + procedure Free is new Ada.Unchecked_Deallocation + (Logical_Lines_Table_Type, Logical_Lines_Table_Ptr); + + ----------------------------- + -- Clear_Source_File_Table -- + ----------------------------- + + procedure Clear_Source_File_Table is + use System; + begin + for X in 1 .. Source_File.Last loop + declare + S : Source_File_Record renames Source_File.Table (X); + Lo : constant Source_Ptr := S.Source_First; + Hi : constant Source_Ptr := S.Source_Last; + subtype Actual_Source_Buffer is Source_Buffer (Lo .. Hi); + -- Physical buffer allocated + + type Actual_Source_Ptr is access Actual_Source_Buffer; + -- This is the pointer type for the physical buffer allocated + + procedure Free is new Ada.Unchecked_Deallocation + (Actual_Source_Buffer, Actual_Source_Ptr); + + pragma Suppress (All_Checks); + + pragma Warnings (Off); + -- The following unchecked conversion is aliased safe, since it + -- is not used to create improperly aliased pointer values. + + function To_Actual_Source_Ptr is new + Ada.Unchecked_Conversion (Address, Actual_Source_Ptr); + + Actual_Ptr : Actual_Source_Ptr := + To_Actual_Source_Ptr (S.Source_Text (Lo)'Address); + + begin + Free (Actual_Ptr); + Free (S.Lines_Table); + Free (S.Logical_Lines_Table); + end; + end loop; + + Source_File.Free; + Source_File.Init; + end Clear_Source_File_Table; + ----------------------- -- Load_Project_File -- ----------------------- -- cgit v1.1