diff mbox

[Ada] Cleanup in exception_occurrence

Message ID 20110829125346.GA28366@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Aug. 29, 2011, 12:53 p.m. UTC
Two components (Private_Data and Cleanup_Flag) are now removed because they
were unused.

No functionnal change.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-29  Tristan Gingold  <gingold@adacore.com>

	* a-exstat.adb (String_To_EO): Do no set Cleanup_Flag.
	* a-exexda.adb (Set_Exception_C_Msg): Ditto.
	(Set_Exception_Msg): Ditto.
	* a-exexpr-gcc.adb (Setup_Current_Excep): Ditto.  Do not set
	Private_Data.
	* a-except.adb, a-except-2005.adb (Save_Occurrence_No_Private): Remove.
	Use Save_Occurrence instead of Save_Occurrence_No_Private.
	(Raise_With_Msg): Remove Cleanup_Flag.
	* a-except.ads, a-except-2005.ads (Exception_Occurrence): Remove
	Clean_Flag and Private_Data components.
diff mbox

Patch

Index: a-exstat.adb
===================================================================
--- a-exstat.adb	(revision 178155)
+++ a-exstat.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -144,8 +144,6 @@ 
          return Null_Occurrence;
 
       else
-         X.Cleanup_Flag := False;
-
          To := S'First - 2;
          Next_String;
 
Index: a-exexpr-gcc.adb
===================================================================
--- a-exexpr-gcc.adb	(revision 178215)
+++ a-exexpr-gcc.adb	(working copy)
@@ -350,11 +350,9 @@ 
 
          Excep.Id := Foreign_Exception'Access;
          Excep.Msg_Length := 0;
-         Excep.Cleanup_Flag := False;
          Excep.Exception_Raised := True;
          Excep.Pid := Local_Partition_ID;
          Excep.Num_Tracebacks := 0;
-         Excep.Private_Data := System.Null_Address;
       end if;
    end Setup_Current_Excep;
 
Index: a-except.adb
===================================================================
--- a-except.adb	(revision 178214)
+++ a-except.adb	(working copy)
@@ -341,18 +341,6 @@ 
    --  (all fields of this exception occurrence are set). Abort is deferred
    --  before the reraise operation.
 
-   --  Save_Occurrence variations: As the management of the private data
-   --  attached to occurrences is delicate, whether or not pointers to such
-   --  data has to be copied in various situations is better made explicit.
-   --  The following procedures provide an internal interface to help making
-   --  this explicit.
-
-   procedure Save_Occurrence_No_Private
-     (Target : out Exception_Occurrence;
-      Source : Exception_Occurrence);
-   --  Copy all the components of Source to Target, except the
-   --  Private_Data pointer.
-
    procedure Transfer_Occurrence
      (Target : Exception_Occurrence_Access;
       Source : Exception_Occurrence);
@@ -959,7 +947,6 @@ 
       Excep.Exception_Raised := False;
       Excep.Id               := E;
       Excep.Num_Tracebacks   := 0;
-      Excep.Cleanup_Flag     := False;
       Excep.Pid              := Local_Partition_ID;
       Abort_Defer.all;
       Raise_Current_Excep (E);
@@ -1164,7 +1151,7 @@ 
    begin
       if X.Id /= null then
          Abort_Defer.all;
-         Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+         Save_Occurrence (Get_Current_Excep.all.all, X);
          Raise_Current_Excep (X.Id);
       end if;
    end Reraise_Occurrence;
@@ -1176,7 +1163,7 @@ 
    procedure Reraise_Occurrence_Always (X : Exception_Occurrence) is
    begin
       Abort_Defer.all;
-      Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+      Save_Occurrence (Get_Current_Excep.all.all, X);
       Raise_Current_Excep (X.Id);
    end Reraise_Occurrence_Always;
 
@@ -1186,7 +1173,7 @@ 
 
    procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
    begin
-      Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+      Save_Occurrence (Get_Current_Excep.all.all, X);
       Raise_Current_Excep (X.Id);
    end Reraise_Occurrence_No_Defer;
 
@@ -1199,38 +1186,25 @@ 
       Source : Exception_Occurrence)
    is
    begin
-      Save_Occurrence_No_Private (Target, Source);
-   end Save_Occurrence;
-
-   function Save_Occurrence (Source : Exception_Occurrence) return EOA is
-      Target : constant EOA := new Exception_Occurrence;
-   begin
-      Save_Occurrence (Target.all, Source);
-      return Target;
-   end Save_Occurrence;
-
-   --------------------------------
-   -- Save_Occurrence_No_Private --
-   --------------------------------
-
-   procedure Save_Occurrence_No_Private
-     (Target : out Exception_Occurrence;
-      Source : Exception_Occurrence)
-   is
-   begin
       Target.Id             := Source.Id;
       Target.Msg_Length     := Source.Msg_Length;
       Target.Num_Tracebacks := Source.Num_Tracebacks;
       Target.Pid            := Source.Pid;
