qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 30/54] qapi: add #if conditions on generated enum


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH v2 30/54] qapi: add #if conditions on generated enum values
Date: Tue, 22 Aug 2017 15:22:31 +0200

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
         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;
-- 
2.14.1.146.gd35faa819




reply via email to

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