From a8d6a3ead554108dce28ebe452e952680a684840 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 6 May 2026 08:36:57 -0500 Subject: [PATCH] trace: Have single macros for funcs with annotations Make both a WESTON_TRACE_ANNOTATE_FUNC_FLOW and a WESTON_TRACE_ANNOTATE_FUNC() that do the preamble, add the annotations, and flush it out in a single "statement". Signed-off-by: Derek Foreman --- libweston/surface-state.c | 7 +++---- libweston/weston-trace.h | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libweston/surface-state.c b/libweston/surface-state.c index 3e8765841..633497617 100644 --- a/libweston/surface-state.c +++ b/libweston/surface-state.c @@ -204,10 +204,9 @@ weston_surface_attach(struct weston_surface *surface, struct weston_buffer *old_buffer = surface->buffer_ref.buffer; enum weston_paint_node_status pnode_changes = WESTON_PAINT_NODE_CLEAN; - WESTON_TRACE_BEGIN_ANNOTATION(); - WESTON_TRACE_ANNOTATE(("surface", surface->internal_name), - ("new buffer", buffer)); - WESTON_TRACE_ANNOTATE_FUNC_FLOW(&surface->flow_id); + WESTON_TRACE_ANNOTATE_FUNC_FLOW(&surface->flow_id, + ("surface", surface->internal_name), + ("new buffer", buffer)); if (!buffer) { if (weston_surface_is_mapped(surface)) { diff --git a/libweston/weston-trace.h b/libweston/weston-trace.h index 04637fbd2..e14cc51c5 100644 --- a/libweston/weston-trace.h +++ b/libweston/weston-trace.h @@ -288,10 +288,14 @@ _weston_trace_scope_end(int *scope) #define WESTON_TRACE_COMMIT_ANNOTATION(id) \ _WESTON_TRACE_COMMIT_ANNOTATION(id, __func__) -#define WESTON_TRACE_ANNOTATE_FUNC() \ +#define WESTON_TRACE_ANNOTATE_FUNC(...) \ + WESTON_TRACE_BEGIN_ANNOTATION(); \ + WESTON_TRACE_ANNOTATE(__VA_ARGS__); \ _WESTON_TRACE_ANNOTATE_FUNC(__func__) -#define WESTON_TRACE_ANNOTATE_FUNC_FLOW(id) \ +#define WESTON_TRACE_ANNOTATE_FUNC_FLOW(id, ...) \ + WESTON_TRACE_BEGIN_ANNOTATION(); \ + WESTON_TRACE_ANNOTATE(__VA_ARGS__); \ _WESTON_TRACE_ANNOTATE_FUNC_FLOW(id, __func__) /* Adds a series of annotations of the form '("key string", value)' separated