[Spice-devel] [spice-server PATCH v1 2/12] migration_protocol: fix alignment warnings on _MAGIC

Victor Toso victortoso at redhat.com
Wed Aug 5 05:23:16 PDT 2015


from clang:
inputs_channel.c:274:36: error: cast from 'const char *' to 'uint32_t *'
(aka 'unsigned int *') increases required alignment from 1 to 4
[-Werror,-Wcast-align]
    spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_INPUTS_MAGIC);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 server/migration_protocol.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/migration_protocol.h b/server/migration_protocol.h
index fa17c7c..8c5a9bf 100644
--- a/server/migration_protocol.h
+++ b/server/migration_protocol.h
@@ -60,7 +60,7 @@ typedef struct __attribute__ ((__packed__)) SpiceMigrateDataCharDevice {
 
 #define SPICE_MIGRATE_DATA_SPICEVMC_VERSION 1 /* NOTE: increase version when CHAR_DEVICE_VERSION
                                                  is increased */
-#define SPICE_MIGRATE_DATA_SPICEVMC_MAGIC (*(uint32_t *)"SVMD")
+#define SPICE_MIGRATE_DATA_SPICEVMC_MAGIC (*(uint32_t *)(void *)"SVMD")
 typedef struct __attribute__ ((__packed__)) SpiceMigrateDataSpiceVmc {
     SpiceMigrateDataCharDevice base;
 } SpiceMigrateDataSpiceVmc;
@@ -71,7 +71,7 @@ typedef struct __attribute__ ((__packed__)) SpiceMigrateDataSpiceVmc {
 
 #define SPICE_MIGRATE_DATA_SMARTCARD_VERSION 1 /* NOTE: increase version when CHAR_DEVICE_VERSION
                                                   is increased */
-#define SPICE_MIGRATE_DATA_SMARTCARD_MAGIC (*(uint32_t *)"SCMD")
+#define SPICE_MIGRATE_DATA_SMARTCARD_MAGIC (*(uint32_t *)(void *)"SCMD")
 typedef struct __attribute__ ((__packed__)) SpiceMigrateDataSmartcard {
     SpiceMigrateDataCharDevice base;
     uint8_t reader_added;
@@ -84,7 +84,7 @@ typedef struct __attribute__ ((__packed__)) SpiceMigrateDataSmartcard {
  * *********************************/
 #define SPICE_MIGRATE_DATA_MAIN_VERSION 1 /* NOTE: increase version when CHAR_DEVICE_VERSION
                                              is increased */
-#define SPICE_MIGRATE_DATA_MAIN_MAGIC (*(uint32_t *)"MNMD")
+#define SPICE_MIGRATE_DATA_MAIN_MAGIC (*(uint32_t *)(void *)"MNMD")
 
 typedef struct __attribute__ ((__packed__)) SpiceMigrateDataMain {
     SpiceMigrateDataCharDevice agent_base;
@@ -115,7 +115,7 @@ typedef struct __attribute__ ((__packed__)) SpiceMigrateDataMain {
  * ***************/
 
 #define SPICE_MIGRATE_DATA_DISPLAY_VERSION 1
-#define SPICE_MIGRATE_DATA_DISPLAY_MAGIC (*(uint32_t *)"DCMD")
+#define SPICE_MIGRATE_DATA_DISPLAY_MAGIC (*(uint32_t *)(void *)"DCMD")
 
 /*
  * TODO: store the cache and dictionary data only in one channel (the
@@ -187,7 +187,7 @@ typedef struct __attribute__ ((__packed__)) MigrateDisplaySurfacesAtClientLossy
  * ***************/
 
 #define SPICE_MIGRATE_DATA_INPUTS_VERSION 1
-#define SPICE_MIGRATE_DATA_INPUTS_MAGIC (*(uint32_t *)"ICMD")
+#define SPICE_MIGRATE_DATA_INPUTS_MAGIC (*(uint32_t *)(void *)"ICMD")
 
 
 typedef struct __attribute__ ((__packed__)) SpiceMigrateDataInputs {
-- 
2.4.3



More information about the Spice-devel mailing list