Opened 9 years ago

Closed 9 years ago

#9174 closed Bugs (fixed)

Incompatible declaration in interlocked.hpp

Reported by: anikin@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.54.0 Severity: Problem
Keywords: interlocked _InterlockedCompareExchange _InterlockedExchangeAdd Cc:

Description

If I compile boost\detail\interlocked.hpp on MS Visual Studio 2010 using Intel Compiler 14.0 and my project also includes msvc's <intrin.h>, then I get a compiler error of incompatible declarations, because <intrin.h> declares _InterlockedCompareExchange, _InterlockedExchange and _InterlockedExchangeAdd without __cdecl but interlocked.hpp declares them as __cdecl. The issue is solved by stripping __CLRCALL_PURE_OR_CDECL from declarations of these three functions. (And maybe better include the standard <intrin.h> when compiling on MSVC even with Intel compiler)

Change History (5)

comment:1 by viboes, 9 years ago

Is this a duplicate of #8485?

comment:2 by viboes, 9 years ago

Component: threadsmart_ptr
Owner: changed from Anthony Williams to Peter Dimov

comment:3 by Peter Dimov, 9 years ago

It is not possible to determine whether Intel has <intrin.h> as this depends on the underlying MSVC installation, but I've added in [85994] support for #define BOOST_USE_INTRIN_H, which forces interlocked.hpp to unconditionally use intrin.h. This should help in cases where the autodetection is not quite up to par.

comment:4 by Peter Dimov, 9 years ago

(In [86416]) Merged revision(s) 85994 from trunk: Add BOOST_USE_INTRIN_H support; remove #pragma intrinsic, not needed and not supported on Intel. Refs #6646. Refs #7318. Refs #9174.

comment:5 by Peter Dimov, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.