From 46924ad780665721a51306a646f7f601c359ba4c Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Mon, 12 Dec 2022 15:31:05 -0500 Subject: ada: Fix incorrect warning about unreferenced packed arrays This patch fixes a bug in which a reference to a renaming of a component of a packed array was not counted as a reference, and thus caused incorrect warnings about unreferenced objects. gcc/ada/ * sem_ch5.adb (Analyze_Assignment): Fix the bug by checking Original_Node. The renaming might be elsewhere, but the (original) reference is right here. * errout.adb: Remove pragma Unreferenced which was added because of the above bug. * einfo.ads: Misc cleanup. * lib.adb: Likewise. * lib.ads: Likewise. --- gcc/ada/einfo.ads | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/ada/einfo.ads') diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index d71dcaf..94022e7 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1865,7 +1865,7 @@ package Einfo is -- Has_Per_Object_Constraint -- Defined in E_Component entities. Set if the subtype of the component -- has a per object constraint. Per object constraints result from the --- following situations : +-- following situations: -- -- 1. N_Attribute_Reference - when the prefix is the enclosing type and -- the attribute is Access. @@ -4136,14 +4136,14 @@ package Einfo is -- set instead, or a similar appearance as an out parameter actual, in -- which case Referenced_As_Out_Parameter is set. --- Referenced_As_LHS : +-- Referenced_As_LHS -- Defined in all entities. This flag is set instead of Referenced if a -- simple variable that is not a renaming appears as the left side of an -- assignment. The reason we distinguish this kind of reference is that -- we have a separate warning for variables that are only assigned and -- never read. --- Referenced_As_Out_Parameter : +-- Referenced_As_Out_Parameter -- Defined in all entities. This flag is set instead of Referenced if a -- simple variable that is not a renaming appears as an actual for an out -- formal. The reason we distinguish this kind of reference is that -- cgit v1.1