Re: [PATCH 07/16] gdb: convert type instance flags to bitfields
Tom Tromey <[email protected]> Tue, 21 Jul 2026 13:13:34 -0600
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
>>>>> Tankut Baris Aktemur <[email protected]> writes: > Convert the instance flags of a type to a struct with bitfields. This > helps avoid bitwise operations and instead refer to the fields by > name. In particular, Harvard address space information (i.e. code > space and data space) and address class information become enum values > instead of being handled by seemingly independent bits. Thanks. I like this direction. I have a couple minor questions. > + type_instance_flags &operator|= (const type_instance_flags &other) > + { ... > + harvard_aspace > + = static_cast<harvard_address_space> (harvard_aspace > + | other.harvard_aspace); > + address_class = address_class | other.address_class; These two assignments in particular don't really make sense to me. Perhaps they should assert that the relevant member of 'this' is 0? > @@ -1593,7 +1616,7 @@ struct type > instance flags are completely inherited from the target type. No > qualifiers can be cleared by the typedef. See also > check_typedef. */ > - unsigned m_instance_flags : 9; > + type_instance_flags m_instance_flags; I would guess this increases the size of 'struct type'. I don't think it's a big deal, but I'm curious about it. Tom