Skip to contentSkip to conversation

decodetree: Support multiple inclusion

PATCH Applied Philippe Mathieu-Daudé 2 participants 5 messages Nov 10, 2018 – Nov 11, 2018

lore
Share & tools
lore
#0 lore raw

cover decodetree: Support multiple inclusion

Hi Richard, I noticed this issue when using decodetree with multiple ISAs.

Regards,

Phil.

Philippe Mathieu-Daudé (2):
MAINTAINERS: Add scripts/decodetree.py to the TCG section
decodetree: Add multiple include guard

 MAINTAINERS           | 1 +
 scripts/decodetree.py | 5 +++++
 2 files changed, 6 insertions(+)
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/2 MAINTAINERS: Add scripts/decodetree.py to the TCG section

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 126fe0be7e..45e4bfcd87 100644
@@ -112,6 +112,7 @@ S: Maintained
 F: cpus.c
 F: exec.c
 F: accel/tcg/
+F: scripts/decodetree.py
 F: include/exec/cpu*.h
 F: include/exec/exec-all.h
 F: include/exec/helper*.h
Signature · 1 line
2.19.1
#3 lore raw

PATCH 2/2 decodetree: Add multiple include guard

In reply to Philippe Mathieu-Daudé

It is necessary when splitting an ISA, or when using multiple ISAs.

---
 scripts/decodetree.py | 5 +++++
 1 file changed, 5 insertions(+)
scripts/decodetree.py +5 -0
index 0bc73b5990..5dea15e7a5 100755
@@ -1030,7 +1030,11 @@ def main():
     else:
         output_fd = sys.stdout
 
+    hdr_guard = filename.split(os.path.sep)[-1].upper().replace('.', '_') + "_H"
+
     output_autogen()
+    output('#ifndef ' + hdr_guard + '\n')
+    output('#define ' + hdr_guard + '\n')
     for n in sorted(arguments.keys()):
         f = arguments[n]
         f.output_def()
@@ -1066,6 +1070,7 @@ def main():
     t.output_code(4, False, 0, 0)
 
     output('}\n')
+    output('#endif /* ' + hdr_guard + ' */\n')
 
     if output_file:
         output_fd.close()
Signature · 1 line
2.19.1
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] decodetree: Add multiple include guard

Quoted 6 lines · Philippe Mathieu-Daudé

It is necessary when splitting an ISA, or when using multiple ISAs.

---
 scripts/decodetree.py | 5 +++++
 1 file changed, 5 insertions(+)

I guess I have no problems with this, but can you explain when these headers get included more than once?

r~