[gcc r12-5726] [Ada] Remove duplicated condition in warnings about read-before-write

Pierre-Marie de Rodat pmderodat@gcc.gnu.org
Thu Dec 2 16:28:33 GMT 2021


https://gcc.gnu.org/g:e2e877266de127fbcd6f14e85e0c46ce4731c207

commit r12-5726-ge2e877266de127fbcd6f14e85e0c46ce4731c207
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Mon Nov 22 12:11:46 2021 +0100

    [Ada] Remove duplicated condition in warnings about read-before-write
    
    gcc/ada/
    
            * sem_warn.adb (Check_References): Remove redundant condition.

Diff:
---
 gcc/ada/sem_warn.adb | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index d9d5d958315..3d7e4124e0a 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -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;


More information about the Gcc-cvs mailing list