From patchwork Thu Jun 20 08:53:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 92512 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B642D3891C0F for ; Thu, 20 Jun 2024 09:19:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 6F046388981D for ; Thu, 20 Jun 2024 08:53:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F046388981D 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 6F046388981D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718873645; cv=none; b=TaF3Smz91d2kvD9w+6Ac5Hsa+J/ejTPe42iRAYdewSds/LlljEL6XF/eSgFDP47H0WM7ycL2YwQz+0uTOJo9Dzse+SEQ1ruanhKkLXo9DCP0u6tuB66wNdNZiswoDXAEYk5r5rOVFKdibRcia3o27qEcKO+5B52zaXLrfGApzME= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718873645; c=relaxed/simple; bh=0CaKnE1KAbs+jir8ykg+4eH2fOl/O2jcJTMCSzt9K5U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cFHAAqRf3pAZKJ3q4J7nTmVTlviWU+LCC2I9Ij2apJMcNzFWDLtP3Roc9lLGMlLafS4AWKShM67HOF2UuwHdpTyejLKyByDc6SvyeifZZNOTbzViKhMJx9fduloc4wByCbt/TF7H9yyksJqsco9207rRJV6XYXrn3dHzLELeG9A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3651ee582cfso165455f8f.2 for ; Thu, 20 Jun 2024 01:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718873635; x=1719478435; 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=grnZnsrDQewcXy8CMspQ3N4l3CoZdK4NHOf4U1Q7Foc=; b=ky8M5zGb1v4tayyVv5eIqpg+fsVJ7hytE1YV9CVbnHx7l6izdGehSOlLPuduDoUG5U iil/7Yy+HWqb5ZVtxDlSXSLkD3rWk/ng94bi6CUkyMoGvXmg+4vkCkgfH6smW6K5lBH6 LNjBynB7+HLf4K9o8h+pBSeZfeTrV4twP5ds8bo4xP9J3yWXlFQCsafuYzB9Hsw1R/c+ 25mlmHKdrvymBf23jIlmiJmS4+O4q9uFqdyPtAXgvJzKZSje7G7rE2PkcBEA/1y5ojG+ MipaLFjI/fUGK3CTuW6kY9wbUIwJ09+KMJHjz/Zww6m/E++HNQigMy7+LFpDFvPoSp3s Ph+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718873635; x=1719478435; 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=grnZnsrDQewcXy8CMspQ3N4l3CoZdK4NHOf4U1Q7Foc=; b=bOFEigVVB+zMsqtkbiQkE/HuHR5LGbw5mxVn1mHRpJS9yeCbpKAt5QHr8sHxvj64E+ SY0n4Q3gDCYtshVKHjLOrAjTGGU8jE1OqGGhHeReSr7cGHk/z1vsD2j0nlY5aAkjavzW YCffye2X6XSwI9f1baStktDxMfOOUDWaKv55rIPaMi5iw9P/f5Mg77PHe6rCwyKusxsr z0TEzbHZSWhKDKvsUytmFTQiB4Fp+1jGNZQ9B1Sovbecz14WZHskaO7zDA0cfdJOE+Pv OKIBL3b1XxQp1E0fVt+/JQqNGO41klJSJqhqdAgw+vRUxEZwMV7iDpYM27wc3nir5Re0 Nkxw== X-Gm-Message-State: AOJu0YzwgfQ6aZ1m/jEDI+nWT8O1JV2R+KeR7zIvQ6bY1A8rLmlLIbZQ qGVdphEQHEZT/NGct7wqEIO0LyJTFMBTClE2batQuw5zJ7MxmsD4PJNZ9csv2HdX1ABNQi4anXI = X-Google-Smtp-Source: AGHT+IE6v1Y5jd1/Os792ndrBqwahglRU3Yg7bP2/Ox6WzEF2riHyPEaU6NluV/1CoiIb8QJLDkSEQ== X-Received: by 2002:adf:f78d:0:b0:362:bcfe:39a4 with SMTP id ffacd0b85a97d-363171e243emr3642460f8f.12.1718873635051; Thu, 20 Jun 2024 01:53:55 -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 ffacd0b85a97d-363c795febfsm3305522f8f.104.2024.06.20.01.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 01:53:54 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 27/30] ada: Replace "All" argument to Extensions_Allowed pragma with "All_Extensions" Date: Thu, 20 Jun 2024 10:53:17 +0200 Message-ID: <20240620085321.2412421-27-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240620085321.2412421-1-poulhies@adacore.com> References: <20240620085321.2412421-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+patchwork=sourceware.org@gcc.gnu.org From: Steve Baird The argument to pragma Extensions_Allowed to enable all extensions is no longer "All", but instead "All_Extensions". gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Update documentation. * doc/gnat_rm/implementation_defined_pragmas.rst: Update documentation. * errout.adb (Error_Msg_GNAT_Extension): Update error message text. * par-prag.adb: Update pragma parsing. This includes changing the the name of the Check_Arg_Is_On_Or_Off formal parameter All_OK_Too to All_Extensions_OK_Too. * sem_prag.adb (Analyze_Pragma): In analyzing an Extensions_Allowed pragma, replace uses of Name_All with Name_All_Extensions; update a comment to reflect this. * snames.ads-tmpl: Add Name_All_Extensions declaration. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../doc/gnat_rm/gnat_language_extensions.rst | 5 +++-- .../implementation_defined_pragmas.rst | 10 +++++----- gcc/ada/errout.adb | 10 ++++++---- gcc/ada/gnat_rm.texi | 15 ++++++++------- gcc/ada/par-prag.adb | 19 ++++++++++--------- gcc/ada/sem_prag.adb | 6 +++--- gcc/ada/snames.ads-tmpl | 1 + 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index f71e8f6eef8..d06ac4cc98d 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -37,8 +37,9 @@ file, or in a ``.adc`` file corresponding to your project. .. attention:: You can activate the extended set of extensions by using either the ``-gnatX0`` command line flag, or the pragma ``Extensions_Allowed`` with - ``All`` as an argument. However, it is not recommended you use this subset - for serious projects, and is only means as a playground/technology preview. + ``All_Extensions`` as an argument. However, it is not recommended you use + this subset for serious projects; it is only meant as a technology preview + for use in playground experiments. .. _Curated_Language_Extensions: diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index 6c08eaee816..f31a1b9a7b8 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -2208,19 +2208,19 @@ Syntax: .. code-block:: ada - pragma Extensions_Allowed (On | Off | All); + pragma Extensions_Allowed (On | Off | All_Extensions); -This configuration pragma enables (via the "On" or "All" argument) or disables -(via the "Off" argument) the implementation extension mode; the pragma takes -precedence over the ``-gnatX`` and ``-gnatX0`` command switches. +This configuration pragma enables (via the "On" or "All_Extensions" argument) +or disables (via the "Off" argument) the implementation extension mode; the +pragma takes precedence over the ``-gnatX`` and ``-gnatX0`` command switches. If an argument of ``"On"`` is specified, the latest version of the Ada language is implemented (currently Ada 2022) and, in addition, a curated set of GNAT specific extensions are recognized. (See the list here :ref:`here`) -An argument of ``"All"`` has the same effect except that some extra +An argument of ``"All_Extensions"`` has the same effect except that some extra experimental extensions are enabled (See the list here :ref:`here`) diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index c4eab2deee3..1d82386099c 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -902,21 +902,23 @@ package body Errout is if Is_Core_Extension then Error_Msg ("\unit must be compiled with -gnatX '[or -gnatX0'] " & - "or use pragma Extensions_Allowed (On) '[or All']", Loc); + "or use pragma Extensions_Allowed (On) '[or All_Extensions']", + Loc); else Error_Msg ("\unit must be compiled with -gnatX0 " & - "or use pragma Extensions_Allowed (All)", Loc); + "or use pragma Extensions_Allowed (All_Extensions)", Loc); end if; else Error_Msg_Sloc := Sloc (Ada_Version_Pragma); Error_Msg ("\incompatible with Ada version set#", Loc); if Is_Core_Extension then Error_Msg - ("\must use pragma Extensions_Allowed (On) '[or All']", Loc); + ("\must use pragma Extensions_Allowed (On)" & + " '[or All_Extensions']", Loc); else Error_Msg - ("\must use pragma Extensions_Allowed (All)", Loc); + ("\must use pragma Extensions_Allowed (All_Extensions)", Loc); end if; end if; end Error_Msg_GNAT_Extension; diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index c578502983c..b80d77eeb02 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -3688,19 +3688,19 @@ GNAT User’s Guide. Syntax: @example -pragma Extensions_Allowed (On | Off | All); +pragma Extensions_Allowed (On | Off | All_Extensions); @end example -This configuration pragma enables (via the “On” or “All” argument) or disables -(via the “Off” argument) the implementation extension mode; the pragma takes -precedence over the @code{-gnatX} and @code{-gnatX0} command switches. +This configuration pragma enables (via the “On” or “All_Extensions” argument) +or disables (via the “Off” argument) the implementation extension mode; the +pragma takes precedence over the @code{-gnatX} and @code{-gnatX0} command switches. If an argument of @code{"On"} is specified, the latest version of the Ada language is implemented (currently Ada 2022) and, in addition, a curated set of GNAT specific extensions are recognized. (See the list here @ref{69,,here}) -An argument of @code{"All"} has the same effect except that some extra +An argument of @code{"All_Extensions"} has the same effect except that some extra experimental extensions are enabled (See the list here @ref{6a,,here}) @@ -28817,8 +28817,9 @@ activate the curated subset of extensions. @quotation Attention You can activate the extended set of extensions by using either the @code{-gnatX0} command line flag, or the pragma @code{Extensions_Allowed} with -@code{All} as an argument. However, it is not recommended you use this subset -for serious projects, and is only means as a playground/technology preview. +@code{All_Extensions} as an argument. However, it is not recommended you use +this subset for serious projects; it is only meant as a technology preview +for use in playground experiments. @end quotation @end cartouche diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 88a04397cf2..9e77bf16ff3 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -74,11 +74,11 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is -- is a string literal. If not give error and raise Error_Resync. procedure Check_Arg_Is_On_Or_Off - (Arg : Node_Id; All_OK_Too : Boolean := False); + (Arg : Node_Id; All_Extensions_OK_Too : Boolean := False); -- Check the expression of the specified argument to make sure that it -- is an identifier which is either ON or OFF, and if not, then issue - -- an error message and raise Error_Resync. If All_OK_Too is True, - -- then an ALL identifer is also acceptable. + -- an error message and raise Error_Resync. If All_Extensions_OK_Too is + -- True, then an ALL_EXTENSIONS identifer is also acceptable. procedure Check_No_Identifier (Arg : Node_Id); -- Checks that the given argument does not have an identifier. If @@ -170,21 +170,22 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is ---------------------------- procedure Check_Arg_Is_On_Or_Off - (Arg : Node_Id; All_OK_Too : Boolean := False) + (Arg : Node_Id; All_Extensions_OK_Too : Boolean := False) is Argx : constant Node_Id := Expression (Arg); Error : Boolean := Nkind (Expression (Arg)) /= N_Identifier; begin if not Error then Error := Chars (Argx) not in Name_On | Name_Off - and then not (All_OK_Too and Chars (Argx) = Name_All); + and then not (All_Extensions_OK_Too + and then Chars (Argx) = Name_All_Extensions); end if; if Error then Error_Msg_Name_2 := Name_On; Error_Msg_Name_3 := Name_Off; - if All_OK_Too then - Error_Msg_Name_4 := Name_All; + if All_Extensions_OK_Too then + Error_Msg_Name_4 := Name_All_Extensions; Error_Msg_N ("argument for pragma% must be% or% or%", Argx); else Error_Msg_N ("argument for pragma% must be% or%", Argx); @@ -433,11 +434,11 @@ begin when Pragma_Extensions_Allowed => Check_Arg_Count (1); Check_No_Identifier (Arg1); - Check_Arg_Is_On_Or_Off (Arg1, All_OK_Too => True); + Check_Arg_Is_On_Or_Off (Arg1, All_Extensions_OK_Too => True); if Chars (Expression (Arg1)) = Name_On then Ada_Version := Ada_With_Core_Extensions; - elsif Chars (Expression (Arg1)) = Name_All then + elsif Chars (Expression (Arg1)) = Name_All_Extensions then Ada_Version := Ada_With_All_Extensions; else Ada_Version := Ada_Version_Explicit; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 6091b5e48d3..784c9a49ae3 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -17422,17 +17422,17 @@ package body Sem_Prag is -- Extensions_Allowed -- ------------------------ - -- pragma Extensions_Allowed (ON | OFF | ALL); + -- pragma Extensions_Allowed (ON | OFF | ALL_EXTENSIONS); when Pragma_Extensions_Allowed => GNAT_Pragma; Check_Arg_Count (1); Check_No_Identifiers; - Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off, Name_All); + Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off, Name_All_Extensions); if Chars (Get_Pragma_Arg (Arg1)) = Name_On then Ada_Version := Ada_With_Core_Extensions; - elsif Chars (Get_Pragma_Arg (Arg1)) = Name_All then + elsif Chars (Get_Pragma_Arg (Arg1)) = Name_All_Extensions then Ada_Version := Ada_With_All_Extensions; else Ada_Version := Ada_Version_Explicit; diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 6027864e583..c624d04a7f7 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -783,6 +783,7 @@ package Snames is Name_Address_Type : constant Name_Id := N + $; Name_Aggregate : constant Name_Id := N + $; + Name_All_Extensions : constant Name_Id := N + $; Name_Allow : constant Name_Id := N + $; Name_Amount : constant Name_Id := N + $; Name_As_Is : constant Name_Id := N + $;