From patchwork Fri Sep 8 13:36:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 811594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-461727-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mZGDtOCZ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xpdd75RYmz9s7p for ; Fri, 8 Sep 2017 23:36:11 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=f8FGO2c8xjHhky087UTmcfpvYQonCjGjQO5+Kl6VOk5o9hxtEz uXU2ibrzUQEQ1/LPDPBcbo62D6ljgTIIWjAsLw+61P7caf5Frnb3r2devP4skfOY MxV3kB13aKVICxNjPImJnlapeLvHtszJ+VpNmjPsfkxZl4laFzcO4rByo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=3TCr1ePq8vy2N6PtuUe0eC01hHE=; b=mZGDtOCZEhL2xGaecbMD 3BF6CReTo8czJ3qzAXueQ0adIXh30PiRm4r9U1re7UI/QOZwaB+QKkNvlEn+Pe9q 2e8z7LZe08/ByDmb+9YNbffZfCewaSO8PSffFq4/dDAZyBPQqDc37hl/emMq3v2P v208EksPa7T3+4QZcyYUGfA= Received: (qmail 39430 invoked by alias); 8 Sep 2017 13:36:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 39420 invoked by uid 89); 8 Sep 2017 13:36:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=2020 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 Sep 2017 13:36:01 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2B1505628B; Fri, 8 Sep 2017 09:36:00 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id iExWGcq1f8is; Fri, 8 Sep 2017 09:36:00 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 1398056285; Fri, 8 Sep 2017 09:36:00 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4192) id 0FA914A4; Fri, 8 Sep 2017 09:36:00 -0400 (EDT) Date: Fri, 8 Sep 2017 09:36:00 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [Ada] New pragma Ada_2020 Message-ID: <20170908133600.GA100516@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) This patch allows pragma Ada_2020 to be used to enable Ada 2020 features that have been implemented in GNAT. Ada_2020 is a configuration pragma. This is in addition to the -gnat2020 command-line switch. Note: There is no synonym pragma Ada_20. We have Ada_05 and Ada_12, but we decided long ago that for years after 2000, four-digit numbers look better. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-09-08 Bob Duff * par-prag.adb, sem_prag.adb, snames.ads-tmpl: Implement pragma Ada_2020, along the same lines as the other Ada version pragmas. Index: par-prag.adb =================================================================== --- par-prag.adb (revision 251892) +++ par-prag.adb (working copy) @@ -326,14 +326,16 @@ case Prag_Id is + -- Ada version pragmas must be processed at parse time, because we want + -- to set the Ada version properly at parse time to recognize the + -- appropriate Ada version syntax. However, pragma Ada_2005 and higher + -- have an optional argument; it is only the zero argument form that + -- must be processed at parse time. + ------------ -- Ada_83 -- ------------ - -- This pragma must be processed at parse time, since we want to set - -- the Ada version properly at parse time to recognize the appropriate - -- Ada version syntax. - when Pragma_Ada_83 => if not Latest_Ada_Only then Ada_Version := Ada_83; @@ -345,10 +347,6 @@ -- Ada_95 -- ------------ - -- This pragma must be processed at parse time, since we want to set - -- the Ada version properly at parse time to recognize the appropriate - -- Ada version syntax. - when Pragma_Ada_95 => if not Latest_Ada_Only then Ada_Version := Ada_95; @@ -360,11 +358,6 @@ -- Ada_05/Ada_2005 -- --------------------- - -- These pragmas must be processed at parse time, since we want to set - -- the Ada version properly at parse time to recognize the appropriate - -- Ada version syntax. However, it is only the zero argument form that - -- must be processed at parse time. - when Pragma_Ada_05 | Pragma_Ada_2005 => @@ -378,11 +371,6 @@ -- Ada_12/Ada_2012 -- --------------------- - -- These pragmas must be processed at parse time, since we want to set - -- the Ada version properly at parse time to recognize the appropriate - -- Ada version syntax. However, it is only the zero argument form that - -- must be processed at parse time. - when Pragma_Ada_12 | Pragma_Ada_2012 => @@ -392,6 +380,17 @@ Ada_Version_Pragma := Pragma_Node; end if; + -------------- + -- Ada_2020 -- + -------------- + + when Pragma_Ada_2020 => + if Arg_Count = 0 then + Ada_Version := Ada_2020; + Ada_Version_Explicit := Ada_2020; + Ada_Version_Pragma := Pragma_Node; + end if; + --------------------------- -- Compiler_Unit_Warning -- --------------------------- Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 251893) +++ sem_prag.adb (working copy) @@ -11835,7 +11835,7 @@ -- The one argument form is used for managing the transition from Ada -- 2005 to Ada 2012 in the run-time library. If an entity is marked - -- as Ada_201 only, then referencing the entity in any pre-Ada_2012 + -- as Ada_2012 only, then referencing the entity in any pre-Ada_2012 -- mode will generate a warning. In addition, in any pre-Ada_2012 -- mode, a preference rule is established which does not choose -- such an entity unless it is unambiguously specified. This avoids @@ -11883,6 +11883,28 @@ end if; end; + -------------- + -- Ada_2020 -- + -------------- + + -- pragma Ada_2020; + + -- Note: this pragma also has some specific processing in Par.Prag + -- because we want to set the Ada 2020 version mode during parsing. + + when Pragma_Ada_2020 => + GNAT_Pragma; + + Check_Arg_Count (0); + + Check_Valid_Configuration_Pragma; + + -- Now set appropriate Ada mode + + Ada_Version := Ada_2020; + Ada_Version_Explicit := Ada_2020; + Ada_Version_Pragma := N; + ---------------------- -- All_Calls_Remote -- ---------------------- @@ -29419,6 +29441,7 @@ Pragma_Ada_2005 => -1, Pragma_Ada_12 => -1, Pragma_Ada_2012 => -1, + Pragma_Ada_2020 => -1, Pragma_All_Calls_Remote => -1, Pragma_Allow_Integer_Address => -1, Pragma_Annotate => 93, Index: snames.ads-tmpl =================================================================== --- snames.ads-tmpl (revision 251892) +++ snames.ads-tmpl (working copy) @@ -388,6 +388,7 @@ Name_Ada_2005 : constant Name_Id := N + $; -- GNAT Name_Ada_12 : constant Name_Id := N + $; -- GNAT Name_Ada_2012 : constant Name_Id := N + $; -- GNAT + Name_Ada_2020 : constant Name_Id := N + $; -- GNAT Name_Allow_Integer_Address : constant Name_Id := N + $; -- GNAT Name_Annotate : constant Name_Id := N + $; -- GNAT Name_Assertion_Policy : constant Name_Id := N + $; -- Ada 05 @@ -1779,6 +1780,9 @@ Pragma_Ada_2005, Pragma_Ada_12, Pragma_Ada_2012, + Pragma_Ada_2020, + -- Note that there is no Pragma_Ada_20. Pragma_Ada_05/12 are for + -- compatibility reasons only; the full year names are preferred. Pragma_Allow_Integer_Address, Pragma_Annotate, Pragma_Assertion_Policy,