qemu/include/qapi
Paolo Bonzini eb350d1d01 include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH()
The typeof_strip_qual() is most useful for the atomic fetch-and-modify
operations in atomic.h, but it can be used elsewhere as well.  For example,
QAPI_LIST_LENGTH() assumes that the argument is not const, which is not a
requirement.

Move the macro to compiler.h and, while at it, move it under #ifndef
__cplusplus to emphasize that it uses C-only constructs.  A C++ version
of typeof_strip_qual() using type traits is possible[1], but beyond the
scope of this patch because the little C++ code that is in QEMU does not
use QAPI.

The patch was tested by changing the declaration of strv_from_str_list()
in qapi/qapi-type-helpers.c to:

    char **strv_from_str_list(const strList *const list)

This is valid C code, and it fails to compile without this change.

[1] https://lore.kernel.org/qemu-devel/20240624205647.112034-1-flwu@google.com/

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Tested-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-06-28 14:44:52 +02:00
..
qmp qerror: QERR_QGA_COMMAND_FAILED is no longer used, drop 2024-05-27 13:00:12 +02:00
clone-visitor.h qapi: Do not cast function pointers 2024-05-29 12:41:56 +02:00
compat-policy.h qapi: Factor out compat_policy_input_ok() 2021-10-29 21:27:20 +02:00
dealloc-visitor.h
error.h error: Add error_vprepend() in comment of ERRP_GUARD() rules 2024-03-12 11:45:33 +01:00
forward-visitor.h qapi: introduce forwarding visitor 2021-07-23 18:17:17 +02:00
opts-visitor.h
qmp-event.h
qobject-input-visitor.h qapi: Move compat policy from QObject to generic visitor 2021-10-27 17:19:15 +02:00
qobject-output-visitor.h qapi: Move compat policy from QObject to generic visitor 2021-10-27 17:19:15 +02:00
string-input-visitor.h
string-output-visitor.h string-output-visitor: show structs as "<omitted>" 2023-12-21 22:49:28 +01:00
type-helpers.h qapi: New strv_from_str_list() 2024-03-04 07:12:40 +01:00
util.h include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH() 2024-06-28 14:44:52 +02:00
visitor-impl.h qapi: Generalize struct member policy checking 2021-10-29 18:23:09 +02:00
visitor.h qapi: Fix dangling references to docs/devel/qapi-code-gen.txt 2024-01-26 07:04:53 +01:00