https://gcc.gnu.org/g:7fbb8361a5ffe4782cb22d114a8be057ac96bd03

commit r17-1186-g7fbb8361a5ffe4782cb22d114a8be057ac96bd03
Author: Mathias Aparicio <[email protected]>
Date:   Thu Apr 9 14:32:51 2026 +0200

    ada: Refactor Has_Assertion_Level_Argument for consistency
    
    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.

Diff:
---
 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 43850d6cfc24..2590e411f0c8 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;

Reply via email to