From a7e68e7fa76aa33eab48a30186abcb4d3b291322 Mon Sep 17 00:00:00 2001 From: Hristian Kirtchev Date: Fri, 12 Apr 2013 13:17:28 +0000 Subject: aspects.adb: Alphabetize subprogram bodies in this unit. 2013-04-12 Hristian Kirtchev * aspects.adb: Alphabetize subprogram bodies in this unit. Add an entry for Aspect_Ghost in the table of canonical aspects. (Has_Aspect): New routine. * aspects.ads: Add Aspect_Ghost to all relevant tables. Alphabetize subprograms in this unit. (Has_Aspect): New routine. * einfo.adb: Add with and use clauses for Aspects. (Is_Ghost_Function): New routine. * einfo.ads: Add new synthesized attribute Is_Ghost_Function and update the structure of the related nodes. (Is_Ghost_Function): New routine. * exp_ch4.adb (Find_Enclosing_Context): Use routine Is_Body_Or_Package_Declaration to terminate a search. (Is_Body_Or_Unit): Removed. * exp_util.adb (Within_Case_Or_If_Expression): Use routine Is_Body_Or_Package_Declaration to terminate a search. * par-prag.adb: Add pragma Ghost to the list of pragmas that do not need special processing by the parser. * sem_attr.adb (Analyze_Access_Attribute): Detect an illegal use of 'Access where the prefix is a ghost function. (Analyze_Attribute): Use routine Is_Body_Or_Package_Declaration to terminate a search. (Check_References_In_Prefix): Use routine Is_Body_Or_Package_Declaration to terminate a search. * sem_ch4.adb (Analyze_Call): Mark a function when it appears inside an assertion expression. Verify the legality of a call to a ghost function. (Check_Ghost_Function_Call): New routine. * sem_ch6.adb (Analyze_Function_Call): Code reformatting. Move the setting of attribute In_Assertion_Expression to Analyze_Call. (Check_Overriding_Indicator): Detect an illegal attempt to override a function with a ghost function. * sem_ch12.adb (Preanalyze_Actuals): Detect an illegal use of a ghost function as a generic actual. * sem_elab.adb (Check_Internal_Call_Continue): Update the call to In_Assertion. * sem_prag.adb: Add an entry for pragma Ghost in the table of significant arguments. (Analyze_Pragma): Do not analyze an "others" case guard. Add processing for pragma Ghost. Use Preanalyze_Assert_Expression when analyzing the expression of pragmas Loop_Invariant and Loop_Variant. * sem_util.adb (Get_Subprogram_Entity): Reimplemented. (Is_Body_Or_Package_Declaration): New routine. * sem_util.ads: Alphabetize subprotrams in this unit. (Is_Body_Or_Package_Declaration): New routine. * sinfo.adb (In_Assertion): Rename to In_Assertion_Expression. (Set_In_Assertion): Rename to Set_In_Assertion_Expression. * sinfo.ads: Rename flag In_Assertion to In_Assertion_Expression to better reflect its use. Update all places that mention the flag. (In_Assertion): Rename to In_Assertion_Expression. Update related pragma Inline. (Set_In_Assertion): Rename to Set_In_Assertion_Expression. Update related pragma Inline. * snames.ads-tmpl: Add new predefined name Ghost. Add new pragma id Pragma_Ghost. From-SVN: r197909 --- gcc/ada/exp_ch4.adb | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'gcc/ada/exp_ch4.adb') diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index ee8ce83..e9458cf 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -5033,30 +5033,9 @@ package body Exp_Ch4 is ---------------------------- function Find_Enclosing_Context return Node_Id is - function Is_Body_Or_Unit (N : Node_Id) return Boolean; - -- Determine whether N denotes a body or unit declaration - - --------------------- - -- Is_Body_Or_Unit -- - --------------------- - - function Is_Body_Or_Unit (N : Node_Id) return Boolean is - begin - return Nkind_In (N, N_Entry_Body, - N_Package_Body, - N_Package_Declaration, - N_Protected_Body, - N_Subprogram_Body, - N_Task_Body); - end Is_Body_Or_Unit; - - -- Local variables - Par : Node_Id; Top : Node_Id; - -- Start of processing for Find_Enclosing_Context - begin -- The expression_with_actions is in a case/if expression and -- the lifetime of any temporary controlled object is therefore @@ -5074,7 +5053,7 @@ package body Exp_Ch4 is -- Prevent the search from going too far - elsif Is_Body_Or_Unit (Par) then + elsif Is_Body_Or_Package_Declaration (Par) then exit; end if; @@ -5099,7 +5078,7 @@ package body Exp_Ch4 is -- Prevent the search from going too far - elsif Is_Body_Or_Unit (Par) then + elsif Is_Body_Or_Package_Declaration (Par) then exit; end if; @@ -5171,7 +5150,9 @@ package body Exp_Ch4 is then return Par; - elsif Is_Body_Or_Unit (Par) then + -- Prevent the search from going too far + + elsif Is_Body_Or_Package_Declaration (Par) then exit; end if; -- cgit v1.1