[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 30/54] qapi: add #if conditions on generated
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v2 30/54] qapi: add #if conditions on generated enum values |
Date: |
Wed, 06 Sep 2017 17:38:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Marc-André Lureau <address@hidden> writes:
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> scripts/qapi.py | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 9c7c01c11d..201e425842 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -1967,13 +1967,16 @@ static const char *const %(c_name)s_array[] = {
> ''',
> c_name=c_name(name))
> for value in values:
> + ifcond = None
I hoped I would see this line in a later patch when I asked for it in my
review of the previous patch :)
> if isinstance(value, tuple):
> value, ifcond = value
> + ret += gen_if(ifcond)
> index = c_enum_const(name, value, prefix)
> ret += mcgen('''
> [%(index)s] = "%(value)s",
> ''',
> index=index, value=value)
> + ret += gen_endif(ifcond)
>
> max_index = c_enum_const(name, '_MAX', prefix)
> ret += mcgen('''
> @@ -1999,12 +2002,15 @@ typedef enum %(c_name)s {
> c_name=c_name(name))
>
> for value in enum_values:
> + ifcond = None
> if isinstance(value, tuple):
> value, ifcond = value
> + ret += gen_if(ifcond)
> ret += mcgen('''
> %(c_enum)s,
> ''',
> c_enum=c_enum_const(name, value, prefix))
> + ret += gen_endif(ifcond)
>
> ret += mcgen('''
> } %(c_name)s;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v2 30/54] qapi: add #if conditions on generated enum values,
Markus Armbruster <=