Commit 5c5e108f by Arnaud Charlet

[multiple changes]

2014-11-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not apply
	inlining expansion if function build in place, i.e. has a limited
	return type.

2014-11-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Analyze_Refined_Depends_In_Decl_Part): Add
	variables Body_Id, Body_Inputs, Body_Outputs, Spec_Inputs,
	Spec_Outputs. Synthesize the inputs and outputs of the subprogram
	when pragma [Refined_]Global is missing and perform legality
	checks on output states with visible refinement.
	(Appears_In): Update the comment on usage.
	(Check_Output_States): New routine.
	(Collect_Dependency_Clause): New routine.
	(Collect_Global_Items): Relocated to
	Analyze_Refined_Global_In_Decl_Part.
	(Collect_Subprogram_Inputs_Outputs): Add new formal parameters
	Synthesize and Depends_Seen. The routine can now synthesize inputs
	and outputs from pragma [Refined_]Depends.
	(Normalize_Clause): Update the comment on usage. The routine no longer
	performs normalization of outputs.
	(Normalize_Clauses): Normalize both inputs and outputs.
	(Normalize_Output): Relocated to Normalize_Clauses.
	* sem_prag.ads (Collect_Subprogram_Inputs_Outputs): Add new
	formal parameters Synthesize and Depends_Seen and update the
	comment on usage.

2014-11-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Reset_Loop_Variable): New subsidiary procedure
	in Build_Predicate_Functions, to handle properly quantified
	expressions in dynamic predicates.

