From b0b81e8e205035056b71c3f5c4daf00720958355 Mon Sep 17 00:00:00 2001 From: Viljar Indus Date: Tue, 29 Jul 2025 11:20:39 +0300 Subject: [PATCH] ada: Add special handling for Runtime and Static in Policy_In_Effect When one of those levels is present then we should not look for the policy in the policy stack but rather determine the policy immidiately like we do in Check_Applicable_Policy. gcc/ada/ChangeLog: * sem_util.adb (Policy_In_Effect): Add special handling for Runtime and Static values. --- gcc/ada/sem_util.adb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 1e855150673..aeae589dcad 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -26574,6 +26574,8 @@ package body Sem_Util is Kind : Name_Id; + Level_Id : Entity_Id; + -- Start of processing for Policy_In_Effect begin @@ -26581,10 +26583,19 @@ package body Sem_Util is raise Program_Error; end if; - if Present (Level) - and then not Is_Valid_Assertion_Level (Level) - then - raise Program_Error; + if Present (Level) then + Level_Id := Get_Assertion_Level (Level); + if No (Level_Id) then + raise Program_Error; + end if; + + if Level_Id = Standard_Level_Runtime then + return Name_Check; + elsif Level_Id = Standard_Level_Static + or else Depends_On_Level (Level_Id, Standard_Level_Static) + then + return Name_Ignore; + end if; end if; -- Inspect all policy pragmas that appear within scopes (if any) -- 2.47.3