This patch modifies the warnings denoting ineffective use-clauses to be more
explicit and user-friendly.
------------
-- Source --
------------
-- unused_a.adb
with Ada.Text_IO;
with Interfaces;
procedure Unused_A is
use type Interfaces.Unsigned_8;
begin
Ada.Text_IO.Put_Line ("Hello, World!");
end;
-- unused_b.adb
with Ada.Text_IO;
with Interfaces;
procedure Unused_B is
use type Interfaces.Unsigned_32;
Val : Interfaces.Unsigned_32 := 5;
begin
Ada.Text_IO.Put_Line ("Hello, World!" & Interfaces.Unsigned_32'Image (Val));
end;
-- unused_c.adb
with Ada.Text_IO;
with Interfaces;
procedure Unused_C is
Val : Interfaces.Unsigned_32 := 5;
begin
Ada.Text_IO.Put_Line ("Hello, World!" & Interfaces.Unsigned_32'Image (Val));
declare
use Interfaces; -- no warning that this is useless here
begin
Ada.Text_IO.Put_Line ("Goodbye!");
end;
end;
----------------------------
-- Compilation and output --
----------------------------
& gnatmake -gnatwu -q unused_a.adb
& gnatmake -gnatwu -q unused_b.adb
& gnatmake -gnatwu -q unused_c.adb
unused_a.adb:5:04: warning: use clause for type "Interfaces.Unsigned_8"
has no effect
unused_b.adb:5:04: warning: use clause for type "Interfaces.Unsigned_32"
has no effect
unused_c.adb:10:07: warning: use clause for package "Interfaces" has no effect
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-10-09 Justin Squirek <[email protected]>
* sem_ch8.adb (Update_Chain_In_Scope): Modify warning messages.
Index: sem_ch8.adb
===================================================================
--- sem_ch8.adb (revision 253546)
+++ sem_ch8.adb (working copy)
@@ -9069,7 +9069,7 @@
(Current_Use_Clause (Associated_Node (N))))
then
Error_Msg_Node_1 := Entity (N);
- Error_Msg_NE ("ineffective use clause for package &?",
+ Error_Msg_NE ("use clause for package &? has no effect",
Curr, Entity (N));
end if;
@@ -9077,7 +9077,7 @@
else
Error_Msg_Node_1 := Etype (N);
- Error_Msg_NE ("ineffective use clause for }?",
+ Error_Msg_NE ("use clause for }? has no effect",
Curr, Etype (N));
end if;
end if;