]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Unreferenced warning on abstract subprogram
authorJustin Squirek <squirek@adacore.com>
Thu, 11 Apr 2024 20:51:05 +0000 (20:51 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 10 Jun 2024 09:04:00 +0000 (11:04 +0200)
This patch modifies the unreferenced entity warning in the compiler to avoid
noisily warning about unreferenced abstract subprogram.

gcc/ada/

* sem_warn.adb (Warn_On_Unreferenced_Entity): Add a condition to
ignore warnings on unreferenced abstract subprogram.

gcc/ada/sem_warn.adb

index 2de3f8668b052117653741e10e78a74591c63941..91a57d521d15907a4224322a4718e6c66223b625 100644 (file)
@@ -4452,12 +4452,16 @@ package body Sem_Warn is
                  ("?u?literal & is not referenced!", E);
 
             when E_Function =>
-               Error_Msg_N -- CODEFIX
-                 ("?u?function & is not referenced!", E);
+               if not Is_Abstract_Subprogram (E) then
+                  Error_Msg_N -- CODEFIX
+                    ("?u?function & is not referenced!", E);
+               end if;
 
             when E_Procedure =>
-               Error_Msg_N -- CODEFIX
-                 ("?u?procedure & is not referenced!", E);
+               if not Is_Abstract_Subprogram (E) then
+                  Error_Msg_N -- CODEFIX
+                    ("?u?procedure & is not referenced!", E);
+               end if;
 
             when E_Package =>
                Error_Msg_N -- CODEFIX