From patchwork Mon May 22 08:49:14 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: 97178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1299535vqo; Mon, 22 May 2023 01:51:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XeTkoJlij7uF53r4L/PlyHav06QRuJukLpFsILFwNtn+yY8BrSGjQBmWW06MZxjnzl0e6 X-Received: by 2002:a17:907:7da5:b0:94f:1a23:2f1c with SMTP id oz37-20020a1709077da500b0094f1a232f1cmr10559102ejc.50.1684745483209; Mon, 22 May 2023 01:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684745483; cv=none; d=google.com; s=arc-20160816; b=r9vIhLDvK/oyLASISUPXdHNLQ6et2mLHo4hE2avE+Lr9YF0b34dXBHoTk6DnmRFTbm crxwN0ukZhOYUgGwX/hKZ1/WXfjcHMIhRj9qeJdJTIPp93F+ui2VISY0qqStg4vehVcR ofyob3Tnia0l5utSlUERiJlMDQ/SP8w9skfcXopabj4gDOwRxHEHnsr6CTZsmbQkr1hT i27A56vNels+phUTvlzEXSsKVQVm/Vr0xDw5GnGurwYYY1qjkgacPSihsUWnob7fzQ5T xnGjGPtKonKGCUvTZS2MaHSUgUeUR3vxzXm+IoBK+XvT6xZyzOuQH6RYZe8/oSKC071A E2qA== 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=vJKUdZNdjPhDEji09obsiZEPtf3n26WppsYYZpgVlo8=; b=Lm/LgJ0p0TYLHSA5J0cNBpN39B+a+djohG8pH2hePJ/R+s3R1Mi1SuJ348XYUI/K02 HTp13WpUqu8s9Rr+u9Amo1xF3DbWvns9eCOd2EfbDx0adxewqn54HPnZpLAGxsZEB04L P3aTcDRQV576yuaRba2/WXQ77C0f3qzTxa0wg5qS/4zP5uvIK5hqzxhI91MDoDO/MQj5 bWIc/+7DTlJb6QQ8uFy94GCQSbBZOrhFBFyTpSAK2rDM8E7FsUrTCl0yz2ESOrjBKxox b2QXPA62hci/NWAjCJrJQZP+ZJ790GHw+Hwr/hCSMSokfg4PvlJdXQgmrLcodfzly0hh cTZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Hv2O/m/h"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qu12-20020a170907110c00b0095357b3921bsi3544169ejb.863.2023.05.22.01.51.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Hv2O/m/h"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 770B038555B2 for ; Mon, 22 May 2023 08:50:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 770B038555B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684745413; bh=vJKUdZNdjPhDEji09obsiZEPtf3n26WppsYYZpgVlo8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Hv2O/m/hsHKBkegRmlW5Dn3fuVFYtTa5DBkt5LK6I0P5cwRBk0BK9SxWiffywakyt D6Bc6wIsU1/S158Oi3EzuXt6jbwRNEAXGukFj5Vd3tRp0s5t2AgTvSQls3tMqOGQ87 asKkaxqzxcFBhwfBB+B6CsVsWZ8RzGrLFtl9Aiao= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 4B51B385AC29 for ; Mon, 22 May 2023 08:49:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B51B385AC29 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30a8fa6e6fcso556527f8f.1 for ; Mon, 22 May 2023 01:49:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684745357; x=1687337357; 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=vJKUdZNdjPhDEji09obsiZEPtf3n26WppsYYZpgVlo8=; b=k6sCCGSHqeIbqQpYwBQ50Ne/Umg150Cui1d5iEJFdUJp3j9h/iMMf/MMg6g3Udm55o k/7VWye408B0yrk6qgRRSPXpRDFzcLy6x5+XsLek+m6BCe/F2hBtskE465cWRCjmOUPE s7iQzdQx3M2mgF/6wBXhvXS5Rkjg2vsCAM9On+/IIawzQCnXqpLsx+NCpmpU4LMGjxdz mgKVTtAST6JWunAllc69+qMWjNii0ALhCjMsO9U7p9jhuDLrhuuUizld3cbz5exOgFTh eXjVmICPwowSxH6Y3p158eEhN8YKGOwueDI4f5bFx8BSCv1FxUPLkvEd68xDYOtupK3C P0Yg== X-Gm-Message-State: AC+VfDy6CvkSFLAOKLSeOrAlft12pwy4ITIpkcAyp/OCBI3swbUhVip5 npfKtBg7srJxW+8MbryuhOtqxpI6WOuGC83sHyKo/w== X-Received: by 2002:adf:e253:0:b0:309:412e:3d38 with SMTP id bl19-20020adfe253000000b00309412e3d38mr6904994wrb.34.1684745357023; Mon, 22 May 2023 01:49:17 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b003078681a1e8sm6915397wrw.54.2023.05.22.01.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:49:16 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITTED] ada: update Ada_Version_Type in fe.h to match opt.ads Date: Mon, 22 May 2023 10:49:14 +0200 Message-Id: <20230522084914.1725248-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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?1766583679766509819?= X-GMAIL-MSGID: =?utf-8?q?1766583679766509819?= From: Bob Duff Remove Ada_With_Extensions, which is not used on the C side. Do not add Ada_With_Core_Extensions and Ada_With_All_Extensions, which are also not used on the C side, and on the Ada side are always used via functions All_Extensions_Allowed and Core_Extensions_Allowed. Explain this in comments. Move the functions closer to the type declaration, so the usage style is clearer. Cleanup only -- no change in compiler behavior. gcc/ada/ * fe.h: Remove Ada_With_Extensions and add commentary. * opt.ads: Rearrange code and add commentary. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/fe.h | 5 ++++- gcc/ada/opt.ads | 27 ++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index dd1ee51aadc..2d8f299903d 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -220,8 +220,11 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id); #define Unnest_Subprogram_Mode opt__unnest_subprogram_mode typedef enum { - Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022, Ada_With_Extensions + Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022 } Ada_Version_Type; +// Ada_With_Core_Extensions and Ada_With_All_Extensions (see opt.ads) are not +// used on the C side for now. If we decide to use them, we should import +// All_Extensions_Allowed and Core_Extensions_Allowed functions. extern Ada_Version_Type Ada_Version; extern Boolean Back_End_Inlining; diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 7e5919d4635..bcafba9e57d 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -81,8 +81,13 @@ package Opt is -- so that tests like Ada_Version >= Ada_95 are legitimate and useful. -- Think twice before using "="; Ada_Version >= Ada_2012 is more likely -- what you want, because it will apply to future versions of the language. + -- -- Note that Ada_With_All_Extensions should always be last since it should - -- always be a superset of the other Ada versions. + -- always be a superset of the other Ada versions. Likewise, the + -- penultimate one should be Ada_With_Core_Extensions. + -- + -- Use the ..._Extensions_Allowed functions below instead of referring + -- directly to Ada_With_..._Extensions. -- WARNING: There is a matching C declaration of this type in fe.h @@ -100,6 +105,16 @@ package Opt is -- WARNING: There is a matching C declaration of this variable in fe.h + function All_Extensions_Allowed return Boolean is + (Ada_Version = Ada_With_All_Extensions); + -- True if GNAT specific language extensions are allowed. See GNAT RM for + -- details. + + function Core_Extensions_Allowed return Boolean is + (Ada_Version >= Ada_With_Core_Extensions); + -- True if some but not all GNAT specific language extensions are allowed. + -- See GNAT RM for details. + Ada_Version_Pragma : Node_Id := Empty; -- Reflects the Ada_xxx pragma that resulted in setting Ada_Version. Used -- to specialize error messages complaining about the Ada version in use. @@ -594,16 +609,6 @@ package Opt is -- Set to True to convert nonbinary modular additions into code -- that relies on the front-end expansion of operator Mod. - function All_Extensions_Allowed return Boolean is - (Ada_Version = Ada_With_All_Extensions); - -- True if GNAT specific language extensions are allowed. See GNAT RM for - -- details. - - function Core_Extensions_Allowed return Boolean is - (Ada_Version >= Ada_With_Core_Extensions); - -- True if some but not all GNAT specific language extensions are allowed. - -- See GNAT RM for details. - type External_Casing_Type is ( As_Is, -- External names cased as they appear in the Ada source Uppercase, -- External names forced to all uppercase letters