From 280d165843e05ab682a7855b218d856836829a6d Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Wed, 8 Oct 2025 12:29:35 -0400 Subject: [PATCH] ada: Get rid of unused node/entity fields (Set_ only) The following fields are Set_ but not used in GNAT. We get rid of them or document them as follows: - Has_Pragma_Controlled Remove. - Corresponding_Entry_Body Document that it is used by codepeer. - Is_Activation_Record Document that it is used by llvm. - Is_Discriminant_Check_Function Document that it is used by codepeer. - Original_Access_Type No change (already documented that it is used by codepeer). gcc/ada/ChangeLog: * einfo.ads (Has_Pragma_Controlled): Remove. (Is_Activation_Record): Document usage by llvm. * gen_il-fields.ads (Opt_Field_Enum): Remove Has_Pragma_Controlled. * gen_il-gen-gen_entities.adb (Access_Kind): Remove Has_Pragma_Controlled. * sem_prag.adb: Remove setting of Has_Pragma_Controlled. * sinfo.ads (Corresponding_Entry_Body): Document usage by codepeer. --- gcc/ada/einfo.ads | 9 ++------- gcc/ada/gen_il-fields.ads | 1 - gcc/ada/gen_il-gen-gen_entities.adb | 1 - gcc/ada/sem_prag.adb | 2 -- gcc/ada/sinfo.ads | 3 ++- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index cd00fe265e1..da6a0286d9e 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1889,10 +1889,6 @@ package Einfo is -- 5. N_Range_Constraint - when the range expression uses the -- discriminant of the enclosing type. --- Has_Pragma_Controlled [implementation base type only] --- Defined in access type entities. It is set if a pragma Controlled --- applies to the access type. - -- Has_Pragma_Elaborate_Body -- Defined in all entities. Set in compilation unit entities if a -- pragma Elaborate_Body applies to the compilation unit. @@ -2383,7 +2379,7 @@ package Einfo is -- Is_Activation_Record -- Applies to E_In_Parameters generated in Exp_Unst for nested -- subprograms, to mark the added formal that carries the activation --- record created in the enclosing subprogram. +-- record created in the enclosing subprogram. Used by the llvm back end. -- Is_Actual_Subtype -- Defined on all types, true for the generated constrained subtypes @@ -2596,7 +2592,7 @@ package Einfo is -- Is_Discriminant_Check_Function -- Defined in all entities. Set only in E_Function entities for functions --- created to do discriminant checks. +-- created to do discriminant checks. Used by CodePeer. -- Is_Discriminal (synthesized) -- Applies to all entities, true for renamings of discriminants. Such @@ -5220,7 +5216,6 @@ package Einfo is -- Associated_Storage_Pool (root type only) -- Finalization_Collection (root type only) -- Storage_Size_Variable (base type only) - -- Has_Pragma_Controlled (base type only) -- Has_Storage_Size_Clause (base type only) -- Is_Access_Constant -- Is_Local_Anonymous_Access diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index 5e954186e05..d6681010ccb 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -614,7 +614,6 @@ package Gen_IL.Fields is Has_Own_Invariants, Has_Partial_Visible_Refinement, Has_Per_Object_Constraint, - Has_Pragma_Controlled, Has_Pragma_Elaborate_Body, Has_Pragma_Inline, Has_Pragma_Inline_Always, diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb index 95b172ad5f1..f13488bee3c 100644 --- a/gcc/ada/gen_il-gen-gen_entities.adb +++ b/gcc/ada/gen_il-gen-gen_entities.adb @@ -647,7 +647,6 @@ begin -- Gen_IL.Gen.Gen_Entities (Sm (Associated_Storage_Pool, Node_Id, Root_Type_Only), Sm (Directly_Designated_Type, Node_Id), Sm (Finalization_Collection, Node_Id, Root_Type_Only), - Sm (Has_Pragma_Controlled, Flag, Impl_Base_Type_Only), Sm (Has_Storage_Size_Clause, Flag, Impl_Base_Type_Only), Sm (Is_Access_Constant, Flag), Sm (Is_Local_Anonymous_Access, Flag), diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 0dc2e4f56bf..0ebf421fc96 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -16449,8 +16449,6 @@ package body Sem_Prag is or else not Is_Access_Type (Entity (Arg)) then Error_Pragma_Arg ("pragma% requires access type", Arg1); - else - Set_Has_Pragma_Controlled (Base_Type (Entity (Arg))); end if; end Controlled; diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index a1a850adb4a..d5677095468 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1003,9 +1003,10 @@ package Sinfo is -- to the defining entity for the corresponding body (NOT the node for -- the body itself). - -- Corresponding_Entry_Body + -- Corresponding_Entry_Body -- Defined in N_Subprogram_Body. Set for subprogram bodies that implement -- a protected type entry; points to the body for the entry. + -- Used by codepeer. -- Corresponding_Formal_Spec -- This field is set in subprogram renaming declarations, where it points -- 2.47.3