From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Michael Roth" <michael.roth@amd.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [RFC PATCH] qapi: Generate QAPI files using qapi/ for generated header paths
Date: Wed, 7 Aug 2024 11:34:06 +0200 [thread overview]
Message-ID: <20240807093406.40360-1-philmd@linaro.org> (raw)
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
next reply other threads:[~2024-08-07 9:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 9:34 Philippe Mathieu-Daudé [this message]
2024-08-07 9:44 ` [RFC PATCH] qapi: Generate QAPI files using qapi/ for generated header paths 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240807093406.40360-1-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).