aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinput-p.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-15 14:57:34 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-15 14:57:34 +0200
commit8a912a6e1046ad6137c0792522787d66ed24bb0d (patch)
tree3489ca9074d53f4ef4b6e41caf8e4ddb5ef09213 /gcc/ada/sinput-p.adb
parent4a13695ca1f5a81aa054ff52e15705b88016bd17 (diff)
downloadgcc-8a912a6e1046ad6137c0792522787d66ed24bb0d.zip
gcc-8a912a6e1046ad6137c0792522787d66ed24bb0d.tar.gz
gcc-8a912a6e1046ad6137c0792522787d66ed24bb0d.tar.bz2
[multiple changes]
2009-04-15 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Comment improvements. (Build_Entry_Family_Name): Add parentheses around the index of a entry family member. 2009-04-15 Bob Duff <duff@adacore.com> * 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 <celier@adacore.com> * sinput-p.ads, sinput-p.adb (Clear_Source_File_Table): New procedure 2009-04-15 Ed Schonberg <schonberg@adacore.com> * 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
Diffstat (limited to 'gcc/ada/sinput-p.adb')
-rw-r--r--gcc/ada/sinput-p.adb55
1 files changed, 55 insertions, 0 deletions
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 --
-----------------------