[vlc-commits] [Git][videolan/vlc][master] tracer: add tracing C++ helpers
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Sep 23 16:33:50 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
efdeec7a by Alaric Senat at 2026-09-23T16:24:57+00:00
tracer: add tracing C++ helpers
Including the tracer API from C++ modules won't compile. Taking adress
of temporary values is invalid in C++, this code also assumes the
compiler support designated initializers, which is not always the case
until c++20.
Introduce small C++ specialized helpers with simple variadic
templating instead.
- - - - -
1 changed file:
- include/vlc_tracer.h
Changes:
=====================================
include/vlc_tracer.h
=====================================
@@ -242,6 +242,30 @@ static inline struct vlc_tracer_entry VLC_TRACE(const char *key, const char *val
#define VLC_TRACE_TICK_NS(key, tick) VLC_TRACE((key), NS_FROM_VLC_TICK((tick)))
+#ifdef __cplusplus
+#undef vlc_tracer_TraceWithTs
+#undef vlc_tracer_Trace
+
+template<typename... Entries>
+static inline void vlc_tracer_TraceWithTs(struct vlc_tracer *tracer,
+ vlc_tick_t ts,
+ struct vlc_tracer_entry first,
+ Entries... rest)
+{
+ const struct vlc_tracer_entry arr[] = { first, rest... };
+ const struct vlc_tracer_trace trace = { arr };
+ vlc_tracer_TraceWithTs(tracer, ts, &trace);
+}
+
+template<typename... Entries>
+static inline void vlc_tracer_Trace(struct vlc_tracer *tracer,
+ struct vlc_tracer_entry first,
+ Entries... rest)
+{
+ vlc_tracer_TraceWithTs(tracer, vlc_tick_now(), first, rest...);
+}
+#endif
+
/**
* @}
*
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/efdeec7a3321e00849a4c907265e1b23edba18ee
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/efdeec7a3321e00849a4c907265e1b23edba18ee
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list