From patchwork Tue Jan 11 13:32:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 49866 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35855385802C for ; Tue, 11 Jan 2022 14:07:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35855385802C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641910033; bh=Bf8T0bOW8hTvrXs2QByBu+vV0giFJw/xrbruF3f77oU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=kFYDvnyn0ZzQdwdOBfIlloazYTIxpjNkH171PGAJRRbD3WX3TJjrtlm/ttnUlJD78 maIPFFkyPk1NwGFnN1ROqwkSZoGBnj6mhqJBfYxnqqV57ylvg6wDsUdcOAOa/X0YiN sUsqXzh3AAnvFxlQ8+evqoBw/8jodUuQ70OLimh4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 79CDB38A1425 for ; Tue, 11 Jan 2022 13:32:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79CDB38A1425 Received: by mail-wm1-x330.google.com with SMTP id p18so4256485wmg.4 for ; Tue, 11 Jan 2022 05:32:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Bf8T0bOW8hTvrXs2QByBu+vV0giFJw/xrbruF3f77oU=; b=ZY0OavPChMeNtQunYYf/FQZFb9xwPTtndBJg+oEsVzQHeOI/3Lcqr/XI3LMTV+4cCf vCYKORdUSGSu72+iWC+g0m4RPbe85bZZBnwSkh7gLOEEzEi51K5y8UssWbYRluXsEDFQ LCJuPEQs/Blc0rtJGvrawBVd+Z15sK+A910JemdXVLl0409Rao5zhgciRO1HB+UiGsoS LEEO0Zb8KrCXhmsCREpa3C1pcHenPaOsbJZqv+tfzqKvQTVxN3tyFxMp+Lg9fhWTbMb6 dUFy9hk6dnyQccdITlN3xczGEyGGQgewYRnDoZlYIUeTZf6JnkiRZ6+d3yduaHIvOpI5 p+yA== X-Gm-Message-State: AOAM530Udnj9OIhlIvqqVXBCpwnO/eUWq7MhcvafD4FRDuNRQIGpYZo5 HlIlTy2S2Zz+0j4mYbd/oZIzyoUxQR3WSg== X-Google-Smtp-Source: ABdhPJwtBzKw5EbysjO7jiCb6iJHz1HCEv8VXsd4IEtOKP7IqkiN6W5hnFrIsvnfY1qgjnKqGFodQg== X-Received: by 2002:a1c:1b89:: with SMTP id b131mr2574101wmb.56.1641907960552; Tue, 11 Jan 2022 05:32:40 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id o9sm9672070wri.97.2022.01.11.05.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 05:32:39 -0800 (PST) Date: Tue, 11 Jan 2022 13:32:38 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove unreferenced CCG-specific routine Insert_Declaration Message-ID: <20220111133238.GA748982@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Routine Insert_Declaration was originally added for the Ada-to-C translator, because in C we can't have declarations within an expressions. However, it is no longer used, because now we insert declarations into N_Expression_With_Actions. Code cleanup related to inserting itypes in spec expressions for GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_util.ads (Insert_Declaration): Remove spec. * exp_util.adb (Insert_Declaration): Remove body. diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7916,43 +7916,6 @@ package body Exp_Util is end if; end Insert_Actions_After; - ------------------------ - -- Insert_Declaration -- - ------------------------ - - procedure Insert_Declaration (N : Node_Id; Decl : Node_Id) is - P : Node_Id; - - begin - pragma Assert (Nkind (N) in N_Subexpr); - - -- Climb until we find a procedure or a package - - P := N; - loop - pragma Assert (Present (Parent (P))); - P := Parent (P); - - if Is_List_Member (P) then - exit when Nkind (Parent (P)) in - N_Package_Specification | N_Subprogram_Body; - - -- Special handling for handled sequence of statements, we must - -- insert in the statements not the exception handlers! - - if Nkind (Parent (P)) = N_Handled_Sequence_Of_Statements then - P := First (Statements (Parent (P))); - exit; - end if; - end if; - end loop; - - -- Now do the insertion - - Insert_Before (P, Decl); - Analyze (Decl); - end Insert_Declaration; - --------------------------------- -- Insert_Library_Level_Action -- --------------------------------- diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -164,18 +164,6 @@ package Exp_Util is -- generalize to expressions if there is a need but this is tricky to -- implement because of short-circuits (among other things). - procedure Insert_Declaration (N : Node_Id; Decl : Node_Id); - -- N must be a subexpression (Nkind in N_Subexpr). This is similar to - -- Insert_Action (N, Decl), but inserts Decl outside the expression in - -- which N appears. This is called Insert_Declaration because the intended - -- use is for declarations that have no associated code. We can't go - -- moving other kinds of things out of the current expression, since they - -- could be executed conditionally (e.g. right operand of short circuit, - -- or THEN/ELSE of if expression). This is currently used only in - -- Modify_Tree_For_C mode, where it is needed because in C we have no - -- way of having declarations within an expression (a really annoying - -- limitation). - procedure Insert_Library_Level_Action (N : Node_Id); -- This procedure inserts and analyzes the node N as an action at the -- library level for the current unit (i.e. it is attached to the