From: Viljar Indus <[email protected]>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/freeze.adb  | 3 ++-
 gcc/ada/sem_ch6.adb | 7 +++++--
 gcc/ada/sem_ch7.adb | 7 +++++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index d8fdc306c3a..66145e52054 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -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
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 4456c94eeff..b752a6b1fdc 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -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;
 
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 989e6bfd2d0..6032487d59f 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -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;
 
-- 
2.51.0

Reply via email to