https://gcc.gnu.org/g:482f8656419e8a2dc095eba09a6f2b12056dfc0d

commit r17-1335-g482f8656419e8a2dc095eba09a6f2b12056dfc0d
Author: Viljar Indus <[email protected]>
Date:   Wed Apr 15 15:55:33 2026 +0300

    ada: Apply ignored ghost regions for ignored pragmas
    
    gcc/ada/ChangeLog:
    
            * ghost.adb (Set_Ghost_Mode): Create ignored ghost regions
            for ignored pragamas.
            * sem_prag.adb (Analyze_Pragma): Mark ignored pragmas checks as
            ignored ghost pragmas.

Diff:
---
 gcc/ada/ghost.adb    | 2 ++
 gcc/ada/sem_prag.adb | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb
index b356bed9d40f..dac1442b663e 100644
--- a/gcc/ada/ghost.adb
+++ b/gcc/ada/ghost.adb
@@ -2907,6 +2907,8 @@ package body Ghost is
          else
             if Is_Checked (N) then
                Install_Ghost_Region (Check, N, Level);
+            elsif Is_Ignored (N) then
+               Install_Ghost_Region (Ignore, N, Level);
             else
                Install_Ghost_Region (None, N, Level);
             end if;
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index d007c1ed8d16..543ca7f6f931 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -15672,6 +15672,12 @@ package body Sem_Prag is
             --  warning when we delete the if statement.
 
             if Expander_Active and Is_Ignored_In_Codegen (N) then
+
+               --  Mark pragma as ignored ghost to reuse the same removal
+               --  process.
+
+               Mark_Ghost_Pragma (N, Opt.Ignore);
+
                Eloc := Sloc (Arg_Check);
 
                Rewrite (N,

Reply via email to