]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
utils: fix -Wcast-align warnings on sparc
authorPatrick McHardy <kaber@trash.net>
Wed, 9 Apr 2014 14:51:21 +0000 (16:51 +0200)
committerPatrick McHardy <kaber@trash.net>
Wed, 9 Apr 2014 14:51:21 +0000 (16:51 +0200)
The cast to char * in the container_of() marcro causes warnings for all
list iteration helpers on sparc:

warning: cast increases required alignment of target type [-Wcast-align]

Fix by using a void * for address calculations.

Signed-off-by: Patrick McHardy <kaber@trash.net>
include/utils.h

index 854986f2db45db206f604dfb2edd1d415fe2a807..88ee0c9ca91a4e32ee1d3f740e01497a31001e72 100644 (file)
@@ -44,7 +44,7 @@
 
 #define container_of(ptr, type, member) ({                     \
        typeof( ((type *)0)->member ) *__mptr = (ptr);          \
-       (type *)( (char *)__mptr - offsetof(type,member) );})
+       (type *)( (void *)__mptr - offsetof(type,member) );})
 
 #define field_sizeof(t, f)     (sizeof(((t *)NULL)->f))
 #define array_size(arr)                (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))