On sparc, GCC would issue the following warning for every use of
CONTAINER_OF:
warning: cast increases required alignment of target type
This is a false positive: assuming that the data structure that it is
applied to was allocated properly, the use of CONTAINER_OF to reach it is
valid. And if it was not allocated properly, then code that accesses it
other ways will have trouble too.
/* Given POINTER, the address of the given MEMBER in a STRUCT object, returns
the STRUCT object. */
#define CONTAINER_OF(POINTER, STRUCT, MEMBER) \
- ((STRUCT *) ((char *) (POINTER) - offsetof (STRUCT, MEMBER)))
+ ((STRUCT *) (void *) ((char *) (POINTER) - offsetof (STRUCT, MEMBER)))
#ifdef __cplusplus
extern "C" {