diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-29 08:48:53 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-06-03 02:49:08 (GMT) |
commit | 79cd573fe46dcd0867ae01ca12304e069bb85d93 (patch) | |
tree | 61f1dc104e8c246e823f6c0863b9b518fe226a9e | |
parent | 2675c5fb0e8a39f4d79110784d108761e141359c (diff) | |
download | Qt-79cd573fe46dcd0867ae01ca12304e069bb85d93.zip Qt-79cd573fe46dcd0867ae01ca12304e069bb85d93.tar.gz Qt-79cd573fe46dcd0867ae01ca12304e069bb85d93.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
(cherry picked from commit 7bc17b5b9ff9f2e3e04f36fec8ccbb546d9b7a31)
-rw-r--r-- | src/corelib/arch/qatomic_windows.h | 14 | ||||
-rw-r--r-- | tools/assistant/lib/fulltextsearch/qclucene_global_p.h | 16 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h index b243446..76b4d4b 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() diff --git a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h index 2a9d146..3dba45a 100644 --- a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h +++ b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h @@ -29,6 +29,14 @@ #include <QtCore/QChar> #include <QtCore/QString> +#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) +# if !defined(TCHAR) +# define TCHAR wchar_t +# endif +#else +# include <windows.h> +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -87,14 +95,6 @@ QT_BEGIN_NAMESPACE # define CL_NS2(sub,sub2) #endif -#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) -# if !defined(TCHAR) -# define TCHAR wchar_t -# endif -#else -# include <windows.h> -#endif - namespace { TCHAR* QStringToTChar(const QString &str) { |