]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 20 Apr 2016 09:14:02 +0000 (11:14 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 20 Apr 2016 09:14:02 +0000 (11:14 +0200)
2016-04-20  Arnaud Charlet  <charlet@adacore.com>

* 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  <schonberg@adacore.com>

* 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.

From-SVN: r235244

gcc/ada/ChangeLog
gcc/ada/einfo.ads
gcc/ada/exp_ch6.adb
gcc/ada/sem_util.adb
gcc/ada/snames.ads-tmpl

index 3a856be4c7f93b0682106fd7ddca4b33042f5b54..fe429f1283e454c5a2e4d52c872f106e44b6788f 100644 (file)
@@ -1,3 +1,18 @@
+2016-04-20  Arnaud Charlet  <charlet@adacore.com>
+
+       * 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  <schonberg@adacore.com>
+
+       * 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  <miranda@adacore.com>
 
        * contracts.adb (Build_Postconditions_Procedure): Force its
index e0b1f26d677a6c8ecce0af30af6845bf27886023..e55c6762bb2b0851a1ae7877376d01ee07f30ae6 100644 (file)
@@ -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
index 5675623e9b234d7e3b9e4e3d1f29b88a587c0392..511f479f160aad1e998f3f8aa6f786782b5169a5 100644 (file)
@@ -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;
 
index e9e16ae4add19fbb7facdfdc455706a0f72433e5..48208309c56325b462d09ea96a38019449cd4f1d 100644 (file)
@@ -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)
index e52a1816495212cf0ab72019982c78809beadc14..76b353bad7b8fdbfba442f4b1a8c7fbb53d4e3eb 100644 (file)
@@ -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 --