This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA:] PR objc/6107, libobjc/objc/objc-api.h: Make protocols_listcount size_t, 64-bit big-endians


Hans-Peter Nilsson wrote:
> 
> What I did was step through the code building up the types of
> _OBJC_CLASS_PROTOCOLS_MyObject and _OBJC_CLASS_METHODS_MyObject
> (generate_protocol_list and build_method_list_template
> respectively), hoping to find the best fix.  Evidently,
> build_method_list_template *does* make its "count" member a
> proper int, with the surrounding type as a RECORD_TYPE (and the
> varying part an ARRAY_REF), letting the generic data-output
> machinery emit it right.  In contrast, generate_protocol_list
> creates an ARRAY_REF for the whole thing, with the count thrown
> in as one of the elements.  Thus "count" is made the size of the
> other elements; pointers.  I don't understand the reasons for
> the record/array difference, but I don't really have a reason to
> doubt correctness besides the bug at hand.  (Besides, I'm not
> good at trees.)

Personally, I think the count should be 32 bits, because programs
aren't likely to have even a billion protocols, so you're wasting
4 bytes.  On the other hand, people using 64-bit systems are
used to wasting space everywhere :-), and maybe there would be
an alignment advantage, so let's go with using size_t for the
count.

(The use of an array rather than a record type looks like a
sloppiness to me; objc-act.c code should mirror the .h types
exactly.)

> Ok for trunk and 3.1 branch?

Yes, thanks.

Stan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]