2660 Vladislav Vaintroub 2008-06-20
Fix Falcon compile problems for nmake build on Vista SDK.
modified:
storage/falcon/CMakeLists.txt
storage/falcon/Interlock.h
2659 Vladislav Vaintroub 2008-06-20
Fix Visual Studio 2003 build.
struct __stat64-> struct _stati64
modified:
include/my_dir.h
mysys/my_winfile.c
=== modified file 'storage/falcon/CMakeLists.txt'
--- a/storage/falcon/CMakeLists.txt 2008-05-09 13:57:44 +0000
+++ b/storage/falcon/CMakeLists.txt 2008-06-20 09:55:40 +0000
@@ -23,13 +23,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/
. TransformLib
${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/zlib)
-IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
- CMAKE_GENERATOR MATCHES "Visual Studio 8")
+IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
SET(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} /EHsc")
SET(CMAKE_CXX_FLAGS_DEBUG_INIT "${CMAKE_CXX_FLAGS_DEBUG_INIT} /EHsc")
-ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
- CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ENDIF(MSVC)
SET(FALCON_SOURCES
Agent.cpp
=== modified file 'storage/falcon/Interlock.h'
--- a/storage/falcon/Interlock.h 2008-03-18 12:45:13 +0000
+++ b/storage/falcon/Interlock.h 2008-06-20 09:55:40 +0000
@@ -22,50 +22,50 @@
#define INTERLOCKED_ADD(ptr, value) interlockedAdd(ptr, value)
#ifdef _WIN32
+#include <windows.h>
#define COMPARE_EXCHANGE(target,compare,exchange)\
(InterlockedCompareExchange(target,exchange,compare)==compare)
-#ifdef _WIN64
-#include <intrin.h>
#define COMPARE_EXCHANGE_POINTER(target,compare,exchange)\
(InterlockedCompareExchangePointer((void *volatile*) target,(void*)exchange,(void*)compare)==(void*)compare)
-#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
-void* _InterlockedCompareExchangePointer(void *volatile *Destination, void *Exchange, void *Comperand);
-#else /* _WIN64 */
-#define COMPARE_EXCHANGE_POINTER(target,compare,exchange)\
- (InterlockedCompareExchange((volatile long*) target,(long)exchange,(long)compare)==(long)compare)
-#endif /* _WIN64 */
-
-#define InterlockedIncrement _InterlockedIncrement
-#define InterlockedDecrement _InterlockedDecrement
-#define InterlockedExchange _InterlockedExchange
-#define InterlockedExchangeAdd _InterlockedExchangeAdd
-
-#define InterlockedCompareExchange _InterlockedCompareExchange
-
-#ifndef InterlockedCompareExchangePointer
-//#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
-#endif /* InterlockedCompareExchangePointer */
-
-#ifndef __MACHINEX64
-extern "C"
+/*
+ x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate
+ function calls to kernel32 instead, even in the optimized build.
+ We force intrinsics as described in MSDN documentation for
+ _InterlockedCompareExchange.
+ x64 on the other hand, always uses intrinsic version, even in debug build
+*/
+#ifdef _M_IX86
+#if (_MSC_VER >= 1400)
+#include <intrin.h>
+#else
+/* Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics */
+extern "C"
{
- long InterlockedIncrement(long* lpAddend);
- long InterlockedDecrement(long* lpAddend);
- long InterlockedExchange(long* volatile addend, long value);
- long InterlockedExchangeAdd(long* volatile addend, long value);
- long InterlockedCompareExchange(volatile long *Destination, long Exchange, long Comperand);
- //void* InterlockedCompareExchangePointer(void *volatile* *Destination, void *Exchange, void *Comperand);
+ long _InterlockedIncrement(long volatile *Addend);
+ long _InterlockedDecrement(long volatile *Addend);
+ long _InterlockedExchangeAdd(long volatile *Addend, long Value);
+ long _InterlockedExchange(long volatile *Target,long Value);
+ long _InterlockedCompareExchange (long volatile *Target, long Value, long Comp);
}
-#endif /* __MACHINEX64 */
-
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedCompareExchange)
-//#pragma intrinsic(_InterlockedCompareExchangePointer)
+#endif /* _MSC_VER */
+
+#define InterlockedIncrement _InterlockedIncrement
+#define InterlockedDecrement _InterlockedDecrement
+#define InterlockedExchangeAdd _InterlockedExchangeAdd
+#define InterlockedExchange _InterlockedExchange
+#define InterlockedCompareExchange _InterlockedCompareExchange
+/*
+ No need to handle InterlockedCompareExchangePointer
+ it is a defined as InterlockedCompareExchange.
+*/
+#endif /*_M_IX86*/
#else /* _WIN32 */
| Thread |
|---|
| • bzr push into mysql-6.0-wtf branch (vvaintroub:2659 to 2660) | Vladislav Vaintroub | 20 Jun |