* [PATCH] utils: fix -Wcast-align warnings on sparc
@ 2014-04-09 14:51 Patrick McHardy
0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2014-04-09 14:51 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/utils.h b/include/utils.h
index 854986f..88ee0c9 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -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))
--
1.9.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-09 14:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-09 14:51 [PATCH] utils: fix -Wcast-align warnings on sparc Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).