https://gcc.gnu.org/g:f0ebef9e3cdbaf9dcef06515892e6c5573c1092b
commit r17-1312-gf0ebef9e3cdbaf9dcef06515892e6c5573c1092b Author: Piotr Trojanek <[email protected]> Date: Fri Apr 25 16:28:33 2025 +0200 ada: Use collective entity kinds for access-to-subprogram types Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch4.adb, sem_attr.adb, sem_ch3.adb: Use Access_Protected_Kind and Access_Subprogram_Kind where possible. Diff: --- gcc/ada/exp_ch4.adb | 16 ++++++---------- gcc/ada/sem_attr.adb | 17 ++++------------- gcc/ada/sem_ch3.adb | 6 +----- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index f3db82c3e724..232ba1be97a2 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -8769,11 +8769,9 @@ package body Exp_Ch4 is -- records because there may be padding or undefined fields. elsif Unnest_Subprogram_Mode - and then Ekind (Typl) in E_Class_Wide_Type - | E_Class_Wide_Subtype + and then Ekind (Typl) in Access_Protected_Kind + | Class_Wide_Kind | E_Access_Subprogram_Type - | E_Access_Protected_Subprogram_Type - | E_Anonymous_Access_Protected_Subprogram_Type | E_Exception_Type and then Present (Equivalent_Type (Typl)) and then Is_Record_Type (Equivalent_Type (Typl)) @@ -10152,12 +10150,10 @@ package body Exp_Ch4 is if Is_Elementary_Type (Typ) and then Sloc (Entity (N)) = Standard_Location - and then not (Ekind (Typ) in E_Class_Wide_Type - | E_Class_Wide_Subtype - | E_Access_Subprogram_Type - | E_Access_Protected_Subprogram_Type - | E_Anonymous_Access_Protected_Subprogram_Type - | E_Exception_Type + and then not (Ekind (Typ) in Access_Protected_Kind + | Class_Wide_Kind + | E_Access_Subprogram_Type + | E_Exception_Type and then Present (Equivalent_Type (Typ)) and then Is_Record_Type (Equivalent_Type (Typ))) then diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index d40ee73ade3c..171dce197eaf 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -11924,11 +11924,8 @@ package body Sem_Attr is -- also be accessibility checks on those, this is where the -- checks can eventually be centralized ??? - if Ekind (Btyp) in E_Access_Protected_Subprogram_Type - | E_Access_Subprogram_Type - | E_Anonymous_Access_Protected_Subprogram_Type - | E_Anonymous_Access_Subprogram_Type - then + if Ekind (Btyp) in Access_Subprogram_Kind then + -- Deal with convention mismatch if Convention (Designated_Type (Btyp)) /= @@ -12214,14 +12211,10 @@ package body Sem_Attr is -- default-initialized aggregate component for a self-referential -- type the reference is legal. - if not (Ekind (Btyp) = E_Access_Subprogram_Type - or else Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type + if not (Ekind (Btyp) in Access_Subprogram_Kind or else (Is_Record_Type (Btyp) and then Present (Corresponding_Remote_Type (Btyp))) - or else Ekind (Btyp) = E_Access_Protected_Subprogram_Type - or else Ekind (Btyp) - = E_Anonymous_Access_Protected_Subprogram_Type or else Is_Access_Constant (Btyp) or else Is_Variable (P) or else Attr_Id = Attribute_Unrestricted_Access) @@ -12456,9 +12449,7 @@ package body Sem_Attr is end; end if; - if Ekind (Btyp) in E_Access_Protected_Subprogram_Type - | E_Anonymous_Access_Protected_Subprogram_Type - then + if Ekind (Btyp) in Access_Protected_Kind then if Is_Entity_Name (P) and then not Is_Protected_Type (Scope (Entity (P))) then diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index d54a13b39c25..1bc9e288bc63 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -7167,11 +7167,7 @@ package body Sem_Ch3 is -- Start of processing for Build_Access_Subprogram_Wrapper begin - if Ekind (Id) in E_Access_Subprogram_Type - | E_Access_Protected_Subprogram_Type - | E_Anonymous_Access_Protected_Subprogram_Type - | E_Anonymous_Access_Subprogram_Type - then + if Ekind (Id) in Access_Subprogram_Kind then null; else
