+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.
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;
-- Identifier (Node1) direct name of statement identifier
-- 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 --
-------------------------------
-- Alternatives (List4)
-- 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 --
-------------------------------------