target: Simplify type checks for CpuModelInfo member @props
commitef6783d3f7d06cf185971afbb30ff35209e9db49
authorMarkus Armbruster <armbru@redhat.com>
Tue, 5 Mar 2024 14:59:15 +0000 (5 15:59 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 12 Mar 2024 12:54:01 +0000 (12 13:54 +0100)
tree68d527ae4a59964330e76b1b615c57fab6c65e1a
parent05ec974671200814fa5c1d5db710e0e4b88a40af
target: Simplify type checks for CpuModelInfo member @props

CpuModelInfo member @props is semantically a mapping from name to
value, and syntactically a JSON object on the wire.  This translates
to QDict in C.  Since the QAPI schema language lacks the means to
express 'object', we use 'any' instead.  This is QObject in C.
Commands taking a CpuModelInfo argument need to check the QObject is a
QDict.

For arm, riscv, and s390x, the code checks right before passing the
QObject to visit_start_struct().  visit_start_struct() then checks
again.

Delete the first check.

The error message for @props that are not an object changes slightly
to the the message we get for this kind of type error in other
contexts.  Minor improvement.

Additionally, error messages about members of @props now refer to
'props.prop-name' instead of just 'prop-name'.  Another minor
improvement.

Both changes are visible in tests/qtest/arm-cpu-features.c.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240305145919.2186971-2-armbru@redhat.com>
Acked-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
[Drop #include now superfluous]
target/arm/arm-qmp-cmds.c
target/riscv/riscv-qmp-cmds.c
target/s390x/cpu_models_sysemu.c
tests/qtest/arm-cpu-features.c