ada: Remove unreachable code in Resolve_Extension_Aggregate

The only functions using the BIP protocol are now those returning a limited
type: Is_Build_In_Place_Result_Type => Is_Inherently_Limited_Type.

gcc/ada/

	* sem_aggr.adb (Resolve_Extension_Aggregate): Remove the unreachable
	call to Transform_BIP_Assignment as well as the procedure.
This commit is contained in:
Eric Botcazou 2023-12-06 23:37:15 +01:00 committed by Marc Poulhiès
parent 3b9d4258ea
commit e3da93d988

View file

@ -31,7 +31,6 @@ with Einfo.Utils; use Einfo.Utils;
with Elists; use Elists;
with Errout; use Errout;
with Expander; use Expander;
with Exp_Ch6; use Exp_Ch6;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
@ -4232,11 +4231,6 @@ package body Sem_Aggr is
-- Verify that the type of the ancestor part is a non-private ancestor
-- of the expected type, which must be a type extension.
procedure Transform_BIP_Assignment (Typ : Entity_Id);
-- For an extension aggregate whose ancestor part is a build-in-place
-- call returning a nonlimited type, this is used to transform the
-- assignment to the ancestor part to use a temp.
----------------------------
-- Valid_Limited_Ancestor --
----------------------------
@ -4328,26 +4322,6 @@ package body Sem_Aggr is
return False;
end Valid_Ancestor_Type;
------------------------------
-- Transform_BIP_Assignment --
------------------------------
procedure Transform_BIP_Assignment (Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
Def_Id : constant Entity_Id := Make_Temporary (Loc, 'Y', A);
Obj_Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Constant_Present => True,
Object_Definition => New_Occurrence_Of (Typ, Loc),
Expression => A,
Has_Init_Expression => True);
begin
Set_Etype (Def_Id, Typ);
Set_Ancestor_Part (N, New_Occurrence_Of (Def_Id, Loc));
Insert_Action (N, Obj_Decl);
end Transform_BIP_Assignment;
-- Start of processing for Resolve_Extension_Aggregate
begin
@ -4521,19 +4495,8 @@ package body Sem_Aggr is
-- an AdaCore query to the ARG after this test was added.
Error_Msg_N ("ancestor part must be statically tagged", A);
else
-- We are using the build-in-place protocol, but we can't build
-- in place, because we need to call the function before
-- allocating the aggregate. Could do better for null
-- extensions, and maybe for nondiscriminated types.
-- This is wrong for limited, but those were wrong already.
if not Is_Inherently_Limited_Type (A_Type)
and then Is_Build_In_Place_Function_Call (A)
then
Transform_BIP_Assignment (A_Type);
end if;
Resolve_Record_Aggregate (N, Typ);
end if;
end if;