[PATCHv2 2/2] gdb/python: add Type.signedness attribute
Tom Tromey
tom@tromey.com
Wed Dec 8 16:56:51 GMT 2021
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> Yet, the DWARF reader does:
Simon> if (type->code () == TYPE_CODE_INT
Simon> && name != nullptr
Simon> && strcmp (name, "char") == 0)
Simon> type->set_has_no_signedness (true);
Simon> I'd like to know the rationale for this, it doesn't make sense to me.
I think the intent is to mirror C semantics, where 'char' in one sense
is signed or unsigned -- it may or may not sign-extend during promotion
-- but is also officially different from both 'signed char' and
'unsigned char'. This weird quirk normally doesn't matter, but does
affect overload resolution. I looked for uses of this flag, and
overload (and the compile feature) are the spots where it seems to be
used.
Possible the Python API shouldn't bother with this, or there should be
some separate thing for the "is this the C char type" case, because
AFAIK that's the only such "signless" case anywhere.
Tom
More information about the Gdb-patches
mailing list