Commit f916243b by Arnaud Charlet

[multiple changes]

2016-04-18  Arnaud Charlet  <charlet@adacore.com>

	* exp_ch4.adb, gnat1drv.adb, opt.ads, sem_res.adb
	(Minimize_Expression_With_Actions): New flag.
	(Adjust_Global_Switches): Set Minimize_Expression_With_Actions
	when generating C.
	(Resolve_Short_Circuit): Redo previous change
	using Minimize_Expression_With_Actions.
	(Expand_N_If_Expression,
	Expand_Short_Circuit_Operator): Restore old code to avoid
	Expression_With_Actions when Minimize_Expression_With_Actions
	is set.

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

	* s-os_lib.adb (Non_Blocking_Spawn, version with Stdout_File and
	Stderr_File): Close local file descriptors when no longer needed.

2016-04-18  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Iterator_Specification): Remove SPARK
	mode check that the type of the cursor in an iteration over
	a formal container is not volatile. The proper check on the
	element type is done elsewhere.

2016-04-18  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Process_Formals): Do not set a delay freeze on
	a subprogram that returns a class-wide type, if the subprogram
	is a compilation unit, because otherwise gigi will treat the
	subprogram as external, leading to link errors.

From-SVN: r235141
parent 22071092
2016-04-18 Arnaud Charlet <charlet@adacore.com>
* exp_ch4.adb, gnat1drv.adb, opt.ads, sem_res.adb
(Minimize_Expression_With_Actions): New flag.
(Adjust_Global_Switches): Set Minimize_Expression_With_Actions
when generating C.
(Resolve_Short_Circuit): Redo previous change
using Minimize_Expression_With_Actions.
(Expand_N_If_Expression,
Expand_Short_Circuit_Operator): Restore old code to avoid
Expression_With_Actions when Minimize_Expression_With_Actions
is set.
2016-04-18 Vincent Celier <celier@adacore.com>
* s-os_lib.adb (Non_Blocking_Spawn, version with Stdout_File and
Stderr_File): Close local file descriptors when no longer needed.
2016-04-18 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Iterator_Specification): Remove SPARK
mode check that the type of the cursor in an iteration over
a formal container is not volatile. The proper check on the
element type is done elsewhere.
2016-04-18 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Process_Formals): Do not set a delay freeze on
a subprogram that returns a class-wide type, if the subprogram
is a compilation unit, because otherwise gigi will treat the
subprogram as external, leading to link errors.
2016-04-18 Arnaud Charlet <charlet@adacore.com>
* sem_res.adb (Resolve_Short_Circuit): Do not use
expression-with-actions when generating C.
......
......@@ -148,6 +148,7 @@ procedure Gnat1drv is
if Generate_C_Code then
Modify_Tree_For_C := True;
Unnest_Subprogram_Mode := True;
Minimize_Expression_With_Actions := True;
-- Set operating mode to Generate_Code to benefit from full front-end
-- expansion (e.g. generics).
......
......@@ -1061,6 +1061,12 @@ package Opt is
-- GNATMAKE
-- Set to True if minimal recompilation mode requested
Minimize_Expression_With_Actions : Boolean := False;
-- GNAT
-- If True, minimize the use of N_Expression_With_Actions node.
-- This can be used in particular on some back-ends where this node is
-- difficult to support.
Modify_Tree_For_C : Boolean := False;
-- GNAT
-- If this switch is set True (currently it is set only by -gnatd.V), then
......
......@@ -1867,6 +1867,14 @@ package body System.OS_Lib is
Result := Non_Blocking_Spawn (Program_Name, Args);
-- Close the files just created for the output, as the file descriptors
-- cannot be used anywhere, being local values. It is safe to do that,
-- as the file descriptors have been duplicated to form standard output
-- and standard error of the spawned process.
Close (Stdout_FD);
Close (Stderr_FD);
-- Restore the standard output and error
Dup2 (Saved_Output, Standout);
......
......@@ -1758,7 +1758,6 @@ package body Sem_Ch5 is
Subt : constant Node_Id := Subtype_Indication (N);
Iter_Name : constant Node_Id := Name (N);
Ent : Entity_Id;
Typ : Entity_Id;
Bas : Entity_Id;
......@@ -2306,7 +2305,6 @@ package body Sem_Ch5 is
Get_Cursor_Type
(Parent (Find_Value_Of_Aspect (Typ, Aspect_Iterable)),
Typ));
Ent := Etype (Def_Id);
else
Set_Etype (Def_Id, Get_Cursor_Type (Typ));
......@@ -2314,20 +2312,6 @@ package body Sem_Ch5 is
end if;
end if;
-- A loop parameter cannot be effectively volatile (SPARK RM 7.1.3(4)).
-- This check is relevant only when SPARK_Mode is on as it is not a
-- standard Ada legality check.
-- Not clear whether this applies to element iterators, where the
-- cursor is not an explicit entity ???
if SPARK_Mode = On
and then not Of_Present (N)
and then Is_Effectively_Volatile (Ent)
then
Error_Msg_N ("loop parameter cannot be volatile", Ent);
end if;
end Analyze_Iterator_Specification;
-------------------
......
......@@ -10504,10 +10504,12 @@ package body Sem_Ch6 is
Analyze_Return_Type (Related_Nod);
-- If return type is class-wide, subprogram freezing may be
-- delayed as well.
-- delayed as well, unless the declaration is a compilation unit
-- in which case the freeze node would appear too late.
if Is_Class_Wide_Type (Etype (Current_Scope))
and then not Is_Thunk (Current_Scope)
and then not Is_Compilation_Unit (Current_Scope)
and then Nkind (Unit_Declaration_Node (Current_Scope)) =
N_Subprogram_Declaration
then
......
......@@ -10044,11 +10044,9 @@ package body Sem_Res is
-- finalization of transient controlled objects) are fully evaluated
-- locally within an expression with actions. This is particularly
-- helpful for coverage analysis. However this should not happen in
-- generics. Similarly, we want to minimize use of expression with
-- actions when generating C code, and finalization is not supported
-- in this mode anyway.
-- generics or if Minimize_Expression_With_Actions is set.
if Expander_Active and not Generate_C_Code then
if Expander_Active and not Minimize_Expression_With_Actions then
declare
Reloc_L : constant Node_Id := Relocate_Node (L);
begin
......
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