On Tue, Aug 28, 2012 at 11:59:34PM -0700, Jeremy Sequoia wrote: > On 08/28/12, Peter Hutterer <[email protected]> wrote: > > > > -#define __container_of(ptr, sample, member) > > > \ > > > - (void *)((char *)(ptr) > > > \ > > > - - ((char *)&(sample)->member - (char *)(sample))) > > > +#define __container_of(ptr, sample, member) \ > > > + container_of(ptr, typeof(*sample), member) > > > > typeof is a gcc extension/c99 and I don't think we support that yet, do we? > > > I thought we were expecting C99 nowadays. CCing Alan since I think he knows > the answer to that and can chime in re: SunCC. > > > In any event, typeof is in *a* standard whereas the previous implementation > is undefined (and can lead to crashes on startup). I'd vote for doing > something that is in a 13 year old standard over something that has undefined > behavior. > > > If there is concern over this breaking gcc-3.2 or some ancient compiler, I'm > happy to update it to use $ifdef guarding. At minimum, I'd like to get this > changed for __clang__ before 1.13 ships.
right, except for the typeof it's a Reviewed-by: Peter Hutterer <[email protected]>, so whatever Alan and Keith are happy with, I guess. Cheers, Peter _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
