aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2015-07-17 17:02:07 +0100
committerWill Deacon <will.deacon@arm.com>2015-07-20 18:25:47 +0100
commit15542bab78ec91a6ccf03d4fedd165c8867c22da (patch)
treeaaa7de593c2197c749bd1f74c412253cb69dacc0
parent43d2781c273192b678b090f3e3c31edfbaeca54d (diff)
downloadkvmtool-15542bab78ec91a6ccf03d4fedd165c8867c22da.tar.gz
avoid casts when initializing structures
Due to our kernel heritage we have code in kvmtool that relies on the (still) implicit -std=gnu89 compiler switch. It turns out that this just affects some structure initialization, where we currently provide a cast to the type, which upsets GCC for anything beyond -std=gnu89 (for instance gnu99 or gnu11). We do need the casts when initializing structures that are not assigned to the same type, so we put it there explicitly. This allows us to compile with all the three GNU standards GCC currently supports: gnu89/90, gnu99 and gnu11. GCC threatens people with moving to gnu11 as the new default standard, so lets fix this better sooner than later. (Compiling without GNU extensions still breaks and I don't bother to fix that without very good reasons.) Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--disk/qcow.c6
-rw-r--r--include/kvm/mutex.h2
-rw-r--r--include/linux/rbtree.h2
-rw-r--r--virtio/9p.c2
-rw-r--r--virtio/balloon.c2
-rw-r--r--virtio/blk.c2
-rw-r--r--virtio/console.c2
-rw-r--r--virtio/net.c2
-rw-r--r--virtio/rng.c2
-rw-r--r--virtio/scsi.c2
10 files changed, 12 insertions, 12 deletions
diff --git a/disk/qcow.c b/disk/qcow.c
index 64a25509..e26c4192 100644
--- a/disk/qcow.c
+++ b/disk/qcow.c
@@ -1203,7 +1203,7 @@ static int qcow_read_refcount_table(struct qcow *q)
if (!rft->rf_table)
return -1;
- rft->root = RB_ROOT;
+ rft->root = (struct rb_root) RB_ROOT;
INIT_LIST_HEAD(&rft->lru_list);
return pread_in_full(q->fd, rft->rf_table, sizeof(u64) * rft->rf_size, header->refcount_table_offset);
@@ -1289,7 +1289,7 @@ static struct disk_image *qcow2_probe(int fd, bool readonly)
l1t = &q->table;
- l1t->root = RB_ROOT;
+ l1t->root = (struct rb_root) RB_ROOT;
INIT_LIST_HEAD(&l1t->lru_list);
h = q->header = qcow2_read_header(fd);
@@ -1435,7 +1435,7 @@ static struct disk_image *qcow1_probe(int fd, bool readonly)
l1t = &q->table;
- l1t->root = RB_ROOT;
+ l1t->root = (struct rb_root)RB_ROOT;
INIT_LIST_HEAD(&l1t->lru_list);
h = q->header = qcow1_read_header(fd);
diff --git a/include/kvm/mutex.h b/include/kvm/mutex.h
index a90584b9..1f7d0f69 100644
--- a/include/kvm/mutex.h
+++ b/include/kvm/mutex.h
@@ -13,7 +13,7 @@
struct mutex {
pthread_mutex_t mutex;
};
-#define MUTEX_INITIALIZER (struct mutex) { .mutex = PTHREAD_MUTEX_INITIALIZER }
+#define MUTEX_INITIALIZER { .mutex = PTHREAD_MUTEX_INITIALIZER }
#define DEFINE_MUTEX(mtx) struct mutex mtx = MUTEX_INITIALIZER
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index fb31765e..33adf780 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -46,7 +46,7 @@ struct rb_root {
#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
-#define RB_ROOT (struct rb_root) { NULL, }
+#define RB_ROOT { NULL, }
#define rb_entry(ptr, type, member) container_of(ptr, type, member)
#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
diff --git a/virtio/9p.c b/virtio/9p.c
index 66dcc26b..49e7c5ce 100644
--- a/virtio/9p.c
+++ b/virtio/9p.c
@@ -1320,7 +1320,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-struct virtio_ops p9_dev_virtio_ops = (struct virtio_ops) {
+struct virtio_ops p9_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
diff --git a/virtio/balloon.c b/virtio/balloon.c
index 84c4bb06..9564aa39 100644
--- a/virtio/balloon.c
+++ b/virtio/balloon.c
@@ -239,7 +239,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-struct virtio_ops bln_dev_virtio_ops = (struct virtio_ops) {
+struct virtio_ops bln_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
diff --git a/virtio/blk.c b/virtio/blk.c
index edfa8e60..c485e4fc 100644
--- a/virtio/blk.c
+++ b/virtio/blk.c
@@ -244,7 +244,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-static struct virtio_ops blk_dev_virtio_ops = (struct virtio_ops) {
+static struct virtio_ops blk_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
diff --git a/virtio/console.c b/virtio/console.c
index 384eac15..f1c0a190 100644
--- a/virtio/console.c
+++ b/virtio/console.c
@@ -197,7 +197,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-static struct virtio_ops con_dev_virtio_ops = (struct virtio_ops) {
+static struct virtio_ops con_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
diff --git a/virtio/net.c b/virtio/net.c
index 97845203..4a6a8558 100644
--- a/virtio/net.c
+++ b/virtio/net.c
@@ -624,7 +624,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-static struct virtio_ops net_dev_virtio_ops = (struct virtio_ops) {
+static struct virtio_ops net_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
diff --git a/virtio/rng.c b/virtio/rng.c
index 8031368a..9b9e1283 100644
--- a/virtio/rng.c
+++ b/virtio/rng.c
@@ -141,7 +141,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-static struct virtio_ops rng_dev_virtio_ops = (struct virtio_ops) {
+static struct virtio_ops rng_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
diff --git a/virtio/scsi.c b/virtio/scsi.c
index be254f30..58d2353a 100644
--- a/virtio/scsi.c
+++ b/virtio/scsi.c
@@ -167,7 +167,7 @@ static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
return size;
}
-static struct virtio_ops scsi_dev_virtio_ops = (struct virtio_ops) {
+static struct virtio_ops scsi_dev_virtio_ops = {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,