From 2168d7cc3ba6f3b2280bfefcc8a789ea4d8d90a5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 12 Jan 2017 15:40:14 +0100 Subject: [multiple changes] 2017-01-12 Hristian Kirtchev * exp_ch9.adb, sem_prag.adb, s-tassta.adb, sem_util.adb, s-tarest.adb, sem_ch13.adb: Minor reformatting. 2017-01-12 Hristian Kirtchev * exp_aggr.adb (Build_Record_Aggr_Code): Guard against a missing adjustment primitive when the ancestor type was not properly frozen. (Gen_Assign): Guard against a missing initialization primitive when the component type was not properly frozen. (Initialize_Array_Component): Guard against a missing adjustment primitive when the component type was not properly frozen. (Initialize_Record_Component): Guard against a missing adjustment primitive when the component type was not properly frozen. (Process_Transient_Component_Completion): The transient object may not be finalized when its associated type was not properly frozen. * exp_ch3.adb (Build_Assignment): Guard against a missing adjustment primitive when the component type was not properly frozen. (Build_Initialization_Call): Guard against a missing initialization primitive when the associated type was not properly frozen. (Expand_N_Object_Declaration): Guard against a missing adjustment primitive when the base type was not properly frozen. (Predefined_Primitive_Bodies): Create an empty Deep_Adjust body when there is no adjustment primitive available. Create an empty Deep_Finalize body when there is no finalization primitive available. * exp_ch4.adb (Apply_Accessibility_Check): Guard against a missing finalization primitive when the designated type was not properly frozen. (Expand_N_Allocator): Guard against a missing initialization primitive when the designated type was not properly frozen. * exp_ch5.adb (Make_Tag_Ctrl_Assignment): Add the adjustment call only when the corresponding adjustment primitive is available. * exp_ch7.adb (Build_Adjust_Or_Finalize_Statements): Generate the adjustment/finalization statements only when there is an available primitive to carry out the action. (Build_Initialize_Statements): Generate the initialization/finalization statements only when there is an available primitive to carry out the action. (Make_Adjust_Call): Do not generate a call when the underlying type is not present due to a possible missing full view. (Make_Final_Call): Do not generate a call when the underlying type is not present due to a possible missing full view. (Make_Finalize_Address_Stmts): Generate an empty body when the designated type lacks a finalization primitive. (Make_Init_Call): Do not generate a call when the underlying type is not present due to a possible missing full view. (Process_Component_For_Adjust): Add the adjustment call only when the corresponding adjustment primitive is available. (Process_Component_For_Finalize): Add the finalization call only when the corresponding finalization primitive is available. (Process_Object_Declaration): Use a null statement to emulate a missing call to the finalization primitive of the object type. * exp_ch7.ads (Make_Adjust_Call): Update the comment on usage. (Make_Final_Call): Update the comment on usage. (Make_Init_Call): Update the comment on usage. * exp_util.adb (Build_Transient_Object_Statements): Code reformatting. 2017-01-12 Arnaud Charlet * einfo.ads: Update documentation of Address_Taken. * sem_attr.adb (Analyze_Access_Attribute, Resolve_Attribute [Access_Attribute]): Only consider 'Access/'Unchecked_Access for subprograms when setting Address_Taken flag. 2017-01-12 Patrick Bernardi * sem_ch10.adb (Analyze_With_Clause): Removed code that turned Configurable_Run_Time_Mode off when analysing with'ed predefined libraries. From-SVN: r244365 --- gcc/ada/sem_attr.adb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'gcc/ada/sem_attr.adb') diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 16904ca..d7c7683 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -1036,9 +1036,16 @@ package body Sem_Attr is Set_Never_Set_In_Source (Ent, False); end if; - -- Mark entity as address taken, and kill current values + -- Mark entity as address taken in the case of + -- 'Unrestricted_Access or subprograms, and kill current + -- values. + + if Aname = Name_Unrestricted_Access + or else Is_Subprogram (Ent) + then + Set_Address_Taken (Ent); + end if; - Set_Address_Taken (Ent); Kill_Current_Values (Ent); exit; @@ -1053,7 +1060,7 @@ package body Sem_Attr is end loop; end; - -- Check for aliased view.. We allow a nonaliased prefix when within + -- Check for aliased view. We allow a nonaliased prefix when within -- an instance because the prefix may have been a tagged formal -- object, which is defined to be aliased even when the actual -- might not be (other instance cases will have been caught in the @@ -11027,9 +11034,13 @@ package body Sem_Attr is end; end if; - -- Mark that address of entity is taken + -- Mark that address of entity is taken in case of + -- 'Unrestricted_Access or in case of a subprogram. - if Is_Entity_Name (P) then + if Is_Entity_Name (P) + and then (Attr_Id = Attribute_Unrestricted_Access + or else Is_Subprogram (Entity (P))) + then Set_Address_Taken (Entity (P)); end if; -- cgit v1.1