[Dwarf-discuss] 2.12.1, Non-defining Declarations

Jim Blandy jimb
Tue May 17 16:21:19 GMT 2005


David Anderson <davea at quasar.engr.sgi.com> writes:
> >Maybe I'm missing something, but it looks like
> >it says that if this DIE for a non-defining declaration,
> >then it has the DW_AT_declaration attribute.
> >
> >Presumably if it's not a non-defining declaration,
> >it doesn't have the DW_AT_declaration attribute.
> >
> >So why does the attribute need a flag value?  Isn't
> >having the attribute enough?
> 
> 
> No it is not enough. If the flag value is 0, then the attribute is considered
> missing (in a sense: hope using this missing word is not simply
> confusing).    If the flag value is zero then is as if
> DW_AT_declaration were not there (another way to put it).

John does have a point, though, in that the wording in the spec
doesn't really reflect that:

    2.12.2 Non-Defining Declarations

    Debugging information entries that represent non-defining or otherwise
    incomplete declarations of a program entity have a DW_AT_declaration
    attribute, whose value is a flag.

Without context, I'd read that to mean that the mere presence of the
attribute indicates that the entry represents a non-defining
declaration.  Something like this would be more explicit:

    If a debugging information entry has a DW_AT_declaration attribute
    whose value is a true flag, then the entry represents a
    non-defining or otherwise incomplete declaration of a program
    entity.





More information about the Dwarf-discuss mailing list