From patchwork Fri Jun 14 07:36:21 2024 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: 1947703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=JaaY7weT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W0rkc2JCfz20Pb for ; Fri, 14 Jun 2024 17:39:04 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A1EEF388265B for ; Fri, 14 Jun 2024 07:39:02 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id F30FB3882168 for ; Fri, 14 Jun 2024 07:36:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F30FB3882168 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F30FB3882168 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718350614; cv=none; b=BljSslIOuJqwvin6L3aaDlK0BgopCN7ghScUnz8Ib6bmn8klSo5lAnvGlRQ1LFk+ynhqlUgJbu+mMLxRADyJEVKfm33tVwAvOSp/JEXO48PEqenQ9Z5QyEA/9MZD16vYNmPqH+8oG3cgn56vE4OXMvb3iKzRBYIgkxjbPbXhnmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718350614; c=relaxed/simple; bh=G8HtaRi6wmkq1gQbGe7ysJtoqH54hoNbFGG9RUOsnA0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uL9iSGIdWlg4odL0APPHjTIAsAuYDjPlz5625veXl0TEoM3XmK+rGdk0Ida7xzyZ7mFAY5UEFWreVr/nxDbG+q/Rfi2Bn181Vy3z3HKXqZeXqgy/6/Ai0WafRJD75q28B3pmw3Mehtp+W4Ol38pEySL6OlKkW81fFCK2yYl9LKA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-35f1c490c13so2087519f8f.3 for ; Fri, 14 Jun 2024 00:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718350608; x=1718955408; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jkg8xpMX9flMtyUcWgUenBLUCtAB9VxV46YV7i0kbPo=; b=JaaY7weTdJU+dEwsL/BDig0HPGtuhOdSq8ZFBxN0mXczpRIbCSJOWxk3Q8e9Csu+Lk cfPC6n/E1HqsevJElo7p4zsw3Gh2TT+eOERZGhlXgN6nCYEwMWRt5pgVHp4HFpxPeDCQ SUpbNT3r93CRhWaHC9pocSt9ECTkDcxmW67/wNyQl8smz/JIf5zFDHXShi4zT9/GTM/r 6o3yET087gk8wbpsJaaX2eq4cvQhaBLnO3yiDh56+HozkoOfGbMe/YLa+zeNnTzHkpXI H2DtmOt59/vrQIzg8YWMaY3jjlRtYjmPxUDV0k7ZorqYpjMZp0ukMB8bZcmts5yfWS9f OgOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718350608; x=1718955408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jkg8xpMX9flMtyUcWgUenBLUCtAB9VxV46YV7i0kbPo=; b=lDKbahdNr3a43GLkblEzt0kgvYfOS9g5cMrz0TrqXHwb/gcE3F+nV7cwlCH2UtocJD WulA5WgcVUbShBjInXC16g5SnP2Y1GZklHe2kvDLWgHg/i4uEPpEZsPXXcuy+FwZ2TM5 Gk/H9AxG8WDfIidF7/zA9/DEFLj8D2dkpsFzBZxMFusUu72Y7prYTdDhujgaLhoQjiq3 nFQ9/0ndbp5hptMOuWRo+F+J2rCy+B8YPKsxWkygTobvt9T5SmAYx3ytPWNE/fn7BGTt yyjbeaJqWrsGD0mRkbf3yKkFZ/x/zxge0+xIbXeDdcTqhrYDRcckthcfWKInNLvRIh1J +2rA== X-Gm-Message-State: AOJu0YzNamCKG5a+w9I9wdf/KTkV5Fnc9IUcXwIbpKyyNpnsSFK9sW62 wyP2l5mvfpFuy5xZim1hHpU+AnEH1gw/JfYo5UFsUWWAAf7R1I4/WCoCzyWN5VLCVXi7/b/e8QU = X-Google-Smtp-Source: AGHT+IE6JnOhiVWHvDn14PHWejStfmw1PFc69ueDty92xJ+qwyg56hSAixJyt5r9PxAaL0dq0hQTTg== X-Received: by 2002:a05:6000:1842:b0:35e:ebe7:de43 with SMTP id ffacd0b85a97d-3607a761571mr1900490f8f.21.1718350607832; Fri, 14 Jun 2024 00:36:47 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:cb5c:2e27:9d1c:5033]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36075093636sm3558191f8f.14.2024.06.14.00.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 00:36:47 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 05/16] ada: Minor tweaks to processing of Aggregate aspect Date: Fri, 14 Jun 2024 09:36:21 +0200 Message-ID: <20240614073633.2089692-5-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240614073633.2089692-1-poulhies@adacore.com> References: <20240614073633.2089692-1-poulhies@adacore.com> 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Eric Botcazou The main one is to give the error for Aggregate applied to array types from Analyze_Aspects_At_Freeze_Point instead of Check_Aspect_At_Freeze_Point, as for the other aspects. The message is also changed to be more direct. gcc/ada/ * aspects.ads (Operational_Aspect): Alphabetize. * sem_ch13.ads (Analyze_Aspects_At_Freeze_Point): Fix description. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point) : Give the error for array types here instead of... (Analyze_Aspect_Specifications) : Adjust comment. (Check_Aspect_At_Freeze_Point) : ...here. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/aspects.ads | 4 ++-- gcc/ada/sem_ch13.adb | 17 ++++++++--------- gcc/ada/sem_ch13.ads | 9 +++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index 3cc62de3411..1acbec87824 100644 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -325,12 +325,12 @@ package Aspects is -- List is currently incomplete ??? Operational_Aspect : constant array (Aspect_Id) of Boolean := - (Aspect_Constant_Indexing => True, + (Aspect_Aggregate => True, + Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Iterator_Element => True, Aspect_Iterable => True, Aspect_Variable_Indexing => True, - Aspect_Aggregate => True, others => False); -- The following array indicates aspects for which multiple occurrences of diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 46a359fd7d6..caebe2e793e 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1367,7 +1367,11 @@ package body Sem_Ch13 is Validate_Storage_Model_Type_Aspect (E, ASN); when Aspect_Aggregate => - null; + if Is_Array_Type (E) then + Error_Msg_N + ("aspect Aggregate may not be applied to array type", + ASN); + end if; when others => null; @@ -1384,7 +1388,7 @@ package body Sem_Ch13 is Next_Rep_Item (ASN); end loop; - -- Make a second pass for a Full_Access_Only entry + -- Make a second pass for a Full_Access_Only entry, see above why ASN := First_Rep_Item (E); while Present (ASN) loop @@ -4130,8 +4134,8 @@ package body Sem_Ch13 is end if; when Aspect_Aggregate => - -- We will be checking that the aspect is not specified on a - -- non-array type in Check_Aspect_At_Freeze_Point + -- We will be checking that the aspect is not specified on + -- an array type in Analyze_Aspects_At_Freeze_Point. Validate_Aspect_Aggregate (Expr); @@ -11378,11 +11382,6 @@ package body Sem_Ch13 is return; when Aspect_Aggregate => - if Is_Array_Type (Entity (ASN)) then - Error_Msg_N - ("aspect& can only be applied to non-array type", - Ident); - end if; Resolve_Aspect_Aggregate (Entity (ASN), Expression (ASN)); return; diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads index 2bdca957826..aeacda833d1 100644 --- a/gcc/ada/sem_ch13.ads +++ b/gcc/ada/sem_ch13.ads @@ -312,10 +312,11 @@ package Sem_Ch13 is -- Quite an awkward approach, but this is an awkard requirement procedure Analyze_Aspects_At_Freeze_Point (E : Entity_Id); - -- Analyzes all the delayed aspects for entity E at freezing point. This - -- includes dealing with inheriting delayed aspects from the parent type - -- in the case where a derived type is frozen. Callers should check that - -- Has_Delayed_Aspects (E) is True before calling this routine. + -- Analyzes all the delayed aspects for entity E at the freeze point. Note + -- that this does not include dealing with inheriting delayed aspects from + -- the parent or base type in the case where a derived type or a subtype is + -- frozen. Callers should check that Has_Delayed_Aspects (E) is True before + -- calling this routine. procedure Check_Aspects_At_End_Of_Declarations (E : Entity_Id); -- Performs the processing described above at the freeze all point, and