]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Remove obsolete workaround
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 21 Jun 2024 21:01:11 +0000 (23:01 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:33 +0000 (17:14 +0200)
It is possible to call the "+" operator of System.Storage_Elements directly
as done for example in Expand_Interface_Thunk.

gcc/ada/

* exp_ch7.adb (Make_Address_For_Finalize): Generate a direct call
to the "+" operator of System.Storage_Elements.
(Make_Finalize_Address_Stmts): Likewise.
* rtsfind.ads (RE_Id): Remove RE_Add_Offset_To_Address.
(RE_Unit_Table): Remove entry for RE_Add_Offset_To_Address.
* libgnat/s-finpri.ads (Add_Offset_To_Address): Delete.
* libgnat/s-finpri.adb (Add_Offset_To_Address): Likewise.

gcc/ada/exp_ch7.adb
gcc/ada/libgnat/s-finpri.adb
gcc/ada/libgnat/s-finpri.ads
gcc/ada/rtsfind.ads

index f4a707034c14130a6730d0cc747e7b824c2b1b93..454f74507f44fd3562b7b8c3734f482429e22287 100644 (file)
@@ -5351,23 +5351,25 @@ package body Exp_Ch7 is
 
          --    V - (Obj_Typ'Descriptor_Size / Storage_Unit)
 
-         --  Note that this is done through a wrapper routine as  RTSfind
-         --  cannot retrieve operations with string name of the form "+".
-
          Obj_Addr :=
            Make_Function_Call (Loc,
              Name                   =>
-               New_Occurrence_Of (RTE (RE_Add_Offset_To_Address), Loc),
+               Make_Expanded_Name (Loc,
+                 Chars => Name_Op_Subtract,
+                 Prefix =>
+                   New_Occurrence_Of
+                     (RTU_Entity (System_Storage_Elements), Loc),
+                 Selector_Name =>
+                   Make_Identifier (Loc, Name_Op_Subtract)),
              Parameter_Associations => New_List (
                Obj_Addr,
-               Make_Op_Minus (Loc,
-                 Make_Op_Divide (Loc,
-                   Left_Opnd  =>
-                     Make_Attribute_Reference (Loc,
-                       Prefix         => New_Occurrence_Of (Obj_Typ, Loc),
-                       Attribute_Name => Name_Descriptor_Size),
-                   Right_Opnd =>
-                     Make_Integer_Literal (Loc, System_Storage_Unit)))));
+               Make_Op_Divide (Loc,
+                 Left_Opnd  =>
+                   Make_Attribute_Reference (Loc,
+                     Prefix         => New_Occurrence_Of (Obj_Typ, Loc),
+                     Attribute_Name => Name_Descriptor_Size),
+                 Right_Opnd =>
+                   Make_Integer_Literal (Loc, System_Storage_Unit))));
       end if;
 
       return Obj_Addr;
@@ -8105,14 +8107,17 @@ package body Exp_Ch7 is
             --  start of the elements:
             --
             --    V + Dnn
-            --
-            --  Note that this is done through a wrapper routine since RTSfind
-            --  cannot retrieve operations with string names of the form "+".
 
             Obj_Expr :=
               Make_Function_Call (Loc,
                 Name                   =>
-                  New_Occurrence_Of (RTE (RE_Add_Offset_To_Address), Loc),
+                  Make_Expanded_Name (Loc,
+                    Chars => Name_Op_Add,
+                    Prefix =>
+                      New_Occurrence_Of
+                        (RTU_Entity (System_Storage_Elements), Loc),
+                    Selector_Name =>
+                      Make_Identifier (Loc, Name_Op_Add)),
                 Parameter_Associations => New_List (
                   Obj_Expr,
                   New_Occurrence_Of (Dope_Id, Loc)));
index bc90fe23ac92625b6304412286cce65b2b05d0ba..9767090cb4a9810dc51876b92d3a1feea6b7654d 100644 (file)
@@ -60,18 +60,6 @@ package body System.Finalization_Primitives is
    --  Unlock the finalization collection, i.e. relinquish ownership of the
    --  lock to the collection.
 
-   ---------------------------
-   -- Add_Offset_To_Address --
-   ---------------------------
-
-   function Add_Offset_To_Address
-     (Addr   : System.Address;
-      Offset : System.Storage_Elements.Storage_Offset) return System.Address
-   is
-   begin
-      return System.Storage_Elements."+" (Addr, Offset);
-   end Add_Offset_To_Address;
-
    ---------------------------------
    -- Attach_Object_To_Collection --
    ---------------------------------
index a821f1db657b4c1dd459f8a6b0891d1320bcb3db..851917b592480f864a609cc8e4eb48559c3961b1 100644 (file)
@@ -171,13 +171,6 @@ package System.Finalization_Primitives with Preelaborate is
 
 private
 
-   --  Since RTSfind cannot contain names of the form RE_"+", the following
-   --  routine serves as a wrapper around System.Storage_Elements."+".
-
-   function Add_Offset_To_Address
-     (Addr   : System.Address;
-      Offset : System.Storage_Elements.Storage_Offset) return System.Address;
-
    --  Finalization masters:
 
    --  Master node type structure. Finalize_Address comes first because it is
index f4566b4846f1528f12e9160c175cccadd51ef1d6..8c0c90453603b30a0f859556fb9ecb607b57f694 100644 (file)
@@ -919,7 +919,6 @@ package Rtsfind is
 
      RE_Attr_Long_Long_Float,            -- System.Fat_LLF
 
-     RE_Add_Offset_To_Address,           -- System.Finalization_Primitives
      RE_Attach_Object_To_Collection,     -- System.Finalization_Primitives
      RE_Attach_Object_To_Master,         -- System.Finalization_Primitives
      RE_Attach_Object_To_Node,           -- System.Finalization_Primitives
@@ -2571,7 +2570,6 @@ package Rtsfind is
 
      RE_Attr_Long_Long_Float             => System_Fat_LLF,
 
-     RE_Add_Offset_To_Address            => System_Finalization_Primitives,
      RE_Attach_Object_To_Collection      => System_Finalization_Primitives,
      RE_Attach_Object_To_Master          => System_Finalization_Primitives,
      RE_Attach_Object_To_Node            => System_Finalization_Primitives,
This page took 0.076248 seconds and 5 git commands to generate.