Re: RFA: unbreak typedefed bitfield

Tom Tromey
2009-12-21T17:08:49Z

>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:

Volodya> It seems to me that TYPE_LENGTH may return different values before and
Volodya> after check_typedef is called. Is the 'before' value ever or any use?

I don't think so. My understanding is that before check_typedef is
called, TYPE_LENGTH is not guaranteed to be valid.

Volodya> If no, and as you say above in some cases we need to preserve
Volodya> some properties of the typedef, why TYPE_LENGTH could not check
Volodya> if the type is typedef, and if so, return length of the true
Volodya> type?

check_typedef is misnamed and is also used to resolve opaque types.
Other than that, I don't know of a reason.

You could try:

#define TYPE_LENGTH(thistype) check_typedef (thistype)->length

While this is probably insufficient to fix the check_typedef problem in
general, it may help with the most common source of problems.

Tom