]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Compare unqualified names in ada_identical_enum_types_p
authorTom Tromey <tromey@adacore.com>
Mon, 26 Aug 2024 18:54:17 +0000 (12:54 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 6 Mar 2025 21:17:17 +0000 (14:17 -0700)
commit7eccd2e407890a554ffc64d015ba82b7fdf941c4
tree6fd7a2114b8e65a0e5fa229143a89c922516b9f0
parenta8551849716c2b29e59547212e3aa69b8f4e2ad8
Compare unqualified names in ada_identical_enum_types_p

With the coming changes to GNAT, gdb must compare the unqualified
names of two enum types.

Currently, GNAT will fully-qualify enumeration constant names, so for
instance one might see "enum_with_gap__lit4" as the name.

GNAT also may emit a copy of an enumeration type when a newtype is
involved.  E.g., in the arr_acc_idx_w_gap.exp test case, this can
occur for the base type of this subtype:

   type Enum_Subrange is new Enum_With_Gaps range Lit1 .. Lit3;

(Note that the base type of this subrange is anonymous.)

With some forthcoming changes to GNAT, these names will no longer be
qualified -- and because the newtype is anonymous, they can't be
identically qualified.  But, in gdb we still want "lit4" to resolve
without ambiguity in this scenario.

The fix is to change ada_identical_enum_types_p to compare unqualified
enum names.  This will work correctly with both variants of the
compiler, and with -fgnat-encodings=all as well.
gdb/ada-lang.c