On Sat, 20 Sep 2008 00:12:21 +0200, Joel Brobecker wrote: > > 2008-09-07 Jan Kratochvil > > > > Split two-bit STATIC_KIND to two separate bitfield single bits. > > * gdbtypes.h (struct main_type ): Split to ... > > (struct main_type , ): ... here. > > (FIELD_STATIC_KIND): Split to ... > > (FIELD_BIT0, FIELD_BIT1): ... here. > > (SET_FIELD_BITPOS): New. > > (SET_FIELD_PHYSNAME, SET_FIELD_PHYSADDR, TYPE_FIELD_STATIC) > > (TYPE_FIELD_STATIC_HAS_ADDR): Update for the split. > > (TYPE_FIELD_STATIC_KIND): Remove. > > (TYPE_FIELD_STATIC_HAS_NAME): New. > > * coffread.c, dwarf2read.c, eval.c, gdbtypes.c, mdebugread.c: Update > > throughout. > > It would be interesting to hear what others think, but I don't really > like the idea of splitting the 2-bit static_kind field into two one-bit > fields named bit0 & bit1. I just find it obscures things even more. > > The first goal, as I understand it, is to be able to extend range types > so that the bounds can be DWARF blocks. Here is a thought: Rename the > static_kind field into "field_loc_kind" which would be an enum with > 4 possible values: loc_in_bitpos, loc_in_physaddr, loc_in_physname, > and loc_in_block. Done. Including below reformatted diff to make the changes more related to each other. It already introduces the new field into the loc union: + /* For variable-sized arrays. Passed to DWARF_LOCEXPR_BATON_EVAL. */ + struct dwarf2_locexpr_baton *dwarf_block; as otherwise this change is not much useful. The other way is to implement there enum address_class but I find it as another larger patch to properly separate it out from symbols, drop the `struct symbol_ops *ops' field etc. Thanks, Jan Unsplit patch now at: http://people.redhat.com/jkratoch/vla/fortran-dynamic-arrays-HEAD-b.patch -#define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind) +#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind) -#define TYPE_FIELD_STATIC_KIND(thistype, n) TYPE_MAIN_TYPE (thistype)->fields[n].static_kind +#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n)) -#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind == 2) +#define FIELD_STATIC(thisfld) (FIELD_LOC_KIND (thisfld) == FIELD_LOC_KIND_PHYSNAME || FIELD_LOC_KIND (thisfld) == FIELD_LOC_KIND_PHYSADDR) -#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind != 0) +#define TYPE_FIELD_STATIC(thistype, n) FIELD_STATIC (TYPE_FIELD (thistype, n)) -#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n)) +#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) +#define SET_FIELD_BITPOS(thisfld, bitpos) (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, FIELD_BITPOS (thisfld) = (bitpos)) -#define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr) +#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) -#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n)) +#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) -#define SET_FIELD_PHYSADDR(thisfld, name) ((thisfld).static_kind = 2, FIELD_PHYSADDR(thisfld) = (name)) +#define SET_FIELD_PHYSADDR(thisfld, addr) (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -#define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname) +#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) -#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n)) +#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) -#define SET_FIELD_PHYSNAME(thisfld, name) ((thisfld).static_kind = 1, FIELD_PHYSNAME(thisfld) = (name)) +#define SET_FIELD_PHYSNAME(thisfld, name) (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, FIELD_STATIC_PHYSNAME (thisfld) = (name)) +#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) +#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) +#define SET_FIELD_DWARF_BLOCK(thisfld, addr) (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_DWARF_BLOCK, FIELD_DWARF_BLOCK (thisfld) = (addr))