From c95d5dd96fa50a567b7b203029652bb036ecd3f4 Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Tue, 18 Oct 2022 18:19:07 -0700 Subject: [PATCH] Fix a build error when compiling with clang Fix the following error: roctx.cpp:91:25: error: reinterpret_cast from 'const void *' to 'decltype(report_activity.load())' (aka 'int (*)(activity_domain_t, unsigned int, void *)') casts away qualifiers report_activity.store(reinterpret_cast(function), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ by replacing the 'const void *function' argument with the correct type. Change-Id: I912239daf6f4a3f00fc753306b84833e5c75f74b --- src/roctx/roctx.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/roctx/roctx.cpp b/src/roctx/roctx.cpp index c7baf57a32..b039e9ee5c 100644 --- a/src/roctx/roctx.cpp +++ b/src/roctx/roctx.cpp @@ -87,7 +87,8 @@ ROCTX_API void roctxRangeStop(roctx_range_id_t range_id) { ReportActivity(ROCTX_API_ID_roctxRangeStop, nullptr, range_id); } -extern "C" ROCTX_EXPORT void roctxRegisterTracerCallback(const void* function) { - report_activity.store(reinterpret_cast(function), - std::memory_order_relaxed); +extern "C" ROCTX_EXPORT void roctxRegisterTracerCallback(int (*function)(activity_domain_t domain, + uint32_t operation_id, + void* data)) { + report_activity.store(function, std::memory_order_relaxed); }