[Ada] Fix warning about generic subprograms withed but not instantiated
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 11 Feb 2022 09:40:32 +0000 (10:40 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 12 May 2022 12:38:40 +0000 (12:38 +0000)
commit3707c8feb1b68028d3967f16c9c4b89d86a14488
treeb9b8475be4ca771b9e5ee48f015968815a8e2a70
parentdff98f76fb246e0a0d02ce13f2160c69168c3dc7
[Ada] Fix warning about generic subprograms withed but not instantiated

The compiler should warn when a generic subprogram unit is withed but
not instantiated by the current main unit. This warning relies on flag
Is_Instantiated, which was wrongly set when the generic unit was also
withed and instantiated by some other unit.

This change merely reverts a fix done 20 years ago, which worked around
some spurious warning emitted with inlining enabled. Now the
Is_Instantiated flag is set similarly for generic subprograms and
generic packages.

gcc/ada/

* atree.adb, atree.ads: Move WITH clause from spec to body; to
prevent new warnings stopping the bootstrap.
* fmap.adb, fname-sf.adb, libgnat/a-direct.adb,
libgnat/s-bignum.adb: Remove unnecessary WITH clauses; to
prevent new warnings stopping the bootstrap.
* sem_ch12.adb (Analyze_Subprogram_Instantiation): Only set
Is_Instantiated flag when the instance is in the extended main
source unit.
gcc/ada/atree.adb
gcc/ada/atree.ads
gcc/ada/fmap.adb
gcc/ada/fname-sf.adb
gcc/ada/libgnat/a-direct.adb
gcc/ada/libgnat/s-bignum.adb
gcc/ada/sem_ch12.adb