From patchwork Thu Sep 9 09:38:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 64267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 51078B6EE8 for ; Thu, 9 Sep 2010 19:39:00 +1000 (EST) Received: (qmail 6614 invoked by alias); 9 Sep 2010 09:38:53 -0000 Received: (qmail 6525 invoked by uid 22791); 9 Sep 2010 09:38:52 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Sep 2010 09:38:43 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 42E68CB0230; Thu, 9 Sep 2010 11:38:41 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZQ2-RJL2LNm5; Thu, 9 Sep 2010 11:38:41 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 2E33BCB021E; Thu, 9 Sep 2010 11:38:41 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 0759CD9BA8; Thu, 9 Sep 2010 11:38:40 +0200 (CEST) Date: Thu, 9 Sep 2010 11:38:40 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Do not require null after label in Ada 2012 mode Message-ID: <20100909093840.GA4639@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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 This patch implements the new Ada 2012 feature that no longer requires a statement to follow a label. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-09-09 Robert Dewar * par-ch5.adb (Test_Statement_Required): Deal with Ada 2012 allowing no null statement after label. Index: par-ch5.adb =================================================================== --- par-ch5.adb (revision 164056) +++ par-ch5.adb (working copy) @@ -193,8 +193,27 @@ package body Ch5 is procedure Test_Statement_Required is begin if Statement_Required then - Error_Msg_BC -- CODEFIX - ("statement expected"); + + -- Check no statement required after label in Ada 2012 + + if Ada_Version >= Ada_2012 + and then not Is_Empty_List (Statement_List) + and then Nkind (Last (Statement_List)) = N_Label + then + declare + Null_Stm : constant Node_Id := + Make_Null_Statement (Token_Ptr); + begin + Set_Comes_From_Source (Null_Stm, False); + Append_To (Statement_List, Null_Stm); + end; + + -- If not Ada 2012, or not special case above, give error message + + else + Error_Msg_BC -- CODEFIX + ("statement expected"); + end if; end if; end Test_Statement_Required;