Issue 140327.1: Clarify DW_AT_byte_size usage with DW_TAG_enumeration

Author: Mark Wielaard
Champion: Ron Brender
Date submitted: 2014-03-27
Date revised:
Date closed:
Type: Clarification
Status: Accepted
DWARF Version: 5
Section 5.7, pg 96

If the DW_TAG_enumeration has a DW_AT_type to indicate the underlying base type 
of this enumeration, and that type has a size itself, then the DW_AT_byte_size is 
optional.  This is not immediately clear from the text of the standard and some 
consumers might not realize that they can get the size of the enumeration from its 
underlying type if DW_AT_byte_size isn't given.

The following clarification is suggested:

In 5.7 Enumeration Type Entries.
Move the last sentence of the third paragraph reading "This entry also has a 
DW_AT_byte_size attribute whose integer constant value is the number of bytes 
required to hold an instance of the enumeration." to the end of the next paragraph
"The enumeration type entry may have a DW_AT_type attribute which refers to the 
underlying data type used to implement the enumeration." Rephrase it a little to 
indicate it is optional. And add a sentence that explains the size may also be 
gotten from the underlying type. So that the fourth paragraph would read:

"The enumeration type entry may have a DW_AT_type attribute which refers to the 
underlying data type used to implement the enumeration. The entry also may have 
a DW_AT_byte_size attribute whose integer constant value is the number of bytes 
required to hold an instance of the enumeration. If no DW_AT_byte_size attribute 
is given the size for holding an instance of the enumeration is given by the size 
of the DW_AT_type underlying data type."

--
5/14/2014 -- Accepted.