diff mbox series

[PULL,09/12] decodetree: Produce clean output for an empty input file

Message ID 20190312170334.14005-10-richard.henderson@linaro.org
State Accepted
Commit 82bfac1c06cadeb5c7252734dc695d951185916c
Headers show
Series decodetree patches | expand

Commit Message

Richard Henderson March 12, 2019, 5:03 p.m. UTC
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 | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

-- 
2.17.2
diff mbox series

Patch

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 6067e940ab..6e7ba278be 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -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)
+    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: