]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Normalize the handling of assertion policies
authorViljar Indus <indus@adacore.com>
Wed, 4 Feb 2026 12:42:22 +0000 (14:42 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 26 May 2026 08:38:20 +0000 (10:38 +0200)
Normalize On and Off to Check and Ignore policies in order to avoid
internal logic errors.

gcc/ada/ChangeLog:

* sem_util.adb (Policy_In_Effect): Normalize the policy names.

gcc/ada/sem_util.adb

index 77a3dbec80f2fd6f81e713daff09b37d242108e3..31a64ea4b120ddb6bb5a19df466b7c87295a7536 100644 (file)
@@ -27098,6 +27098,14 @@ package body Sem_Util is
          Kind := Policy_In_List (Check_Policy_List_Config);
       end if;
 
+      --  Normalize the policy names
+
+      if Kind = Name_Off then
+         Kind := Name_Ignore;
+      elsif Kind = Name_On then
+         Kind := Name_Check;
+      end if;
+
       --  The context lacks policy pragmas, determine the mode based on whether
       --  assertions are enabled at the configuration level. This ensures that
       --  the policy is preserved when analyzing generics.