]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Improve 'Val implementation for some enumeration types
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 9 Jan 2020 15:25:39 +0000 (16:25 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 3 Jun 2020 10:01:37 +0000 (06:01 -0400)
commit79e267f9fb23da4e9553a97dc45ea757545cf521
tree4db89173cb6248ef10d3e68f46313581d9f95d13
parent075116992690d6f29530a0a7f08cf2f7d5652a93
[Ada] Improve 'Val implementation for some enumeration types

2020-06-03  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* einfo.ads (Enum_Pos_To_Rep): Adjust description.
* exp_attr.adb (Expand_N_Attribute_Reference) <Pred>:
Reimplement in the case of an enumeration type with non-standard
but contiguous representation.
<Succ>: Likewise.
<Val>: Likewise.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Count the
literals in the first loop.  If the representation is
contiguous, just build the index type of the array type and set
Enum_Pos_To_Rep to it.
gcc/ada/einfo.ads
gcc/ada/exp_attr.adb
gcc/ada/exp_ch3.adb