===================================================================
@@ -135,10 +135,15 @@
-- Called before outputting anything for an entity. Ensures that
-- a blank line precedes the output for a particular entity.
- procedure List_Entities (Ent : Entity_Id; Bytes_Big_Endian : Boolean);
+ procedure List_Entities
+ (Ent : Entity_Id;
+ Bytes_Big_Endian : Boolean;
+ In_Subprogram : Boolean := False);
-- This procedure lists the entities associated with the entity E, starting
-- with the First_Entity and using the Next_Entity link. If a nested
-- package is found, entities within the package are recursively processed.
+ -- When recursing within a subprogram body, Is_Subprogram suppresses
+ -- duplicate information about signature.
procedure List_Name (Ent : Entity_Id);
-- List name of entity Ent in appropriate case. The name is listed with
@@ -314,7 +319,11 @@
-- List_Entities --
-------------------
- procedure List_Entities (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is
+ procedure List_Entities
+ (Ent : Entity_Id;
+ Bytes_Big_Endian : Boolean;
+ In_Subprogram : Boolean := False)
+ is
Body_E : Entity_Id;
E : Entity_Id;
@@ -353,12 +362,15 @@
and then Nkind (Declaration_Node (Ent)) not in N_Renaming_Declaration
then
-- If entity is a subprogram and we are listing mechanisms,
- -- then we need to list mechanisms for this entity.
+ -- then we need to list mechanisms for this entity. We skip this
+ -- if it is a nested subprogram, as the information has already
+ -- been produced when listing the enclosing scope.
if List_Representation_Info_Mechanisms
and then (Is_Subprogram (Ent)
or else Ekind (Ent) = E_Entry
or else Ekind (Ent) = E_Entry_Family)
+ and then not In_Subprogram
then
Need_Blank_Line := True;
List_Mechanisms (Ent);
@@ -386,6 +398,13 @@
List_Mechanisms (E);
end if;
+ -- Recurse into entities local to subprogram
+
+ List_Entities (E, Bytes_Big_Endian, True);
+
+ elsif Ekind (E) in Formal_Kind and then In_Subprogram then
+ null;
+
elsif Ekind_In (E, E_Entry,
E_Entry_Family,
E_Subprogram_Type)