qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 10/19] qlit: Support all types of QNums


From: Markus Armbruster
Subject: Re: [PATCH v3 10/19] qlit: Support all types of QNums
Date: Tue, 24 Nov 2020 10:55:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Eduardo Habkost <ehabkost@redhat.com> writes:

> Add two new macros to support other types of QNums:
> QLIT_QNUM_UINT, and QLIT_QNUM_DOUBLE, and include them
> in the qlit_equal_qobject_test() test case.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v2 -> v3:
> * QLIT_QNUM macro doesn't exist anymore
> * Addition of the QNumValue field to QLitObject is
>   now in a separate patch ("qlit: Use QNumValue to represent QNums")
> * check-qjson test case changes dropped.
>   Instead, I'm only extending the qlit_equal_qobject_test() test
>   case.
>
> Changes v1 -> v2:
> * Coding style fix at qlit_equal_qobject()
> ---
>  include/qapi/qmp/qlit.h | 4 ++++
>  tests/check-qlit.c      | 5 +++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h
> index a240cdd299..a2881b7f42 100644
> --- a/include/qapi/qmp/qlit.h
> +++ b/include/qapi/qmp/qlit.h
> @@ -42,6 +42,10 @@ struct QLitDictEntry {
>      { .type = QTYPE_QBOOL, .value.qbool = (val) }
>  #define QLIT_QNUM_INT(val) \
>      { .type = QTYPE_QNUM, .value.qnum = QNUM_VAL_INT(val) }
> +#define QLIT_QNUM_UINT(val) \
> +    { .type = QTYPE_QNUM, .value.qnum = QNUM_VAL_UINT(val) }
> +#define QLIT_QNUM_DOUBLE(val) \
> +    { .type = QTYPE_QNUM, .value.qnum = QNUM_VAL_DOUBLE(val) }
>  #define QLIT_QSTR(val) \
>      { .type = QTYPE_QSTRING, .value.qstr = (val) }
>  #define QLIT_QDICT(val) \
> diff --git a/tests/check-qlit.c b/tests/check-qlit.c
> index 5a9260b93f..31e90f8965 100644
> --- a/tests/check-qlit.c
> +++ b/tests/check-qlit.c
> @@ -58,6 +58,11 @@ static void qlit_equal_qobject_test(void)
>          QLIT_QNUM_INT(1),
>          QLIT_QNUM_INT(INT64_MIN),
>          QLIT_QNUM_INT(INT64_MAX),
> +        QLIT_QNUM_UINT(UINT64_MAX),
> +        /* Larger than UINT64_MAX: */
> +        QLIT_QNUM_DOUBLE(18446744073709552e3),
> +        /* Smaller than INT64_MIN: */
> +        QLIT_QNUM_DOUBLE(-92233720368547758e2),

Why "larger than UINT64_MAX" and "smaller than INT64_MIN"?

>          QLIT_QSTR(""),
>          QLIT_QSTR("foo"),
>          qlit,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]