[multiple changes]
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
This commit is contained in:
parent
e361e9a1db
commit
1ba563f5f9
10 changed files with 86 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
---------------------------------
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue