This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/RFA] Cleaner handling of character entities ?


On Fri, May 05, 2006 at 02:47:00PM -0700, Jim Blandy wrote:
> 
> Daniel Jacobowitz <drow@false.org> writes:
> > On Fri, May 05, 2006 at 12:40:02PM -0700, Jim Blandy wrote:
> >> 
> >> Joel Brobecker <brobecker@adacore.com> writes:
> >> > We would be left with:
> >> >
> >> >         * dwarf2read.c (read_base_type): Set code to TYPE_CODE_CHAR
> >> >         for char and unsigned char types of Ada compilation units.
> >> >         * ada-lang.c (ada_is_character_type): Always return true if
> >> >         the type code is TYPE_CODE_CHAR.
> >> >
> >> > Would that be OK?
> >> 
> >> Yeah, I think that sounds like the right thing.
> >
> > Alternatively, do we think we ought to be using TYPE_CODE_CHAR, and if
> > so, should we try it?
> 
> If we do that, we're effectively signing up to go through GDB and make
> CHAR cases behave more like the INT cases.  Which makes that code less
> likely to work properly in languages that really do distinguish the
> two.

Or more likely to work properly.  Because C does not treat them the
same, the TYPE_CODE_CHAR case is fairly likely to be bitrotten anyway.

> I think we should reserve the TYPE_CODE_INT / TYPE_CODE_CHAR
> distinction for use in source languages that really make the
> distinction, and let languages where characters are just another kind
> of integer use TYPE_CODE_INT for everything.

Anyway, this is fine by me.  However, in tdep files, we don't want to
make language distinctions.  So, Joel, I think that a patch along the
lines of that changelog entry above is probably the way to go, but then
you may want to audit uses of TYPE_CODE_INT and TYPE_CODE_CHAR in
backends or else calling Ada procedures which take chars may not work
well.

[Sounds like a new testcase, doesn't it?]

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]