diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-20 21:17:36 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-20 21:17:36 +0000 |
commit | 56e7b7eaede52e8d2123e909d7d42220f8c63143 (patch) | |
tree | 73e1dc4b2e53d68c3a9d5269f9140142ef08c187 /storage | |
parent | 9d97e6010ebdeab0579a8371d01f34118c518b30 (diff) | |
download | mariadb-git-56e7b7eaede52e8d2123e909d7d42220f8c63143.tar.gz |
Make possible to use clang on Windows (clang-cl)
-DWITH_ASAN can be used as well now, on x64
Fix many clang-cl warnings.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/CMakeLists.txt | 4 | ||||
-rw-r--r-- | storage/federated/ha_federated.h | 1 | ||||
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 2 | ||||
-rw-r--r-- | storage/innobase/fts/fts0opt.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/os0thread.h | 6 | ||||
-rw-r--r-- | storage/innobase/os/os0event.cc | 12 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 54 | ||||
-rw-r--r-- | storage/innobase/row/row0ftsort.cc | 4 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 2 | ||||
-rw-r--r-- | storage/maria/ma_control_file.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_dynrec.c | 4 | ||||
-rw-r--r-- | storage/maria/ma_norec.c | 4 | ||||
-rw-r--r-- | storage/maria/ma_pagecache.c | 4 | ||||
-rw-r--r-- | storage/maria/maria_chk.c | 2 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 4 | ||||
-rw-r--r-- | storage/maria/unittest/test_file.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_dynrec.c | 2 | ||||
-rw-r--r-- | storage/myisam/myisamchk.c | 2 | ||||
-rw-r--r-- | storage/myisam/myisamdef.h | 2 | ||||
-rw-r--r-- | storage/rocksdb/CMakeLists.txt | 4 |
20 files changed, 33 insertions, 86 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index fb0c5d5f897..33b0477842d 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -69,6 +69,10 @@ ELSE(NOT UNIX) # Add exception handling to the CONNECT project) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") SET(IPHLPAPI_LIBRARY iphlpapi.lib) + IF(MSVC AND (CMAKE_CXX_COMPILER_ID MATCHES Clang)) + # Connect does not work with clang-cl + RETURN() + ENDIF() ENDIF(UNIX) diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index e264258a63a..8fe42bd2b08 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -89,7 +89,6 @@ class ha_federated: public handler */ DYNAMIC_ARRAY results; bool position_called, table_will_be_deleted; - uint fetch_num; // stores the fetch num MYSQL_ROW_OFFSET current_position; // Current position used by ::position() int remote_error_number; char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE]; diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 76431fd67f6..5413f324127 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -3510,7 +3510,9 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)( os_thread_create */ { my_thread_init(); +#ifndef DBUG_OFF os_thread_id_t cleaner_thread_id = os_thread_get_curr_id(); +#endif mutex_enter(&page_cleaner.mutex); ulint thread_no = page_cleaner.n_workers++; diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 910721d8b32..296494f6a63 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -2972,7 +2972,7 @@ Optimize all FTS tables. @return Dummy return */ static os_thread_ret_t -fts_optimize_thread( +DECLARE_THREAD(fts_optimize_thread)( /*================*/ void* arg) /*!< in: work queue*/ { diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index c240f5dacdd..c1b96ef7a1f 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -53,12 +53,8 @@ typedef LPTHREAD_START_ROUTINE os_thread_func_t; /** Macro for specifying a Windows thread start function. */ #define DECLARE_THREAD(func) WINAPI func -/** Required to get around a build error on Windows. Even though our functions -are defined/declared as WINAPI f(LPVOID a); the compiler complains that they -are defined as: os_thread_ret_t (__cdecl*)(void*). Because our functions -don't access the arguments and don't return any value, we should be safe. */ #define os_thread_create(f,a,i) \ - os_thread_create_func(reinterpret_cast<os_thread_func_t>(f), a, i) + os_thread_create_func(f, a, i) #else diff --git a/storage/innobase/os/os0event.cc b/storage/innobase/os/os0event.cc index b687af3e21c..98b474c0bda 100644 --- a/storage/innobase/os/os0event.cc +++ b/storage/innobase/os/os0event.cc @@ -35,9 +35,6 @@ Created 2012-09-23 Sunny Bains #include <list> -/** The number of microsecnds in a second. */ -static const ulint MICROSECS_IN_A_SECOND = 1000000; - #ifdef _WIN32 /** Native condition variable. */ typedef CONDITION_VARIABLE os_cond_t; @@ -381,13 +378,8 @@ os_event::wait_time_low( tv.tv_usec += time_in_usec; - if ((ulint) tv.tv_usec >= MICROSECS_IN_A_SECOND) { - tv.tv_sec += tv.tv_usec / MICROSECS_IN_A_SECOND; - tv.tv_usec %= MICROSECS_IN_A_SECOND; - } - - abstime.tv_sec = tv.tv_sec; - abstime.tv_nsec = tv.tv_usec * 1000; + abstime.tv_sec = tv.tv_sec + tv.tv_usec / 1000000; + abstime.tv_nsec = tv.tv_usec % 1000000 * 1000; } else { abstime.tv_nsec = 999999999; abstime.tv_sec = (time_t) ULINT_MAX; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 942b512206f..b0f4b90b127 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -3401,16 +3401,6 @@ static void __stdcall win_free_syncio_event(void *data) { /* -Initialize tls index.for event handle used for synchronized IO on files that -might be opened with FILE_FLAG_OVERLAPPED. -*/ -static void win_init_syncio_event() { - fls_sync_io = FlsAlloc(win_free_syncio_event); - ut_a(fls_sync_io != FLS_OUT_OF_INDEXES); -} - - -/* Retrieve per-thread event for doing synchronous io on asyncronously opened files */ static HANDLE win_get_syncio_event() @@ -3515,46 +3505,6 @@ struct WinIoInit /* Ensures proper initialization and shutdown */ static WinIoInit win_io_init; -/** Check if the file system supports sparse files. -@param[in] name File name -@return true if the file system supports sparse files */ -static -bool -os_is_sparse_file_supported_win32(const char* filename) -{ - char volname[MAX_PATH]; - BOOL result = GetVolumePathName(filename, volname, MAX_PATH); - - if (!result) { - - ib::error() - << "os_is_sparse_file_supported: " - << "Failed to get the volume path name for: " - << filename - << "- OS error number " << GetLastError(); - - return(false); - } - - DWORD flags; - - result = GetVolumeInformation( - volname, NULL, MAX_PATH, NULL, NULL, - &flags, NULL, MAX_PATH); - - - if (!result) { - ib::error() - << "os_is_sparse_file_supported: " - << "Failed to get the volume info for: " - << volname - << "- OS error number " << GetLastError(); - - return(false); - } - - return(flags & FILE_SUPPORTS_SPARSE_FILES) ? true : false; -} /** Free storage space associated with a section of the file. @param[in] fh Open file handle @@ -3851,7 +3801,7 @@ os_file_create_simple_func( ib::info() << "Read only mode set. Unable to" " open file '" << name << "' in RW mode, " - << "trying RO mode", name; + << "trying RO mode"; access = GENERIC_READ; @@ -4546,7 +4496,7 @@ bool os_file_close_func( os_file_t file) { - ut_a(file > 0); + ut_a(file); if (CloseHandle(file)) { return(true); diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index b467f9d1615..ef7e92e3a23 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -766,7 +766,7 @@ It also performs the initial in memory sort of the parsed records. @return OS_THREAD_DUMMY_RETURN */ static os_thread_ret_t -fts_parallel_tokenization( +DECLARE_THREAD(fts_parallel_tokenization)( /*======================*/ void* arg) /*!< in: psort_info for the thread */ { @@ -1106,7 +1106,7 @@ Function performs the merge and insertion of the sorted records. @return OS_THREAD_DUMMY_RETURN */ static os_thread_ret_t -fts_parallel_merge( +DECLARE_THREAD(fts_parallel_merge)( /*===============*/ void* arg) /*!< in: parallel merge info */ { diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 8b3841c1504..47fc4bb7556 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -860,7 +860,7 @@ srv_suspend_thread_low( ut_a(!slot->suspended); slot->suspended = TRUE; - if (my_atomic_addlint(&srv_sys.n_threads_active[type], -1) < 0) { + if ((lint)my_atomic_addlint(&srv_sys.n_threads_active[type], -1) < 0) { ut_error; } diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c index 1ccb67d5698..94f9ad46a48 100644 --- a/storage/maria/ma_control_file.c +++ b/storage/maria/ma_control_file.c @@ -217,7 +217,6 @@ static CONTROL_FILE_ERROR create_control_file(const char *name, static int lock_control_file(const char *name) { - uint retry= 0; /* On Windows, my_lock() uses locking() which is mandatory locking and so prevents maria-recovery.test from copying the control file. And in case of @@ -228,6 +227,7 @@ static int lock_control_file(const char *name) file under Windows. */ #ifndef __WIN__ + uint retry= 0; /* We can't here use the automatic wait in my_lock() as the alarm thread may not yet exists. diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c index e5c108a18c6..5909a0175d9 100644 --- a/storage/maria/ma_dynrec.c +++ b/storage/maria/ma_dynrec.c @@ -1208,8 +1208,8 @@ err: my_errno is set to HA_ERR_WRONG_IN_RECORD */ -ulong _ma_rec_unpack(register MARIA_HA *info, register uchar *to, uchar *from, - ulong found_length) +size_t _ma_rec_unpack(register MARIA_HA *info, register uchar *to, uchar *from, + size_t found_length) { uint flag,bit,length,min_pack_length, column_length; enum en_fieldtype type; diff --git a/storage/maria/ma_norec.c b/storage/maria/ma_norec.c index 8ed0ef68eb4..da26d0d6dbd 100644 --- a/storage/maria/ma_norec.c +++ b/storage/maria/ma_norec.c @@ -32,14 +32,14 @@ my_bool _ma_update_no_record(MARIA_HA *info __attribute__((unused)), const uchar *oldrec __attribute__((unused)), const uchar *record __attribute__((unused))) { - return HA_ERR_WRONG_COMMAND; + return (my_bool)HA_ERR_WRONG_COMMAND; } my_bool _ma_delete_no_record(MARIA_HA *info __attribute__((unused)), const uchar *record __attribute__((unused))) { - return HA_ERR_WRONG_COMMAND; + return (my_bool)HA_ERR_WRONG_COMMAND; } diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 6922326da19..fd5995515c1 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -890,9 +890,9 @@ size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem, DBUG_PRINT("exit", ("disk_blocks: %zu block_root: %p hash_entries: %zu\ hash_root: %p hash_links: %zu hash_link_root: %p", - pagecache->disk_blocks, pagecache->block_root, + (size_t)pagecache->disk_blocks, pagecache->block_root, pagecache->hash_entries, pagecache->hash_root, - pagecache->hash_links, pagecache->hash_link_root)); + (size_t)pagecache->hash_links, pagecache->hash_link_root)); pagecache->blocks= pagecache->disk_blocks > 0 ? pagecache->disk_blocks : 0; DBUG_RETURN((size_t)pagecache->disk_blocks); diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index cb8b374691e..01af4c0381f 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -857,7 +857,7 @@ get_one_option(int optid, case 2: method_conv= MI_STATS_METHOD_IGNORE_NULLS; break; - default: assert(0); /* Impossible */ + default: abort(); /* Impossible */ } check_param.stats_method= method_conv; break; diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index f6d16960f5f..23dbf4431c5 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1202,8 +1202,8 @@ extern my_bool _ma_read_cache(MARIA_HA *, IO_CACHE *info, uchar *buff, extern ulonglong ma_retrieve_auto_increment(const uchar *key, uint8 key_type); extern my_bool _ma_alloc_buffer(uchar **old_addr, size_t *old_size, size_t new_size); -extern ulong _ma_rec_unpack(MARIA_HA *info, uchar *to, uchar *from, - ulong reclength); +extern size_t _ma_rec_unpack(MARIA_HA *info, uchar *to, uchar *from, + size_t reclength); extern my_bool _ma_rec_check(MARIA_HA *info, const uchar *record, uchar *packpos, ulong packed_length, my_bool with_checkum, ha_checksum checksum); diff --git a/storage/maria/unittest/test_file.c b/storage/maria/unittest/test_file.c index 7ee38c57068..1f74790c565 100644 --- a/storage/maria/unittest/test_file.c +++ b/storage/maria/unittest/test_file.c @@ -54,7 +54,7 @@ int test_file(PAGECACHE_FILE file, char *file_name, LARGE_INTEGER li; if(GetFileAttributesEx(file_name, GetFileExInfoStandard, &file_attr) == 0) { - diag("Can't GetFileAttributesEx %s (errno: %d)\n", file_name, + diag("Can't GetFileAttributesEx %s (errno: %lu)\n", file_name, GetLastError()); res= 0; goto err; diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index cb49ded0c20..905f8ecfbc9 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -1216,7 +1216,7 @@ err: /* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */ /* right. Returns reclength (>0) if ok */ -ulong _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from, +size_t _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from, ulong found_length) { uint flag,bit,length,rec_length,min_pack_length; diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 2e36c364453..e2f99177894 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -727,7 +727,7 @@ get_one_option(int optid, case 2: method_conv= MI_STATS_METHOD_IGNORE_NULLS; break; - default: assert(0); /* Impossible */ + default: abort(); /* Impossible */ } check_param.stats_method= method_conv; break; diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index e0e552ec5fa..41ad0e8dd7f 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -571,7 +571,7 @@ extern uchar *mi_alloc_rec_buff(MI_INFO *, ulong, uchar **); #define mi_get_rec_buff_len(info,buf) \ (*((uint32 *)(mi_get_rec_buff_ptr(info,buf)))) -extern ulong _mi_rec_unpack(MI_INFO *info, uchar *to, uchar *from, +extern size_t _mi_rec_unpack(MI_INFO *info, uchar *to, uchar *from, ulong reclength); extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos, ulong packed_length, my_bool with_checkum); diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index a49cbbcb85c..7a6d8ef8765 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -57,6 +57,10 @@ ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}") ENDIF() SET(CXX11_FLAGS "-std=c++11 -stdlib=libstdc++") + IF(MSVC) + # clang-cl does not work yet + SKIP_ROCKSDB_PLUGIN("Clang-cl is not supported") + ENDIF() ELSEIF(MSVC) IF (MSVC_VERSION LESS 1900) SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}") |