[Ada] Implement AI12-0109 (prohibit some "early" derivations)
authorSteve Baird <baird@adacore.com>
Fri, 13 Dec 2019 09:04:38 +0000 (09:04 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Fri, 13 Dec 2019 09:04:38 +0000 (09:04 +0000)
commitcfedf3e51bbcfc13e014a5b1d98418fe4f50d907
tree6fc4cb3aad05c1d410c763da1bce66640c1caf4b
parent63e21a7237fac8dfedda51cc7f4089e8c07a25e9
[Ada] Implement AI12-0109 (prohibit some "early" derivations)

2019-12-13  Steve Baird  <baird@adacore.com>

gcc/ada/

* einfo.ads: Correct comment for Derived_Type_Link to reflect
that fact that this function is now used for more than just
generation of warnings.
* sem_ch3.adb (Build_Derived_Type): Do not call
Set_Derived_Type_Link if the derived type and the parent type
are in different compilation units. Such a derivation cannot be
a problematic "early" derivation (identifying these is what the
Derived_Type_Link attribute is used for) and we don't like
inter-unit references that go in the opposite direction of
semantic dependencies.
* sem_ch13.adb (Is_Type_Related_Rep_Item): A new function,
analogous to the existing function Is_Operational_Item.
(Rep_Item_Too_Late): Generate a hard error (with same text as
the warning that was previously being generated) if the
AI12-0109 legality rule is violated.

From-SVN: r279355
gcc/ada/ChangeLog
gcc/ada/einfo.ads
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb