This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Addition of entity kinds to warning messages for unreferenced entities


The warning messages for cases of unreferenced labels, exceptions, packages,
discriminants, and formal objects now include the kind of entity at the
start of the warning message. This enables easy suppression of warnings for
those specific entity kinds using pragma Warnings (Off, ...). Formerly, such
cases were reported simply as "<entity> is not referenced".

The test below must report the following warnings when compiled
with "gcc -c -gnatwu unreferenced.adb":

unreferenced.adb:4:07: warning: formal object "In_Obj" is not referenced
unreferenced.adb:5:07: warning: formal object "In_Out_Obj" is not referenced
unreferenced.adb:11:12: warning: package "New_Pkg" is not referenced
unreferenced.adb:13:04: warning: exception "E" is not referenced
unreferenced.adb:15:25: warning: discriminant "D" is not referenced
unreferenced.adb:26:04: warning: label "Some_Label" is not referenced

procedure Unreferenced is

   generic
      In_Obj     : in Integer;
      In_Out_Obj : in out Integer;
   package Gen_Pkg is
   end Gen_Pkg;

   I : Integer := 123;

   package New_Pkg is new Gen_Pkg (I, I);

   E : exception;

   task type Some_Task (D : Integer) is
   end Some_Task;

   task body Some_Task is
   begin
      null;
   end Some_Task;

   ST : Some_Task (I);

begin
 <<Some_Label>>
   null;
end Unreferenced;

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-07-22  Gary Dismukes  <dismukes@adacore.com>

	* sem_warn.adb (Warn_On_Unreferenced_Entity): Add warning messages that
	include the entity kind for following cases of unreferenced entities:
	E_Label, E_Discriminant, E_Package, E_Exception, and Formal_Object_Kind.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]