diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-09 09:38:32 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-09 09:38:32 +0000 |
commit | 3638f03ec550a6a943589884f9466da8f60df872 (patch) | |
tree | 51ef530385e0986b28f4247929bfe6f23767f4ac | |
parent | 64f49c80456f3552dab6aaaad487cbb1913315f3 (diff) | |
download | gcc-3638f03ec550a6a943589884f9466da8f60df872.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164057 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/par-ch5.adb | 23 | ||||
-rw-r--r-- | gcc/ada/sinfo.ads | 9 |
3 files changed, 36 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c0c3e104c31..6bdf3695674 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,11 @@ 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. Use Node_Or_Entity_Id where appropriate. * par-labl.adb, sem_ch6.adb, sem_type.adb: Use In_Same_List. diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index d9d64d7f542..bbac0327ebc 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -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; diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index cb358c4d75b..707bf6480d9 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -3911,6 +3911,10 @@ package Sinfo is -- 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 -- ------------------------------- @@ -4006,6 +4010,11 @@ package Sinfo is -- 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 -- ------------------------------------- |