Commit f0d10385 by Arnaud Charlet

[multiple changes]

2010-06-22  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch3.adb (Build_Discriminal): Set default scopes for newly created
	discriminals to the current scope.
	* sem_util.adb (Find_Body_Discriminal): Remove setting of discriminal's
	scope, which could overwrite a different already set value.

2010-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Valid_Conversion): If expression is a predefined
	operator, use sloc of type of interpretation to improve error message
	when operand is of some derived type.
	* sem_eval.adb (Is_Mixed_Mode_Operand): New function, use it.

2010-06-22  Emmanuel Briot  <briot@adacore.com>

	* g-expect-vms.adb (Expect_Internal): No longer raises an exception, so
	that it can set out parameters as well. When a process has died, reset
	its Input_Fd to Invalid_Fd, so that when using multiple processes we
	can find out which process has died.

From-SVN: r161135
parent d7567964
2010-06-22 Gary Dismukes <dismukes@adacore.com>
* sem_ch3.adb (Build_Discriminal): Set default scopes for newly created
discriminals to the current scope.
* sem_util.adb (Find_Body_Discriminal): Remove setting of discriminal's
scope, which could overwrite a different already set value.
2010-06-22 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb (Valid_Conversion): If expression is a predefined
operator, use sloc of type of interpretation to improve error message
when operand is of some derived type.
* sem_eval.adb (Is_Mixed_Mode_Operand): New function, use it.
2010-06-22 Emmanuel Briot <briot@adacore.com>
* g-expect-vms.adb (Expect_Internal): No longer raises an exception, so
that it can set out parameters as well. When a process has died, reset
its Input_Fd to Invalid_Fd, so that when using multiple processes we
can find out which process has died.
2010-06-22 Thomas Quinot <quinot@adacore.com>
* sem_eval.adb (Find_Universal_Operator_Type): New
......
......@@ -7710,6 +7710,7 @@ package body Sem_Ch3 is
Set_Ekind (D_Minal, E_In_Parameter);
Set_Mechanism (D_Minal, Default_Mechanism);
Set_Etype (D_Minal, Etype (Discrim));
Set_Scope (D_Minal, Current_Scope);
Set_Discriminal (Discrim, D_Minal);
Set_Discriminal_Link (D_Minal, Discrim);
......@@ -7726,6 +7727,7 @@ package body Sem_Ch3 is
Set_Ekind (CR_Disc, E_In_Parameter);
Set_Mechanism (CR_Disc, Default_Mechanism);
Set_Etype (CR_Disc, Etype (Discrim));
Set_Scope (CR_Disc, Current_Scope);
Set_Discriminal_Link (CR_Disc, Discrim);
Set_CR_Discriminant (Discrim, CR_Disc);
end if;
......
......@@ -4799,6 +4799,24 @@ package body Sem_Eval is
Typ1 : Entity_Id := Empty;
Priv_E : Entity_Id;
function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean;
-- Check whether one operand is a mixed-mode operation that requires
-- the presence of a fixed-point type. Given that all operands are
-- universal and have been constant-folded, retrieve the original
-- function call.
---------------------------
-- Is_Mixed_Mode_Operand --
---------------------------
function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean is
begin
return Nkind (Original_Node (Op)) = N_Function_Call
and then Present (Next_Actual (First_Actual (Original_Node (Op))))
and then Etype (First_Actual (Original_Node (Op))) /=
Etype (Next_Actual (First_Actual (Original_Node (Op))));
end Is_Mixed_Mode_Operand;
begin
if Nkind (Call) /= N_Function_Call
or else Nkind (Name (Call)) /= N_Expanded_Name
......@@ -4845,6 +4863,20 @@ package body Sem_Eval is
if No (Typ1) then
Typ1 := E;
-- Before emitting an error, check for the presence of a
-- mixed-mode operation that specifies a fixed point type.
elsif Is_Relational
and then
(Is_Mixed_Mode_Operand (Left_Opnd (N))
or else Is_Mixed_Mode_Operand (Right_Opnd (N)))
and then Is_Fixed_Point_Type (E) /= Is_Fixed_Point_Type (Typ1)
then
if Is_Fixed_Point_Type (E) then
Typ1 := E;
end if;
else
-- More than one type of the proper class declared in P
......
......@@ -9567,6 +9567,7 @@ package body Sem_Res is
It : Interp;
It1 : Interp;
N1 : Entity_Id;
T1 : Entity_Id;
begin
-- Remove procedure calls, which syntactically cannot appear in
......@@ -9623,16 +9624,30 @@ package body Sem_Res is
if Present (It.Typ) then
N1 := It1.Nam;
T1 := It1.Typ;
It1 := Disambiguate (Operand, I1, I, Any_Type);
if It1 = No_Interp then
Error_Msg_N ("ambiguous operand in conversion", Operand);
Error_Msg_Sloc := Sloc (It.Nam);
-- If the interpretation involves a standard operator, use
-- the location of the type, which may be user-defined.
if Sloc (It.Nam) = Standard_Location then
Error_Msg_Sloc := Sloc (It.Typ);
else
Error_Msg_Sloc := Sloc (It.Nam);
end if;
Error_Msg_N -- CODEFIX
("\\possible interpretation#!", Operand);
Error_Msg_Sloc := Sloc (N1);
if Sloc (N1) = Standard_Location then
Error_Msg_Sloc := Sloc (T1);
else
Error_Msg_Sloc := Sloc (N1);
end if;
Error_Msg_N -- CODEFIX
("\\possible interpretation#!", Operand);
......
......@@ -3082,7 +3082,6 @@ package body Sem_Util is
Disc := First_Discriminant (Tsk);
while Present (Disc) loop
if Chars (Disc) = Chars (Spec_Discriminant) then
Set_Scope (Discriminal (Disc), Tsk);
return Discriminal (Disc);
end if;
......
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