aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb24
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 96e8da6..29b7766 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -7270,7 +7270,9 @@ package body Sem_Res is
if Restriction_Check_Required (No_Relative_Delay)
and then Is_RTE (Nam, RE_Set_Handler)
- and then Is_RTE (Etype (Next_Actual (First_Actual (N))), RE_Time_Span)
+ and then
+ Is_RTE
+ (Base_Type (Etype (Next_Actual (First_Actual (N)))), RE_Time_Span)
then
Check_Restriction (No_Relative_Delay, N);
end if;
@@ -12463,16 +12465,6 @@ package body Sem_Res is
Orig_N := Original_Node (Expression (Orig_N));
Orig_T := Target_Typ;
- -- If the node is part of a larger expression, the Target_Type
- -- may not be the original type of the node if the context is a
- -- condition. Recover original type to see if conversion is needed.
-
- if Is_Boolean_Type (Orig_T)
- and then Nkind (Parent (N)) in N_Op
- then
- Orig_T := Etype (Parent (N));
- end if;
-
-- If we have an entity name, then give the warning if the entity
-- is the right type, or if it is a loop parameter covered by the
-- original type (that's needed because loop parameters have an
@@ -12548,6 +12540,16 @@ package body Sem_Res is
then
null;
+ -- Do not warn if original source-level conversion was
+ -- between two different types.
+
+ elsif Nkind (Original_Node (N)) = N_Type_Conversion
+ and then
+ Base_Type (Etype (Subtype_Mark (Original_Node (N))))
+ /= Base_Type (Etype (Expression (Original_Node (N))))
+ then
+ null;
+
-- Here we give the redundant conversion warning. If it is an
-- entity, give the name of the entity in the message. If not,
-- just mention the expression.