diff mbox series

[06/13] qapi/visit: hide fields in JSON marshalling

Message ID 20250507231442.879619-7-pierrick.bouvier@linaro.org
State New
Headers show
Series single-binary: make QAPI generated files common | expand

Commit Message

Pierrick Bouvier May 7, 2025, 11:14 p.m. UTC
We modify gen_visit_object_members to hide elements based on the
specified conditional.
This allows to hide those elements in input/output json, even though
they still exist in C code.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 scripts/qapi/visit.py | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 36e240967b6..82caf8c5f0b 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -90,6 +90,7 @@  def gen_visit_object_members(name: str,
 
     for memb in members:
         ret += memb.ifcond.gen_if()
+        ret += memb.ifcond.gen_runtime_if()
         if memb.optional:
             has = 'has_' + c_name(memb.name)
             if memb.need_has():
@@ -126,6 +127,7 @@  def gen_visit_object_members(name: str,
             ret += mcgen('''
     }
 ''')
+        ret += memb.ifcond.gen_runtime_endif()
         ret += memb.ifcond.gen_endif()
 
     if branches: