Ada character types : tree code and DW_AT_encoding
James E Wilson
wilson@specifix.com
Thu Aug 11 01:57:00 GMT 2005
Jerome Guitton wrote:
> Two solutions : we can either change the tree code to CHAR_TYPE or add a test
> to detect Ada character types in the INTEGER_TYPE case, like it is done for
> C:
> ...
> The first solution would probably be cleaner, but it would mean that
> Ada would be the only supported langage to use CHAR_TYPE. The second
> one would be safer.
Belatedly following up on this...
Java uses CHAR_TYPE. So Ada would not be the only supported language
using it if you switched to it.
The C support isn't quite right. There is no attempt to handle wchar_t
here, which is obviously a character type. We would need more
exceptions to get this right.
I think it would be better if the language front ends switched to using
CHAR_TYPE for character types. Otherwise the debug output routines need
a lot of code to tell which integer types are actually character types,
and this is going to be hard to get right. It is easier if the language
front ends choose the right type to begin with.
This still may not solve the C front end problem though, as the C
language doesn't actually have distinct character types separate from
integer types. We don't need the C hacks here for gdb, as gdb knows
that single byte integer types are sometimes used for holding
characters. This stuff still might be useful for other debuggers though.
Looking at the gdb code in dwarf2read.c, it looks like the distinction
between DW_ATE_unsigned and DW_ATE_unsigned_char is irrelevant as it
handles them the same. So unless you are planning to do some gdb work,
it doesn't matter which one gcc emits. Or maybe you are using a
different debugger that does care?
--
Jim Wilson, GNU Tools Support, http://www.specifix.com
More information about the Gcc
mailing list