From 689cf79625ddecebad34486f347a8320602d3846 Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Tue, 25 Oct 2016 14:18:55 -0700 Subject: [PATCH 1/2] Correct cast for _InterlockedExchangeAdd on ICC A bug in ICC improperly identified the first parameter as "void*" rather than the proper "volatile long*". This is scheduled to be fixed in ICC in a future release. This patch casts only to a "long*" to preserve backwards compatibility with the ICC 16 and ICC 17 releases. --- modules/core/include/opencv2/core/cvdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index bfacd22f62..a4c1fc11f8 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -420,7 +420,7 @@ Cv64suf; #if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32) // atomic increment on the linux version of the Intel(tm) compiler -# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd(const_cast(reinterpret_cast(addr)), delta) +# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd(const_cast(reinterpret_cast(addr)), delta) #elif defined __GNUC__ # if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__) # ifdef __ATOMIC_ACQ_REL From ad6af6b9e449269c7881e40399bc01de99c81d4a Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Wed, 26 Oct 2016 09:37:25 -0700 Subject: [PATCH 2/2] Remove Intel Specific CV_XADD Definition Intel supports __atomic_fetch_add, so it isn't necessary to use a specific version otherwise. --- modules/core/include/opencv2/core/cvdef.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index a4c1fc11f8..e71c25a9b5 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -418,10 +418,7 @@ Cv64suf; * exchange-add operation for atomic operations on reference counters * \****************************************************************************************/ -#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32) - // atomic increment on the linux version of the Intel(tm) compiler -# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd(const_cast(reinterpret_cast(addr)), delta) -#elif defined __GNUC__ +#if defined __GNUC__ # if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__) # ifdef __ATOMIC_ACQ_REL # define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)