diff options
author | Bob Duff <duff@adacore.com> | 2023-01-08 18:22:17 -0500 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-15 11:36:42 +0200 |
commit | d2a1dcf72f793d671512bd5638d5b66eb19e8ca6 (patch) | |
tree | 5ab875c75a755fefd8cc712048ccb8f91d2ba549 /gcc/ada/einfo.ads | |
parent | 0ca7fcf5635bdd363a5a18e7cf5828d87b5aac55 (diff) | |
download | gcc-d2a1dcf72f793d671512bd5638d5b66eb19e8ca6.zip gcc-d2a1dcf72f793d671512bd5638d5b66eb19e8ca6.tar.gz gcc-d2a1dcf72f793d671512bd5638d5b66eb19e8ca6.tar.bz2 |
ada: Clean up vanishing entity fields
Fix all the failures caused by enabling Check_Vanishing_Fields on
entities in all cases except the case of converting to or from E_Void.
But leave Check_Vanishing_Fields disabled by default (controlled by
-gnatd_v flag), because it might be too slow even for assertions-on
mode, and we should deal with the E_Void cases eventually.
The failures are fixed either by adding calls to Reinit_Field_To_Zero,
or by changing which entities have which fields.
Note that in a series of Reinit_Field_To_Zero calls, the optional
Old_Ekind parameter is only useful on the first such call.
gcc/ada/
* atree.adb
(Check_Vanishing_Fields): Disable the check for "root/base type
only" fields. This is a bug fix -- if we're checking some subtype
S, we don't want to reach over to the root or base type and
Reinit_Field_To_Zero of that, thus modifying the field for lots of
subtypes other than S. Disable in the to/from E_Void cases. Misc
cleanup.
* gen_il-gen-gen_entities.adb: Define First_Entity, Last_Entity,
and Stored_Constraint for all type entities, because there are too
many cases where Reinit_Field_To_Zero would otherwise be needed.
In any case, it seems cleaner to have First_Entity and Last_Entity
defined in the same entity kinds.
* einfo.ads:
(First_Entity, Last_Entity, Stored_Constraint): Update comments to
reflect gen_il-gen-gen_entities.adb changes.
(Lit_Hash): Add missing "[root type only]" comment.
* exp_ch5.adb: Add Reinit_Field_To_Zero calls for vanishing
fields.
* sem_ch10.adb: Likewise.
* sem_ch6.adb: Likewise.
* sem_ch7.adb: Likewise.
* sem_ch8.adb: Likewise.
* sem_ch3.adb: Likewise. Also remove now-unnecessary
Reinit_Field_To_Zero calls.
Diffstat (limited to 'gcc/ada/einfo.ads')
-rw-r--r-- | gcc/ada/einfo.ads | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index a200d63..878737c 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1346,12 +1346,13 @@ package Einfo is -- find the first discriminant if discriminants are present. -- First_Entity --- Defined in all entities which act as scopes to which a list of --- associated entities is attached (blocks, class subtypes and types, --- entries, functions, loops, packages, procedures, protected objects, --- record types and subtypes, private types, task types and subtypes). +-- Defined in all entities that act as scopes to which a list of +-- associated entities is attached. This is defined in all [sub]types, +-- including things like scalars that cannot have nested entities, +-- which makes it more convenient to Mutate_Entity between type kinds. -- Points to a list of associated entities using the Next_Entity field -- as a chain pointer with Empty marking the end of the list. +-- See also Last_Entity. -- First_Exit_Statement -- Defined in E_Loop entity. The exit statements for a loop are chained @@ -3510,12 +3511,8 @@ package Einfo is -- statements whose value is not used. -- Last_Entity --- Defined in all entities which act as scopes to which a list of --- associated entities is attached (blocks, class subtypes and types, --- entries, functions, loops, packages, procedures, protected objects, --- record types and subtypes, private types, task types and subtypes). --- Points to the last entry in the list of associated entities chained --- through the Next_Entity field. Empty if no entities are chained. +-- Defined for the same entity kinds as First_Entity. Last_Entity +-- is the last entry in the list. Empty if no entities are chained. -- Last_Formal (synthesized) -- Applies to subprograms and subprogram types, and also in entries @@ -3538,7 +3535,7 @@ package Einfo is -- field may be set as a result of a linker section pragma applied to the -- type of the object. --- Lit_Hash +-- Lit_Hash [root type only] -- Defined in enumeration types and subtypes. Non-empty only for the -- case of an enumeration root type, where it contains the entity for -- the generated hash function. See unit Exp_Imgv for full details of @@ -4535,11 +4532,9 @@ package Einfo is -- share the same storage pool). -- Stored_Constraint --- Defined in entities that can have discriminants (concurrent types --- subtypes, record types and subtypes, private types and subtypes, --- limited private types and subtypes and incomplete types). Points --- to an element list containing the expressions for each of the --- stored discriminants for the record (sub)type. +-- Defined in type entities. Points to an element list containing the +-- expressions for each of the stored discriminants, if any, for the +-- (sub)type. -- Stores_Attribute_Old_Prefix -- Defined in constants, variables, and types which are created during |