decodetree: Produce clean output for an empty input file

This is interesting for bisection, where an output file is plumbed,
but does not yet have patterns.

Backports commit 82bfac1c06cadeb5c7252734dc695d951185916c from qemu
This commit is contained in:
Richard Henderson 2019-03-13 11:19:21 -04:00 committed by Lioncash
parent 190ee1657b
commit e18e116ce5
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1185,15 +1185,15 @@ def main():
'(DisasContext *ctx, ', insntype, ' insn)\n{\n') '(DisasContext *ctx, ', insntype, ' insn)\n{\n')
i4 = str_indent(4) i4 = str_indent(4)
output(i4, 'union {\n') if len(allpatterns) != 0:
for n in sorted(arguments.keys()): output(i4, 'union {\n')
f = arguments[n] for n in sorted(arguments.keys()):
output(i4, i4, f.struct_name(), ' f_', f.name, ';\n') f = arguments[n]
output(i4, '} u;\n\n') output(i4, i4, f.struct_name(), ' f_', f.name, ';\n')
output(i4, '} u;\n\n')
t.output_code(4, False, 0, 0)
t.output_code(4, False, 0, 0)
output(i4, 'return false;\n') output(i4, 'return false;\n')
output('}\n') output('}\n')
if output_file: if output_file: