Commit 821b8ef4 by Robert Dewar Committed by Arnaud Charlet

par-ch5.adb (Test_Statement_Required): Deal with Ada 2012 allowing no null statement after label.

2010-09-09  Robert Dewar  <dewar@adacore.com>

	* par-ch5.adb (Test_Statement_Required): Deal with Ada 2012 allowing no
	null statement after label.
	* sinfo.ads: Minor comment updates.

From-SVN: r164057
parent 30196a76
2010-09-09 Robert Dewar <dewar@adacore.com> 2010-09-09 Robert Dewar <dewar@adacore.com>
* par-ch5.adb (Test_Statement_Required): Deal with Ada 2012 allowing no
null statement after label.
* sinfo.ads: Minor comment updates.
2010-09-09 Robert Dewar <dewar@adacore.com>
* nlists.ads, nlists.adb (In_Same_List): New function. * nlists.ads, nlists.adb (In_Same_List): New function.
Use Node_Or_Entity_Id where appropriate. Use Node_Or_Entity_Id where appropriate.
* par-labl.adb, sem_ch6.adb, sem_type.adb: Use In_Same_List. * par-labl.adb, sem_ch6.adb, sem_type.adb: Use In_Same_List.
......
...@@ -193,8 +193,27 @@ package body Ch5 is ...@@ -193,8 +193,27 @@ package body Ch5 is
procedure Test_Statement_Required is procedure Test_Statement_Required is
begin begin
if Statement_Required then 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 if;
end Test_Statement_Required; end Test_Statement_Required;
......
...@@ -3911,6 +3911,10 @@ package Sinfo is ...@@ -3911,6 +3911,10 @@ package Sinfo is
-- Identifier (Node1) direct name of statement identifier -- Identifier (Node1) direct name of statement identifier
-- Exception_Junk (Flag8-Sem) -- Exception_Junk (Flag8-Sem)
-- Note: Before Ada 2012, a label is always followed by a statement,
-- and this is true in the tree even in Ada 2012 mode (the parser
-- inserts a null statement marked with Comes_From_Source False).
------------------------------- -------------------------------
-- 5.1 Statement Identifier -- -- 5.1 Statement Identifier --
------------------------------- -------------------------------
...@@ -4006,6 +4010,11 @@ package Sinfo is ...@@ -4006,6 +4010,11 @@ package Sinfo is
-- Alternatives (List4) -- Alternatives (List4)
-- End_Span (Uint5) (set to No_Uint if expander generated) -- End_Span (Uint5) (set to No_Uint if expander generated)
-- Note: Before Ada 2012, a pragma in a statement sequence is always
-- followed by a statement, and this is true in the tree even in Ada
-- 2012 mode (the parser inserts a null statement marked with the flag
-- Comes_From_Source False).
------------------------------------- -------------------------------------
-- 5.4 Case Statement Alternative -- -- 5.4 Case Statement Alternative --
------------------------------------- -------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment