--- client/mysql.cc Thu Sep 19 23:34:26 2013 +++ client/mysql.cc Sat Nov 23 20:46:37 2013 @@ -4889,7 +4889,7 @@ { if (!opt_nobeep) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSVC) MessageBeep(MB_ICONWARNING); #else putchar('\a'); /* This should make a bell */ --- client/mysqlbinlog.cc Thu Sep 19 23:34:26 2013 +++ client/mysqlbinlog.cc Sat Nov 23 20:17:04 2013 @@ -101,7 +101,7 @@ static char *opt_plugindir= 0, *opt_default_auth= 0; #ifdef HAVE_SMEM -static char *shared_memory_base_name= 0; +char *shared_memory_base_name= 0; #endif static char* user = 0; static char* pass = 0; --- client/mysqlslap.c Thu Sep 19 23:34:23 2013 +++ client/mysqlslap.c Sat Nov 23 12:14:49 2013 @@ -281,7 +281,7 @@ return s + us; } -#ifdef __WIN__ +#if defined(__WIN__) && !defined(__GNUC__) static int gettimeofday(struct timeval *tp, void *tzp) { unsigned int ticks; --- client/mysqltest.cc Thu Sep 19 23:34:26 2013 +++ client/mysqltest.cc Sat Nov 23 15:12:57 2013 @@ -8768,12 +8768,20 @@ LONG WINAPI exception_filter(EXCEPTION_POINTERS *exp) { +#ifdef _MSVC __try +#else + if (1) +#endif { my_set_exception_pointers(exp); signal_handler(exp->ExceptionRecord->ExceptionCode); } +#ifdef _MSVC __except(EXCEPTION_EXECUTE_HANDLER) +#else + if (0) +#endif { fputs("Got exception in exception handler!\n", stderr); } --- cmake/ssl.cmake Thu Sep 19 23:34:23 2013 +++ cmake/ssl.cmake Sat Nov 23 17:49:04 2013 @@ -75,7 +75,11 @@ SET(CMAKE_REQUIRED_INCLUDES) IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) SET(SSL_SOURCES "") + IF(MINGW) + SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES}) + ELSE() SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) + ENDIF() SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) SET(SSL_INTERNAL_INCLUDE_DIRS "") SET(SSL_DEFINES "-DHAVE_OPENSSL") --- cmake/os/Windows.cmake Thu Sep 19 23:34:23 2013 +++ cmake/os/Windows.cmake Sat Nov 23 18:36:11 2013 @@ -51,14 +51,18 @@ ENDIF() ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE") -ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501") +ADD_DEFINITIONS("-D_WIN32_WINNT=0x0601") # Speed up build process excluding unused header files ADD_DEFINITIONS("-DWIN32_LEAN_AND_MEAN") # Adjust compiler and linker flags IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) # mininal architecture flags, i486 enables GCC atomics - ADD_DEFINITIONS(-march=i486) + # ADD_DEFINITIONS(-march=i486) + FOREACH(lang C CXX) + SET(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -march=i486") + ENDFOREACH() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") ENDIF() IF(MSVC) --- include/my_dir.h Mon Jan 19 23:26:36 1970 +++ include/my_dir.h Mon Jan 19 23:26:36 1970 @@ -69,7 +69,7 @@ #else -#if(_MSC_VER) +#ifdef _WIN32 #define MY_STAT struct _stati64 /* 64 bit file size */ #else #define MY_STAT struct stat /* Orginal struct have what we need */ --- include/my_global.h Thu Sep 19 23:34:26 2013 +++ include/my_global.h Sat Nov 23 18:13:42 2013 @@ -1363,11 +1363,12 @@ #define dlclose(lib) FreeLibrary((HMODULE)lib) static inline char *dlerror(void) { + static char win_errormsgnull[] = ""; static char win_errormsg[2048]; if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), 0, win_errormsg, 2048, NULL)) return win_errormsg; - return ""; + return win_errormsgnull; } #define HAVE_DLOPEN 1 #define HAVE_DLERROR 1 --- include/my_pthread.h Thu Sep 19 23:34:26 2013 +++ include/my_pthread.h Sat Nov 23 18:38:56 2013 @@ -33,6 +33,7 @@ #endif /* __cplusplus */ #if defined(__WIN__) +#include typedef CRITICAL_SECTION pthread_mutex_t; typedef DWORD pthread_t; typedef struct thread_attr { @@ -54,6 +55,13 @@ We use native conditions on Vista and later, and fallback to own implementation on earlier OS version. */ +typedef enum +{ + SIGNAL= 0, + BROADCAST= 1, + MAX_EVENTS= 2 +} MY_EVENTS; + typedef union { /* Native condition (used on Vista and later) */ @@ -64,12 +72,7 @@ { uint32 waiting; CRITICAL_SECTION lock_waiting; - enum - { - SIGNAL= 0, - BROADCAST= 1, - MAX_EVENTS= 2 - } EVENTS; + MY_EVENTS EVENTS; HANDLE events[MAX_EVENTS]; HANDLE broadcast_block_event; }; @@ -86,10 +89,12 @@ #define MY_PTHREAD_ONCE_INPROGRESS 1 #define MY_PTHREAD_ONCE_DONE 2 +#ifndef _TIMESPEC_DEFINED struct timespec { time_t tv_sec; long tv_nsec; }; +#endif int win_pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *); @@ -146,6 +151,10 @@ #define pthread_condattr_destroy(A) #define pthread_yield() SwitchToThread() #define my_sigset(A,B) signal(A,B) +#ifdef HAVE_PTHREAD_YIELD_ZERO_ARG +#undef HAVE_PTHREAD_YIELD_ZERO_ARG +#endif +#define HAVE_PTHREAD_YIELD_ZERO_ARG #else /* Normal threads */ @@ -486,7 +495,21 @@ /* READ-WRITE thread locking */ -#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) +#if defined(__WIN__) && defined(__GNUC__) +/* Force using own implementation for MINGW compiler */ +/* Use our own version of read/write locks */ +#define NEED_MY_RW_LOCK 1 +#define rw_lock_t my_rw_lock_t +#define my_rwlock_init(A,B) my_rw_init((A)) +#define rw_rdlock(A) my_rw_rdlock((A)) +#define rw_wrlock(A) my_rw_wrlock((A)) +#define rw_tryrdlock(A) my_rw_tryrdlock((A)) +#define rw_trywrlock(A) my_rw_trywrlock((A)) +#define rw_unlock(A) my_rw_unlock((A)) +#define rwlock_destroy(A) my_rw_destroy((A)) +#define rw_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A)) +#define rw_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner((A)) +#elif defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) /* use these defs for simple mutex locking */ #define rw_lock_t pthread_mutex_t #define my_rwlock_init(A,B) pthread_mutex_init((A),(B)) --- mysys/CMakeLists.txt Thu Sep 19 23:34:26 2013 +++ mysys/CMakeLists.txt Sat Nov 23 12:21:34 2013 @@ -76,6 +76,10 @@ IF (WIN32) TARGET_LINK_LIBRARIES(mysys IPHLPAPI) + IF (MINGW) + TARGET_LINK_LIBRARIES(mysys dbghelp) + TARGET_LINK_LIBRARIES(mysys pthread) + ENDIF (MINGW) ENDIF(WIN32) # Need explicit pthread for gcc -fsanitize=address --- mysys/my_gethwaddr.c Thu Sep 19 23:34:23 2013 +++ mysys/my_gethwaddr.c Sat Nov 23 18:39:41 2013 @@ -129,8 +129,14 @@ #elif defined(_WIN32) #include +#ifdef __GNUC__ +typedef struct _CRYPTOAPI_BLOB { + DWORD cbData; + BYTE *pbData; +} CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB, CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB, CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB, CERT_NAME_BLOB, CERT_RDN_VALUE_BLOB, *PCERT_NAME_BLOB, *PCERT_RDN_VALUE_BLOB, CERT_BLOB, *PCERT_BLOB, CRL_BLOB, *PCRL_BLOB, DATA_BLOB, *PDATA_BLOB, CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB, CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB, CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB, CRYPT_DER_BLOB, PCRYPT_DER_BLOB, CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB; +#endif #include -#pragma comment(lib, "iphlpapi.lib") +#pragma comment(lib, "iphlpapi.lib") #define ETHER_ADDR_LEN 6 --- mysys/stacktrace.c Thu Sep 19 23:34:23 2013 +++ mysys/stacktrace.c Sat Nov 23 14:47:14 2013 @@ -730,11 +730,19 @@ void my_safe_print_str(const char *val, int len) { +#ifdef _MSVC __try +#else + if (1) +#endif { my_write_stderr(val, len); } +#ifdef _MSVC __except(EXCEPTION_EXECUTE_HANDLER) +#else + if (0) +#endif { my_safe_printf_stderr("%s", "is an invalid string pointer"); } --- plugin/feedback/utils.cc Thu Sep 19 23:34:23 2013 +++ plugin/feedback/utils.cc Sat Nov 23 12:23:12 2013 @@ -22,7 +22,7 @@ #include #include -#if defined (_WIN32) +#if defined (_WIN32) && defined(_MSVC) #define HAVE_SYS_UTSNAME_H #ifndef VER_SUITE_WH_SERVER --- plugin/win_auth_client/common.h Thu Sep 19 23:34:25 2013 +++ plugin/win_auth_client/common.h Sat Nov 23 20:36:07 2013 @@ -59,7 +59,7 @@ to fprintf() (see error_log_vprint() function). */ -#if defined(DEBUG_ERROR_LOG) && defined(DBUG_OFF) +#if (defined(DEBUG_ERROR_LOG) && defined(DBUG_OFF)) || defined(_WIN32) #define ERROR_LOG(Level, Msg) do {} while (0) #else #define ERROR_LOG(Level, Msg) error_log_print< error_log_level::Level > Msg --- plugin/win_auth_client/handshake.h Thu Sep 19 23:34:25 2013 +++ plugin/win_auth_client/handshake.h Sat Nov 23 19:56:26 2013 @@ -100,7 +100,7 @@ Handshake(const char *ssp, side_t side); virtual ~Handshake(); - int Handshake::packet_processing_loop(); + int packet_processing_loop(); bool virtual is_complete() const { --- scripts/CMakeLists.txt Thu Sep 19 23:34:23 2013 +++ scripts/CMakeLists.txt Sat Nov 23 11:42:41 2013 @@ -21,7 +21,7 @@ # Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts) -IF(NOT WIN32 OR CMAKE_CROSSCOMPILING) +IF(NOT WIN32 OR CMAKE_CROSSCOMPILING OR MINGW) FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable") MARK_AS_ADVANCED(CAT_EXECUTABLE) ENDIF() --- sql/CMakeLists.txt Thu Sep 19 23:34:26 2013 +++ sql/CMakeLists.txt Sat Nov 23 22:45:26 2013 @@ -312,15 +312,37 @@ ENDIF(WIN32 AND MYSQLD_EXECUTABLE) ENDIF(INSTALL_LAYOUT STREQUAL "STANDALONE") -IF(WIN32) +# # Create my_bootstrap.sql SQL script +IF(NOT WIN32 OR CMAKE_CROSSCOMPILING OR MINGW) + FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable") + MARK_AS_ADVANCED(CAT_EXECUTABLE) +ENDIF() + +IF(CAT_EXECUTABLE) + SET(CAT_COMMAND COMMAND + ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts + ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_data.sql fill_help_tables.sql mysql_performance_tables.sql > + ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql + ) +ELSEIF(WIN32) SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql) FILE(TO_NATIVE_PATH ${my_bootstrap_sql} native_outfile) - # Create bootstrapper SQL script + SET(CAT_COMMAND + COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts + cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql + ${native_outfile} ) +ELSE() + MESSAGE(FATAL_ERROR "Cannot concatenate files") +ENDIF() + +IF(WIN32) + SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql) + + # Create my_bootstrap.sql SQL script ADD_CUSTOM_COMMAND(OUTPUT ${my_bootstrap_sql} - COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts - cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql ${native_outfile} + ${CAT_COMMAND} DEPENDS ${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql ${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql @@ -351,6 +373,9 @@ mysql_upgrade_service.cc COMPONENT Server) TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys winservice) + IF(NOT MSVC) + TARGET_LINK_LIBRARIES(mysql_upgrade_service version) + ENDIF() ENDIF(WIN32) INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development --- sql/mysql_upgrade_service.cc Thu Sep 19 23:34:23 2013 +++ sql/mysql_upgrade_service.cc Sat Nov 23 18:15:06 2013 @@ -20,6 +20,9 @@ */ #define DONT_DEFINE_VOID +#ifndef _MSVC +#define vsprintf_s vsnprintf +#endif #include #include #include --- sql/mysqld.cc Sat Nov 23 12:28:37 2013 +++ sql/mysqld.cc Sat Nov 23 15:22:08 2013 @@ -2735,12 +2735,20 @@ */ wait_for_debugger(DEBUGGER_ATTACH_TIMEOUT); #endif /* DEBUG_UNHANDLED_EXCEPTION_FILTER */ +#ifdef _MSVC __try +#else + if (1) +#endif { my_set_exception_pointers(ex_pointers); handle_fatal_signal(ex_pointers->ExceptionRecord->ExceptionCode); } +#ifdef _MSVC __except(EXCEPTION_EXECUTE_HANDLER) +#else + if (0) +#endif { DWORD written; const char msg[] = "Got exception in exception handler!\n"; @@ -2851,7 +2859,7 @@ pthread_attr_setstacksize(attr, stacksize + guard_size); /* Retrieve actual stack size if possible */ -#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE +#if defined(HAVE_PTHREAD_ATTR_GETSTACKSIZE) && !defined(_WIN32) { size_t real_stack_size= 0; /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */ @@ -4102,7 +4110,7 @@ #endif /* HAVE_OPENSSL */ } -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSVC) /** Registers a file to be collected when Windows Error Reporting creates a crash report. @@ -4186,7 +4194,7 @@ if (!res) setbuf(stderr, NULL); -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSVC) /* Add error log to windows crash reporting. */ add_file_to_crash_report(log_error_file); #endif @@ -5214,7 +5222,7 @@ if (my_strcasecmp(system_charset_info, argv[1],"mysql")) load_default_groups[load_default_groups_sz-2]= argv[1]; start_mode= 1; - Service.Init(argv[1], mysql_service); + Service.Init(argv[1], (void *)mysql_service); return 0; } } @@ -5235,7 +5243,7 @@ start_mode= 1; if (my_strcasecmp(system_charset_info, argv[2],"mysql")) load_default_groups[load_default_groups_sz-2]= argv[2]; - Service.Init(argv[2], mysql_service); + Service.Init(argv[2], (void *)mysql_service); return 0; } } @@ -5268,7 +5276,7 @@ { /* start the default service */ start_mode= 1; - Service.Init(MYSQL_SERVICENAME, mysql_service); + Service.Init(MYSQL_SERVICENAME, (void *)mysql_service); return 0; } } --- sql/sql_class.cc Thu Sep 19 23:34:26 2013 +++ sql/sql_class.cc Sat Nov 23 15:34:49 2013 @@ -950,7 +950,7 @@ tablespace_op=FALSE; tmp= sql_rnd_with_mutex(); - my_rnd_init(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id); + my_rnd_init(&rand, tmp + (uintptr_t) &rand, tmp + (ulong) ::global_query_id); substitute_null_with_insert_id = FALSE; thr_lock_info_init(&lock_info); /* safety: will be reset after start */ --- sql/threadpool_win.cc Thu Sep 19 23:34:23 2013 +++ sql/threadpool_win.cc Sat Nov 23 23:28:26 2013 @@ -61,6 +61,62 @@ static pFN_##function my_##function = (pFN_##function) \ (GetProcAddress(GetModuleHandle("kernel32"),#function)) +#ifdef __GNUC__ +#define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 1 +#define FILE_SKIP_SET_EVENT_ON_HANDLE 2 +typedef struct _TP_POOL TP_POOL, *PTP_POOL; +typedef void (__stdcall * MY_PTP_WIN32_IO_CALLBACK )(PTP_CALLBACK_INSTANCE instance, PVOID context, PVOID overlapped, ULONG io_result, ULONG_PTR nbytes, PTP_IO io); +#define PTP_WIN32_IO_CALLBACK MY_PTP_WIN32_IO_CALLBACK +typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP; +typedef struct _ACTIVATION_CONTEXT ACTIVATION_CONTEXT, *PACTIVATION_CONTEXT; +typedef struct _TP_POOL_STACK_INFORMATION TP_POOL_STACK_INFORMATION, *PTP_POOL_STACK_INFORMATION; +typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE; +typedef struct _TP_CALLBACK_ENVIRON +{ + ULONG Version; + _TP_POOL * Pool; + _TP_CLEANUP_GROUP * CleanupGroup; + PVOID CleanupGroupCancelCallback; + PVOID RaceDll; + _ACTIVATION_CONTEXT * ActivationContext; + PVOID FinalizationCallback; + union { + DWORD Flags; + struct { + DWORD LongFunction : 1; + DWORD Private : 31; + } s; + } u; +} TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; +VOID InitializeThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe) +{ + pcbe->Version = 1; + + pcbe->Pool = NULL; + pcbe->CleanupGroup = NULL; + pcbe->CleanupGroupCancelCallback = NULL; + pcbe->RaceDll = NULL; + pcbe->ActivationContext = NULL; + pcbe->FinalizationCallback = NULL; + pcbe->u.Flags = 0; +} + +VOID DestroyThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe) +{ +} + +VOID SetThreadpoolCallbackPool(PTP_CALLBACK_ENVIRON pcbe, PTP_POOL ptpp) +{ + pcbe->Pool = ptpp; +} + +VOID SetThreadpoolCallbackCleanupGroup(PTP_CALLBACK_ENVIRON pcbe, PTP_CLEANUP_GROUP ptpcg, PTP_CLEANUP_GROUP_CANCEL_CALLBACK pfng) +{ + pcbe->CleanupGroup = ptpcg; + pcbe->CleanupGroupCancelCallback = (PVOID)pfng; +} +#endif + WEAK_SYMBOL(VOID, CancelThreadpoolIo, PTP_IO); #define CancelThreadpoolIo my_CancelThreadpoolIo @@ -147,7 +203,7 @@ WEAK_SYMBOL(BOOL, CallbackMayRunLong, PTP_CALLBACK_INSTANCE pci); #define CallbackMayRunLong my_CallbackMayRunLong -#if _MSC_VER >= 1600 +#if _MSC_VER >= 1600 || defined(__GNUC__) /* Stack size manipulation available only on Win7+ /declarations in VS10 */ WEAK_SYMBOL(BOOL, SetThreadpoolStackInformation, PTP_POOL, PTP_POOL_STACK_INFORMATION); @@ -558,11 +614,12 @@ connection_t *connection = (connection_t*)context; + THD *thd= connection->thd; + ulonglong old_timeout = connection->timeout; + if (io_result != ERROR_SUCCESS) goto error; - THD *thd= connection->thd; - ulonglong old_timeout = connection->timeout; connection->timeout = ULONGLONG_MAX; connection->callback_instance= instance; if (threadpool_process_request(connection->thd)) --- sql-common/client.c Thu Sep 19 23:34:25 2013 +++ sql-common/client.c Sat Nov 23 20:12:52 2013 @@ -124,7 +124,7 @@ const char *not_error_sqlstate= "00000"; const char *cant_connect_sqlstate= "08001"; #ifdef HAVE_SMEM -char *shared_memory_base_name= 0; +static char *shared_memory_base_name= 0; const char *def_shared_memory_base_name= default_shared_memory_base_name; #endif --- storage/innobase/include/univ.i Thu Sep 19 23:34:25 2013 +++ storage/innobase/include/univ.i Sat Nov 23 18:02:27 2013 @@ -233,7 +233,7 @@ that are only referenced from within InnoDB, not from MySQL. We disable the GCC visibility directive on all Sun operating systems because there is no easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */ -#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) || defined(__INTEL_COMPILER) +#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) && !defined(__WIN__) || defined(__INTEL_COMPILER) # define UNIV_INTERN __attribute__((visibility ("hidden"))) #else # define UNIV_INTERN @@ -255,7 +255,7 @@ #ifndef UNIV_MUST_NOT_INLINE /* Definition for inline version */ -#ifdef __WIN__ +#ifdef _MSVC # define UNIV_INLINE __inline #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) # define UNIV_INLINE static inline --- storage/xtradb/include/os0sync.h Thu Sep 19 23:34:25 2013 +++ storage/xtradb/include/os0sync.h Sat Nov 23 12:33:12 2013 @@ -37,7 +37,7 @@ #include "univ.i" #include "ut0lst.h" -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) /** Native event (slow)*/ typedef HANDLE os_native_event_t; /** Native mutex */ @@ -58,7 +58,7 @@ /** An asynchronous signal sent between threads */ struct os_event_struct { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) HANDLE handle; /*!< kernel event object, slow, used on older Windows */ #endif --- storage/xtradb/include/os0sync.ic Thu Sep 19 23:34:25 2013 +++ storage/xtradb/include/os0sync.ic Sat Nov 23 18:11:59 2013 @@ -23,7 +23,7 @@ Created 9/6/1995 Heikki Tuuri *******************************************************/ -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) #include #endif @@ -36,7 +36,7 @@ /*==================*/ os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if (TryEnterCriticalSection(fast_mutex)) { return(0); --- storage/xtradb/include/univ.i Thu Sep 19 23:34:27 2013 +++ storage/xtradb/include/univ.i Sat Nov 23 18:02:40 2013 @@ -237,7 +237,7 @@ that are only referenced from within InnoDB, not from MySQL. We disable the GCC visibility directive on all Sun operating systems because there is no easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */ -#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) || defined(__INTEL_COMPILER) +#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) && !defined(__WIN__) || defined(__INTEL_COMPILER) # define UNIV_INTERN __attribute__((visibility ("hidden"))) #else # define UNIV_INTERN @@ -259,7 +259,7 @@ #ifndef UNIV_MUST_NOT_INLINE /* Definition for inline version */ -#ifdef __WIN__ +#ifdef _MSVC # define UNIV_INLINE __inline #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) # define UNIV_INLINE static inline --- storage/xtradb/os/os0sync.c Thu Sep 19 23:34:25 2013 +++ storage/xtradb/os/os0sync.c Sat Nov 23 17:54:14 2013 @@ -29,7 +29,7 @@ #include "os0sync.ic" #endif -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) #include #endif @@ -85,7 +85,7 @@ so we have to use them via runtime loading, as long as we support XP. */ static void os_cond_module_init(void); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) /* Prototypes and function pointers for condition variable functions */ typedef VOID (WINAPI* InitializeConditionVariableProc) (PCONDITION_VARIABLE ConditionVariable); @@ -116,7 +116,7 @@ { ut_a(cond); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) ut_a(initialize_condition_variable != NULL); initialize_condition_variable(cond); #else @@ -133,7 +133,7 @@ /*===============*/ os_cond_t* cond, /*!< in: condition variable. */ os_fast_mutex_t* mutex, /*!< in: fast mutex */ -#ifndef __WIN__ +#if !defined(__WIN__) || !defined(_MSVC) const struct timespec* abstime /*!< in: timeout */ #else DWORD time_in_ms /*!< in: timeout in @@ -141,7 +141,7 @@ #endif /* !__WIN__ */ ) { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) BOOL ret; DWORD err; @@ -200,7 +200,7 @@ ut_a(cond); ut_a(mutex); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) ut_a(sleep_condition_variable != NULL); ut_a(sleep_condition_variable(cond, mutex, INFINITE)); #else @@ -218,7 +218,7 @@ { ut_a(cond); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) ut_a(wake_all_condition_variable != NULL); wake_all_condition_variable(cond); #else @@ -236,7 +236,7 @@ { ut_a(cond); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) ut_a(wake_condition_variable != NULL); wake_condition_variable(cond); #else @@ -252,7 +252,7 @@ /*============*/ os_cond_t* cond) /*!< in: condition variable. */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) /* Do nothing */ #else ut_a(pthread_cond_destroy(cond) == 0); @@ -268,7 +268,7 @@ os_cond_module_init(void) /*=====================*/ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) HMODULE h_dll; if (!srv_use_native_conditions) @@ -365,7 +365,7 @@ { os_event_t event; -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if(!srv_use_native_conditions) { event = ut_malloc(sizeof(struct os_event_struct)); @@ -433,7 +433,7 @@ { ut_a(event); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if (!srv_use_native_conditions) { ut_a(SetEvent(event->handle)); return; @@ -473,7 +473,7 @@ ut_a(event); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if(!srv_use_native_conditions) { ut_a(ResetEvent(event->handle)); return(0); @@ -501,7 +501,7 @@ /*===================*/ os_event_t event) /*!< in: event to free */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if(!srv_use_native_conditions) { ut_a(event); ut_a(CloseHandle(event->handle)); @@ -534,7 +534,7 @@ { ut_a(event); -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if(!srv_use_native_conditions){ ut_a(CloseHandle(event->handle)); } else /*Windows with condition variables */ @@ -583,7 +583,7 @@ returned by previous call of os_event_reset(). */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) if(!srv_use_native_conditions) { DWORD err; @@ -635,7 +635,7 @@ { ibool timed_out = FALSE; -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) DWORD time_in_ms; if (!srv_use_native_conditions) { @@ -715,7 +715,7 @@ timed_out = os_cond_wait_timed( &event->cond_var, &event->os_mutex, -#ifndef __WIN__ +#if !defined(__WIN__) || !defined(_MSVC) &abstime #else time_in_ms @@ -836,7 +836,7 @@ /*===============*/ os_fast_mutex_t* fast_mutex) /*!< in: fast mutex */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) ut_a(fast_mutex); InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex); @@ -865,7 +865,7 @@ /*===============*/ os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) EnterCriticalSection((LPCRITICAL_SECTION) fast_mutex); #else pthread_mutex_lock(fast_mutex); @@ -880,7 +880,7 @@ /*=================*/ os_fast_mutex_t* fast_mutex) /*!< in: mutex to release */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) LeaveCriticalSection(fast_mutex); #else pthread_mutex_unlock(fast_mutex); @@ -895,7 +895,7 @@ /*===============*/ os_fast_mutex_t* fast_mutex) /*!< in: mutex to free */ { -#ifdef __WIN__ +#if defined(__WIN__) && defined(_MSVC) ut_a(fast_mutex); DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex);