Re: [PATCH 16/20] Change is_valid_DW_AT_defaulted to a method on attribute

Tom Tromey
2020-04-04T14:23:33Z

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> + if (form_is_constant ())
>> + complaint (_("unrecognized DW_AT_defaulted value (%s)"),
>> + plongest (value));
>> + return DW_DEFAULTED_no;

Simon> I don't quite understand the logic here, we check
Simon> form_is_constant after having called constant_value? If the form
Simon> is not a constant, shouldn't we emit a warning to that effect
Simon> (and return _no)?

In this case the complaint is issued by constant_value. This avoids
duplicate complaints. I will make a note to this effect.

>> + /* Return the value as one of the recognized enum
>> + dwarf_defaulted_attribute constants according to DWARF5 spec,
>> + Table 7.24. If the value is incorrect, or if this attribute has
>> + the wrong form, then a complaint is issued and DW_DEFAULTED_no is
>> + returned. */
>> + dwarf_defaulted_attribute defaulted () const;
>> +

Simon> There's an extra empty line here, might as well remove it.

I often leave space between the methods and the data members, but I
suppose I don't really care that much.

It would be better to add "private:" but that requires another round of
patching.

Tom