mbox series

[v3,00/19] qom: Use qlit to represent property defaults

Message ID 20201123194818.2773508-1-ehabkost@redhat.com
Headers show
Series qom: Use qlit to represent property defaults | expand


Eduardo Habkost Nov. 23, 2020, 7:47 p.m. UTC
Based-on: 20201104160021.2342108-1-ehabkost@redhat.com
Git branch: https://gitlab.com/ehabkost/qemu/-/commits/work/qdev-qlit-defaults

This extend qlit.h to support all QNum types (signed int,
unsigned int, and double), and use QLitObject to represent field
property defaults.

It allows us to get rid of most type-specific .set_default_value
functions for QOM property types.

The only remaining .set_default_value function in the code is
field_prop_set_default_value_enum().  This will take a bit more
work because the default is currently stored as int, but parsed
as string, so it will be addressed in a separate series.

Changes v2 -> v3:

* qnum/qlit patches:
  * Variable naming in qnum code
  * Coding style changes in qnum code
  * Split "qlit: Support all types of QNums"
    in smaller patches
  * Replace QLIT_QNUM with QLIT_QNUM_INT
  * Extend test cases, move most of the new test case code to
  * Remove qnum_get_value() and qlit_get_type() function
  * Removed kernel-doc conversion patch, to reduce noise in series review
* qom patches:
  * Split "qom: Use qlit to represent property defaults" in
    smaller patches, hopefully making review easier
  * Small changes in UUID property code (See
    "qom: Don't ignore defval on UUID property" and
    "qom: Fix documentation of UUID property type")

Changes v1 -> v2:
* Rebase to latest version of field properties series
* Fix unit test failure
* Coding style changes

Eduardo Habkost (19):
  qnum: Make qnum_get_double() get const pointer
  qnum: Make num_x/num_y variables at qnum_is_equal() const
  qnum: QNumValue type for QNum value literals
  qnum: qnum_value_is_equal() function
  qlit: Use qnum_value_is_equal() when comparing QNums
  qlit: Rename QLIT_QNUM to QLIT_QNUM_INT
  qlit: Use QNumValue to represent QNums
  qlit: Move qlit_equal_qobject() reference values to array
  qlit: Add more test literals to qlit_equal_qobject() test case
  qlit: Support all types of QNums
  qom: field_prop_set_default_value() helper
  qom: Replace defval value in Property with QLitObject
  qom: Fix documentation of UUID property type
  qom: Don't ignore defval on UUID property
  qom: Make object_property_set_default() public
  qom: Make PropertyInfo.set_default_value optional
  qom: Delete field_prop_set_default_value_*int()
  qom: Delete set_default_uuid()
  qom: Delete set_default_value_bool()

 include/hw/qdev-properties-system.h   |   4 +-
 include/qapi/qmp/qlit.h               |  11 ++-
 include/qapi/qmp/qnum.h               |  26 +++++-
 include/qom/field-property-internal.h |   7 +-
 include/qom/field-property.h          |  30 +++----
 include/qom/object.h                  |  11 +++
 include/qom/property-types.h          |  18 ++--
 hw/core/qdev-properties-system.c      |  13 +--
 qobject/qlit.c                        |   5 +-
 qobject/qnum.c                        | 113 ++++++++++++++------------
 qom/field-property.c                  |  36 ++++++--
 qom/object.c                          |   2 +-
 qom/property-types.c                  |  37 ++-------
 tests/check-qjson.c                   |  30 +++----
 tests/check-qlit.c                    |  72 +++++++++++++---
 tests/check-qnum.c                    |  14 ++--
 16 files changed, 253 insertions(+), 176 deletions(-)