From: charlet Date: Mon, 5 Sep 2011 13:01:17 +0000 (+0000) Subject: 2011-09-05 Johannes Kanig X-Git-Tag: upstream/4.9.2~17934 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93f8b2cd16135707747a648d4dac4efde6274002;p=platform%2Fupstream%2Flinaro-gcc.git 2011-09-05 Johannes Kanig * lib-xref-alfa.adb (Is_Alfa_Reference): Filter constants from effect information. 2011-09-05 Ed Schonberg * 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 05246c4..082b45e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2011-09-05 Johannes Kanig + + * lib-xref-alfa.adb (Is_Alfa_Reference): Filter constants from effect + information. + +2011-09-05 Ed Schonberg + + * 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. + 2011-09-05 Bob Duff * sem_res.adb (Resolve_Intrinsic_Operator): Use unchecked diff --git a/gcc/ada/lib-xref-alfa.adb b/gcc/ada/lib-xref-alfa.adb index a2ea0e6..c58f600 100644 --- a/gcc/ada/lib-xref-alfa.adb +++ b/gcc/ada/lib-xref-alfa.adb @@ -616,7 +616,9 @@ package body Alfa is -- section, as these will be translated as constants in the -- intermediate language for formal verification. - when E_In_Parameter => + -- Above comment is incomplete??? what about E_Constant case + + when E_In_Parameter | E_Constant => return False; when others => @@ -624,18 +626,13 @@ package body Alfa is -- Objects of Task type or protected type are not Alfa -- references. - if Present (Etype (E)) then - case Ekind (Etype (E)) is - when E_Task_Type | E_Protected_Type => - return False; - - when others => - null; - end case; + if Present (Etype (E)) + and then Ekind (Etype (E)) in E_Concurrent_Kind + then + return False; end if; return Typ = 'r' or else Typ = 'm'; - end case; end Is_Alfa_Reference; diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 167f43e..100259e 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 diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb index 0dbb7d9..4abc5b2 100644 --- a/gcc/ada/par.adb +++ b/gcc/ada/par.adb @@ -466,15 +466,22 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is -- control heuristic error recovery actions. Labl : Node_Id; - -- This field is used only for the LOOP and BEGIN cases, and is the - -- Node_Id value of the label name. For all cases except child units, - -- this value is an entity whose Chars field contains the name pointer - -- that identifies the label uniquely. For the child unit case the Labl - -- field references an N_Defining_Program_Unit_Name node for the name. - -- For cases other than LOOP or BEGIN, the Label field is set to Error, - -- indicating that it is an error to have a label on the end line. + -- This field is used to provide the name of the construct being parsed + -- and indirectly its kind. For loops and blocks, the field contains the + -- source name or the generated one. For package specifications, bodies, + -- subprogram specifications and bodies the field holds the correponding + -- program unit name. For task declarations and bodies, protected types + -- and bodies, and accept statements the field hold the name of the type + -- or operation. For if-statements, case-statements, and selects, the + -- field is initialized to Error, indicating that it is an error to have + -- a label on the end line. -- (this is really a misuse of Error since there is no Error ???) + -- Whenever the field is a name, it is attached to the parent node of + -- the construct being parsed. Thus the parent node indicates the kind + -- of construct whose parse tree is being built. This is used in error + -- recovery. + Decl : List_Id; -- Points to the list of declarations (i.e. the declarative part) -- associated with this construct. It is set only in the END [name]