Signed-off-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
---
 scripts/qapi/commands.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 79142273828..7b172f7c081 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -27,6 +27,7 @@
     build_params,
     gen_features,
     ifcontext,
+    runtime_ifcontext,
 )
 from .schema import (
     QAPISchema,
@@ -406,9 +407,10 @@ def visit_command(self,
                 self._gen_trace_events.add(gen_trace(name))
         with self._temp_module('./init'):
             with ifcontext(ifcond, self._genh, self._genc):
-                self._genc.add(gen_register_command(
-                    name, features, success_response, allow_oob,
-                    allow_preconfig, coroutine))
+                with runtime_ifcontext(ifcond, self._genh, self._genc):
+                    self._genc.add(gen_register_command(
+                        name, features, success_response, allow_oob,
+                        allow_preconfig, coroutine))
 
 
 def gen_commands(schema: QAPISchema,
-- 
2.47.2


Reply via email to