tree.h (DECL_FIELD_OFFSET, [...]): Fix comments to reflect actual behavior and relati...
authorSandra Loosemore <sandra@codesourcery.com>
Sun, 1 Oct 2006 23:38:08 +0000 (19:38 -0400)
committerSandra Loosemore <sandra@gcc.gnu.org>
Sun, 1 Oct 2006 23:38:08 +0000 (19:38 -0400)
2006-10-01  Sandra Loosemore  <sandra@codesourcery.com>

* gcc/tree.h (DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET):  Fix
comments to reflect actual behavior and relationship between
DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET, and DECL_OFFSET_ALIGN.

* gcc/doc/c-tree.texi (Working with declarations): Fix documentation
of FIELD_DECL likewise.

From-SVN: r117352

gcc/ChangeLog
gcc/doc/c-tree.texi
gcc/tree.h

index e957ecb4f9e89028fc7248c2393e91479a8312f7..14e3af7981c93fdfa9aec6dc36c1bc8192e02257 100644 (file)
@@ -1,3 +1,12 @@
+2006-10-01  Sandra Loosemore  <sandra@codesourcery.com>
+
+       * tree.h (DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET):  Fix
+       comments to reflect actual behavior and relationship between
+       DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET, and DECL_OFFSET_ALIGN.
+
+       * doc/c-tree.texi (Working with declarations): Fix documentation
+       of FIELD_DECL likewise.
+
 2006-10-01  Ryan Mansfield  <rmansfield@qnx.com>
 
        PR c/20533
index 06dcc82fe2335a2df9040ce7bf5b68e57d4676cd..bc4d9b67fa80ee0ce2582a09401505c10531b760 100644 (file)
@@ -967,12 +967,20 @@ ordinary type might be @code{short} while the @code{DECL_ARG_TYPE} is
 
 @item FIELD_DECL
 These nodes represent non-static data members.  The @code{DECL_SIZE} and
-@code{DECL_ALIGN} behave as for @code{VAR_DECL} nodes.  The
-@code{DECL_FIELD_BITPOS} gives the first bit used for this field, as an
-@code{INTEGER_CST}.  These values are indexed from zero, where zero
-indicates the first bit in the object.
-
-If @code{DECL_C_BIT_FIELD} holds, this field is a bit-field.
+@code{DECL_ALIGN} behave as for @code{VAR_DECL} nodes.  
+The position of the field within the parent record is specified by a 
+combination of three attributes.  @code{DECL_FIELD_OFFSET} is the position,
+counting in bytes, of the @code{DECL_OFFSET_ALIGN}-bit sized word containing
+the bit of the field closest to the beginning of the structure.  
+@code{DECL_FIELD_BIT_OFFSET} is the bit offset of the first bit of the field
+within this word; this may be nonzero even for fields that are not bit-fields,
+since @code{DECL_OFFSET_ALIGN} may be greater than the natural alignment
+of the field's type.
+
+If @code{DECL_C_BIT_FIELD} holds, this field is a bit-field.  In a bit-field,
+@code{DECL_BIT_FIELD_TYPE} also contains the type that was originally
+specified for it, while DECL_TYPE may be a modified type with lesser precision,
+according to the size of the bit field.
 
 @item NAMESPACE_DECL
 @xref{Namespaces}.
index 72a8e46bd033866493d4d0f65c2aee1fe937aed6..c2ea4798a5947123c7fd07f1f9105e71d3ab2d1c 100644 (file)
@@ -2648,11 +2648,14 @@ struct tree_decl_with_rtl GTY(())
 };
 
 /* In a FIELD_DECL, this is the field position, counting in bytes, of the
-   byte containing the bit closest to the beginning of the structure.  */
+   DECL_OFFSET_ALIGN-bit-sized word containing the bit closest to the beginning
+   of the structure.  */
 #define DECL_FIELD_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.offset)
 
 /* In a FIELD_DECL, this is the offset, in bits, of the first bit of the
-   field from DECL_FIELD_OFFSET.  */
+   field from DECL_FIELD_OFFSET.  This field may be nonzero even for fields
+   that are not bit fields (since DECL_OFFSET_ALIGN may be larger than the
+   natural alignment of the field's type).  */
 #define DECL_FIELD_BIT_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.bit_offset)
 
 /* In a FIELD_DECL, this indicates whether the field was a bit-field and