diff mbox series

[Ada] Task arrays trigger spurious unreferenced warnings

Message ID 20220111133240.GA749002@adacore.com
State New
Headers show
Series [Ada] Task arrays trigger spurious unreferenced warnings | expand

Commit Message

Pierre-Marie de Rodat Jan. 11, 2022, 1:32 p.m. UTC
Incremental patch to handle multi-dimensional arrays of tasks and
records with task components.

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

gcc/ada/

	* sem_warn.adb (Check_References): Add call to Has_Task instead
	of checking component type.
diff mbox series

Patch

diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -1701,13 +1701,10 @@  package body Sem_Warn is
                           and then Ekind (E1) /= E_Constant
                           and then Ekind (E1) /= E_Component)
 
-                         --  Check that E1T is not a task or an array of them
+                         --  Check that E1T is not a task or a composite type
+                         --  with a task component.
 
-                         or else not
-                           (Is_Task_Type (E1T)
-                             or else (Ekind (E1T) in Array_Kind
-                                       and then Is_Task_Type
-                                                  (Component_Type (E1T)))))
+                         or else not Has_Task (E1T))
 
               --  For subunits, only place warnings on the main unit itself,
               --  since parent units are not completely compiled.