summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-20 09:11:42 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-20 09:11:42 +0000
commit2de214f62d7b317f18fd5ab44d4401c1b7a5663f (patch)
tree918f75eaaa0499d130d89f924914044fdb189136
parenta69c81bd45c179e46dff0cc78a3aade66a3a97bc (diff)
downloadgcc-2de214f62d7b317f18fd5ab44d4401c1b7a5663f.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235243 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/clean.adb5
-rw-r--r--gcc/ada/contracts.adb30
-rw-r--r--gcc/ada/exp_ch6.adb8
-rw-r--r--gcc/ada/gnatname.adb4
-rw-r--r--gcc/ada/make.adb3
-rw-r--r--gcc/ada/sem_attr.adb16
-rw-r--r--gcc/ada/sem_ch12.adb8
-rw-r--r--gcc/ada/sinfo.adb4
-rw-r--r--gcc/ada/sinfo.ads4
10 files changed, 86 insertions, 17 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e6bc859a22a..3a856be4c7f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,26 @@
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
scope associated with the renaming object declaration.
* exp_util.adb (Insert_Actions): Remove handling of iterator
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index 814f47107b3..db9be956b6b 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -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
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 4a2121f72ca..a5f8bc3e5a3 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -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;
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 4e6fadbf64f..5675623e9b2 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -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;
diff --git a/gcc/ada/gnatname.adb b/gcc/ada/gnatname.adb
index bd0c8612045..1030fde32a4 100644
--- a/gcc/ada/gnatname.adb
+++ b/gcc/ada/gnatname.adb
@@ -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
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index fb70e378a21..308d4e6cced 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -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,
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index a9bb2ff8240..1d220c543d3 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -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;
---------------------------------
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 084335c472d..fe867f3ed70 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -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.
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index b97fa587657..3ea7a6add27 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -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
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index c82bdecf02b..3161edb706a 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -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