diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-06-21 23:01:11 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-08-01 17:14:33 +0200 |
commit | 76d37f8612faa0bf89983869a90e773794eaa227 (patch) | |
tree | 0b3de3a7a840ed73a9c9ff552f58d27a38519705 /gcc/ada | |
parent | 7e88a1a34aae0abd3019423d3ceae045c9931adb (diff) | |
download | gcc-76d37f8612faa0bf89983869a90e773794eaa227.zip gcc-76d37f8612faa0bf89983869a90e773794eaa227.tar.gz gcc-76d37f8612faa0bf89983869a90e773794eaa227.tar.bz2 |
ada: Remove obsolete workaround
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.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_ch7.adb | 37 | ||||
-rw-r--r-- | gcc/ada/libgnat/s-finpri.adb | 12 | ||||
-rw-r--r-- | gcc/ada/libgnat/s-finpri.ads | 7 | ||||
-rw-r--r-- | gcc/ada/rtsfind.ads | 2 |
4 files changed, 21 insertions, 37 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index f4a7070..454f745 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -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))); diff --git a/gcc/ada/libgnat/s-finpri.adb b/gcc/ada/libgnat/s-finpri.adb index bc90fe2..9767090 100644 --- a/gcc/ada/libgnat/s-finpri.adb +++ b/gcc/ada/libgnat/s-finpri.adb @@ -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 -- --------------------------------- diff --git a/gcc/ada/libgnat/s-finpri.ads b/gcc/ada/libgnat/s-finpri.ads index a821f1d..851917b 100644 --- a/gcc/ada/libgnat/s-finpri.ads +++ b/gcc/ada/libgnat/s-finpri.ads @@ -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 diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads index f4566b4..8c0c904 100644 --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -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, |