-      Target.Cleanup_Flag   := Source.Cleanup_Flag;
 
       Target.Msg (1 .. Target.Msg_Length) :=
         Source.Msg (1 .. Target.Msg_Length);
 
       Target.Tracebacks (1 .. Target.Num_Tracebacks) :=
         Source.Tracebacks (1 .. Target.Num_Tracebacks);
-   end Save_Occurrence_No_Private;
+   end Save_Occurrence;
 
+   function Save_Occurrence (Source : Exception_Occurrence) return EOA is
+      Target : constant EOA := new Exception_Occurrence;
+   begin
+      Save_Occurrence (Target.all, Source);
+      return Target;
+   end Save_Occurrence;
+
    -------------------------
    -- Transfer_Occurrence --
    -------------------------
@@ -1240,13 +1214,7 @@ 
       Source : Exception_Occurrence)
    is
    begin
-      --  Setup Target as an exception to be propagated in the calling task
-      --  (rendezvous-wise), taking care not to clobber the associated private
-      --  data. Target is expected to be a pointer to the calling task's fixed
-      --  TSD occurrence, which is very different from Get_Current_Excep here
-      --  because this subprogram is called from the called task.
-
-      Save_Occurrence_No_Private (Target.all, Source);
+      Save_Occurrence (Target.all, Source);
    end Transfer_Occurrence;
 
    -------------------
Index: a-except.ads
===================================================================
--- a-except.ads	(revision 178206)
+++ a-except.ads	(working copy)
@@ -271,13 +271,6 @@ 
       Msg : String (1 .. Exception_Msg_Max_Length);
       --  Characters of message
 
-      Cleanup_Flag : Boolean := False;
-      --  The cleanup flag is normally False, it is set True for an exception
-      --  occurrence passed to a cleanup routine, and will still be set True
-      --  when the cleanup routine does a Reraise_Occurrence call using this
-      --  exception occurrence. This is used to avoid recording a bogus trace
-      --  back entry from this reraise call.
-
       Exception_Raised : Boolean := False;
       --  Set to true to indicate that this exception occurrence has actually
       --  been raised. When an exception occurrence is first created, this is
@@ -295,11 +288,6 @@ 
 
       Tracebacks : Tracebacks_Array;
       --  Stored tracebacks (in Tracebacks (1 .. Num_Tracebacks))
-
-      Private_Data : System.Address := System.Null_Address;
-      --  Field used by low level exception mechanism to store specific data.
-      --  Currently used by the GCC exception mechanism to store a pointer to
-      --  a GNAT_GCC_Exception.
    end record;
 
    function "=" (Left, Right : Exception_Occurrence) return Boolean
@@ -317,11 +305,9 @@ 
      Id               => null,
      Msg_Length       => 0,
      Msg              => (others => ' '),
-     Cleanup_Flag     => False,
      Exception_Raised => False,
      Pid              => 0,
      Num_Tracebacks   => 0,
-     Tracebacks       => (others => TBE.Null_TB_Entry),
-     Private_Data     => System.Null_Address);
+     Tracebacks       => (others => TBE.Null_TB_Entry));
 
 end Ada.Exceptions;
Index: a-except-2005.adb
===================================================================
--- a-except-2005.adb	(revision 178215)
+++ a-except-2005.adb	(working copy)
@@ -380,18 +380,6 @@ 
    --  the TSD (all fields of this exception occurrence are set). Abort
    --  is deferred before the reraise operation.
 
-   --  Save_Occurrence variations: As the management of the private data
-   --  attached to occurrences is delicate, whether or not pointers to such
-   --  data has to be copied in various situations is better made explicit.
-   --  The following procedures provide an internal interface to help making
-   --  this explicit.
-
-   procedure Save_Occurrence_No_Private
-     (Target : out Exception_Occurrence;
-      Source : Exception_Occurrence);
-   --  Copy all the components of Source to Target, except the
-   --  Private_Data pointer.
-
    procedure Transfer_Occurrence
      (Target : Exception_Occurrence_Access;
       Source : Exception_Occurrence);
@@ -1006,7 +994,6 @@ 
       Excep.Exception_Raised := False;
       Excep.Id               := E;
       Excep.Num_Tracebacks   := 0;
-      Excep.Cleanup_Flag     := False;
       Excep.Pid              := Local_Partition_ID;
 
       --  The following is a common pattern, should be abstracted
@@ -1274,7 +1261,7 @@ 
             Abort_Defer.all;
          end if;
 
-         Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+         Save_Occurrence (Get_Current_Excep.all.all, X);
          Raise_Current_Excep (X.Id);
       end if;
    end Reraise_Occurrence;
@@ -1289,7 +1276,7 @@ 
          Abort_Defer.all;
       end if;
 
-      Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+      Save_Occurrence (Get_Current_Excep.all.all, X);
       Raise_Current_Excep (X.Id);
    end Reraise_Occurrence_Always;
 
