When climbing the chain of scopes (using Sinfo.Scope) we always process
unique entities, e.g. an E_Procedure even for entities that
syntactically reside in E_Subprogram_Body; same for tasks, entries and
packages. There is no need to expect E_Package_Body, because it never
occurs.
The removed dead code was only relevant to GNATprove; it doesn't affect
compilation.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-02  Piotr Trojanek  <troja...@adacore.com>

gcc/ada/

        * sem_util.adb (Check_No_Hidden_State): Remove dead code.
--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -3398,12 +3398,6 @@ package body Sem_Util is
            or else Ekind_In (Context, E_Block, E_Task_Type)
          then
             return;
-
-         --  When examining a package body, use the entity of the spec as it
-         --  carries the abstract state declarations.
-
-         elsif Ekind (Context) = E_Package_Body then
-            Context := Spec_Entity (Context);
          end if;
 
          --  Stop the traversal when a package subject to a null abstract state

Reply via email to