From ad513ca332d38bba8d70a537c5d791c13cce109f Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 18 Feb 2018 10:24:54 +0100 Subject: [PATCH] Fix warning in TBB --- .../src/tbb/tools_api/ittnotify_static.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bundled/tbb41_20130401oss/src/tbb/tools_api/ittnotify_static.c b/bundled/tbb41_20130401oss/src/tbb/tools_api/ittnotify_static.c index 462cc6f911..096794022e 100644 --- a/bundled/tbb41_20130401oss/src/tbb/tools_api/ittnotify_static.c +++ b/bundled/tbb41_20130401oss/src/tbb/tools_api/ittnotify_static.c @@ -277,14 +277,13 @@ ITT_EXTERN_C void _N_(error_handler)(__itt_error_code, va_list args); #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */ #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ -static void __itt_report_error(__itt_error_code code, ...) -{ +static void __itt_report_error_impl(int code, ...) { va_list args; va_start(args, code); if (__itt_ittapi_global.error_handler != NULL) { - __itt_error_handler_t* handler = (__itt_error_handler_t*)__itt_ittapi_global.error_handler; - handler(code, args); + __itt_error_handler_t* handler = (__itt_error_handler_t*)(size_t)__itt_ittapi_global.error_handler; + handler((__itt_error_code)code, args); } #ifdef ITT_NOTIFY_EXT_REPORT _N_(error_handler)(code, args); @@ -292,6 +291,11 @@ static void __itt_report_error(__itt_error_code code, ...) va_end(args); } +//va_start cannot take enum (__itt_error_code) on clang, so it is necessary to transform it to int +#define __itt_report_error(code, ...) \ + __itt_report_error_impl((int)code,__VA_ARGS__) + + #if ITT_PLATFORM==ITT_PLATFORM_WIN #pragma warning(pop) #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ -- 2.39.5