]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove unreachable code in Resolve_Extension_Aggregate
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 6 Dec 2023 22:37:15 +0000 (23:37 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 9 Jan 2024 13:13:30 +0000 (14:13 +0100)
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.

gcc/ada/sem_aggr.adb

index 1027acf20b503a6f9af308e5c1b3544ae5522a0a..f586c18e655b7e52a0269f0aff6e9ca2a1a6886f 100644 (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;
 
+            else
                Resolve_Record_Aggregate (N, Typ);
             end if;
          end if;