summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Toso <victortoso@redhat.com>2015-08-14 18:24:23 +0200
committerFrediano Ziglio <fziglio@redhat.com>2015-08-20 11:05:19 +0100
commit39be7a8fce1c062a59590517bdab5e75a2d6028f (patch)
tree282cc5ea42eebeb68612c952f93cf181d88ce7bd
parentfa19ebb83f29bfc6fa011239d5fff172282bfe55 (diff)
downloadspice-protocol-39be7a8fce1c062a59590517bdab5e75a2d6028f.tar.gz
spice-protocol-39be7a8fce1c062a59590517bdab5e75a2d6028f.tar.xz
spice-protocol-39be7a8fce1c062a59590517bdab5e75a2d6028f.zip
macros: fix alignment issue reported by clang
char_device.c:131:52: warning: cast from 'uint8_t *' (aka 'unsigned char *') to 'SpiceCharDeviceMsgToClientItem *' (aka 'struct SpiceCharDeviceMsgToClientItem *') increases required alignment from 1 to 8 [-Wcast-align] SpiceCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item, ^~~~~~~~~~~~~~~~~~~~~~~ ../spice-common/spice-protocol/spice/macros.h:142:6: note: expanded from macro 'SPICE_CONTAINEROF' ((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-rw-r--r--spice/macros.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/spice/macros.h b/spice/macros.h
index 034caf7..29cdf82 100644
--- a/spice/macros.h
+++ b/spice/macros.h
@@ -140,7 +140,7 @@
#endif
#define SPICE_CONTAINEROF(ptr, struct_type, member) \
- ((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member)))
+ ((struct_type *)(void *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member)))
#define SPICE_MEMBER_P(struct_p, struct_offset) \
((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset)))