qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] qapi: Generate QAPI files using qapi/ for generated header paths
@ 2024-08-07  9:34 Philippe Mathieu-Daudé
  2024-08-07  9:44 ` Daniel P. Berrangé
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-08-07  9:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Roth, Daniel P . Berrange, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

QAPI script generates headers under the qapi/ directory,
so use this prefix in generated header paths, keeping
all QAPI under the qapi/ namespace.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Ideally I'd also remove "CPPFLAGS+=-I qapi" in this patch
but I couldn't figure out where meson adds it...
---
 scripts/qapi/commands.py   | 10 +++++-----
 scripts/qapi/events.py     | 10 +++++-----
 scripts/qapi/gen.py        |  2 +-
 scripts/qapi/introspect.py |  2 +-
 scripts/qapi/types.py      |  4 ++--
 scripts/qapi/visit.py      |  4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 79951a841f..07fbd21334 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -323,8 +323,8 @@ def _begin_user_module(self, name: str) -> None:
 #include "qapi/qmp/qdict.h"
 #include "qapi/dealloc-visitor.h"
 #include "qapi/error.h"
-#include "%(visit)s.h"
-#include "%(commands)s.h"
+#include "qapi/%(visit)s.h"
+#include "qapi/%(commands)s.h"
 ''',
                              commands=commands, visit=visit))
 
@@ -338,7 +338,7 @@ def _begin_user_module(self, name: str) -> None:
             # match .underscorify() in trace/meson.build
 
         self._genh.add(mcgen('''
-#include "%(types)s.h"
+#include "qapi/%(types)s.h"
 
 ''',
                              types=types))
@@ -353,8 +353,8 @@ def visit_begin(self, schema: QAPISchema) -> None:
                              c_prefix=c_name(self._prefix, protect=False)))
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqapi-commands.h"
-#include "%(prefix)sqapi-init-commands.h"
+#include "qapi/%(prefix)sqapi-commands.h"
+#include "qapi/%(prefix)sqapi-init-commands.h"
 
 void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds)
 {
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py
index d1f639981a..f3803c8afe 100644
--- a/scripts/qapi/events.py
+++ b/scripts/qapi/events.py
@@ -189,9 +189,9 @@ def _begin_user_module(self, name: str) -> None:
         visit = self._module_basename('qapi-visit', name)
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqapi-emit-events.h"
-#include "%(events)s.h"
-#include "%(visit)s.h"
+#include "qapi/%(prefix)sqapi-emit-events.h"
+#include "qapi/%(events)s.h"
+#include "qapi/%(visit)s.h"
 #include "qapi/compat-policy.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
@@ -201,7 +201,7 @@ def _begin_user_module(self, name: str) -> None:
                              prefix=self._prefix))
         self._genh.add(mcgen('''
 #include "qapi/util.h"
-#include "%(types)s.h"
+#include "qapi/%(types)s.h"
 ''',
                              types=types))
 
@@ -209,7 +209,7 @@ def visit_end(self) -> None:
         self._add_module('./emit', ' * QAPI Events emission')
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqapi-emit-events.h"
+#include "qapi/%(prefix)sqapi-emit-events.h"
 ''',
                                       prefix=self._prefix))
         self._genh.preamble_add(mcgen('''
diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
index 6a8abe0041..d24bd7ba08 100644
--- a/scripts/qapi/gen.py
+++ b/scripts/qapi/gen.py
@@ -363,6 +363,6 @@ def visit_include(self, name: str, info: Optional[QAPISourceInfo]) -> None:
         relname = os.path.relpath(self._module_filename(self._what, name),
                                   os.path.dirname(self._genh.fname))
         self._genh.preamble_add(mcgen('''
-#include "%(relname)s.h"
+#include "qapi/%(relname)s.h"
 ''',
                                       relname=relname))
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index ac14b20f30..7b74db11ed 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -182,7 +182,7 @@ def __init__(self, prefix: str, unmask: bool):
         self._name_map: Dict[str, str] = {}
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqapi-introspect.h"
+#include "qapi/%(prefix)sqapi-introspect.h"
 
 ''',
                              prefix=prefix))
diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
index 0dd0b00ada..19c8c9c18c 100644
--- a/scripts/qapi/types.py
+++ b/scripts/qapi/types.py
@@ -306,8 +306,8 @@ def _begin_user_module(self, name: str) -> None:
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
 #include "qapi/dealloc-visitor.h"
-#include "%(types)s.h"
-#include "%(visit)s.h"
+#include "qapi/%(types)s.h"
+#include "qapi/%(visit)s.h"
 ''',
                                       types=types, visit=visit))
         self._genh.preamble_add(mcgen('''
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index 12f92e429f..06d89504ce 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -359,12 +359,12 @@ def _begin_user_module(self, name: str) -> None:
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "%(visit)s.h"
+#include "qapi/%(visit)s.h"
 ''',
                                       visit=visit))
         self._genh.preamble_add(mcgen('''
 #include "qapi/qapi-builtin-visit.h"
-#include "%(types)s.h"
+#include "qapi/%(types)s.h"
 
 ''',
                                       types=types))
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-08  8:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07  9:34 [RFC PATCH] qapi: Generate QAPI files using qapi/ for generated header paths Philippe Mathieu-Daudé
2024-08-07  9:44 ` Daniel P. Berrangé
2024-08-07 10:50   ` Markus Armbruster
2024-08-07 11:00     ` Daniel P. Berrangé
2024-08-07 11:21       ` Markus Armbruster
2024-08-07 11:25         ` Daniel P. Berrangé
2024-08-07 12:01           ` Markus Armbruster
2024-08-07 12:09             ` Philippe Mathieu-Daudé
2024-08-08  8:53     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).