27.01.2022 10:24, Markus Armbruster wrote:
Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> writes:

Add trace generation disabled by default and new option --gen-trace to
enable it.  The next commit will enable it for qapi/, but not for qga/
and tests/.  Making it work for the latter two would involve some Meson
hackery to ensure we generate the trace-events files before trace-tool
uses them.  Since we don't actually support tracing there, we'll bypass
that problem.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>
---
  scripts/qapi/commands.py | 91 +++++++++++++++++++++++++++++++++++-----
  scripts/qapi/main.py     | 14 +++++--
  2 files changed, 91 insertions(+), 14 deletions(-)

diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 17e5ed2414..fa90b6246b 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py

[...]

@@ -265,6 +319,17 @@ def _begin_user_module(self, name: str) -> None:
''',
                               commands=commands, visit=visit))
+
+        if self._gen_tracing and commands != 'qapi-commands':
+            self._genc.add(mcgen('''
+#include "trace/trace-qapi.h"

I believe this include is superfluous.

No objections to drop it


+#include "qapi/qmp/qjson.h"
+#include "trace/trace-%(nm)s_trace_events.h"
+''',
+                                 nm=c_name(commands, protect=False)))
+            # We use c_name(commands, protect=False) to turn '-' into '_', to
+            # match .underscorify() in trace/meson.build
+
          self._genh.add(mcgen('''
  #include "%(types)s.h"

[...]



--
Best regards,
Vladimir

Reply via email to