]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Avoid Ignored ghost code behavior in Codepeer_Mode
authorViljar Indus <indus@adacore.com>
Fri, 10 Oct 2025 09:47:07 +0000 (12:47 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:16 +0000 (15:15 +0100)
When the frontend is called by it should treat all ghost
code as checked. Avoid removing expansion in ignored ghost code regions
when Codepeer_Mode is active.

gcc/ada/ChangeLog:

* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Avoid disabling
the expander for ignored ghost regions if Codepeer_Mode is active.
* sem_ch7.adb (Analyze_Package_Body_Helper): Likewise.
* freeze.adb (Freeze_Entity): Avoid triggering special freezing
action for entities within ignored ghost regions in Codepeer_Mode.

gcc/ada/freeze.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch7.adb

index d8fdc306c3a51e52d0b1cc885fd7f53ccd20528e..66145e520544e4fb0479ff98e18caed18a4297a7 100644 (file)
@@ -8382,7 +8382,8 @@ package body Freeze is
       --  and Per-Object Expressions" will suppress the insertion, and the
       --  freeze node will be dropped on the floor.
 
-      if Saved_Ghost_Config.Ghost_Mode = Ignore
+      if not CodePeer_Mode
+        and then Saved_Ghost_Config.Ghost_Mode = Ignore
         and then Ghost_Config.Ghost_Mode /= Ignore
         and then Present (Ghost_Config.Ignored_Ghost_Region)
       then
index 4456c94eeff37d53aaf1548f5cd0454f7098b8f4..b752a6b1fdc35f99e597a4fec345abf6b8904610 100644 (file)
@@ -3843,7 +3843,8 @@ package body Sem_Ch6 is
       --  user entities, as internally generated entitities might still need
       --  to be expanded (e.g. those generated for types).
 
-      if Present (Ghost_Config.Ignored_Ghost_Region)
+      if not CodePeer_Mode
+        and then Present (Ghost_Config.Ignored_Ghost_Region)
         and then Comes_From_Source (Body_Id)
       then
          Expander_Active := False;
@@ -5029,7 +5030,9 @@ package body Sem_Ch6 is
       end if;
 
    <<Leave>>
-      if Present (Ghost_Config.Ignored_Ghost_Region) then
+      if not CodePeer_Mode
+        and then Present (Ghost_Config.Ignored_Ghost_Region)
+      then
          Expander_Active := Saved_EA;
       end if;
 
index 989e6bfd2d010f847c09ffaade27c7b095a6b034..6032487d59f555a24e2195c8b7ca30413086ebd7 100644 (file)
@@ -835,7 +835,8 @@ package body Sem_Ch7 is
       --  user entities, as internally generated entities might still need
       --  to be expanded (e.g. those generated for types).
 
-      if Present (Ghost_Config.Ignored_Ghost_Region)
+      if not CodePeer_Mode
+        and then Present (Ghost_Config.Ignored_Ghost_Region)
         and then Comes_From_Source (Body_Id)
       then
          Expander_Active := False;
@@ -1148,7 +1149,9 @@ package body Sem_Ch7 is
          end if;
       end if;
 
-      if Present (Ghost_Config.Ignored_Ghost_Region) then
+      if not CodePeer_Mode and then
+        Present (Ghost_Config.Ignored_Ghost_Region)
+      then
          Expander_Active := Saved_EA;
       end if;