]> git.proxmox.com Git - mirror_qemu.git/commitdiff
decodetree: Produce clean output for an empty input file
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 28 Feb 2019 05:37:32 +0000 (21:37 -0800)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 12 Mar 2019 16:46:58 +0000 (09:46 -0700)
This is interesting for bisection, where an output file is plumbed,
but does not yet have patterns.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
scripts/decodetree.py

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