From patchwork Fri May 26 07:36:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 99392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp297363vqr; Fri, 26 May 2023 01:00:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/Fn0u2ZWGZwi/nMVbwaekfpm1TnQ45m+6yfw652QLpZ8KdHrl5g0KL7ZYXPcPQfAGZhax X-Received: by 2002:a17:907:846:b0:96a:4ea0:a1ea with SMTP id ww6-20020a170907084600b0096a4ea0a1eamr1209985ejb.44.1685088004312; Fri, 26 May 2023 01:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685088004; cv=none; d=google.com; s=arc-20160816; b=NTRz6SQ4YtlOJjoVzHT28gfWI6DzqC5LtEmcAUc8q3qzT/1RN0ujk6g+ysMy4kHKiL NrxNGZNexEB0ati9SP+95mdNXVrbYKbXWQ/Fk1QKffisouwMrKGWg7vHBqhQTT98BCKx iWU4WmOmvHZ1KitIyOCGJu7DMfQyiJiiR6E9nHa9Twfm9VqYJYL2ZEx0Mdrzm07UOSgu NW3asMskU6/sDNhhQG8FF4K4SqzMOSn5Hi8k80v9Gby6BCLXGTrCtPIiC9+SOSr34Ynm 769ok3kkDbEzInTiy8Gfk4vHObzrWT9iw+p681+Yz06cX8F08fTX34yoM1cZ3vPO7E9e 1UbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=1il946Jt0w6vt50VGDbCvkOhAWxvro3A09XdcICKo6I=; b=u1wveb1rU21MijaL/eep2wndzY0mNcUzCO4Swl4yJs+62VDXeJ9Doc+x6LZvRNSp9d 7PcoyRmtOtPjkrUBN3rSaO8lYn78sM+i54hl/5MZuDXrv8/bwZkqFPVW3NfZdjBt/Ezz maW54i6rLRpO6VJ3ZDpN/V+BA+9hvRpCc7y63xt3zvQbxoasTTf0ZfGLwa5R1qesL/R5 W+q5VLW2rT632JlFqEZLfOhnSsyxkFPfNB0V/5if21su1GcEVtIU9kc7tjwzMbe9SfFa 2uw4tXszM9hAz22vDpmzomlFP1Hv4iYeZfUhYU55a2XAmxUfIKQX7MkDw/ZI5A8+QlvU zebg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=P9wrep+d; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id kv4-20020a17090778c400b0096ace683f1fsi1607435ejc.804.2023.05.26.01.00.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 01:00:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=P9wrep+d; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E10573831965 for ; Fri, 26 May 2023 07:46:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E10573831965 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685087197; bh=1il946Jt0w6vt50VGDbCvkOhAWxvro3A09XdcICKo6I=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=P9wrep+dzTv6v8N7B0+qOVZDoomYJFoyJ+MGyaA5YgVxx5lY223bZgixTJJYjQn+6 OHAs1aaybz++n+13WczuLEpiKrKK77oNa0wFqx4UP61LzMl1e3g11Sx/hZr9Gk0lqG S7Nj3Qnj46jWtx0rNGRSISO1ii+tJOuLWupmeQxo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id F19AC3846449 for ; Fri, 26 May 2023 07:36:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F19AC3846449 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-309553c5417so333284f8f.2 for ; Fri, 26 May 2023 00:36:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685086593; x=1687678593; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1il946Jt0w6vt50VGDbCvkOhAWxvro3A09XdcICKo6I=; b=PfvwR9i7xXMNxW+9uBg0UYDJUz7t1QlHXi5lCqmGarpOfX59Sm0rXRZvIpDJcvsBcB oUURW9MPrHIjg7k5OrSG9LUKwLdGDS2jowX7Ry/er4FvBmtMyE3lLgifJyQfPJOVBfbH UMgdFG5TAADVitPZEuLaRV86WWioILmSuB03lDBXl+Pe84kPyoIZBq/s0tY3Nt6Yengj 72pNiPRlelBXAzCjZIek7K5cIS3qss2oIbobXXZ/PzTrdfjZEwHQ9xnw2izyn3hxZbPQ vjIsiDdWXiTEHPvjWGY+N29nCtJxThwF1hNOWmoUk4lThyGjwSytfK5TSLpL99r1xCTG 7Kww== X-Gm-Message-State: AC+VfDx5qtGduE6ZYr2bpZT+8ZP80l0iOe63ymlz/EcvMV+uysHoN+Rc f1eYdExw/80DIPJZ3FEL3G2l6kqW7sZj2JB1Xvc1hA== X-Received: by 2002:a05:6000:11c4:b0:306:2e04:5925 with SMTP id i4-20020a05600011c400b003062e045925mr620439wrx.17.1685086592846; Fri, 26 May 2023 00:36:32 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:777b:eef4:6f79:f26f]) by smtp.gmail.com with ESMTPSA id g14-20020a5d540e000000b00307a86a4bcesm4188843wrv.35.2023.05.26.00.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:36:32 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Remove leftover code for counting protected entries Date: Fri, 26 May 2023 09:36:31 +0200 Message-Id: <20230526073631.2069250-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766942839381236394?= X-GMAIL-MSGID: =?utf-8?q?1766942839381236394?= From: Piotr Trojanek We used to count protected entries by iterating over component declarations, but then switched to iterating over entities and left some code that is no longer needed. Cleanup; semantics is unaffected (maybe except fixing an assertion failure in developer builds when there is pragma among entry family declarations). gcc/ada/ * exp_ch9.adb (Build_Entry_Count_Expression): Remove loop over component declaration; consequently remove a parameter that is no longer used; adapt callers. (Make_Task_Create_Call): Refine type of a local variable. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch9.adb | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 68f1290cab4..b0e3632b8c8 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -154,8 +154,7 @@ package body Exp_Ch9 is -- N is the enclosing construct. function Build_Entry_Count_Expression - (Concurrent_Type : Node_Id; - Component_List : List_Id; + (Concurrent_Type : Entity_Id; Loc : Source_Ptr) return Node_Id; -- Compute number of entries for concurrent object. This is a count of -- simple entries, followed by an expression that computes the length @@ -1428,14 +1427,12 @@ package body Exp_Ch9 is ---------------------------------- function Build_Entry_Count_Expression - (Concurrent_Type : Node_Id; - Component_List : List_Id; + (Concurrent_Type : Entity_Id; Loc : Source_Ptr) return Node_Id is Eindx : Nat; Ent : Entity_Id; Ecount : Node_Id; - Comp : Node_Id; Lo : Node_Id; Hi : Node_Id; Typ : Entity_Id; @@ -1459,13 +1456,8 @@ package body Exp_Ch9 is -- Loop through entry families building the addition nodes Ent := First_Entity (Concurrent_Type); - Comp := First (Component_List); while Present (Ent) loop if Ekind (Ent) = E_Entry_Family then - while Chars (Ent) /= Chars (Defining_Identifier (Comp)) loop - Next (Comp); - end loop; - Typ := Entry_Index_Type (Ent); Hi := Type_High_Bound (Typ); Lo := Type_Low_Bound (Typ); @@ -9248,7 +9240,7 @@ package body Exp_Ch9 is declare Entry_Count_Expr : constant Node_Id := Build_Entry_Count_Expression - (Prot_Typ, Cdecls, Loc); + (Prot_Typ, Loc); Num_Attach_Handler : Nat := 0; Protection_Subtype : Node_Id; Ritem : Node_Id; @@ -14232,7 +14224,7 @@ package body Exp_Ch9 is Tdec : Node_Id; Tdef : Node_Id; Tnam : Name_Id; - Ttyp : Node_Id; + Ttyp : Entity_Id; begin Ttyp := Corresponding_Concurrent_Type (Task_Rec); @@ -14453,14 +14445,7 @@ package body Exp_Ch9 is -- where a,b... are the entry family names for the task definition - Ecount := - Build_Entry_Count_Expression - (Ttyp, - Component_Items - (Component_List - (Type_Definition - (Parent (Corresponding_Record_Type (Ttyp))))), - Loc); + Ecount := Build_Entry_Count_Expression (Ttyp, Loc); Append_To (Args, Ecount); -- Master parameter. This is a reference to the _Master parameter of