From: Mathias Aparicio <[email protected]>

First branches of `Has_Assertion_Level_Argument` test an equality and if
met return False.

This patch apply this logic for the two other if that returned False
after the if.

gcc/ada/ChangeLog:

        * sem_util.adb (Has_Assertion_Level_Argument): Invert the final
        check in aspect branch and the check in pragma branch to use
        early returns for consistency.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_util.adb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 43850d6cfc2..2590e411f0c 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -11517,20 +11517,20 @@ package body Sem_Util is
 
          Choice := First (Choices (Assoc));
 
-         if Nkind (Choice) = N_Identifier then
-            return Present (Get_Assertion_Level (Chars (Choice)));
+         if Nkind (Choice) /= N_Identifier then
+            return False;
          end if;
 
-         return False;
+         return Present (Get_Assertion_Level (Chars (Choice)));
       else
          pragma Assert (Nkind (N) = N_Pragma);
          Assocs := Pragma_Argument_Associations (N);
          Assoc := First (Assocs);
-         if Present (Assoc) and then Chars (Assoc) /= No_Name then
-            return Present (Get_Assertion_Level (Chars (Assoc)));
+         if No (Assoc) or else Chars (Assoc) = No_Name then
+            return False;
          end if;
 
-         return False;
+         return Present (Get_Assertion_Level (Chars (Assoc)));
       end if;
    end Has_Assertion_Level_Argument;
 
-- 
2.53.0

Reply via email to