diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-05-27 09:08:20 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-05-27 09:08:20 +0000 |
commit | 131f3644ef87d5406722ee42b0989cb5783156fa (patch) | |
tree | 6f9c3016cb1696987ba7b0cc8c1b8c5400c6157d /gcc/ada/par-ch3.adb | |
parent | 851ccf1afd9b0e045e7dda2539a3dfa30c16bb64 (diff) | |
download | gcc-131f3644ef87d5406722ee42b0989cb5783156fa.tar.gz |
2015-05-27 Basile Starynkevitch <basile@starynkevitch.net>
{{merged with almost GCC 5. i.e. trunk r222129 from 2015-04-15,
using svn merge -r219880:222129
svn+ssh://bstarynk@gcc.gnu.org/svn/gcc/trunk }}
[gcc/]
2015-05-27 Basile Starynkevitch <basile@starynkevitch.net>
{{merged with GCC 5, so}}
* melt-runtime.h (melt_fatal_error, melt_fatal_error_at_line):
Pass UNKNOWN_LOCATION for GCC 5. Re-indented with command:
astyle --style=gnu -s2
* melt-runtime.cc: Re-indented with command:
astyle --style=gnu -s2
(melt_branch_process_arguments, melt_ggcstart_callback)
(melt_reserved_allocation_failure): Use melt_fatal_error instead
of fatal_error.
* melt/generated/meltrunsup-inc.cc: Manually edited for fatal_error.
* melt/generated/warmelt-first.cc: Ditto.
* melt/warmelt-first.melt (melt_assert_failure_fun): Ditto.
* melt/warmelt-modes.melt (generate_runtypesupport_scanning):
Ditto, in the emitted code.
* Makefile.in: mention s-gtype instead of gt-melt-runtime.h in
dependencies.
(TEXI_GCCINT_FILES): Add meltgendoc.texi.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@223739 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch3.adb')
-rw-r--r-- | gcc/ada/par-ch3.adb | 86 |
1 files changed, 64 insertions, 22 deletions
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 80c95a9c635..0be12177513 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1455,6 +1455,16 @@ package body Ch3 is else Restore_Scan_State (Scan_State); + + -- Reset Token_Node, because it already got changed from an + -- Identifier to a Defining_Identifier, and we don't want that + -- for a statement! + + Token_Node := + Make_Identifier (Sloc (Token_Node), Chars (Token_Node)); + + -- And now scan out one or more statements + Statement_When_Declaration_Expected (Decls, Done, In_Spec); return; end if; @@ -1504,14 +1514,34 @@ package body Ch3 is return; -- Otherwise we definitely have an ordinary identifier with a junk - -- token after it. Just complain that we expect a declaration, and - -- skip to a semicolon + -- token after it. else - Set_Declaration_Expected; - Resync_Past_Semicolon; - Done := False; - return; + -- If in -gnatd.2 mode, try for statements + + if Debug_Flag_Dot_2 then + Restore_Scan_State (Scan_State); + + -- Reset Token_Node, because it already got changed from an + -- Identifier to a Defining_Identifier, and we don't want that + -- for a statement! + + Token_Node := + Make_Identifier (Sloc (Token_Node), Chars (Token_Node)); + + -- And now scan out one or more statements + + Statement_When_Declaration_Expected (Decls, Done, In_Spec); + return; + + -- Normal case, just complain and skip to semicolon + + else + Set_Declaration_Expected; + Resync_Past_Semicolon; + Done := False; + return; + end if; end if; end if; @@ -4777,6 +4807,12 @@ package body Ch3 is if In_Spec then null; + -- Just ignore it if we are in -gnatd.2 (allow statements to appear + -- in declaration sequences) mode. + + elsif Debug_Flag_Dot_2 then + null; + -- In the declarative part case, take a second statement as a sure -- sign that we really have a missing BEGIN, and end the declarative -- part now. Note that the caller will fix up the first message to @@ -4790,26 +4826,32 @@ package body Ch3 is -- Case of first occurrence of unexpected statement else - -- If we are in a package spec, then give message of statement - -- not allowed in package spec. This message never gets changed. + -- Do not give error message if we are operating in -gnatd.2 mode + -- (alllow statements to appear in declarative parts). - if In_Spec then - Error_Msg_SC ("statement not allowed in package spec"); + if not Debug_Flag_Dot_2 then - -- If in declarative part, then we give the message complaining - -- about finding a statement when a declaration is expected. This - -- gets changed to a complaint about a missing BEGIN if we later - -- find that no BEGIN is present. + -- If we are in a package spec, then give message of statement + -- not allowed in package spec. This message never gets changed. - else - Error_Msg_SC ("statement not allowed in declarative part"); - end if; + if In_Spec then + Error_Msg_SC ("statement not allowed in package spec"); - -- Capture message Id. This is used for two purposes, first to - -- stop multiple messages, see test above, and second, to allow - -- the replacement of the message in the declarative part case. + -- If in declarative part, then we give the message complaining + -- about finding a statement when a declaration is expected. This + -- gets changed to a complaint about a missing BEGIN if we later + -- find that no BEGIN is present. - Missing_Begin_Msg := Get_Msg_Id; + else + Error_Msg_SC ("statement not allowed in declarative part"); + end if; + + -- Capture message Id. This is used for two purposes, first to + -- stop multiple messages, see test above, and second, to allow + -- the replacement of the message in the declarative part case. + + Missing_Begin_Msg := Get_Msg_Id; + end if; end if; -- In all cases except the case in which we decided to terminate the |