From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 41831385840D for ; Mon, 20 May 2024 07:49:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41831385840D 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 41831385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716191377; cv=none; b=FjwZtO7pcMfiHoevStNaVrsT3T3+QQte08KJy642Zbw+tVFILK27vMzfp4dxqSzdYedFv662zLuX0/hZaJbv31bB3sfMdCHnIDA/n/THeAVMpvtKQqhWysOXIaT0Sn7xWP2ijZM2OmI5365Pp7dGv6PFN/P63CHwZ35+0+O5V6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716191377; c=relaxed/simple; bh=ubKS8DQ0GMJCNTyqAH9o7QT40QgocZKblZ+Ui44xdkw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hUC7fL6fiCU/RbH/DPx5umUPUBp3nUClmX0TEDF8LqrM1YV8Cs6mAWZUk68CEeewmP6YXnkVtYeXTnNomhL3o0pOpDdBQ7AeR1hOtTq5jzZFQzwSJKcnSEGbHmrkma1FMyxS5ghdbk+a46oWw4G7LjOPAozJNcL6iWR9EC+6Bbk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4202cea9a2fso17451185e9.3 for ; Mon, 20 May 2024 00:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716191372; x=1716796172; 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=4llUDrDiRpmePe3nEX+6gbvhqz/glRme4eTP5I2DKVk=; b=PBLczU9NXmPZ81nQsxHn/RnXlnX3IXzblTnuBWwL7IgiwoiiPzt1Zf5bfTcdTr7Trz OCy07lAUEDUIuw4x+9W8YmLvPZJFZHL8FfP+dPqQDqphTXZnG7JzlcL3wO11bnGvvIIT cal0aigWh3NLDC4dlw9g6lgIjTpKSuHVMWMe2wl+Cq65aChGbP9wn7C7RACYinHZUVuX NjGyIT1rmSMTVp11rVt65j9ieSeQW6E+eHxdQrU91/x0p+6wIXdYOiNrYSWAfsylP06N OCaOOTOwrL8UaPZlQq0je/OB4yeM32f8vOTc8gYYBzEYkaYZGRFvla1LkviFLH22aWuI MnLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716191372; x=1716796172; 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=4llUDrDiRpmePe3nEX+6gbvhqz/glRme4eTP5I2DKVk=; b=o3zv4D0YdotqWV9Y7NB9uyApEXdZBRGi94cLL/0vMyEz9FtWiOeVXltfbJ76wr0zK3 DNJDF71AUw+X6TakWQQHKf2unhQsDbkQAjsjdc5doTxrvgQKt58oCgLzLsqgR8hsxt/W L9idomHfKfThiuC1Ag0G5WlVdiaf/yH9VR5mTRsh4wXyx2zjW/bQM0pyf+DoJf/AYVe8 SdqvcHcP+wyWimeSLJFpn7cOhAkEjSEfwi72r3/SAwOcwa+sppQtXptN4pcmt+mcKplq 0UC27X/NBQnbFJDbc2PmPziZGR0GY1wMZko9MnBfu/s5ws0qYALi+fAvb27cl0aIkdfz fSPQ== X-Gm-Message-State: AOJu0Ywr1TusEkpNJ+w7/HcpcONK601BHaZrzTOHN41aqIWyT6VtZsFH bpxAlNoBEDwRqomN/LkybCEVrjVYIUNnrZwXto0yVGnfmUCh+ymH4RkL/+g4er4+WozLbs+Gang = X-Google-Smtp-Source: AGHT+IHEf6bQhp/dtsVDcu3xqp1g3dboCg1/bRsx6wtud8P67+Lx2Jm7gTb06J1ps/FypdPr1kiUiQ== X-Received: by 2002:a05:600c:35c5:b0:420:2ca9:1b90 with SMTP id 5b1f17b1804b1-4202ca91e1bmr91763345e9.5.1716191371948; Mon, 20 May 2024 00:49:31 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f88111033sm446892175e9.34.2024.05.20.00.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 00:49:31 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITTED 26/30] ada: Formal package comment corrections in sinfo.ads Date: Mon, 20 May 2024 09:48:52 +0200 Message-ID: <20240520074858.222435-26-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240520074858.222435-1-poulhies@adacore.com> References: <20240520074858.222435-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.9 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Bob Duff Misc comment corrections and clarifications in sinfo.ads related to generic formal packages. gcc/ada/ * sinfo.ads: Misc comment corrections and clarifications. The syntax for GENERIC_ASSOCIATION and FORMAL_PACKAGE_ACTUAL_PART was wrong. Emphasize that "others => <>" is not represented as an N_Generic_Association (with or without Box_Present set), and give examples illustrating the various possibilities. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sinfo.ads | 61 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 228082eb823..599f4f63cce 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1574,9 +1574,9 @@ package Sinfo is -- Instance_Spec -- This field is present in generic instantiation nodes, and also in -- formal package declaration nodes (formal package declarations are - -- treated in a manner very similar to package instantiations). It points - -- to the node for the spec of the instance, inserted as part of the - -- semantic processing for instantiations in Sem_Ch12. + -- treated similarly to package instantiations). It points to the node + -- for the spec of the instance, inserted as part of the semantic + -- processing for instantiations in Sem_Ch12. -- Is_Abort_Block -- Present in N_Block_Statement nodes. True if the block protects a list @@ -3639,8 +3639,8 @@ package Sinfo is -- The only choice that appears explicitly is the OTHERS choice, as -- defined here. Other cases of discrete choice (expression and - -- discrete range) appear directly. This production is also used - -- for the OTHERS possibility of an exception choice. + -- discrete range) appear directly. N_Others_Choice is also used + -- in exception handlers and generic formal packages. -- Note: in accordance with the syntax, the parser does not check that -- OTHERS appears at the end on its own in a choice list context. This @@ -7139,6 +7139,7 @@ package Sinfo is -- GENERIC_ASSOCIATION ::= -- [generic_formal_parameter_SELECTOR_NAME =>] + -- EXPLICIT_GENERIC_ACTUAL_PARAMETER -- Note: unlike the procedure call case, a generic association node -- is generated for every association, even if no formal parameter @@ -7149,7 +7150,8 @@ package Sinfo is -- In Ada 2005, a formal may be associated with a box, if the -- association is part of the list of actuals for a formal package. -- If the association is given by OTHERS => <>, the association is - -- an N_Others_Choice. + -- an N_Others_Choice (not an N_Generic_Association whose Selector_Name + -- is an N_Others_Choice). -- N_Generic_Association -- Sloc points to first token of generic association @@ -7442,7 +7444,7 @@ package Sinfo is -- Defining_Identifier -- Name -- Generic_Associations (set to No_List if (<>) case or - -- empty generic actual part) + -- empty formal package actual part) -- Box_Present -- Instance_Spec -- Is_Known_Guaranteed_ABE @@ -7452,21 +7454,50 @@ package Sinfo is -------------------------------------- -- FORMAL_PACKAGE_ACTUAL_PART ::= - -- ([OTHERS] => <>) + -- ([OTHERS =>] <>) -- | [GENERIC_ACTUAL_PART] - -- (FORMAL_PACKAGE_ASSOCIATION {. FORMAL_PACKAGE_ASSOCIATION} + -- | (FORMAL_PACKAGE_ASSOCIATION {, FORMAL_PACKAGE_ASSOCIATION} + -- [, OTHERS => <>]) -- FORMAL_PACKAGE_ASSOCIATION ::= -- GENERIC_ASSOCIATION -- | GENERIC_FORMAL_PARAMETER_SELECTOR_NAME => <> -- There is no explicit node in the tree for a formal package actual - -- part. Instead the information appears in the parent node (i.e. the - -- formal package declaration node itself). - - -- There is no explicit node for a formal package association. All of - -- them are represented either by a generic association, possibly with - -- Box_Present, or by an N_Others_Choice. + -- part, nor for a formal package association. A formal package + -- association is represented as a generic association, possibly with + -- Box_Present. + -- + -- The "others => <>" syntax (both cases) is represented as an + -- N_Others_Choice (not an N_Generic_Association whose Selector_Name + -- is an N_Others_Choice). This admittedly odd representation does not + -- lose information, because "others" cannot be followed by anything + -- other than "=> <>". Thus: + -- + -- "... is new G;" + -- The N_Formal_Package_Declaration has empty Generic_Associations, + -- and Box_Present = False. + -- + -- "... is new G(<>);" + -- The N_Formal_Package_Declaration has empty Generic_Associations, + -- and Box_Present = True. + -- + -- "... is new G(others => <>);" + -- The N_Formal_Package_Declaration has Generic_Associations with a + -- single element, which is an N_Others_Choice. + -- The N_Formal_Package_Declaration has Box_Present = False. + -- + -- "... is new G(X, F => Y, others => <>);" + -- The N_Formal_Package_Declaration has Generic_Associations with + -- three elements, the last of which is an N_Others_Choice. + -- The N_Formal_Package_Declaration has Box_Present = False. + -- + -- "... is new G(F1 => X, F2 => <>, others => <>);" + -- The N_Formal_Package_Declaration has Generic_Associations with + -- three elements. The first is an N_Generic_Association with + -- Box_Present = False. The second is an N_Generic_Association with + -- Box_Present = True. The last is an N_Others_Choice. + -- The N_Formal_Package_Declaration has Box_Present = False. --------------------------------- -- 13.1 Representation clause -- -- 2.43.2