diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-07 12:37:10 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-07 12:37:10 +0000 |
commit | 26e182d2e080cfccf7a2a11e9f675fb4c757948c (patch) | |
tree | 9938e6b83fa49b9e8d2ffa23b29a00aadd3f6372 /gcc/ada/par-ch6.adb | |
parent | 7836f2d6ff0a966aff9a38e98b71f7c332ed9b99 (diff) | |
download | gcc-26e182d2e080cfccf7a2a11e9f675fb4c757948c.tar.gz |
2010-10-07 Robert Dewar <dewar@adacore.com>
* par-ch6.adb: Fix error in handling of parametrized expressions.
* par-ch4.adb (P_Name): Allow qualified expression as name in Ada 2012
mode.
(P_Simple_Expression): Better message for qualified expression prefix
* s-crc32.adb: Minor reformatting.
* exp_intr.adb (Expand_Unc_Deallocation): Remove test for empty
storage pool (this test is moved to Sem_Intr).
* sem_intr.adb (Check_Intrinsic_Call): Add check for deallocation from
empty storage pool, moved here from Exp_Intr and made into error.
(Check_Intrinsic_Call): Remove assumption in generating not-null free
warning that the name of the instantiation is Free.
* sinput.adb (Tree_Read): Document use of illegal free call allowed in
GNAT mode.
* types.ads: Remove storage size clauses from big types (since we may
need to do deallocations, which are now illegal for empty pools).
2010-10-07 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Add missing word.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165099 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch6.adb')
-rw-r--r-- | gcc/ada/par-ch6.adb | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 2c979cfe674..994e166c259 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -632,26 +632,36 @@ package body Ch6 is return False; -- If currently pointing to BEGIN or a declaration keyword - -- or a pragma then we definitely do not have a parametrized - -- expression. + -- or a pragma, then we definitely have a subprogram body. + -- This is a common case, so worth testing first. - elsif Token in Token_Class_Declk - or else Token = Tok_Begin + elsif Token = Tok_Begin + or else Token in Token_Class_Declk or else Token = Tok_Pragma then return False; - -- A common error case, missing BEGIN before RETURN + -- Test for tokens which could only start an expression and + -- thus signal the case of a parametrized expression. - elsif Token = Tok_Return then - return False; + elsif Token in Token_Class_Literal + or else Token in Token_Class_Unary_Addop + or else Token = Tok_Left_Paren + or else Token = Tok_Abs + or else Token = Tok_Null + or else Token = Tok_New + or else Token = Tok_Not + then + return True; - -- Anything other than an identifier must be a parametrized - -- expression at this stage. Probably we could do a little - -- better job of distingushing some more error cases. + -- Anything other than an identifier must be a body at + -- this stage. Probably we could do a little better job of + -- distingushing some more error cases, but it seems right + -- to err on the side of favoring a body over the + -- new-fangled parametrized expression. elsif Token /= Tok_Identifier then - return True; + return False; -- For identifier we have to scan ahead if identifier is -- followed by a colon or a comma, it is a declaration and @@ -740,7 +750,6 @@ package body Ch6 is Pop_Scope_Stack; return Decl_Node; - end P_Subprogram; --------------------------------- |