@@ -378,13 +384,18 @@
'typename': 'str',
'*alias-of' : 'str',
'deprecated' : 'bool' },
- 'if': { 'any': [ 'TARGET_PPC',
- 'TARGET_ARM',
- 'TARGET_I386',
- 'TARGET_S390X',
- 'TARGET_MIPS',
- 'TARGET_LOONGARCH64',
- 'TARGET_RISCV' ] } }
+ 'runtime_if': { 'any': [ 'target_ppc()',
+ 'target_ppc64()',
+ 'target_arm()',
+ 'target_aarch64()',
+ 'target_i386()',
+ 'target_x86_64()',
+ 'target_s390x()',
+ 'target_mips()',
+ 'target_mips64()',
+ 'target_loongarch64()',
+ 'target_riscv32()',
+ 'target_riscv64()' ] } }
@@ -272,7 +272,7 @@
{ 'command': 'query-sev-attestation-report',
'data': { 'mnonce': 'str' },
'returns': 'SevAttestationReport',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
##
# @GICCapability:
@@ -297,7 +297,7 @@
'data': { 'version': 'int',
'emulated': 'bool',
'kernel': 'bool' },
- 'if': 'TARGET_ARM' }
+ 'runtime_if': { 'any': [ 'target_arm()', 'target_aarch64()' ] } }
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 5ae26395964..f31f28ecb10 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -638,7 +638,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
if meta == 'enum':
check_keys(expr, info, meta,
- ['enum', 'data'], ['if', 'features', 'prefix'])
+ ['enum', 'data'], ['if', 'runtime_if', 'features',
+ 'prefix'])
check_enum(expr)
elif meta == 'union':
check_keys(expr, info, meta,
@@ -654,7 +655,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
check_alternate(expr)
elif meta == 'struct':
check_keys(expr, info, meta,
- ['struct', 'data'], ['base', 'if', 'features'])
+ ['struct', 'data'], ['base', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr['data'])
check_struct(expr)
elif meta == 'command':
@@ -667,7 +669,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
check_command(expr)
elif meta == 'event':
check_keys(expr, info, meta,
- ['event'], ['data', 'boxed', 'if', 'features'])
+ ['event'], ['data', 'boxed', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr.get('data'))
check_event(expr)
else: