[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 20 Apr 2016 09:11:42 +0000 (11:11 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 20 Apr 2016 09:11:42 +0000 (11:11 +0200)
2016-04-20  Javier Miranda  <miranda@adacore.com>

* contracts.adb (Build_Postconditions_Procedure): Force its
inlining when generating C code.
* sem_attr.adb (Analyze_Attribute_Old_Result): Handle inlined
_postconditions when generating C code.
* exp_ch6.adb (Inlined_Subprogram): Inline calls to
_postconditions when generating C code.
* sinfo.ads, sinfo.adb (Corresponding_Spec, Set_Corresponding_Spec):
types of return value and argument changed from Node_Id to
Entity_Id.

2016-04-20  Vincent Celier  <celier@adacore.com>

* make.adb, clean.adb, gnatname.adb: Revert previous change for now.

2016-04-20  Eric Botcazou  <ebotcazou@adacore.com>

* sem_ch12.adb (Analyze_Instance_And_Renamings): Do not reset
the Has_Delayed_Freeze flag on the anonymous instance node.

From-SVN: r235243

gcc/ada/ChangeLog
gcc/ada/clean.adb
gcc/ada/contracts.adb
gcc/ada/exp_ch6.adb
gcc/ada/gnatname.adb
gcc/ada/make.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch12.adb
gcc/ada/sinfo.adb
gcc/ada/sinfo.ads

index e6bc859a22a1139fa59bde12fa5dc6a912d2bde9..3a856be4c7f93b0682106fd7ddca4b33042f5b54 100644 (file)
@@ -1,3 +1,24 @@
+2016-04-20  Javier Miranda  <miranda@adacore.com>
+
+       * contracts.adb (Build_Postconditions_Procedure): Force its
+       inlining when generating C code.
+       * sem_attr.adb (Analyze_Attribute_Old_Result): Handle inlined
+       _postconditions when generating C code.
+       * exp_ch6.adb (Inlined_Subprogram): Inline calls to
+       _postconditions when generating C code.
+       * sinfo.ads, sinfo.adb (Corresponding_Spec, Set_Corresponding_Spec):
+       types of return value and argument changed from Node_Id to
+       Entity_Id.
+
+2016-04-20  Vincent Celier  <celier@adacore.com>
+
+       * make.adb, clean.adb, gnatname.adb: Revert previous change for now.
+
+2016-04-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * sem_ch12.adb (Analyze_Instance_And_Renamings): Do not reset
+       the Has_Delayed_Freeze flag on the anonymous instance node.
+
 2016-04-20  Javier Miranda  <miranda@adacore.com>
 
        * sem_ch5.adb (Analyze_Iterator_Specification): Remove transient
index 814f47107b3216efcb586926378767e7e7ec7bdd..db9be956b6b000d500b84c5bea90e24404a908fa 100644 (file)
@@ -1386,8 +1386,9 @@ package body Clean is
          --  Warn about 'gnatclean -P'
 
          if Project_File_Name /= null then
-            Fail
-              ("project files are no longer supported; use gprclean instead.");
+            Put_Line
+              ("warning: gnatclean -P is obsolete and will not be available" &
+               " in the next release; use gprclean instead.");
          end if;
 
          --  A project file was specified by a -P switch
index 4a2121f72ca8f063899674155f0bb1257a71668b..a5f8bc3e5a309ed864ab38423d905ea3ca795b75 100644 (file)
@@ -1800,6 +1800,36 @@ package body Contracts is
                  End_Label  => Make_Identifier (Loc, Chars (Proc_Id))));
 
          Insert_Before_First_Source_Declaration (Proc_Bod);
+
+         --  Force the front-end inlining of _PostConditions when generating
+         --  C code, since its body may have references to itypes defined in
+         --  the enclosing subprogram, thus causing problems for the unnested
+         --  routines. For this purpose its declaration with proper decoration
+         --  for inlining is needed.
+
+         if Generate_C_Code then
+            declare
+               Proc_Decl    : Node_Id;
+               Proc_Decl_Id : Entity_Id;
+
+            begin
+               Proc_Decl :=
+                 Make_Subprogram_Declaration (Loc,
+                   Specification =>
+                     Copy_Subprogram_Spec (Specification (Proc_Bod)));
+               Insert_Before (Proc_Bod, Proc_Decl);
+
+               Proc_Decl_Id := Defining_Entity (Specification (Proc_Decl));
+               Set_Has_Pragma_Inline (Proc_Decl_Id);
+               Set_Has_Pragma_Inline_Always (Proc_Decl_Id);
+               Set_Is_Inlined (Proc_Decl_Id);
+
+               Set_Postconditions_Proc (Subp_Id, Proc_Decl_Id);
+
+               Analyze (Proc_Decl);
+            end;
+         end if;
+
          Analyze (Proc_Bod);
       end Build_Postconditions_Procedure;
 
index 4e6fadbf64f08282dca6a6b051c08023cdf9e56e..5675623e9b234d7e3b9e4e3d1f29b88a587c0392 100644 (file)
@@ -3866,6 +3866,14 @@ package body Exp_Ch6 is
                     and then In_Package_Body
                   then
                      Must_Inline := not In_Extended_Main_Source_Unit (Subp);
