From a160b4e046d11b51cbedb936b13d15e3d0b19f7e Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Mon, 26 Oct 2020 12:15:34 +0100 Subject: [PATCH] [Ada] Reuse Is_Concurrent_Type when detecting protected or task types gcc/ada/ * exp_ch13.adb, exp_ch9.adb, sem_ch8.adb, sem_util.adb: Replace a combination of Is_Protected_Type and Is_Task_Type by Is_Concurrent_Type. --- gcc/ada/exp_ch13.adb | 5 ++--- gcc/ada/exp_ch9.adb | 7 +++---- gcc/ada/sem_ch8.adb | 2 +- gcc/ada/sem_util.adb | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb index 30f101dba0d..89efca9e538 100644 --- a/gcc/ada/exp_ch13.adb +++ b/gcc/ada/exp_ch13.adb @@ -582,9 +582,8 @@ package body Exp_Ch13 is Install_Visible_Declarations (E_Scope); end if; - if Is_Package_Or_Generic_Package (E_Scope) or else - Is_Protected_Type (E_Scope) or else - Is_Task_Type (E_Scope) + if Is_Concurrent_Type (E_Scope) + or else Is_Package_Or_Generic_Package (E_Scope) then Install_Private_Declarations (E_Scope); end if; diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 72077236c9d..7b70321c97d 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -10579,13 +10579,12 @@ package body Exp_Ch9 is Extract_Entry (N, Concval, Ename, Index); Conc_Typ := Etype (Concval); - -- Examine the scope stack in order to find nearest enclosing protected - -- or task type. This will constitute our invocation source. + -- Examine the scope stack in order to find nearest enclosing concurrent + -- type. This will constitute our invocation source. Old_Typ := Current_Scope; while Present (Old_Typ) - and then not Is_Protected_Type (Old_Typ) - and then not Is_Task_Type (Old_Typ) + and then not Is_Concurrent_Type (Old_Typ) loop Old_Typ := Scope (Old_Typ); end loop; diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 9404d6884af..950d4a00b2f 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -7519,7 +7519,7 @@ package body Sem_Ch8 is -- Reference to type name in predicate/invariant expression - elsif (Is_Task_Type (P_Type) or else Is_Protected_Type (P_Type)) + elsif Is_Concurrent_Type (P_Type) and then not In_Open_Scopes (P_Name) and then (not Is_Concurrent_Type (Etype (P_Name)) or else not In_Open_Scopes (Etype (P_Name))) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 6875e470825..a5db24d9d74 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -25472,7 +25472,7 @@ package body Sem_Util is -- All other cases do not require a transient scope else - pragma Assert (Is_Protected_Type (Typ) or else Is_Task_Type (Typ)); + pragma Assert (Is_Concurrent_Type (Typ)); return False; end if; end Old_Requires_Transient_Scope; -- 2.30.2