public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Remove unreachable code in Resolve_Extension_Aggregate
@ 2024-01-09 13:15 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-01-09 13:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

From: Eric Botcazou <ebotcazou@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_aggr.adb | 39 +--------------------------------------
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 1027acf20b5..f586c18e655 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -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;
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-09 13:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 13:15 [COMMITTED] ada: Remove unreachable code in Resolve_Extension_Aggregate Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).