001018.1 | A | R. Brender | Representation | Unspecified type |
PROPOSAL
--------
Add a DIE for an unspecified type declaration. The following text is
suggested as a new section:
5.14 Unspecified Type
<i>Some languages have constructs in which a type may be left
unspecified or the absence of a type can be explicitly
indicated.</i>
An unspecified (implicit, unknown, ambiguous or nonexistent) type
is represented by a debugging information entry with the tag
DW_TAG_unspecified_type. If a name has been given to the type, then
the corresponding unspecified type entry has a DW_AT_name attribute
whose value is a null-terminated string containing the name.
<i>The interpretation of this debugging information entry
is intentionally left flexible to allow it to be interpreted
appropriately in different languages. For example, in C and C++
the language implementation can provide an unspecified type entry
with the name "void" which can be referenced by the type
attribute
of pointer types and typedef declarations for 'void' (see
Sections 5.2 and 5.3, respectively). As another example, in Ada
such an unspecified type entry can be referred to by the type
attribute of an access type where the denoted type is incomplete
(the name is declared as a type but the definition is deferred to
a separate compilation unit).</i>
DISCUSSION
----------
DWARF requires that DW_TAG_pointer_type have a DW_AT_type attribute
that refers to the DIE for the pointee type. However, without a concrete
DWARF representation for type void, it is unclear how to achieve this
for the C type 'void *'.
Similarly, DWARF requires that DW_TAG_typedef have a DW_AT_type attribute
that refers to the DIE of the type being given another name. However,
without a concrete DWARF representation for type void, it is unclear
how to achieve this for a declaration such as 'typedef void MyVoid;'.
Various other alternatives have been suggested and debated, but none
seems able to win consensus (see the many e-mails over the last four
months that include "void *" in their title).
This proposal meets the needs for a concrete representation of 'void'
and requires no incompatible change to DWARF.