Commit 71fb4dc8 by Arnaud Charlet

[multiple changes]

2012-10-03  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch6.adb: Minor typo fix.

2012-10-03  Robert Dewar  <dewar@adacore.com>

	* checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated):
	Set Top_Level properly (to False) for operand of range of
	membership test.
	* exp_ch4.adb (Expand_Membership_Minimize_Eliminate_Overflow):
	Fix crash with -gnato3 and membership operations.
	(Expand_Membership_Minimize_Eliminate_Overflow): Fix error message
	and wrong results for -gnato3 large expression and predicated
	subtype.
	(Expand_Membership_Minimize_Eliminate_Overflow): Use
	expression action node to avoid using insert actions (bombs in
	some cases).
	(Expand_Compare_Minimize_Eliminate_Overflow): Use expression action
	node to avoid using insert actions (bombs in some cases).

2012-10-03  Javier Miranda  <miranda@adacore.com>

	* exp_disp.adb (Set_CPP_Constructors_Old): Handle constructor of
	untagged type that has all its parameters with defaults and hence it
	covers the default constructor.

From-SVN: r192027
parent 3ada950b
2012-10-03 Gary Dismukes <dismukes@adacore.com>
* sem_ch6.adb: Minor typo fix.
2012-10-03 Robert Dewar <dewar@adacore.com>
* checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated):
Set Top_Level properly (to False) for operand of range of
membership test.
* exp_ch4.adb (Expand_Membership_Minimize_Eliminate_Overflow):
Fix crash with -gnato3 and membership operations.
(Expand_Membership_Minimize_Eliminate_Overflow): Fix error message
and wrong results for -gnato3 large expression and predicated
subtype.
(Expand_Membership_Minimize_Eliminate_Overflow): Use
expression action node to avoid using insert actions (bombs in
some cases).
(Expand_Compare_Minimize_Eliminate_Overflow): Use expression action
node to avoid using insert actions (bombs in some cases).
2012-10-03 Javier Miranda <miranda@adacore.com>
* exp_disp.adb (Set_CPP_Constructors_Old): Handle constructor of
untagged type that has all its parameters with defaults and hence it
covers the default constructor.
2012-10-03 Yannick Moy <moy@adacore.com>
* checks.adb, sem_prag.adb, s-bignum.ads: Minor typo fixes.
......
......@@ -1101,17 +1101,16 @@ package body Checks is
-- In all these cases, we will process at the higher level (and then
-- this node will be processed during the downwards recursion that
-- is part of the processing in Minimize_Eliminate_Overflow_Checks.
-- is part of the processing in Minimize_Eliminate_Overflow_Checks).
if Is_Signed_Integer_Arithmetic_Op (P)
or else Nkind (Op) in N_Membership_Test
or else Nkind (Op) in N_Op_Compare
or else Nkind (P) in N_Membership_Test
or else Nkind (P) in N_Op_Compare
-- We may also be a range operand in a membership test
or else (Nkind (Op) = N_Range
and then Nkind (Parent (Op)) in N_Membership_Test)
or else (Nkind (P) = N_Range
and then Nkind (Parent (P)) in N_Membership_Test)
then
return;
end if;
......
......@@ -8459,6 +8459,8 @@ package body Exp_Disp is
P : Node_Id;
Parms : List_Id;
Covers_Default_Constructor : Entity_Id := Empty;
begin
-- Look for the constructor entities
......@@ -8490,7 +8492,8 @@ package body Exp_Disp is
Make_Defining_Identifier (Loc,
Chars (Defining_Identifier (P))),
Parameter_Type =>
New_Copy_Tree (Parameter_Type (P))));
New_Copy_Tree (Parameter_Type (P)),
Expression => New_Copy_Tree (Expression (P))));
Next (P);
end loop;
end if;
......@@ -8508,6 +8511,17 @@ package body Exp_Disp is
Set_Convention (Init, Convention_CPP);
Set_Is_Public (Init);
Set_Has_Completion (Init);
-- If this constructor has parameters and all its parameters
-- have defaults then it covers the default constructor. The
-- semantic analyzer ensures that only one constructor with
-- defaults covers the default constructor.
if Present (Parameter_Specifications (Parent (E)))
and then Needs_No_Actuals (E)
then
Covers_Default_Constructor := Init;
end if;
end if;
Next_Entity (E);
......@@ -8519,6 +8533,49 @@ package body Exp_Disp is
if not Found then
Set_Is_Abstract_Type (Typ);
end if;
-- Handle constructor that has all its parameters with defaults and
-- hence it covers the default constructor. We generate a wrapper IP
-- which calls the covering constructor.
if Present (Covers_Default_Constructor) then
declare
Body_Stmts : List_Id;
Wrapper_Id : Entity_Id;
Wrapper_Body_Node : Node_Id;
begin
Loc := Sloc (Covers_Default_Constructor);
Body_Stmts := New_List (
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Covers_Default_Constructor, Loc),
Parameter_Associations => New_List (
Make_Identifier (Loc, Name_uInit))));
Wrapper_Id := Make_Defining_Identifier (Loc,
Make_Init_Proc_Name (Typ));
Wrapper_Body_Node :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Wrapper_Id,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uInit),
Parameter_Type =>
New_Reference_To (Typ, Loc)))),
Declarations => No_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Body_Stmts,
Exception_Handlers => No_List));
Discard_Node (Wrapper_Body_Node);
Set_Init_Proc (Typ, Wrapper_Id);
end;
end if;
end Set_CPP_Constructors_Old;
-- Local variables
......
......@@ -5764,7 +5764,7 @@ package body Sem_Ch6 is
and then TSS_Name /= TSS_Stream_Output
then
-- Here we have a definite conformance error. It is worth
-- special casesing the error message for the case of a
-- special casing the error message for the case of a
-- controlling formal (which excludes null).
if Is_Controlling_Formal (New_Formal) then
......
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