]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ada-lang.c
treat identical enum types as the same type
authorJoel Brobecker <brobecker@gnat.com>
Fri, 1 Jul 2011 18:26:50 +0000 (18:26 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Fri, 1 Jul 2011 18:26:50 +0000 (18:26 +0000)
commit8f17729f21e54827ba8de614be382c4fbd6b690f
tree92add7a0018deb53f1793f0ea2d22f4fc38fd14d
parentf5aa6869dee6874a9d1a3a386b1d5893f0ac46d4
treat identical enum types as the same type

This is to avoid an unnecessary multiple-choice menu for an
expression involving an enumeral declared in two types, when
the second type is an identical copy of the first type. This
happens in the following situation:

       type Color is (Black, Red, Green, Blue, White);
       type RGB_Color is new Color range Red .. Blue;

In that case, an implict type is created, and is used as the base
type for type RGB_Color.  This base type is a copy of type Color.
We've added some extensive comments explaining the situation and
our approach further.

gdb/ChangeLog:

        * ada-lang.c (ada_identical_enum_types_p): New function.
        (symbols_are_identical_enums): New function.
        (remove_extra_symbols): Do nothing if NSYMS < 2.
        Use symbols_are_identical_enums.

gdb/testsuite/ChangeLog:

        * gdb.ada/same_enum: New testcase.
gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/same_enum.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/same_enum/a.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/same_enum/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/same_enum/pck.ads [new file with mode: 0644]