From patchwork Fri Jan 7 16:26:59 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: 49700 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 269393857C65 for ; Fri, 7 Jan 2022 16:33:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 269393857C65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641573210; bh=xvnvgRrVtTeeiXLVxtEJoKq8NRF/KcnR9Qv5jf3WW4w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=x9xnk+hKwY/vrJJ9UTOf4BqfjfmTnnqSIA59iY40xRvH5G8uiMHvyel3YADCcFSD3 60TScslWfJYelkGXHfpwwGVOLWCOQXeRvf6SCmnO+OSVTji/aDbgtiwrv1pNjSjuxI 91G8CVwoHuDlRtTOvBdm/j7n7yKIAzFJCCpP4R4Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 04E6D3857C62 for ; Fri, 7 Jan 2022 16:27:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 04E6D3857C62 Received: by mail-wm1-x332.google.com with SMTP id m20so4317033wmi.0 for ; Fri, 07 Jan 2022 08:27:01 -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=xvnvgRrVtTeeiXLVxtEJoKq8NRF/KcnR9Qv5jf3WW4w=; b=zs/2g/ZdpXb0Vre73kiVhyBzs+pY86iQ3iB+Y/fHn30YCW5OXCpIfF67GhCSLXjpbj bYFTDmsq4ZUuUdEUZ7bY8JqNhQ8GeTZCkVCMA299pbwzWjyM79xNOV73aX0HYyr0L59E czukkdQMvgSwUwpDlcq3Yl6zzLXksYRICVV3P1UNITs7rRU+9w+elt6WhpJRP9OPdWHa Ye5LqAMStFMQ7iNg74hBr8qbZPZXgYMVlCI9N4mn0jrTMTMXHRja8nPzxYYNWyeBCEhN JKuECuz/0OyZ8J6r45IT7Zktcr1XR0GwwSJqumQTEZ9KSYyK2nRvbt3hkI6saEqgYXpf 6RXQ== X-Gm-Message-State: AOAM533bbA7HLx7H+1gCySEl4PsrOBl+onFGi4JVDPzbtOI9xSWf08z2 L/cZE/QPz/jXZm8ZaFTBZY11IZBiYKewgg== X-Google-Smtp-Source: ABdhPJwA7Y7HXDgfn9Y2I0JtAWMn0hz2dzO3NvwxApURm6ZdOQ/DHElIsQ1bhf9DCXgptbqo+NIhzw== X-Received: by 2002:a1c:7909:: with SMTP id l9mr7959351wme.143.1641572821072; Fri, 07 Jan 2022 08:27:01 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id s8sm6043819wra.9.2022.01.07.08.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 08:27:00 -0800 (PST) Date: Fri, 7 Jan 2022 16:26:59 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] treepr: print value only for discrete types Message-ID: <20220107162659.GA948132@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.1 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: Bob Duff Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Follow-on to previous change "Print value of static expression". Print only if the type is discrete. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * treepr.adb (Print_Node_Ref): Change "not Is_Array_Type" to "Is_Discrete_Type". diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -1643,13 +1643,13 @@ package body Treepr is end if; end if; - -- If this is an integer-like expression whose value is known, print - -- that value. + -- If this is a discrete expression whose value is known, print that + -- value. if Nkind (N) in N_Subexpr and then Compile_Time_Known_Value (N) and then Present (Etype (N)) - and then not Is_Array_Type (Etype (N)) + and then Is_Discrete_Type (Etype (N)) then if Is_Entity_Name (N) -- e.g. enumeration literal or else Nkind (N) in N_Integer_Literal