From: Bob Duff <d...@adacore.com> Fix the comment about Itypes, so the Parent field is no longer required.
Change VAST to no longer require it. Remove Check_Itype_Parents from Check_Enum; it can no longer fail, so there's no point in making it switchable. gcc/ada/ChangeLog: * einfo.ads (Associated_Node_For_Itype): Document that Parent field may be empty. * vast.adb: Allow empty Parent in Itypes. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo.ads | 12 +++++++----- gcc/ada/vast.adb | 14 +++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index e529a64e0f6..495a1932109 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -463,11 +463,13 @@ package Einfo is -- For an access_to_protected_subprogram parameter it is the declaration -- of the corresponding formal parameter. --- --- Itypes have no explicit declaration, and therefore are not attached to --- the tree: their Parent field is always empty. The Associated_Node_For_ --- Itype is the only way to determine the construct that leads to the --- creation of a given itype entity. + +-- Itypes need not have an explicit declaration, in which case they are +-- not attached to the tree through the Parent field, which is empty. In +-- other cases, they have one and are attached to the tree through the +-- Parent field as usual. Associated_Node_For_Itype should be used to +-- determine the construct that leads to the creation of a given itype +-- entity. -- Associated_Storage_Pool [root type only] -- Defined in simple and general access type entities. References the diff --git a/gcc/ada/vast.adb b/gcc/ada/vast.adb index a48707b2ce5..acb48b6254d 100644 --- a/gcc/ada/vast.adb +++ b/gcc/ada/vast.adb @@ -50,12 +50,11 @@ package body VAST is -- False means disabled checks are silent; True means we print a message -- (but still don't raise VAST_Failure). - type Check_Enum is (Check_Other, Check_Itype_Parents, Check_Error_Nodes); + type Check_Enum is (Check_Other, Check_Error_Nodes); Enabled_Checks : constant array (Check_Enum) of Boolean := --- (Check_Other => True, others => False); - (others => True); --- (Check_Itype_Parents => False, -- this one fails in bootstrap! --- others => True); + (Check_Other => True, +-- others => False); + others => True); -- Passing checks are Check_Other, which should always be enabled. -- Currently-failing checks are different enumerals in Check_Enum, -- which can be disabled individually until we fix the bugs, or enabled @@ -152,9 +151,10 @@ package body VAST is if Nkind (N) = N_Compilation_Unit then Assert (No (Parent (N))); -- The root of each unit should not have a parent + elsif N in N_Entity_Id and then Is_Itype (N) then - Assert (No (Parent (N)), Check_Itype_Parents); - -- Itypes should not have a parent + null; -- An Itype might or might not have a parent + else if Nkind (N) = N_Error then Assert (False, Check_Error_Nodes); -- 2.43.0