Mark,

Thank you for your answer!

On 11/10/2016 01:38 PM, Mark Wielaard wrote:
IMHO having an explicit DW_AT_type pointing at the base type with size
and encoding for the DW_TAG_enumerator_type is better for consumers than
having to try and interpret the DW_FORM used to encode the values.

I’m curious about why you think this alternative is better for consumers: after all, they always have to interpret the DW_FORM anyway in order to decode the DIE stream. At least this goes against the DWARF standard’s “strong” recommendation: section 7.5.4 Attribute Encodings says:

    If one of the DW_FORM_data<n> forms is used to represent a signed
    or unsigned integer, it can be hard for a consumer to discover the
    context necessary to determine which interpretation is intended.
    Producers are therefore strongly encouraged to use DW_FORM_sdata or
    DW_FORM_udata for signed and unsigned integers respectively, rather
    than DW_FORM_data<n>.

Alternatively could we just attach a DW_AT_encoding to the
DW_TAG_enumeration_type? The spec doesn't list it as one of the
attributes for an enumeration_type, but it makes sense given it already
carries bit/byte size attributes.

I agree it would make sense, but would it be acceptable to enable this even in strict mode? If not, I’d prefer to stick to a solution that would apply everywhere. :-)

--
Pierre-Marie de Rodat

Reply via email to