+2019-05-03 Tom Tromey <tromey@adacore.com>
+
+ * ada-exp.y (convert_char_literal): Check suffix of each
+ enumerator.
+
2019-05-03 Dilyan Palauzov <dilyan.palauzov@aegee.org>
PR ada/21406:
return val;
xsnprintf (name, sizeof (name), "QU%02x", (int) val);
+ size_t len = strlen (name);
for (f = 0; f < TYPE_NFIELDS (type); f += 1)
{
- if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0)
+ /* Check the suffix because an enum constant in a package will
+ have a name like "pkg__QUxx". This is safe enough because we
+ already have the correct type, and because mangling means
+ there can't be clashes. */
+ const char *ename = TYPE_FIELD_NAME (type, f);
+ size_t elen = strlen (ename);
+
+ if (elen >= len && strcmp (name, ename + elen - len) == 0)
return TYPE_FIELD_ENUMVAL (type, f);
}
return val;
+2019-05-03 Tom Tromey <tromey@adacore.com>
+
+ * gdb.ada/char_enum/pck.ads (Global_Enum_Type): New type.
+ * gdb.ada/char_enum/foo.adb: Use Global_Enum_Type.
+ * gdb.ada/char_enum.exp: Add test.
+
2019-05-03 Tom de Vries <tdevries@suse.de>
* boards/cc-with-gdb-index.exp: New file.
procedure Foo is
type Char_Enum_Type is ('A', 'B', 'C', 'D', 'E');
Char : Char_Enum_Type := 'D';
+ Gchar : Global_Enum_Type := 'Z';
begin
Do_Nothing (Char'Address); -- STOP
end Foo;