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
..
2024-05-03 15:47:48 +02:00
2023-12-19 19:03:38 +01:00
2023-09-15 13:57:00 +00:00
2023-05-23 15:20:15 +08:00
2020-12-10 12:15:18 -05:00
2023-02-10 14:12:06 +01:00
2024-01-10 06:58:50 +00:00
2017-10-16 20:57:13 +03:00
2020-10-15 16:06:27 +02:00
2023-09-06 11:19:33 +02:00
2022-12-20 17:09:41 -08:00
2023-08-31 19:47:43 +02:00
2019-09-11 08:46:17 +02:00
2023-04-24 11:29:00 +02:00
2020-12-10 17:16:44 +01:00
2024-06-21 09:47:22 -03:00
2024-06-24 10:15:04 +01:00
2018-09-26 08:55:54 -07:00
2019-04-18 22:18:59 +02:00
2024-01-30 21:20:20 +03:00
2024-06-24 23:15:30 +02:00
2023-04-27 16:39:43 +02:00
2018-08-24 20:26:37 +02:00
2023-02-08 07:27:20 +01:00