From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30a8fa6e6fcso556527f8f.1 for ; Mon, 22 May 2023 01:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1684745357; x=1687337357; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vJKUdZNdjPhDEji09obsiZEPtf3n26WppsYYZpgVlo8=; b=WafrazzimGuHAzdXiCVVE3k+PgTESCAiKT2z6VfUM6dTuPyzz/W14irdNAv755xD+A XuJDf9VAJQQsZZdC3vNYiYy3kqptzg5vnlmm7UnkN9dHWgPdNAdOq3Fwpy/KfTiJQLBG aXLNrc3k8O8KhmQKOZsMMxeKEqnmHELSnYNJ/u3hOop0zxabYu43p/7QF0r2C9dLrROw 28qhQ8ipPfqMUPWE2MGCoGuPNWkLehOVIRU0c5DoFFaIwpZipV/+tb/LB3kTur8lGn4Q hgBMbl5dF38gk+PpgQjg3QFlViju+iOOx4NlHRSdoY2ddkkAiXX7jTuvQdeMbP6YBl2+ QO7w== 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-Google-Smtp-Source: ACHHUZ5o56VhY9fE6g3P5Bvh6OYbSk5m3nvQJo+62Gzeq3o2XvRujTARRg7VD2x5DwT3bO8aLc6vDg== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.40.0