From 019e90494bd07f71380547ad8c2c70826aaf88f9 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Tue, 24 Mar 2020 00:04:11 +0100 Subject: [PATCH] [Ada] Reuse Is_Entry where possible 2020-06-12 Piotr Trojanek gcc/ada/ * contracts.adb, einfo.adb, sem_ch4.adb, sem_ch6.adb, sem_res.adb, sem_util.adb: Replace Ekind_In with Is_Entry. --- gcc/ada/contracts.adb | 3 +-- gcc/ada/einfo.adb | 7 +++---- gcc/ada/sem_ch4.adb | 2 +- gcc/ada/sem_ch6.adb | 2 +- gcc/ada/sem_res.adb | 7 +++---- gcc/ada/sem_util.adb | 6 +++--- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 42f36d5909c..300bbf90cfa 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -562,8 +562,7 @@ package body Contracts is -- Save the SPARK_Mode-related data to restore on exit Skip_Assert_Exprs : constant Boolean := - Ekind_In (Subp_Id, E_Entry, E_Entry_Family) - and then not GNATprove_Mode; + Is_Entry (Subp_Id) and then not GNATprove_Mode; Depends : Node_Id := Empty; Global : Node_Id := Empty; diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index 9176f4a7de1..2456fc15e8f 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -1299,7 +1299,7 @@ package body Einfo is function Contract_Wrapper (Id : E) return E is begin - pragma Assert (Ekind_In (Id, E_Entry, E_Entry_Family)); + pragma Assert (Is_Entry (Id)); return Node25 (Id); end Contract_Wrapper; @@ -1709,8 +1709,7 @@ package body Einfo is function Has_Out_Or_In_Out_Parameter (Id : E) return B is begin pragma Assert - (Ekind_In (Id, E_Entry, E_Entry_Family) - or else Is_Subprogram_Or_Generic_Subprogram (Id)); + (Is_Entry (Id) or else Is_Subprogram_Or_Generic_Subprogram (Id)); return Flag110 (Id); end Has_Out_Or_In_Out_Parameter; @@ -4159,7 +4158,7 @@ package body Einfo is procedure Set_Contract_Wrapper (Id : E; V : E) is begin - pragma Assert (Ekind_In (Id, E_Entry, E_Entry_Family)); + pragma Assert (Is_Entry (Id)); Set_Node25 (Id, V); end Set_Contract_Wrapper; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 7bdb0d10b07..4b19d2d31f1 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -4989,7 +4989,7 @@ package body Sem_Ch4 is then if Is_Task_Type (Prefix_Type) and then Present (Entity (Sel)) - and then Ekind_In (Entity (Sel), E_Entry, E_Entry_Family) + and then Is_Entry (Entity (Sel)) then null; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 456bd97c68f..9fb46d97474 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -12259,7 +12259,7 @@ package body Sem_Ch6 is -- point of the call. if Out_Present (Spec) then - if Ekind_In (Id, E_Entry, E_Entry_Family) + if Is_Entry (Id) or else Is_Subprogram_Or_Generic_Subprogram (Id) then Set_Has_Out_Or_In_Out_Parameter (Id, True); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index c60f46c81b6..4cd6f060eb5 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6098,8 +6098,7 @@ package body Sem_Res is -- can be an arbitrary expression with special resolution rules. elsif Nkind_In (Subp, N_Selected_Component, N_Indexed_Component) - or else (Is_Entity_Name (Subp) - and then Ekind_In (Entity (Subp), E_Entry, E_Entry_Family)) + or else (Is_Entity_Name (Subp) and then Is_Entry (Entity (Subp))) then Resolve_Entry_Call (N, Typ); @@ -7937,7 +7936,7 @@ package body Sem_Res is end; end if; - if Ekind_In (Nam, E_Entry, E_Entry_Family) + if Is_Entry (Nam) and then Present (Contract_Wrapper (Nam)) and then Current_Scope /= Contract_Wrapper (Nam) then @@ -8008,7 +8007,7 @@ package body Sem_Res is Generate_Reference (Nam, Entry_Name, 's'); - if Ekind_In (Nam, E_Entry, E_Entry_Family) then + if Is_Entry (Nam) then Check_Potentially_Blocking_Operation (N); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 0a62b10e568..2661517e760 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -9139,7 +9139,7 @@ package body Sem_Util is if Msg_Index <= Msg_Last - 10 and then Msg (Msg_Index .. Msg_Index + 9) = "subprogram" then - if Ekind_In (Id, E_Entry, E_Entry_Family) then + if Is_Entry (Id) then Res (Res_Index .. Res_Index + 4) := "entry"; Res_Index := Res_Index + 5; @@ -15417,7 +15417,7 @@ package body Sem_Util is function Is_Entry_Body (Id : Entity_Id) return Boolean is begin return - Ekind_In (Id, E_Entry, E_Entry_Family) + Is_Entry (Id) and then Nkind (Unit_Declaration_Node (Id)) = N_Entry_Body; end Is_Entry_Body; @@ -15428,7 +15428,7 @@ package body Sem_Util is function Is_Entry_Declaration (Id : Entity_Id) return Boolean is begin return - Ekind_In (Id, E_Entry, E_Entry_Family) + Is_Entry (Id) and then Nkind (Unit_Declaration_Node (Id)) = N_Entry_Declaration; end Is_Entry_Declaration;