[Ada] Fix warning about generic subprograms withed but not referenced
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 11 Feb 2022 13:31:39 +0000 (14:31 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 12 May 2022 12:38:40 +0000 (12:38 +0000)
commitec0f9f7d88861198d9a94b51eb301567b6752fc5
tree219c41f7d405e618cfbf35c2931bc233f61bc95c
parent3707c8feb1b68028d3967f16c9c4b89d86a14488
[Ada] Fix warning about generic subprograms withed but not referenced

For warnings about unreferenced entities and unused WITH clauses we
typically exclude references outside of the extended main source unit.
However, we include references to variables of formal private types to
warn in the instance if the corresponding type is not a fully
initialized type.

This special case was unnecessarily applied to references to other
entities of formal private types. In particular, we applied it to the
references to generic functions, where the full initialization of the
formal private type doesn't matter.

As an extreme example, this special case was unnecessarily applied to
"pragma Pure (Unchecked_Conversion)" in the runtime unit.

gcc/ada/

* lib-xref.adb (Generate_Reference): Fix comment and implement
it precisely.
gcc/ada/lib-xref.adb