Re: [RFA] New dwarf2_attribute_true_p function in dwarf2read.c

Joel Brobecker
2004-04-16T16:18:07Z

> Sorry, this patch is incorrect.

Ah, sorry, you're right, I wasn't paying enough attention.
I have backed the change out for the time being, pending rework.

> > - return (dwarf2_attr (die, DW_AT_declaration, cu)
> > - && ! dwarf2_attr (die, DW_AT_specification, cu));
> > + /* A DIE is a declaration if it has a DW_AT_declaration attribute
> > + which value is non-zero. However, we have to be careful of DIEs
> > + with a DW_AT_specification attribute, because dwarf2_attribute_p()
> > + follows this attribute, and therefore might cause us to find a
> > + DW_AT_declaration attribute, but that belongs to a different DIE. */
> > + return (dwarf2_attribute_true_p (die, DW_AT_declaration, cu)
> > + && ! dwarf2_attribute_true_p (die, DW_AT_specification, cu));
> > }
> >
> > /* Return the die giving the specification for DIE, if there is
>
> First of all, there's no dwarf2_attribute_p, you mean dwarf2_attr and
> dwarf2_attr_true_p.
>
> Secondly, the predicate function should be used for flag attributes
> like DW_AT_declaration, but checking DW_UNSND for DW_AT_specification
> is incorrect - it's a DIE reference. dwarf2_attr != NULL is the right
> check. Some day I hope to add checking macros to verify we're using
> the right member of each union...

I will send a new patch right away.

Thanks Daniel.
--
Joel