[Ada] Remove duplicated condition in warnings about read-before-write
Commit Message
Code for warnings about read-before-write of a variable had one
condition in the outer IF statement and then the very same condition in
an inner IF statement.
Cleanup related to spurious warning on 'Initialized.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_warn.adb (Check_References): Remove redundant condition.
@@ -1569,15 +1569,13 @@ package body Sem_Warn is
-- For access types, UR was only set for dereferences,
-- so the issue is that the value may be null.
- if not Is_Trivial_Subprogram (Scope (E1)) then
- if not Warnings_Off_E1 then
- if Is_Access_Type (Etype (Parent (UR))) then
- Error_Msg_N ("??`&.&` may be null!", UR);
- else
- Error_Msg_N
- ("??`&.&` may be referenced before "
- & "it has a value!", UR);
- end if;
+ if not Warnings_Off_E1 then
+ if Is_Access_Type (Etype (Parent (UR))) then
+ Error_Msg_N ("??`&.&` may be null!", UR);
+ else
+ Error_Msg_N
+ ("??`&.&` may be referenced before "
+ & "it has a value!", UR);
end if;
end if;