diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3a856be4c7f..fe429f1283e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2016-04-20 Arnaud Charlet + + * snames.ads-tmpl (Internal_Attribute_Id, Attribute_Class_Array): Fix + indentation. + * sem_util.adb (Is_Unchecked_Conversion_Instance): + defense against library-level renamings of other functions, + which are never instances of Unchecked_Conversion. + * einfo.ads: minor fix of casing in comment + +2016-04-20 Ed Schonberg + + * exp_ch6.adb (Expand_N_Subprogram_Stub): Do not expand a body + that has been analyzed and expanded already. Qualify the names + in the proper body for use in the generation of C code. + 2016-04-20 Javier Miranda * contracts.adb (Build_Postconditions_Procedure): Force its diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index e0b1f26d677..e55c6762bb2 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -4441,9 +4441,9 @@ package Einfo is -- protected operation, etc). -- b) Alias applies to overloadable entities, and the value is an overloadable --- entity. so this is a subset of the previous one. We use the term Alias to +-- entity. So this is a subset of the previous one. We use the term Alias to -- cover both renamings and inherited operations, because both cases are --- handled in the same way when expanding a call. namely the Alias of a given +-- handled in the same way when expanding a call. Namely the Alias of a given -- subprogram is the subprogram that will actually be called. -- Both a) and b) are set transitively, so that in fact it is not necessary to diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 5675623e9b2..511f479f160 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -5521,10 +5521,23 @@ package body Exp_Ch6 is ----------------------------------- procedure Expand_N_Subprogram_Body_Stub (N : Node_Id) is + Bod : Node_Id; begin if Present (Corresponding_Body (N)) then - Expand_N_Subprogram_Body ( - Unit_Declaration_Node (Corresponding_Body (N))); + Bod := Unit_Declaration_Node (Corresponding_Body (N)); + + -- The body may have been expanded already when it is analyzed + -- through the subunit node. Do no expand again: it interferes + -- with the construction of unnesting tables when generating C. + + if not Analyzed (Bod) then + Expand_N_Subprogram_Body (Bod); + end if; + + -- Add full qualification to entities that may be created late + -- during unnesting. + + Qualify_Entity_Names (N); end if; end Expand_N_Subprogram_Body_Stub; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e9e16ae4add..48208309c56 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -14282,6 +14282,7 @@ package body Sem_Util is -------------------------------------- function Is_Unchecked_Conversion_Instance (Id : Entity_Id) return Boolean is + Par : Node_Id; Gen_Par : Entity_Id; begin @@ -14289,7 +14290,13 @@ package body Sem_Util is -- function Unchecked_Conversion. if Ekind (Id) = E_Function then - Gen_Par := Generic_Parent (Parent (Id)); + Par := Parent (Id); + + if Nkind (Par) /= N_Function_Specification then + return False; + end if; + + Gen_Par := Generic_Parent (Par); return Present (Gen_Par) diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index e52a1816495..76b353bad7b 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -1677,11 +1677,11 @@ package Snames is Attribute_Dispatching_Domain, Attribute_Interrupt_Priority); - subtype Internal_Attribute_Id is Attribute_Id range - Attribute_CPU .. Attribute_Interrupt_Priority; + subtype Internal_Attribute_Id is Attribute_Id range + Attribute_CPU .. Attribute_Interrupt_Priority; - type Attribute_Class_Array is array (Attribute_Id) of Boolean; - -- Type used to build attribute classification flag arrays + type Attribute_Class_Array is array (Attribute_Id) of Boolean; + -- Type used to build attribute classification flag arrays ------------------------------------ -- Convention Name ID Definitions --