From patchwork Tue Jan 11 13:32:25 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: 1578489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=gw1rFX26; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JYC4v1pjqz9s1l for ; Wed, 12 Jan 2022 01:00:15 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BF26F38A9431 for ; Tue, 11 Jan 2022 14:00:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF26F38A9431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641909612; bh=24dXC/vOH90e+HVdfEza+IPXtEGIoTS9+DF3bo20YCM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=gw1rFX260Jk9xDfQM9Cj8kOcO8jjg59EcsjWjtbW3+yFHGkqF50pHvuA0wA3Dm5d4 AiZ2fpzocgbfZ1Hv41eMNTSqDhGeifDIBiduGqFZ0WM75Bmgt/WCxNwKydG5b5Q1Nq AjGiRtYY+UcZjwa2R29LUVSChXXk4DJxbsEH4LJ8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id B70F138A9427 for ; Tue, 11 Jan 2022 13:32:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B70F138A9427 Received: by mail-wr1-x436.google.com with SMTP id e9so31498757wra.2 for ; Tue, 11 Jan 2022 05:32:28 -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=24dXC/vOH90e+HVdfEza+IPXtEGIoTS9+DF3bo20YCM=; b=qFsMyuKsVzbo9hbEd+py0tECkBNVyFo9SZtzTWoU+hP3O1btybFjtaMlXS/0sg3WiN OWeGyfiCYk44fDIchlb/nEmPP8Ockkt4uHwD0/jk3E7MHwHrhgmfICiTQ0U0wjxlOJlT i8zy+OYHi3FhCZcPEpF5wSObxWJvvloOyR00iv50GW8YtcxW9RJoo4Uo5yE8v/fXOvB3 hjvscHyyiizVuNGk+9mImU6ZCpo5tXUK+gFHLv0Pc/Vm+8zwTYVph1AQ/3xwOwey92OS /xQJQnsy+4A+BX8AZD2HVki3Qv03JPNrrSdu29atUSM6sxOvMsRjOQq0WClQmYBycB9p LPHA== X-Gm-Message-State: AOAM532Jnrxel9kSj/pWH6YEF7FvNJoYQ4AZRYxuGxJ3C+/3sFfpSIF6 nyQUddcj71VZfV6XkEuBn/6fgvyRl9pl7g== X-Google-Smtp-Source: ABdhPJzw1P7WUh1ApgxxcIQgHeWdPAFAVph8TpNebA7WbPWtFB+X4w1lC/QZBeQCBJK1pvjKroifxA== X-Received: by 2002:adf:e643:: with SMTP id b3mr3892926wrn.288.1641907947797; Tue, 11 Jan 2022 05:32:27 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id j9sm1587690wms.0.2022.01.11.05.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 05:32:26 -0800 (PST) Date: Tue, 11 Jan 2022 13:32:25 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Deconstruct a VMS utility routine which is only used by GNATprove Message-ID: <20220111133225.GA748842@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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Routine Compile_Time_Known_Value_Or_Aggr was needed for VMS compatibility, which was deconstructed in 2014. This routine was dead since then, until it got accidentally reused by GNATprove to pretty print counterexamples. Cleanup related to handling of compile-time-known null values in GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_eval.ads (Compile_Time_Known_Value_Or_Aggr): Remove spec. * sem_eval.adb (Compile_Time_Known_Value_Or_Aggr): Remove body. diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -1916,90 +1916,6 @@ package body Sem_Eval is return False; end Compile_Time_Known_Value; - -------------------------------------- - -- Compile_Time_Known_Value_Or_Aggr -- - -------------------------------------- - - function Compile_Time_Known_Value_Or_Aggr (Op : Node_Id) return Boolean is - begin - -- If we have an entity name, then see if it is the name of a constant - -- and if so, test the corresponding constant value, or the name of - -- an enumeration literal, which is always a constant. - - if Is_Entity_Name (Op) then - declare - E : constant Entity_Id := Entity (Op); - V : Node_Id; - - begin - if Ekind (E) = E_Enumeration_Literal then - return True; - - elsif Ekind (E) /= E_Constant then - return False; - - else - V := Constant_Value (E); - return Present (V) - and then Compile_Time_Known_Value_Or_Aggr (V); - end if; - end; - - -- We have a value, see if it is compile-time-known - - else - if Compile_Time_Known_Value (Op) then - return True; - - elsif Nkind (Op) = N_Aggregate then - - if Present (Expressions (Op)) then - declare - Expr : Node_Id; - begin - Expr := First (Expressions (Op)); - while Present (Expr) loop - if not Compile_Time_Known_Value_Or_Aggr (Expr) then - return False; - else - Next (Expr); - end if; - end loop; - end; - end if; - - if Present (Component_Associations (Op)) then - declare - Cass : Node_Id; - - begin - Cass := First (Component_Associations (Op)); - while Present (Cass) loop - if not - Compile_Time_Known_Value_Or_Aggr (Expression (Cass)) - then - return False; - end if; - - Next (Cass); - end loop; - end; - end if; - - return True; - - elsif Nkind (Op) = N_Qualified_Expression then - return Compile_Time_Known_Value_Or_Aggr (Expression (Op)); - - -- All other types of values are not known at compile time - - else - return False; - end if; - - end if; - end Compile_Time_Known_Value_Or_Aggr; - --------------------------------------- -- CRT_Safe_Compile_Time_Known_Value -- --------------------------------------- diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads --- a/gcc/ada/sem_eval.ads +++ b/gcc/ada/sem_eval.ads @@ -236,15 +236,6 @@ package Sem_Eval is -- WARNING: There is a matching C declaration of this subprogram in fe.h - function Compile_Time_Known_Value_Or_Aggr (Op : Node_Id) return Boolean; - -- Similar to Compile_Time_Known_Value, but also returns True if the value - -- is a compile-time-known aggregate, i.e. an aggregate all of whose - -- constituent expressions are either compile-time-known values (based on - -- calling Compile_Time_Known_Value) or compile-time-known aggregates. - -- Note that the aggregate could still involve run-time checks that might - -- fail (such as for subtype checks in component associations), but the - -- evaluation of the expressions themselves will not raise an exception. - function CRT_Safe_Compile_Time_Known_Value (Op : Node_Id) return Boolean; -- In the case of configurable run-times, there may be an issue calling -- Compile_Time_Known_Value with non-static expressions where the legality