@@ -1299,7 +1286,7 @@ 
 
    procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
    begin
-      Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+      Save_Occurrence (Get_Current_Excep.all.all, X);
       Raise_Current_Excep (X.Id);
    end Reraise_Occurrence_No_Defer;
 
@@ -1312,38 +1299,25 @@ 
       Source : Exception_Occurrence)
    is
    begin
-      Save_Occurrence_No_Private (Target, Source);
-   end Save_Occurrence;
-
-   function Save_Occurrence (Source : Exception_Occurrence) return EOA is
-      Target : constant EOA := new Exception_Occurrence;
-   begin
-      Save_Occurrence (Target.all, Source);
-      return Target;
-   end Save_Occurrence;
-
-   --------------------------------
-   -- Save_Occurrence_No_Private --
-   --------------------------------
-
-   procedure Save_Occurrence_No_Private
-     (Target : out Exception_Occurrence;
-      Source : Exception_Occurrence)
-   is
-   begin
       Target.Id             := Source.Id;
       Target.Msg_Length     := Source.Msg_Length;
       Target.Num_Tracebacks := Source.Num_Tracebacks;
       Target.Pid            := Source.Pid;
-      Target.Cleanup_Flag   := Source.Cleanup_Flag;
 
       Target.Msg (1 .. Target.Msg_Length) :=
         Source.Msg (1 .. Target.Msg_Length);
 
       Target.Tracebacks (1 .. Target.Num_Tracebacks) :=
         Source.Tracebacks (1 .. Target.Num_Tracebacks);
-   end Save_Occurrence_No_Private;
+   end Save_Occurrence;
 
+   function Save_Occurrence (Source : Exception_Occurrence) return EOA is
+      Target : constant EOA := new Exception_Occurrence;
+   begin
+      Save_Occurrence (Target.all, Source);
+      return Target;
+   end Save_Occurrence;
+
    -------------------------
    -- Transfer_Occurrence --
    -------------------------
@@ -1353,7 +1327,7 @@ 
       Source : Exception_Occurrence)
    is
    begin
-      Save_Occurrence_No_Private (Target.all, Source);
+      Save_Occurrence (Target.all, Source);
    end Transfer_Occurrence;
 
    -------------------
Index: a-except-2005.ads
===================================================================
--- a-except-2005.ads	(revision 178197)
+++ a-except-2005.ads	(working copy)
@@ -301,13 +301,6 @@ 
       Msg : String (1 .. Exception_Msg_Max_Length);
       --  Characters of message
 
-      Cleanup_Flag : Boolean := False;
-      --  The cleanup flag is normally False, it is set True for an exception
-      --  occurrence passed to a cleanup routine, and will still be set True
-      --  when the cleanup routine does a Reraise_Occurrence call using this
-      --  exception occurrence. This is used to avoid recording a bogus trace
-      --  back entry from this reraise call.
-
       Exception_Raised : Boolean := False;
       --  Set to true to indicate that this exception occurrence has actually
       --  been raised. When an exception occurrence is first created, this is
@@ -325,11 +318,6 @@ 
 
       Tracebacks : Tracebacks_Array;
       --  Stored tracebacks (in Tracebacks (1 .. Num_Tracebacks))
-
-      Private_Data : System.Address := System.Null_Address;
-      --  Field used by low level exception mechanism to store specific data.
-      --  Currently used by the GCC exception mechanism to store a pointer to
-      --  a GNAT_GCC_Exception.
    end record;
 
    function "=" (Left, Right : Exception_Occurrence) return Boolean
@@ -347,11 +335,9 @@ 
      Id               => null,
      Msg_Length       => 0,
      Msg              => (others => ' '),
-     Cleanup_Flag     => False,
      Exception_Raised => False,
      Pid              => 0,
      Num_Tracebacks   => 0,
-     Tracebacks       => (others => TBE.Null_TB_Entry),
-     Private_Data     => System.Null_Address);
+     Tracebacks       => (others => TBE.Null_TB_Entry));
 
 end Ada.Exceptions;
Index: a-exexda.adb
===================================================================
--- a-exexda.adb	(revision 178214)
+++ a-exexda.adb	(working copy)
@@ -617,7 +617,6 @@ 
       Excep.Num_Tracebacks   := 0;
       Excep.Pid              := Local_Partition_ID;
       Excep.Msg_Length       := 0;
-      Excep.Cleanup_Flag     := False;
 
       while To_Ptr (Msg1) (Excep.Msg_Length + 1) /= ASCII.NUL
         and then Excep.Msg_Length < Exception_Msg_Max_Length
@@ -668,7 +667,6 @@ 
       Excep.Id               := Id;
       Excep.Num_Tracebacks   := 0;
       Excep.Pid              := Local_Partition_ID;
-      Excep.Cleanup_Flag     := False;
 
    end Set_Exception_Msg;