diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-07 20:36:08 +0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-06-20 14:31:32 +0200 |
commit | 76318657a803c542cdee232c8507dec8004e2478 (patch) | |
tree | 9695ca941d9ed5a9fbacc0903a2e86ce832a6839 /include | |
parent | 85bbd1e7a4aea4c6d4d636d300c3f405afa98285 (diff) | |
download | qemu-76318657a803c542cdee232c8507dec8004e2478.zip qemu-76318657a803c542cdee232c8507dec8004e2478.tar.gz qemu-76318657a803c542cdee232c8507dec8004e2478.tar.bz2 |
qdev: wrap default property value in an union
Wrap the Property default value (an int64_t) in a union, to prepare
for the next patch adding a uint64_t.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170607163635.17635-17-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/qdev-core.h | 4 | ||||
-rw-r--r-- | include/hw/qdev-properties.h | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 9523339..784971b 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -226,7 +226,9 @@ struct Property { PropertyInfo *info; ptrdiff_t offset; uint8_t bitnr; - int64_t defval; + union { + int64_t i; + } defval; int arrayoffset; PropertyInfo *arrayinfo; int arrayfieldsize; diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0560380..34524d0 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -42,7 +42,7 @@ extern PropertyInfo qdev_prop_arraylen; .info = &(_prop), \ .offset = offsetof(_state, _field) \ + type_check(_type,typeof_field(_state, _field)), \ - .defval = (_type)_defval, \ + .defval.i = (_type)_defval, \ } #define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) { \ .name = (_name), \ @@ -50,7 +50,7 @@ extern PropertyInfo qdev_prop_arraylen; .bitnr = (_bit), \ .offset = offsetof(_state, _field) \ + type_check(uint32_t,typeof_field(_state, _field)), \ - .defval = (bool)_defval, \ + .defval.i = (bool)_defval, \ } #define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) { \ .name = (_name), \ @@ -58,7 +58,7 @@ extern PropertyInfo qdev_prop_arraylen; .bitnr = (_bit), \ .offset = offsetof(_state, _field) \ + type_check(uint64_t, typeof_field(_state, _field)), \ - .defval = (bool)_defval, \ + .defval.i = (bool)_defval, \ } #define DEFINE_PROP_BOOL(_name, _state, _field, _defval) { \ @@ -66,7 +66,7 @@ extern PropertyInfo qdev_prop_arraylen; .info = &(qdev_prop_bool), \ .offset = offsetof(_state, _field) \ + type_check(bool, typeof_field(_state, _field)), \ - .defval = (bool)_defval, \ + .defval.i = (bool)_defval, \ } #define PROP_ARRAY_LEN_PREFIX "len-" |