[PATCH][4.8] C++ memory model bitfield handling rewrite
Joseph S. Myers
joseph@codesourcery.com
Tue Feb 7 13:28:00 GMT 2012
On Tue, 7 Feb 2012, Richard Guenther wrote:
> If the C frontend would stop using DECL_INITIAL temporarily for
> bitfield FIELD_DECLs we could avoid adding a new member to struct
> tree_field_decl - Joseph, is it possible to avoid using DECL_INITIAL?
C++ does the same thing with DECL_INITIAL so I'd expect that to need to
change as well - Jason? C only needs an integer width within a limited
range; C++ may actually need a general expression here.
C currently uses a TREE_LIST of field declarations when parsing a
structure. It should be reasonably straightforward to change that to a
VEC of structures storing both the declaration and the width, so the width
no longer need go in DECL_INITIAL of the declaration, though it will be
necessary to check for other code using DECL_INITIAL to check for
bit-fields. For example, c-common.c:handle_packed_attribute uses
DECL_INITIAL like that; it should be possible to make both C and C++ set
DECL_C_BIT_FIELD early enough that such DECL_INITIAL checks can be
replaced by a more meaningful DECL_C_BIT_FIELD check.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list