+
+                  --  Inline calls to _postconditions when generating C code
+
+                  elsif Generate_C_Code
+                    and then In_Same_Extended_Unit (Sloc (Bod), Loc)
+                    and then Chars (Name (N)) = Name_uPostconditions
+                  then
+                     Must_Inline := True;
                   end if;
                end if;
 
index bd0c861204531bf6f22a19e73a966354455c0d47..1030fde32a43d37bc4d5d3e25e8d41da55d26d11 100644 (file)
@@ -659,7 +659,9 @@ begin
    --  gprname did not succeed.
 
    if Create_Project then
-      Fail ("project files are no longer supported; use gprname instead");
+      Write_Line
+        ("warning: gnatname -P is obsolete and will not be available in the" &
+         " next release; use gprname instead");
    end if;
 
    --  If no Ada or foreign pattern was specified, print the usage and return
index fb70e378a2121892009833c50e3cfdb4062899a9..308d4e6cced21c165a7760571f1d1e40a5a9b8a0 100644 (file)
@@ -6509,8 +6509,7 @@ package body Make is
       --  Warn about 'gnatmake -P'
 
       if Project_File_Name /= null then
-         Make_Failed
-           ("project files are no longer supported; use gprbuild instead");
+         Make_Failed ("project file name missing after -P");
       end if;
 
       --  If --subdirs= is specified, but not -P, this is equivalent to -D,
index a9bb2ff8240f73a3b1421256d064d4b01f61a4d7..1d220c543d367a9e0ee5f5711d8cbfec48642ae8 100644 (file)
@@ -1370,6 +1370,22 @@ package body Sem_Attr is
 
          Legal   := True;
          Spec_Id := Unique_Defining_Entity (Subp_Decl);
+
+         --  When generating C code, nested _postcondition subprograms are
+         --  inlined by the front end to avoid problems (when unnested) with
+         --  referenced itypes. Handle that here, since as part of inlining the
+         --  expander nests subprogram within a dummy procedure named _parent
+         --  (see Build_Postconditions_Procedure and Build_Body_To_Inline).
+         --  Hence, in this context, the spec_id of _postconditions is the
+         --  enclosing scope.
+
+         if Generate_C_Code
+           and then Chars (Spec_Id) = Name_uParent
+           and then Chars (Scope (Spec_Id)) = Name_uPostconditions
+         then
+            Spec_Id := Scope (Spec_Id);
+            pragma Assert (Is_Inlined (Spec_Id));
+         end if;
       end Analyze_Attribute_Old_Result;
 
       ---------------------------------
index 084335c472d86cab1c5c866e0543806d4cd3bd3c..fe867f3ed708fdbfcd7bd83e827683f780103ded 100644 (file)
@@ -4923,14 +4923,6 @@ package body Sem_Ch12 is
 
          Set_Comes_From_Source (Act_Decl_Id, Comes_From_Source (Gen_Unit));
 
-         --  The signature may involve types that are not frozen yet, but the
-         --  subprogram will be frozen at the point the wrapper package is
-         --  frozen, so it does not need its own freeze node. In fact, if one
-         --  is created, it might conflict with the freezing actions from the
-         --  wrapper package.
-
-         Set_Has_Delayed_Freeze (Anon_Id, False);
-
          --  If the instance is a child unit, mark the Id accordingly. Mark
          --  the anonymous entity as well, which is the real subprogram and
          --  which is used when the instance appears in a context clause.
index b97fa587657fe90fe6191b23582035d3f7528929..3ea7a6add277172330f80511cae242d7618814fc 100644 (file)
@@ -691,7 +691,7 @@ package body Sinfo is
    end Corresponding_Integer_Value;
 
    function Corresponding_Spec
-      (N : Node_Id) return Node_Id is
+      (N : Node_Id) return Entity_Id is
    begin
       pragma Assert (False
         or else NT (N).Nkind = N_Expression_Function
@@ -3947,7 +3947,7 @@ package body Sinfo is
    end Set_Corresponding_Integer_Value;
 
    procedure Set_Corresponding_Spec
-      (N : Node_Id; Val : Node_Id) is
+      (N : Node_Id; Val : Entity_Id) is
    begin
       pragma Assert (False
         or else NT (N).Nkind = N_Expression_Function
index c82bdecf02b6690451b857c05486984192b74c6d..3161edb706a8c56940112b2000a68809467e8c40 100644 (file)
@@ -8993,7 +8993,7 @@ package Sinfo is
      (N : Node_Id) return Uint;       -- Uint4
 
    function Corresponding_Spec
-     (N : Node_Id) return Node_Id;    -- Node5
+     (N : Node_Id) return Entity_Id;  -- Node5
 
    function Corresponding_Spec_Of_Stub
      (N : Node_Id) return Node_Id;    -- Node2
@@ -10033,7 +10033,7 @@ package Sinfo is
      (N : Node_Id; Val : Uint);               -- Uint4
 
    procedure Set_Corresponding_Spec
-     (N : Node_Id; Val : Node_Id);            -- Node5
+     (N : Node_Id; Val : Entity_Id);          -- Node5
 
    procedure Set_Corresponding_Spec_Of_Stub
      (N : Node_Id; Val : Node_Id);            -- Node2