From patchwork Wed Dec 1 10:25:31 2021 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: 48332 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 1CC52385800E for ; Wed, 1 Dec 2021 10:33:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CC52385800E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638354836; bh=KoqJt5XDV6B1Tw6HeXfhm5oJRio+oz77pzctBI8OhSY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=E0uH8FXHvcyp4e7ruPTd9oXYTEv3h3zThkiMfLr7HTtlp9zMgI7w8iDtEQAiW9Bt9 LhEOIyzQH98N7IOijhjo4DmL+jLp62NpKkcujvoJfZbqDZVF5WhtmWEqLYDyWNuGuq Lty3/JsiQcsGRMAciP3EOwjhxWsNe0k28soL+Uy4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 8A3463858416 for ; Wed, 1 Dec 2021 10:25:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A3463858416 Received: by mail-wm1-x329.google.com with SMTP id k37-20020a05600c1ca500b00330cb84834fso21836051wms.2 for ; Wed, 01 Dec 2021 02:25:34 -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=KoqJt5XDV6B1Tw6HeXfhm5oJRio+oz77pzctBI8OhSY=; b=kf2k2jmrGrZKDNwXGay1wLqlz7AeHG7rW6HupN/Jgq2jn65OcF36kqZqrWKBsdV3os CourJ+fm7wUcPYQE4uEjaoFUz+3f9SSg76LL9twbqgGe0PP1wTtxm4QQApmdPXDteBRz O10nbfS1yQBFZWlASDQUWxQVK5IT4yojBwi9lSaBBLaUjTwZAnDxfvi6V/F7hDfvvjuq 1GYacBA5Pl8UMt1YsYfVe+Cef8g42cCef8jsl2tLtHANb/wQZ41SCpyLifiLEci3py9v gQev0p45rNFnQYtGaECx64nWl9TQgSQ4jjgwyp5yKfcEEyW21MAM+tIPpnnE1kfGQ2Lo e09g== X-Gm-Message-State: AOAM531yNhckl3JfzjBlWkjcsJtjHSxAB7bS/SEM6wcodqYSOukcjouI dEjLh50fNMaY5/1cIjBD0XqhGAgO6ydVxbY3 X-Google-Smtp-Source: ABdhPJyXCynvlOGOUm4XpZg25z1kNvrvMa0sumBKeBuqYtreL/JFSSgTR36VeR57GnZP6E5cMp0FYw== X-Received: by 2002:a1c:f414:: with SMTP id z20mr5997885wma.17.1638354333641; Wed, 01 Dec 2021 02:25:33 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id p62sm600406wmp.10.2021.12.01.02.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 02:25:32 -0800 (PST) Date: Wed, 1 Dec 2021 10:25:31 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Replace low-level detection of subprograms with high-level wrapper Message-ID: <20211201102531.GA1635131@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.3 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 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" Cleanup related to handling of dispatching equality in GNATprove; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_aggr.adb, sem_cat.adb, sem_ch10.adb, sem_ch12.adb, sem_elim.adb, sem_util.adb: Replace uses of Subprogram_Kind with Is_Subprogram. diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -9248,7 +9248,7 @@ package body Exp_Aggr is when N_Object_Declaration => return not Constant_Present (C) - and then Ekind (Current_Scope) in Subprogram_Kind; + and then Is_Subprogram (Current_Scope); -- False for all other contexts diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -807,7 +807,7 @@ package body Sem_Cat is end if; if not Is_Remote_Call_Interface (E) then - if Ekind (E) in Subprogram_Kind then + if Is_Subprogram (E) then Declaration := Unit_Declaration_Node (E); if Nkind (Declaration) in diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -5271,7 +5271,7 @@ package body Sem_Ch10 is end if; if Is_Generic_Instance (Uname) - and then Ekind (Uname) in Subprogram_Kind + and then Is_Subprogram (Uname) then -- Set flag as well on the visible entity that denotes the -- instance, which renames the current one. diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -5298,7 +5298,7 @@ package body Sem_Ch12 is Scop := Scope (E); while Scop /= Standard_Standard loop - if Ekind (Scop) in Subprogram_Kind and then Is_Inlined (Scop) then + if Is_Subprogram (Scop) and then Is_Inlined (Scop) then return True; end if; diff --git a/gcc/ada/sem_elim.adb b/gcc/ada/sem_elim.adb --- a/gcc/ada/sem_elim.adb +++ b/gcc/ada/sem_elim.adb @@ -247,7 +247,7 @@ package body Sem_Elim is -- Elimination of objects and types is not implemented yet - elsif Ekind (E) not in Subprogram_Kind then + elsif not Is_Subprogram (E) then return; end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -29476,7 +29476,7 @@ package body Sem_Util is -- Since we are only interested in the formal case, avoid -- the anonymous access result type. - if Ekind (Def_Ent) in Subprogram_Kind + if Is_Subprogram (Def_Ent) and then not (Ekind (Def_Ent) = E_Function and then Etype (Def_Ent) = Typ) then