From patchwork Fri May 26 07:35:43 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: 99332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp289385vqr; Fri, 26 May 2023 00:37:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FmpVTFpD8pEHUZQ4s0P73IiYnfDYY7jjedFa/0z0pBzw0tiuVB6r1fOpcP6EUKH/1LQIq X-Received: by 2002:a17:906:eec7:b0:96a:f09b:373e with SMTP id wu7-20020a170906eec700b0096af09b373emr1148602ejb.15.1685086646872; Fri, 26 May 2023 00:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685086646; cv=none; d=google.com; s=arc-20160816; b=q9oyqQJF/ZpfSrFtqCRcsxPVOIv4GxdawehLWEC0LsoiNLlYlRcwa+OApPbf3rUU5q Z9zB14MmfK4YUy+KDMdQ3ikha2w82X/Uz1Gj2RDzyaBlk+2f/RQgp4n8r3G2Ya2+XKBl JdYXhNuioM8ULn/dc14i3p4tj/n4Lo68PadiGOlsYwWIdWf4hxjGlgr5rkUliK5n2+kH 5LLNoL8V/CGy8EWxiF7ZTE47HAFzRDznDjqix9ZNGD7xNFVGiLrtcvHzpnKuEghgFES9 fSZtA9UCsfYHPeK+uUKn5WIuGDbj3oNetiFQlvntTcqWPS5K6bDWbBFnOHtJXisk6Q2M lewQ== 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=mDCm5EU0Qkr+/FF2/Nl6P8ppTdvPSq1W0wXypGuE2B8=; b=IM1qhMQ+AdQvfDyrLxmVungefXvbeQ7ua/4YnGNyje5S4jIx6qWYwOhqPsS5Efmlr/ 5Z5ULcAbi7yjYugJtF3KEsofTJEsy4GarkIBUMjGi0kXsSxNOKmcKS8OWEJzmjUt71co XwneH3hrXLOOAmFvK0z7mK28BP1mFHg9CdoCuQQaN9yX3UUzz4in93DC+x6a/CkXqFc7 0/0XjhBVuZRUbzRpxu1A1/rkOapZdKRZSS3SyVoAI+csB4hwLVyzGlfFWun0W9v+Z+44 +wuLJ2uVyWpMU1XJ2/hIJJTkAZu4GDpnMphLCU74pQcQfpC7Gci30UtcyIOwb0UWSFfy Mogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=G9xlpaxI; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id e11-20020a170906314b00b009661b0ef2f1si2272795eje.610.2023.05.26.00.37.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=G9xlpaxI; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 D45963858416 for ; Fri, 26 May 2023 07:36:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D45963858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086594; bh=mDCm5EU0Qkr+/FF2/Nl6P8ppTdvPSq1W0wXypGuE2B8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=G9xlpaxILHVMNEEjTmyaGKhIaAh+tpZEzbxQzE1HU45UWXCxORvKa4bmtiPemVNau W4VCrHFY1/9bJ9fcDiLu0cRFawr7JGnl952JILFiLCFVXK3owl+epqs6PkLdl8W3JU JMhfikZt1WMRNi12MhV83RWqxGqSqrrdkGRkCQ4s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id C8F9E3857730 for ; Fri, 26 May 2023 07:35:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8F9E3857730 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-30aa76048fbso200952f8f.2 for ; Fri, 26 May 2023 00:35:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685086544; x=1687678544; 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=mDCm5EU0Qkr+/FF2/Nl6P8ppTdvPSq1W0wXypGuE2B8=; b=Bcwfo3se0kV4y8ELiZS5CZEOtDYUlhEQ7Gxh4W5UIk0WQvvdNidd9Kqj0pLkzVpeyZ k73h/oWFGbMLdb5lNWKbGJJNh9jHYI8mqVKToyq+qeeW8RIY4lyr1+pJ6pBcOnPgI6pJ 1/8f5pmlPTpkh2YVT1u5uqmgNhUkbf7f8GWwhmBN0QClDcxQgQFhX4W8jcLzdA6HMe4z Y2GFg6ZjlVcLm/OpQFtUUX7M+Mj5VYB4x3iY/5xTwBcXTSzlaQPbKVldBZVcF/ITYxFJ vtDNbHy2kXsBnOe+FXzf2XM+352kWEWaDjwJa16KCELyz8eERXtQ/YPjYJqMvjXdHvTk uApw== X-Gm-Message-State: AC+VfDwCWXFEolffkN/9euJ0qFzFbtTdUy9I5DlC9n/QLVowidadWnnI MHwlHE+fgK9G6WOvf5/CbXY35PaH9tqMdzCJa92WrA== X-Received: by 2002:adf:ee0d:0:b0:30a:9cb2:badd with SMTP id y13-20020adfee0d000000b0030a9cb2baddmr568834wrn.46.1685086544599; Fri, 26 May 2023 00:35:44 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:777b:eef4:6f79:f26f]) by smtp.gmail.com with ESMTPSA id n26-20020a7bcbda000000b003f60482024fsm4289992wmi.30.2023.05.26.00.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:35:44 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Clean style in expansion of array aggregates Date: Fri, 26 May 2023 09:35:43 +0200 Message-Id: <20230526073543.2067746-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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?1766941415784445233?= X-GMAIL-MSGID: =?utf-8?q?1766941415784445233?= From: Piotr Trojanek Code cleanup only; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code): Change variable to constant. (Check_Same_Aggr_Bounds): Fix style; remove unused initial value. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index de4d5a785fc..bbc0f408abc 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -2305,7 +2305,7 @@ package body Exp_Aggr is Assoc : Node_Id; Choice : Node_Id; Expr : Node_Id; - Typ : Entity_Id; + Typ : constant Entity_Id := Etype (N); Bounds : Range_Nodes; Low : Node_Id renames Bounds.First; @@ -2323,12 +2323,10 @@ package body Exp_Aggr is -- Start of processing for Build_Array_Aggr_Code begin - -- First before we start, a special case. if we have a bit packed + -- First before we start, a special case. If we have a bit packed -- array represented as a modular type, then clear the value to -- zero first, to ensure that unused bits are properly cleared. - Typ := Etype (N); - if Present (Typ) and then Is_Bit_Packed_Array (Typ) and then Is_Modular_Integer_Type (Packed_Array_Impl_Type (Typ)) @@ -6002,8 +6000,8 @@ package body Exp_Aggr is ---------------------------- procedure Check_Same_Aggr_Bounds (Sub_Aggr : Node_Id; Dim : Pos) is - Sub_Bounds : constant Range_Nodes - := Get_Index_Bounds (Aggregate_Bounds (Sub_Aggr)); + Sub_Bounds : constant Range_Nodes := + Get_Index_Bounds (Aggregate_Bounds (Sub_Aggr)); Sub_Lo : Node_Id renames Sub_Bounds.First; Sub_Hi : Node_Id renames Sub_Bounds.Last; -- The bounds of this specific subaggregate @@ -6015,7 +6013,7 @@ package body Exp_Aggr is Ind_Typ : constant Entity_Id := Aggr_Index_Typ (Dim); -- The index type for this dimension.xxx - Cond : Node_Id := Empty; + Cond : Node_Id; Assoc : Node_Id; Expr : Node_Id;