Skip to contentSkip to conversation

migration: Fix compilation with older compilers

PATCH In review Juan Quintela 2 participants 3 messages Jun 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 migration: Fix compilation with older compilers

That typedefs are needed on both files. New compilers (F25 where I work) don't complain about repeating a typedef. But older ones complain.

---
 include/migration/register.h | 3 ---
 include/migration/vmstate.h  | 1 -
 include/qemu/typedefs.h      | 2 ++
 3 files changed, 2 insertions(+), 4 deletions(-)
include/migration/register.h +0 -3
index 717c617..d9498d9 100644
@@ -14,9 +14,6 @@
 #ifndef MIGRATION_REGISTER_H
 #define MIGRATION_REGISTER_H
 
-typedef void SaveStateHandler(QEMUFile *f, void *opaque);
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
-
 typedef struct SaveVMHandlers {
     /* This runs inside the iothread lock.  */
     SaveStateHandler *save_state;
include/migration/vmstate.h +0 -1
index f3f3c2a..e85fbd8 100644
@@ -29,7 +29,6 @@
 
 #include "migration/qjson.h"
 
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 typedef struct VMStateInfo VMStateInfo;
 typedef struct VMStateDescription VMStateDescription;
 typedef struct VMStateField VMStateField;
include/qemu/typedefs.h +2 -0
index 51958bf..f745d5f 100644
@@ -96,5 +96,7 @@ typedef struct uWireSlave uWireSlave;
 typedef struct VirtIODevice VirtIODevice;
 typedef struct Visitor Visitor;
 typedef struct node_info NodeInfo;
+typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
 #endif /* QEMU_TYPEDEFS_H */
Signature · 1 line
2.9.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · On Wed, 14 Jun 2017 10:34:34 +0200 Juan Quintela <[email protected]> wrote:

That typedefs are needed on both files. New compilers (F25 where I

Only LoadStateHandler is actually needed by both files but I guess it is ok to keep these typedefs together.

Quoted 48 lines

work) don't complain about repeating a typedef. But older ones complain.

---
 include/migration/register.h | 3 ---
 include/migration/vmstate.h  | 1 -
 include/qemu/typedefs.h      | 2 ++
 3 files changed, 2 insertions(+), 4 deletions(-)
include/migration/register.h +0 -3
index 717c617..d9498d9 100644
@@ -14,9 +14,6 @@
 #ifndef MIGRATION_REGISTER_H
 #define MIGRATION_REGISTER_H
 
-typedef void SaveStateHandler(QEMUFile *f, void *opaque);
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
-
 typedef struct SaveVMHandlers {
     /* This runs inside the iothread lock.  */
     SaveStateHandler *save_state;
include/migration/vmstate.h +0 -1
index f3f3c2a..e85fbd8 100644
@@ -29,7 +29,6 @@
 
 #include "migration/qjson.h"
 
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 typedef struct VMStateInfo VMStateInfo;
 typedef struct VMStateDescription VMStateDescription;
 typedef struct VMStateField VMStateField;
include/qemu/typedefs.h +2 -0
index 51958bf..f745d5f 100644
@@ -96,5 +96,7 @@ typedef struct uWireSlave uWireSlave;
 typedef struct VirtIODevice VirtIODevice;
 typedef struct Visitor Visitor;
 typedef struct node_info NodeInfo;
+typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
 #endif /* QEMU_TYPEDEFS_H */
#2 lore raw
Quoted 7 lines · Greg Kurz
Quoted 1 line · On Wed, 14 Jun 2017 10:34:34 +0200 Juan Quintela <[email protected]> wrote:

That typedefs are needed on both files. New compilers (F25 where I

Only LoadStateHandler is actually needed by both files but I guess it is ok to keep these typedefs together.

Yeap. Sorry for the confusing message. I wanted to have them together. As you said, only the Load one is needed.

In due curse, register.h file should be removed, but that is not going to happen soon.

Quoted 51 lines
Quoted 48 lines

work) don't complain about repeating a typedef. But older ones complain.

---
 include/migration/register.h | 3 ---
 include/migration/vmstate.h  | 1 -
 include/qemu/typedefs.h      | 2 ++
 3 files changed, 2 insertions(+), 4 deletions(-)
include/migration/register.h +0 -3
index 717c617..d9498d9 100644
@@ -14,9 +14,6 @@
 #ifndef MIGRATION_REGISTER_H
 #define MIGRATION_REGISTER_H
 
-typedef void SaveStateHandler(QEMUFile *f, void *opaque);
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
-
 typedef struct SaveVMHandlers {
     /* This runs inside the iothread lock.  */
     SaveStateHandler *save_state;
include/migration/vmstate.h +0 -1
index f3f3c2a..e85fbd8 100644
@@ -29,7 +29,6 @@
 
 #include "migration/qjson.h"
 
-typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 typedef struct VMStateInfo VMStateInfo;
 typedef struct VMStateDescription VMStateDescription;
 typedef struct VMStateField VMStateField;
include/qemu/typedefs.h +2 -0
index 51958bf..f745d5f 100644
@@ -96,5 +96,7 @@ typedef struct uWireSlave uWireSlave;
 typedef struct VirtIODevice VirtIODevice;
 typedef struct Visitor Visitor;
 typedef struct node_info NodeInfo;
+typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
 #endif /* QEMU_TYPEDEFS_H */