Commit c4cb2400 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9024 Build fails with VS2015

cherry-pick f1daf9ce from 10.0 branch
-------------------------------------

Fix build failures caused by new C runtime library
- isnan, snprintf, struct timespec are now defined, attempt to
redefine them leads
- P_tmpdir, tzname are no more defined
-  lfind() and lsearch() in lf_hash.c had to be renamed,  declaration
conflicts with some C runtime functions with the same name declared in
a header included by stdlib.h

 Also fix couple of annoying warnings :
- remove #define NOMINMAX from config.h to avoid "redefined" compiler
warnings(NOMINMAX is already in compile flags)

- disable incremental linker in Debug as well (feature not used much
and compiler crashes often)

Also simplify package building with Wix, require Wix 3.9 or later
(VS2015 is not compatible with old Wix 3.5/3.6)
parent 1e361f28
...@@ -1107,7 +1107,7 @@ inline int get_command_index(char cmd_char) ...@@ -1107,7 +1107,7 @@ inline int get_command_index(char cmd_char)
All client-specific commands are in the first part of commands array All client-specific commands are in the first part of commands array
and have a function to implement it. and have a function to implement it.
*/ */
for (uint i= 0; *commands[i].func; i++) for (uint i= 0; commands[i].func; i++)
if (commands[i].cmd_char == cmd_char) if (commands[i].cmd_char == cmd_char)
return i; return i;
return -1; return -1;
......
...@@ -5211,7 +5211,7 @@ static st_error global_error_names[] = ...@@ -5211,7 +5211,7 @@ static st_error global_error_names[] =
#include <my_base.h> #include <my_base.h>
static st_error handler_error_names[] = static st_error handler_error_names[] =
{ {
{ "<No error>", -1U, "" }, { "<No error>", UINT_MAX, "" },
#include <handler_ername.h> #include <handler_ername.h>
{ 0, 0, 0 } { 0, 0, 0 }
}; };
......
...@@ -100,9 +100,12 @@ IF(MSVC) ...@@ -100,9 +100,12 @@ IF(MSVC)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}") STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release") SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release")
ENDFOREACH() ENDFOREACH()
# Mark 32 bit executables large address aware so they can # Mark 32 bit executables large address aware so they can
# use > 2GB address space # use > 2GB address space
IF(CMAKE_SIZEOF_VOID_P MATCHES 4) IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
...@@ -117,7 +120,7 @@ IF(MSVC) ...@@ -117,7 +120,7 @@ IF(MSVC)
#TODO: update the code and remove the disabled warnings #TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /we4099")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8) IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself. # _WIN64 is defined by the compiler itself.
...@@ -185,14 +188,14 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h) ...@@ -185,14 +188,14 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h) CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h) CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h)
CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h) CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h)
CHECK_SYMBOL_REPLACEMENT(isnan _isnan float.h) CHECK_SYMBOL_REPLACEMENT(isnan _isnan "math.h;float.h")
CHECK_SYMBOL_REPLACEMENT(finite _finite float.h) CHECK_SYMBOL_REPLACEMENT(finite _finite "math;float.h")
CHECK_FUNCTION_REPLACEMENT(popen _popen) CHECK_FUNCTION_REPLACEMENT(popen _popen)
CHECK_FUNCTION_REPLACEMENT(pclose _pclose) CHECK_FUNCTION_REPLACEMENT(pclose _pclose)
CHECK_FUNCTION_REPLACEMENT(access _access) CHECK_FUNCTION_REPLACEMENT(access _access)
CHECK_FUNCTION_REPLACEMENT(strcasecmp _stricmp) CHECK_FUNCTION_REPLACEMENT(strcasecmp _stricmp)
CHECK_FUNCTION_REPLACEMENT(strncasecmp _strnicmp) CHECK_FUNCTION_REPLACEMENT(strncasecmp _strnicmp)
CHECK_FUNCTION_REPLACEMENT(snprintf _snprintf) CHECK_SYMBOL_REPLACEMENT(snprintf _snprintf stdio.h)
CHECK_FUNCTION_REPLACEMENT(strtok_r strtok_s) CHECK_FUNCTION_REPLACEMENT(strtok_r strtok_s)
CHECK_FUNCTION_REPLACEMENT(strtoll _strtoi64) CHECK_FUNCTION_REPLACEMENT(strtoll _strtoi64)
CHECK_FUNCTION_REPLACEMENT(strtoull _strtoui64) CHECK_FUNCTION_REPLACEMENT(strtoull _strtoui64)
......
...@@ -101,7 +101,6 @@ SET(HAVE_IPPROTO_IPV6 CACHE INTERNAL "") ...@@ -101,7 +101,6 @@ SET(HAVE_IPPROTO_IPV6 CACHE INTERNAL "")
SET(HAVE_IPV6 TRUE CACHE INTERNAL "") SET(HAVE_IPV6 TRUE CACHE INTERNAL "")
SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "") SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "")
SET(HAVE_ISINF CACHE INTERNAL "") SET(HAVE_ISINF CACHE INTERNAL "")
SET(HAVE_ISNAN CACHE INTERNAL "")
SET(HAVE_ISSETUGID CACHE INTERNAL "") SET(HAVE_ISSETUGID CACHE INTERNAL "")
SET(HAVE_GETUID CACHE INTERNAL "") SET(HAVE_GETUID CACHE INTERNAL "")
SET(HAVE_GETEUID CACHE INTERNAL "") SET(HAVE_GETEUID CACHE INTERNAL "")
...@@ -231,7 +230,6 @@ SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "") ...@@ -231,7 +230,6 @@ SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "")
SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "")
SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "") SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "")
SET(HAVE_SLEEP CACHE INTERNAL "") SET(HAVE_SLEEP CACHE INTERNAL "")
SET(HAVE_SNPRINTF CACHE INTERNAL "")
SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "") SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "")
SET(HAVE_SOLARIS_STYLE_GETHOST CACHE INTERNAL "") SET(HAVE_SOLARIS_STYLE_GETHOST CACHE INTERNAL "")
SET(STACK_DIRECTION -1 CACHE INTERNAL "") SET(STACK_DIRECTION -1 CACHE INTERNAL "")
...@@ -324,10 +322,8 @@ SET(WORDS_BIGENDIAN CACHE INTERNAL "") ...@@ -324,10 +322,8 @@ SET(WORDS_BIGENDIAN CACHE INTERNAL "")
SET(HAVE__S_IFIFO 1 CACHE INTERNAL "") SET(HAVE__S_IFIFO 1 CACHE INTERNAL "")
SET(HAVE__S_IREAD 1 CACHE INTERNAL "") SET(HAVE__S_IREAD 1 CACHE INTERNAL "")
SET(HAVE__finite 1 CACHE INTERNAL "") SET(HAVE__finite 1 CACHE INTERNAL "")
SET(HAVE__isnan 1 CACHE INTERNAL "")
SET(HAVE__pclose 1 CACHE INTERNAL "") SET(HAVE__pclose 1 CACHE INTERNAL "")
SET(HAVE__popen 1 CACHE INTERNAL "") SET(HAVE__popen 1 CACHE INTERNAL "")
SET(HAVE__snprintf 1 CACHE INTERNAL "")
SET(HAVE__stricmp 1 CACHE INTERNAL "") SET(HAVE__stricmp 1 CACHE INTERNAL "")
SET(HAVE__strnicmp 1 CACHE INTERNAL "") SET(HAVE__strnicmp 1 CACHE INTERNAL "")
SET(HAVE__strtoi64 1 CACHE INTERNAL "") SET(HAVE__strtoi64 1 CACHE INTERNAL "")
......
...@@ -319,6 +319,8 @@ ...@@ -319,6 +319,8 @@
#cmakedefine HAVE_TIMESPEC_TS_SEC 1 #cmakedefine HAVE_TIMESPEC_TS_SEC 1
#cmakedefine STRUCT_DIRENT_HAS_D_INO 1 #cmakedefine STRUCT_DIRENT_HAS_D_INO 1
#cmakedefine STRUCT_DIRENT_HAS_D_NAMLEN 1 #cmakedefine STRUCT_DIRENT_HAS_D_NAMLEN 1
#cmakedefine STRUCT_TIMESPEC_HAS_TV_SEC 1
#cmakedefine STRUCT_TIMESPEC_HAS_TV_NSEC 1
#cmakedefine SPRINTF_RETURNS_INT 1 #cmakedefine SPRINTF_RETURNS_INT 1
#define USE_MB 1 #define USE_MB 1
...@@ -515,6 +517,10 @@ ...@@ -515,6 +517,10 @@
#cmakedefine strtoll @strtoll@ #cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@ #cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@ #cmakedefine vsnprintf @vsnprintf@
#if (_MSC_VER > 1800)
#define tzname _tzname
#define P_tmpdir "C:\\TEMP"
#endif
#if (_MSC_VER > 1310) #if (_MSC_VER > 1310)
# define HAVE_SETENV # define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b) #define setenv(a,b,c) _putenv_s(a,b)
......
...@@ -1101,3 +1101,5 @@ CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H) ...@@ -1101,3 +1101,5 @@ CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
IF(NOT HAVE_UCONTEXT_H) IF(NOT HAVE_UCONTEXT_H)
CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H) CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H)
ENDIF() ENDIF()
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV_SEC)
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC)
...@@ -86,10 +86,12 @@ typedef volatile LONG my_pthread_once_t; ...@@ -86,10 +86,12 @@ typedef volatile LONG my_pthread_once_t;
#define MY_PTHREAD_ONCE_INPROGRESS 1 #define MY_PTHREAD_ONCE_INPROGRESS 1
#define MY_PTHREAD_ONCE_DONE 2 #define MY_PTHREAD_ONCE_DONE 2
#if !STRUCT_TIMESPEC_HAS_TV_SEC || !STRUCT_TIMESPEC_HAS_TV_NSEC
struct timespec { struct timespec {
time_t tv_sec; time_t tv_sec;
long tv_nsec; long tv_nsec;
}; };
#endif
int win_pthread_mutex_trylock(pthread_mutex_t *mutex); int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *); int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);
......
...@@ -88,7 +88,7 @@ const char *client_errors[]= ...@@ -88,7 +88,7 @@ const char *client_errors[]=
"" ""
}; };
const char** get_client_errmsgs() const char** get_client_errmsgs(void)
{ {
return client_errors; return client_errors;
} }
......
...@@ -45,7 +45,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST); ...@@ -45,7 +45,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST);
/* /*
a structure to pass the context (pointers two the three successive elements a structure to pass the context (pointers two the three successive elements
in a list) from lfind to linsert/ldelete in a list) from l_find to l_insert/l_delete
*/ */
typedef struct { typedef struct {
intptr volatile *prev; intptr volatile *prev;
...@@ -72,7 +72,7 @@ typedef struct { ...@@ -72,7 +72,7 @@ typedef struct {
cursor is positioned in either case cursor is positioned in either case
pins[0..2] are used, they are NOT removed on return pins[0..2] are used, they are NOT removed on return
*/ */
static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins) const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins)
{ {
uint32 cur_hashnr; uint32 cur_hashnr;
...@@ -140,7 +140,7 @@ retry: ...@@ -140,7 +140,7 @@ retry:
/* /*
DESCRIPTION DESCRIPTION
insert a 'node' in the list that starts from 'head' in the correct insert a 'node' in the list that starts from 'head' in the correct
position (as found by lfind) position (as found by l_find)
RETURN RETURN
0 - inserted 0 - inserted
...@@ -150,7 +150,7 @@ retry: ...@@ -150,7 +150,7 @@ retry:
it uses pins[0..2], on return all pins are removed. it uses pins[0..2], on return all pins are removed.
if there're nodes with the same key value, a new node is added before them. if there're nodes with the same key value, a new node is added before them.
*/ */
static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
LF_SLIST *node, LF_PINS *pins, uint flags) LF_SLIST *node, LF_PINS *pins, uint flags)
{ {
CURSOR cursor; CURSOR cursor;
...@@ -158,7 +158,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, ...@@ -158,7 +158,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
for (;;) for (;;)
{ {
if (lfind(head, cs, node->hashnr, node->key, node->keylen, if (l_find(head, cs, node->hashnr, node->key, node->keylen,
&cursor, pins) && &cursor, pins) &&
(flags & LF_HASH_UNIQUE)) (flags & LF_HASH_UNIQUE))
{ {
...@@ -202,7 +202,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, ...@@ -202,7 +202,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
NOTE NOTE
it uses pins[0..2], on return all pins are removed. it uses pins[0..2], on return all pins are removed.
*/ */
static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, LF_PINS *pins) const uchar *key, uint keylen, LF_PINS *pins)
{ {
CURSOR cursor; CURSOR cursor;
...@@ -210,7 +210,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -210,7 +210,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
for (;;) for (;;)
{ {
if (!lfind(head, cs, hashnr, key, keylen, &cursor, pins)) if (!l_find(head, cs, hashnr, key, keylen, &cursor, pins))
{ {
res= 1; /* not found */ res= 1; /* not found */
break; break;
...@@ -234,7 +234,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -234,7 +234,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
(to ensure the number of "set DELETED flag" actions (to ensure the number of "set DELETED flag" actions
is equal to the number of "remove from the list" actions) is equal to the number of "remove from the list" actions)
*/ */
lfind(head, cs, hashnr, key, keylen, &cursor, pins); l_find(head, cs, hashnr, key, keylen, &cursor, pins);
} }
res= 0; res= 0;
break; break;
...@@ -260,12 +260,12 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -260,12 +260,12 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
it uses pins[0..2], on return the pin[2] keeps the node found it uses pins[0..2], on return the pin[2] keeps the node found
all other pins are removed. all other pins are removed.
*/ */
static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs, static LF_SLIST *l_search(LF_SLIST * volatile *head, CHARSET_INFO *cs,
uint32 hashnr, const uchar *key, uint keylen, uint32 hashnr, const uchar *key, uint keylen,
LF_PINS *pins) LF_PINS *pins)
{ {
CURSOR cursor; CURSOR cursor;
int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins); int res= l_find(head, cs, hashnr, key, keylen, &cursor, pins);
if (res) if (res)
_lf_pin(pins, 2, cursor.curr); _lf_pin(pins, 2, cursor.curr);
else else
...@@ -365,7 +365,7 @@ void lf_hash_destroy(LF_HASH *hash) ...@@ -365,7 +365,7 @@ void lf_hash_destroy(LF_HASH *hash)
-1 - out of memory -1 - out of memory
NOTE NOTE
see linsert() for pin usage notes see l_insert() for pin usage notes
*/ */
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
{ {
...@@ -386,7 +386,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) ...@@ -386,7 +386,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return -1; return -1;
node->hashnr= my_reverse_bits(hashnr) | 1; /* normal node */ node->hashnr= my_reverse_bits(hashnr) | 1; /* normal node */
if (linsert(el, hash->charset, node, pins, hash->flags)) if (l_insert(el, hash->charset, node, pins, hash->flags))
{ {
_lf_alloc_free(pins, node); _lf_alloc_free(pins, node);
lf_rwunlock_by_pins(pins); lf_rwunlock_by_pins(pins);
...@@ -409,7 +409,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) ...@@ -409,7 +409,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
1 - didn't (not found) 1 - didn't (not found)
-1 - out of memory -1 - out of memory
NOTE NOTE
see ldelete() for pin usage notes see l_delete() for pin usage notes
*/ */
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{ {
...@@ -429,7 +429,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) ...@@ -429,7 +429,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
*/ */
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return -1; return -1;
if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1, if (l_delete(el, hash->charset, my_reverse_bits(hashnr) | 1,
(uchar *)key, keylen, pins)) (uchar *)key, keylen, pins))
{ {
lf_rwunlock_by_pins(pins); lf_rwunlock_by_pins(pins);
...@@ -448,7 +448,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) ...@@ -448,7 +448,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
MY_ERRPTR if OOM MY_ERRPTR if OOM
NOTE NOTE
see lsearch() for pin usage notes see l_search() for pin usage notes
*/ */
void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{ {
...@@ -462,7 +462,7 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) ...@@ -462,7 +462,7 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
return MY_ERRPTR; return MY_ERRPTR;
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return MY_ERRPTR; return MY_ERRPTR;
found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1, found= l_search(el, hash->charset, my_reverse_bits(hashnr) | 1,
(uchar *)key, keylen, pins); (uchar *)key, keylen, pins);
lf_rwunlock_by_pins(pins); lf_rwunlock_by_pins(pins);
return found ? found+1 : 0; return found ? found+1 : 0;
...@@ -490,16 +490,16 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, ...@@ -490,16 +490,16 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */ dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
dummy->key= dummy_key; dummy->key= dummy_key;
dummy->keylen= 0; dummy->keylen= 0;
if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE))) if ((cur= l_insert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
{ {
my_free(dummy); my_free(dummy);
dummy= cur; dummy= cur;
} }
my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy); my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
/* /*
note that if the CAS above failed (after linsert() succeeded), note that if the CAS above failed (after l_insert() succeeded),
it would mean that some other thread has executed linsert() for it would mean that some other thread has executed l_insert() for
the same dummy node, its linsert() failed, it picked up our the same dummy node, its l_insert() failed, it picked up our
dummy node (in "dummy= cur") and executed the same CAS as above. dummy node (in "dummy= cur") and executed the same CAS as above.
Which means that even if CAS above failed we don't need to retry, Which means that even if CAS above failed we don't need to retry,
and we should not free(dummy) - there's no memory leak here and we should not free(dummy) - there's no memory leak here
......
...@@ -17,35 +17,62 @@ IF(NOT WIN32) ...@@ -17,35 +17,62 @@ IF(NOT WIN32)
RETURN() RETURN()
ENDIF() ENDIF()
IF(MSVC_VERSION LESS 1600)
RETURN()
ENDIF()
SET(MANUFACTURER "MariaDB Corporation Ab") SET(MANUFACTURER "MariaDB Corporation Ab")
FIND_PATH(WIX_DIR heat.exe FIND_PATH(WIX_DIR heat.exe
$ENV{WIX_DIR}/bin "$ENV{ProgramFiles}/WiX Toolset v3.9/bin"
$ENV{ProgramFiles}/wix/bin "$ENV{ProgramFiles}/WiX Toolset v3.10/bin"
"$ENV{ProgramFiles}/Windows Installer XML v3/bin"
"$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
"$ENV{ProgramFiles}/Windows Installer XML v3.6/bin"
"$ENV{WIX}/bin"
) )
SET(CPACK_WIX_PACKAGE_BASE_NAME "MariaDB") SET(CPACK_WIX_PACKAGE_BASE_NAME "MariaDB")
IF(CMAKE_SIZEOF_VOID_P EQUAL 4) IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(CPACK_WIX_UPGRADE_CODE "49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3") SET(CPACK_WIX_UPGRADE_CODE "49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3")
SET(CPACK_WIX_PACKAGE_NAME "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@") SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION}")
ELSE() ELSE()
SET(CPACK_WIX_UPGRADE_CODE "2331E7BD-EE58-431B-9E18-B2B918BCEB1B") SET(CPACK_WIX_UPGRADE_CODE "2331E7BD-EE58-431B-9E18-B2B918BCEB1B")
SET(CPACK_WIX_PACKAGE_NAME "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@ (x64)") SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION} (x64)")
ENDIF()
IF(WIX_DIR)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(WIX_ARCH_SUFFIX "x64")
ELSE()
SET(WIX_ARCH_SUFFIX "x86")
ENDIF()
# Need some Wix SDK libraries to link with customaction
IF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
SET(WIX_MSVC_SUFFIX "VS2010")
ELSEIF(MSVC_VERSION EQUAL 1800)
SET(WIX_MSVC_SUFFIX "VS2013")
ELSEIF (MSVC_VERSION EQUAL 1900)
SET(WIX_MSVC_SUFFIX "VS2015")
ENDIF() ENDIF()
IF(NOT WIX_DIR) FIND_LIBRARY(WIX_WCAUTIL_LIBRARY
IF(NOT _WIX_DIR_CHECKED) NAMES wcautil${WIX_ARCH_SUFFIX} wcautil${WIX_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "") wcautil
PATHS
${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/lib/${WIX_ARCH_SUFFIX}
)
FIND_LIBRARY(WIX_DUTIL_LIBRARY
NAMES dutil${WIX_ARCH_SUFFIX}
dutil
PATHS
${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/lib/${WIX_ARCH_SUFFIX}
)
ENDIF()
IF(NOT WIX_DUTIL_LIBRARY)
MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated") MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
IF(BUILD_RELEASE) IF(BUILD_RELEASE)
MESSAGE(FATAL_ERROR MESSAGE(FATAL_ERROR
"Can't find Wix. It is necessary for producing official package" "Can't find Wix. It is necessary for producing official package")
)
ENDIF()
ENDIF() ENDIF()
RETURN() RETURN()
ENDIF() ENDIF()
......
...@@ -13,50 +13,11 @@ ...@@ -13,50 +13,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc) INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/inc)
LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib)
SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def) SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(WIX_ARCH_SUFFIX "_x64")
SET(WIX36_ARCH_SUFFIX "x64")
ELSE()
SET(WIX_ARCH_SUFFIX)
SET(WIX36_ARCH_SUFFIX "x86")
ENDIF()
IF(MSVC_VERSION EQUAL 1400)
SET(WIX35_MSVC_SUFFIX "_2005")
ELSEIF(MSVC_VERSION EQUAL 1500)
SET(WIX35_MSVC_SUFFIX "_2008")
SET(WIX36_MSVC_SUFFIX "VS2008")
ELSEIF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
SET(WIX35_MSVC_SUFFIX "_2010")
SET(WIX36_MSVC_SUFFIX "VS2010")
ELSE()
# When next VS is out, add the correct version here
MESSAGE(FATAL_ERROR "Unknown VS version")
ENDIF()
INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/inc)
FIND_LIBRARY(WIX_WCAUTIL_LIBRARY
NAMES wcautil${WIX_ARCH_SUFFIX} wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
wcautil
PATHS
${WIX_DIR}/../SDK/lib
${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX})
FIND_LIBRARY(WIX_DUTIL_LIBRARY
NAMES dutil${WIX_ARCH_SUFFIX} dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
dutil
PATHS
${WIX_DIR}/../SDK/lib
${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX}
)
ADD_VERSION_INFO(wixca SHARED WIXCA_SOURCES) ADD_VERSION_INFO(wixca SHARED WIXCA_SOURCES)
ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES}) ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES})
TARGET_LINK_LIBRARIES(wixca ${WIX_WCAUTIL_LIBRARY} ${WIX_DUTIL_LIBRARY} TARGET_LINK_LIBRARIES(wixca ${WIX_WCAUTIL_LIBRARY} ${WIX_DUTIL_LIBRARY}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment