summaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch5.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-05 10:30:15 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-05 10:30:15 +0000
commit7892aafd743c092bcbb34274456384f1af246d2f (patch)
tree9190178a47cd0fd3cb4320d67c4362206056744c /gcc/ada/par-ch5.adb
parent98f7db28f6275af79e04065bb2d7c6e21c5ee398 (diff)
downloadgcc-7892aafd743c092bcbb34274456384f1af246d2f.tar.gz
2010-10-05 Robert Dewar <dewar@adacore.com>
* par-ch5.adb (Test_Statement_Required): Allow all pragmas in Ada 2012 mode. 2010-10-05 Pascal Obry <obry@adacore.com> * gnat_rm.texi: Fix typo. 2010-10-05 Arnaud Charlet <charlet@adacore.com> * gnat_ugn.texi: Add note about identifiers with same name and -fdump-ada-spec. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164983 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch5.adb')
-rw-r--r--gcc/ada/par-ch5.adb32
1 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb
index 30433ef208e..428dc7890aa 100644
--- a/gcc/ada/par-ch5.adb
+++ b/gcc/ada/par-ch5.adb
@@ -190,14 +190,40 @@ package body Ch5 is
-----------------------------
procedure Test_Statement_Required is
+ function All_Pragmas return Boolean;
+ -- Return True if statement list is all pragmas
+
+ -----------------
+ -- All_Pragmas --
+ -----------------
+
+ function All_Pragmas return Boolean is
+ S : Node_Id;
+ begin
+ S := First (Statement_List);
+ while Present (S) loop
+ if Nkind (S) /= N_Pragma then
+ return False;
+ else
+ Next (S);
+ end if;
+ end loop;
+
+ return True;
+ end All_Pragmas;
+
+ -- Start of processing for Test_Statement_Required
+
begin
if Statement_Required then
- -- Check no statement required after label in Ada 2012
+ -- Check no statement required after label in Ada 2012, and that
+ -- it is OK to have nothing but pragmas in a statement sequence.
if Ada_Version >= Ada_2012
and then not Is_Empty_List (Statement_List)
- and then Nkind (Last (Statement_List)) = N_Label
+ and then (Nkind (Last (Statement_List)) = N_Label
+ or else All_Pragmas)
then
declare
Null_Stm : constant Node_Id :=
@@ -207,6 +233,8 @@ package body Ch5 is
Append_To (Statement_List, Null_Stm);
end;
+ -- All pragmas is OK on
+
-- If not Ada 2012, or not special case above, give error message
else