* [Ada] Do not require null after label in Ada 2012 mode
@ 2010-09-09 9:45 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2010-09-09 9:45 UTC (permalink / raw)
To: gcc-patches; +Cc: Robert Dewar
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
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 <dewar@adacore.com>
* par-ch5.adb (Test_Statement_Required): Deal with Ada 2012 allowing no
null statement after label.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1177 bytes --]
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-09 9:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09 9:45 [Ada] Do not require null after label in Ada 2012 mode Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).