cvs commit: src/sys/sys queue.h
Joseph Koshy
jkoshy at FreeBSD.ORG
Sat Mar 4 07:42:59 PST 2006
> mux 2006-03-03 18:54:33 UTC
>
> FreeBSD src repository
>
> Modified files:
> sys/sys queue.h
> Log:
> Cast the pointer to void * before casting it back to struct type * in
> STAILQ_LAST. This quiets a warning from GCC about increased required
> alignment for the cast.
>
> Idea from: cognet
Doesn't this trade a compile time warning for a runtime fault on those
architectures where alignment matters?
Which code triggers this warning?
274 #define STAILQ_LAST(head, type, field) \
275 (STAILQ_EMPTY((head)) ? \
276 NULL : \
277 ((struct type *) \
278 ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
I can't see how this code would trigger a warning in normal usage.
Regards,
Koshy
<jkoshy at freebsd.org>
More information about the cvs-src
mailing list