diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-29 08:48:53 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-29 08:52:02 (GMT) |
commit | 7bc17b5b9ff9f2e3e04f36fec8ccbb546d9b7a31 (patch) | |
tree | ac23b0ae9f4ebba6671dfd06d274bdf8488b7dc5 /src | |
parent | f67bc13bc8e2d2c76d7d9f12abb1dbda85abe337 (diff) | |
download | Qt-7bc17b5b9ff9f2e3e04f36fec8ccbb546d9b7a31.zip Qt-7bc17b5b9ff9f2e3e04f36fec8ccbb546d9b7a31.tar.gz Qt-7bc17b5b9ff9f2e3e04f36fec8ccbb546d9b7a31.tar.bz2 |
Fixed build issues with MSVC
in atomic operations, we declare Interlock... functions in the namespace
That can confuse the compiler because they are also declared in another
header outside the namespace.
Same problem in clucene where we include windows.h from within the NS.
Task-number: 254214
Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/arch/qatomic_windows.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h index ac26b4f..5135575 100644 --- a/src/corelib/arch/qatomic_windows.h +++ b/src/corelib/arch/qatomic_windows.h @@ -220,6 +220,9 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo #if !defined(Q_OS_WINCE) // use compiler intrinsics for all atomic functions +//those functions need to be define in the global namespace +QT_END_NAMESPACE + extern "C" { long __cdecl _InterlockedIncrement(volatile long *); long __cdecl _InterlockedDecrement(volatile long *); @@ -252,6 +255,9 @@ extern "C" { # define _InterlockedExchangeAddPointer(a,b) \ _InterlockedExchangeAdd(reinterpret_cast<volatile long *>(a), long(b)) # endif + +QT_BEGIN_NAMESPACE + inline bool QBasicAtomicInt::ref() { return _InterlockedIncrement(reinterpret_cast<volatile long *>(&_q_value)) != 0; @@ -335,6 +341,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo #define Q_ARGUMENT_TYPE #endif +QT_END_NAMESPACE + extern "C" { long __cdecl InterlockedIncrement(long Q_ARGUMENT_TYPE * lpAddend); long __cdecl InterlockedDecrement(long Q_ARGUMENT_TYPE * lpAddend); @@ -351,6 +359,8 @@ long __cdecl InterlockedExchangeAdd(long Q_ARGUMENT_TYPE * Addend, long Value); # pragma intrinsic (_InterlockedExchangeAdd) #endif +QT_BEGIN_NAMESPACE + #endif @@ -409,6 +419,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo // MinGW's definition, such that we pick up variations in the headers. #ifndef __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED +QT_END_NAMESPACE + extern "C" { __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long); __declspec(dllimport) long __stdcall InterlockedIncrement(long *); @@ -416,6 +428,8 @@ extern "C" { __declspec(dllimport) long __stdcall InterlockedExchange(long *, long); __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long *, long); } + +QT_BEGIN_NAMESPACE #endif inline bool QBasicAtomicInt::ref() |