https://gcc.gnu.org/g:6a331103e785e132a4e119a2cce13de1579d2ce6
commit r16-4985-g6a331103e785e132a4e119a2cce13de1579d2ce6 Author: Viljar Indus <[email protected]> Date: Fri Oct 10 12:47:07 2025 +0300 ada: Avoid Ignored ghost code behavior in Codepeer_Mode 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. Diff: --- 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 d8fdc306c3a5..66145e520544 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 4456c94eeff3..b752a6b1fdc3 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 989e6bfd2d01..6032487d59f5 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;