From-SVN: r217850
parent bfe25016
2014-11-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not apply
inlining expansion if function build in place, i.e. has a limited
return type.
2014-11-20 Hristian Kirtchev <kirtchev@adacore.com>
* sem_prag.adb (Analyze_Refined_Depends_In_Decl_Part): Add
variables Body_Id, Body_Inputs, Body_Outputs, Spec_Inputs,
Spec_Outputs. Synthesize the inputs and outputs of the subprogram
when pragma [Refined_]Global is missing and perform legality
checks on output states with visible refinement.
(Appears_In): Update the comment on usage.
(Check_Output_States): New routine.
(Collect_Dependency_Clause): New routine.
(Collect_Global_Items): Relocated to
Analyze_Refined_Global_In_Decl_Part.
(Collect_Subprogram_Inputs_Outputs): Add new formal parameters
Synthesize and Depends_Seen. The routine can now synthesize inputs
and outputs from pragma [Refined_]Depends.
(Normalize_Clause): Update the comment on usage. The routine no longer
performs normalization of outputs.
(Normalize_Clauses): Normalize both inputs and outputs.
(Normalize_Output): Relocated to Normalize_Clauses.
* sem_prag.ads (Collect_Subprogram_Inputs_Outputs): Add new
formal parameters Synthesize and Depends_Seen and update the
comment on usage.
2014-11-20 Vincent Celier <celier@adacore.com>
PR ada/47500
* back_end.adb (Scan_Back_End_Switches): Skip switch -G and
its argument.
2014-11-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Reset_Loop_Variable): New subsidiary procedure
in Build_Predicate_Functions, to handle properly quantified
expressions in dynamic predicates.
2014-11-20 Robert Dewar <dewar@adacore.com> 2014-11-20 Robert Dewar <dewar@adacore.com>
* gnatcmd.adb, sem_ch6.adb, exp_dist.adb: Minor reformatting. * gnatcmd.adb, sem_ch6.adb, exp_dist.adb: Minor reformatting.
......
...@@ -2853,6 +2853,7 @@ package body Sem_Ch13 is ...@@ -2853,6 +2853,7 @@ package body Sem_Ch13 is
begin begin
if A_Id = Aspect_Pre or else A_Id = Aspect_Precondition then if A_Id = Aspect_Pre or else A_Id = Aspect_Precondition then
Pname := Name_Precondition; Pname := Name_Precondition;
else else
Pname := Name_Postcondition; Pname := Name_Postcondition;
end if; end if;
...@@ -2925,6 +2926,7 @@ package body Sem_Ch13 is ...@@ -2925,6 +2926,7 @@ package body Sem_Ch13 is
-- with delay of visibility for the expression analysis. -- with delay of visibility for the expression analysis.
Insert_Pragma (Aitem); Insert_Pragma (Aitem);
goto Continue; goto Continue;
end Pre_Post; end Pre_Post;
...@@ -3552,7 +3554,7 @@ package body Sem_Ch13 is ...@@ -3552,7 +3554,7 @@ package body Sem_Ch13 is
-- the type of the formal match. -- the type of the formal match.
if Base_Type (Typ) /= Base_Type (Ent) if Base_Type (Typ) /= Base_Type (Ent)
or else Present ((Next_Formal (F))) or else Present (Next_Formal (F))
then then
return False; return False;
...@@ -3630,7 +3632,8 @@ package body Sem_Ch13 is ...@@ -3630,7 +3632,8 @@ package body Sem_Ch13 is
Error_Msg_N ("stream subprogram must not be abstract", Expr); Error_Msg_N ("stream subprogram must not be abstract", Expr);
return; return;
-- Test for stream subprogram for interface type being non-null -- A stream subprogram for an interface type must be a null
-- procedure (RM 13.13.2 (38/3)).
elsif Is_Interface (U_Ent) elsif Is_Interface (U_Ent)
and then not Inside_A_Generic and then not Inside_A_Generic
...@@ -8268,11 +8271,44 @@ package body Sem_Ch13 is ...@@ -8268,11 +8271,44 @@ package body Sem_Ch13 is
if Raise_Expression_Present then if Raise_Expression_Present then
declare declare
Map : constant Elist_Id := New_Elmt_List; Map : constant Elist_Id := New_Elmt_List;
New_V : Entity_Id := Empty;
-- The unanalyzed expression will be copied and appear in
-- both functions. Normally expressions do not declare new
-- entities, but quantified expressions do, so we need to
-- create new entities for their bound variables, to prevent
-- multiple definitions in gigi.
function Reset_Loop_Variable (N : Node_Id)
return Traverse_Result;
procedure Collect_Loop_Variables is
new Traverse_Proc (Reset_Loop_Variable);
------------------------
-- Reset_Loop_Variable --
------------------------
function Reset_Loop_Variable (N : Node_Id)
return Traverse_Result
is
begin
if Nkind (N) = N_Iterator_Specification then
New_V := Make_Defining_Identifier
(Sloc (N), Chars (Defining_Identifier (N)));
Set_Defining_Identifier (N, New_V);
end if;
return OK;
end Reset_Loop_Variable;
begin begin
Append_Elmt (Object_Entity, Map); Append_Elmt (Object_Entity, Map);
Append_Elmt (Object_Entity_M, Map); Append_Elmt (Object_Entity_M, Map);
Expr_M := New_Copy_Tree (Expr, Map => Map); Expr_M := New_Copy_Tree (Expr, Map => Map);
Collect_Loop_Variables (Expr_M);
end; end;
end if; end if;
......
...@@ -3691,6 +3691,11 @@ package body Sem_Ch6 is ...@@ -3691,6 +3691,11 @@ package body Sem_Ch6 is
if Comes_From_Source (Body_Id) if Comes_From_Source (Body_Id)
and then Ekind (Spec_Id) = E_Function and then Ekind (Spec_Id) = E_Function
and then Returns_Unconstrained_Type (Spec_Id) and then Returns_Unconstrained_Type (Spec_Id)
-- If function builds in place, i.e. returns a limited type,
-- inlining cannot be done.
and then not Is_Limited_Type (Etype (Spec_Id))
then then
Check_And_Split_Unconstrained_Function (N, Spec_Id, Body_Id); Check_And_Split_Unconstrained_Function (N, Spec_Id, Body_Id);
......
...@@ -172,14 +172,21 @@ package Sem_Prag is ...@@ -172,14 +172,21 @@ package Sem_Prag is
procedure Collect_Subprogram_Inputs_Outputs procedure Collect_Subprogram_Inputs_Outputs
(Subp_Id : Entity_Id; (Subp_Id : Entity_Id;
Synthesize : Boolean := False;
Subp_Inputs : in out Elist_Id; Subp_Inputs : in out Elist_Id;
Subp_Outputs : in out Elist_Id; Subp_Outputs : in out Elist_Id;
Global_Seen : out Boolean); Global_Seen : out Boolean);
-- Used during the analysis of pragmas Depends, Global, Refined_Depends, -- Subsidiary to the analysis of pragmas Depends, Global, Refined_Depends
-- and Refined_Global. Also used by GNATprove. Gathers all inputs and -- and Refined_Global. The routine is also used by GNATprove. Collect all
-- outputs of subprogram Subp_Id in lists Subp_Inputs and Subp_Outputs. -- inputs and outputs of subprogram Subp_Id in lists Subp_Inputs (inputs)
-- If subprogram has no inputs and/or outputs, then the returned list -- and Subp_Outputs (outputs). The inputs and outputs are gathered from:
-- is No_Elist. Global_Seen is set when the related subprogram has -- 1) The formal parameters of the subprogram
-- 2) The items of pragma [Refined_]Global
-- or
-- 3) The items of pragma [Refined_]Depends if there is no pragma
-- [Refined_]Global present and flag Synthesize is set to True.
-- If the subprogram has no inputs and/or outputs, then the returned list
-- is No_Elist. Flag Global_Seen is set when the related subprogram has
-- pragma [Refined_]Global. -- pragma [Refined_]Global.
function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean; function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment