mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST
Now that all of the Property arrays are counted, we can remove the terminator object from each array. Update the assertions in device_class_set_props to match. With struct Property being 88 bytes, this was a rather large form of terminator. Saves 30k from qemu-system-aarch64. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Lei Yang <leiyang@redhat.com> Link: https://lore.kernel.org/r/20241218134251.4724-21-richard.henderson@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
ebe9685f12
commit
5fcabe628b
556 changed files with 7 additions and 624 deletions
|
@ -941,22 +941,22 @@ char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
|
|||
/**
|
||||
* device_class_set_props(): add a set of properties to an device
|
||||
* @dc: the parent DeviceClass all devices inherit
|
||||
* @props: an array of properties, terminate by DEFINE_PROP_END_OF_LIST()
|
||||
* @props: an array of properties
|
||||
*
|
||||
* This will add a set of properties to the object. It will fault if
|
||||
* you attempt to add an existing property defined by a parent class.
|
||||
* To modify an inherited property you need to use????
|
||||
*
|
||||
* Validate that @props has at least one Property plus the terminator.
|
||||
* Validate that @props has at least one Property.
|
||||
* Validate that @props is an array, not a pointer, via ARRAY_SIZE.
|
||||
* Validate that the array is terminated at compile-time (with -O2),
|
||||
* which requires the array to be const.
|
||||
* Validate that the array does not have a legacy terminator at compile-time;
|
||||
* requires -O2 and the array to be const.
|
||||
*/
|
||||
#define device_class_set_props(dc, props) \
|
||||
do { \
|
||||
QEMU_BUILD_BUG_ON(sizeof(props) == 0); \
|
||||
size_t props_count_ = ARRAY_SIZE(props) - 1; \
|
||||
if ((props)[props_count_].name != NULL) { \
|
||||
size_t props_count_ = ARRAY_SIZE(props); \
|
||||
if ((props)[props_count_ - 1].name == NULL) { \
|
||||
qemu_build_not_reached(); \
|
||||
} \
|
||||
device_class_set_props_n((dc), (props), props_count_); \
|
||||
|
@ -965,7 +965,7 @@ char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
|
|||
/**
|
||||
* device_class_set_props_n(): add a set of properties to an device
|
||||
* @dc: the parent DeviceClass all devices inherit
|
||||
* @props: an array of properties, not terminated by DEFINE_PROP_END_OF_LIST.
|
||||
* @props: an array of properties
|
||||
* @n: ARRAY_SIZE(@props)
|
||||
*
|
||||
* This will add a set of properties to the object. It will fault if
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue