diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-05 13:01:17 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-05 13:01:17 +0000 |
commit | 93f8b2cd16135707747a648d4dac4efde6274002 (patch) | |
tree | 722b72d2c0b3b7a1539911871f9c6d663acb878b /gcc/ada/par-ch6.adb | |
parent | eb5c9ae3720518f7f262fcd0a65e6729fc59c82e (diff) | |
download | gcc-93f8b2cd16135707747a648d4dac4efde6274002.tar.gz |
2011-09-05 Johannes Kanig <kanig@adacore.com>
* lib-xref-alfa.adb (Is_Alfa_Reference): Filter constants from effect
information.
2011-09-05 Ed Schonberg <schonberg@adacore.com>
* par-ch6.adb (P_Subprogram): In Ada2012 mode, if the subprogram
appears within a package specification and the token after "IS"
is not a parenthesis, assume that this is an unparenthesized
expression function, even if the token appears in a line by
itself.
* par.adb: Clarify use of Labl field of scope stack in error
recovery.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178532 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch6.adb')
-rw-r--r-- | gcc/ada/par-ch6.adb | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 167f43e195b..100259e9995 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -675,10 +675,42 @@ package body Ch6 is else -- If the identifier is the first token on its line, then -- let's assume that we have a missing begin and this is - -- intended as a subprogram body. + -- intended as a subprogram body. However, if the context + -- is a function and the unit is a package declaration, a + -- body would be illegal, so try for an unparenthesized + -- expression function. if Token_Is_At_Start_Of_Line then - return False; + declare + + -- The enclosing scope entry is a subprogram spec. + + Spec_Node : constant Node_Id := + Parent (Scope.Table (Scope.Last).Labl); + Lib_Node : Node_Id := Spec_Node; + + begin + + -- Check whether there is an enclosing scope that + -- is a package declaration. + + if Scope.Last > 1 then + Lib_Node := + Parent (Scope.Table (Scope.Last - 1).Labl); + end if; + + if Ada_Version >= Ada_2012 + and then + Nkind (Lib_Node) = N_Package_Specification + and then + Nkind (Spec_Node) = N_Function_Specification + then + null; + + else + return False; + end if; + end; -- Otherwise we have to scan ahead. If the identifier is -- followed by a colon or a comma, it is a declaration |