mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
util/perf: fix multiple tracepoints in a scope
Fixes "../src/util/perf/cpu_trace.h:32:8: error: redefinition of ‘_mesa_trace_scope___LINE__’" This should work until someone wants multiple MESA_TRACE_SCOPE on the same line :) Acked-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18260>
This commit is contained in:
parent
022cd156d4
commit
3163e637f4
1 changed files with 14 additions and 3 deletions
|
|
@ -28,9 +28,20 @@
|
|||
|
||||
#if __has_attribute(cleanup) && __has_attribute(unused)
|
||||
|
||||
#define MESA_TRACE_SCOPE(name) \
|
||||
int _mesa_trace_scope_##__LINE__ \
|
||||
__attribute__((cleanup(mesa_trace_scope_end), unused)) = \
|
||||
#define _MESA_TRACE_SCOPE_VAR_CONCAT(name, suffix) name##suffix
|
||||
#define _MESA_TRACE_SCOPE_VAR(suffix) \
|
||||
_MESA_TRACE_SCOPE_VAR_CONCAT(_mesa_trace_scope_, suffix)
|
||||
|
||||
/* This must expand to a single non-scoped statement for
|
||||
*
|
||||
* if (cond)
|
||||
* MESA_TRACE_SCOPE(...)
|
||||
*
|
||||
* to work.
|
||||
*/
|
||||
#define MESA_TRACE_SCOPE(name) \
|
||||
int _MESA_TRACE_SCOPE_VAR(__LINE__) \
|
||||
__attribute__((cleanup(mesa_trace_scope_end), unused)) = \
|
||||
mesa_trace_scope_begin(name)
|
||||
|
||||
static inline int
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue