On Mon, Oct 05, 2026 at 01:08:47PM +0100, Daniel P. Berrangé wrote:
> Each backend generates the same trace_event_get_state_dynamic_by_id()
> call for the TRACE....DSTATE() macro body, so when multiple backends
> are enabled, the same check is repeated:
>
> #define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
> QEMU_TEST_WIBBLE_ENABLED() || \
> trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
> trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
> trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
> trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
> tracepoint_enabled(qemu, test_wibble) || \
> false)
>
> Expanding the use of the 'backend.check_trace_event_get_state'
> attr in the C header generator removes the duplication, in the
> same way that the Rust generator already does.
>
> Signed-off-by: Daniel P. Berrangé <[email protected]>
> ---
> +++ b/scripts/tracetool/backend/__init__.py
> @@ -133,8 +133,8 @@ def generate_begin(self, events, group):
> def generate(self, event, group, check_trace_event_get_state=None):
> self._run_function("generate_%s", event, group,
> check_trace_event_get_state=check_trace_event_get_state)
>
> - def generate_backend_dstate(self, event, group):
> - self._run_function("generate_%s_backend_dstate", event, group)
> + def generate_backend_dstate(self, event, group,
> check_trace_event_get_state=None):
> + self._run_function("generate_%s_backend_dstate", event, group,
> check_trace_event_get_state=check_trace_event_get_state)
I guess we don't care about long lines in python the way we do in C.
If a lint check flags it, the fix is trivial; otherwise I'm fine with
it as is.
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org