Commit f1daf9ce authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-9024 Build fails with VS2015

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 a36048d1
...@@ -1108,7 +1108,7 @@ inline int get_command_index(char cmd_char) ...@@ -1108,7 +1108,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;
......
...@@ -5246,7 +5246,7 @@ static st_error global_error_names[] = ...@@ -5246,7 +5246,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 }
}; };
......
...@@ -96,9 +96,12 @@ IF(MSVC) ...@@ -96,9 +96,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)
...@@ -113,7 +116,7 @@ IF(MSVC) ...@@ -113,7 +116,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.
...@@ -181,14 +184,14 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h) ...@@ -181,14 +184,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 "")
......
...@@ -317,6 +317,8 @@ ...@@ -317,6 +317,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
...@@ -514,6 +516,10 @@ ...@@ -514,6 +516,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)
...@@ -522,7 +528,7 @@ ...@@ -522,7 +528,7 @@
/* We don't want the min/max macros */ /* We don't want the min/max macros */
#ifdef __WIN__ #ifdef __WIN__
#define NOMINMAX #define NOMINMAX 1
#endif #endif
/* /*
......
...@@ -1056,3 +1056,5 @@ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_IN ...@@ -1056,3 +1056,5 @@ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_IN
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN) CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN)
SET(SPRINTF_RETURNS_INT 1) SET(SPRINTF_RETURNS_INT 1)
CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H) CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
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)
...@@ -44,7 +44,7 @@ extern "C" { ...@@ -44,7 +44,7 @@ extern "C" {
typedef uint my_hash_value_type; typedef uint my_hash_value_type;
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
typedef my_hash_value_type (*my_hash_function)(const CHARSET_INFO *, typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
const uchar *, size_t); const uchar *, size_t);
typedef void (*my_hash_free_key)(void *); typedef void (*my_hash_free_key)(void *);
typedef my_bool (*my_hash_walk_action)(void *,void *); typedef my_bool (*my_hash_walk_action)(void *,void *);
...@@ -78,7 +78,7 @@ uchar *my_hash_search(const HASH *info, const uchar *key, size_t length); ...@@ -78,7 +78,7 @@ uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
uchar *my_hash_search_using_hash_value(const HASH *info, uchar *my_hash_search_using_hash_value(const HASH *info,
my_hash_value_type hash_value, my_hash_value_type hash_value,
const uchar *key, size_t length); const uchar *key, size_t length);
my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, my_hash_value_type my_hash_sort(CHARSET_INFO *cs,
const uchar *key, size_t length); const uchar *key, size_t length);
#define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C) #define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C)
uchar *my_hash_first(const HASH *info, const uchar *key, size_t length, uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,
......
...@@ -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 *);
......
...@@ -90,7 +90,7 @@ const char *client_errors[]= ...@@ -90,7 +90,7 @@ const char *client_errors[]=
"" ""
}; };
const char** get_client_errmsgs() const char** get_client_errmsgs(void)
{ {
return client_errors; return client_errors;
} }
......
...@@ -40,7 +40,7 @@ static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink); ...@@ -40,7 +40,7 @@ static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
size_t length); size_t length);
my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, const uchar *key, my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
size_t length) size_t length)
{ {
ulong nr1= 1, nr2= 4; ulong nr1= 1, nr2= 4;
......
...@@ -43,7 +43,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST); ...@@ -43,7 +43,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;
...@@ -70,7 +70,7 @@ typedef struct { ...@@ -70,7 +70,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;
...@@ -138,7 +138,7 @@ static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -138,7 +138,7 @@ static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
/* /*
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
...@@ -148,7 +148,7 @@ static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -148,7 +148,7 @@ static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
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;
...@@ -156,7 +156,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, ...@@ -156,7 +156,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))
{ {
...@@ -200,7 +200,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, ...@@ -200,7 +200,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;
...@@ -208,7 +208,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -208,7 +208,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;
...@@ -232,7 +232,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -232,7 +232,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;
...@@ -258,12 +258,12 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -258,12 +258,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
...@@ -363,7 +363,7 @@ void lf_hash_destroy(LF_HASH *hash) ...@@ -363,7 +363,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)
{ {
...@@ -384,7 +384,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) ...@@ -384,7 +384,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);
...@@ -407,7 +407,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) ...@@ -407,7 +407,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)
{ {
...@@ -427,7 +427,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) ...@@ -427,7 +427,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);
...@@ -446,7 +446,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) ...@@ -446,7 +446,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)
{ {
...@@ -460,7 +460,7 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) ...@@ -460,7 +460,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;
...@@ -488,16 +488,16 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, ...@@ -488,16 +488,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,36 +17,62 @@ IF(NOT WIN32) ...@@ -17,36 +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/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{ProgramFiles}/WiX Toolset v3.9/bin" "$ENV{ProgramFiles}/WiX Toolset v3.9/bin"
"$ENV{WIX}/bin" "$ENV{ProgramFiles}/WiX Toolset v3.10/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,53 +13,13 @@ ...@@ -13,53 +13,13 @@
# 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")
ELSEIF(MSVC_VERSION EQUAL 1800 OR MSVC_VERSION EQUAL 1900 )
SET(WIX35_MSVC_SUFFIX "_2013")
SET(WIX36_MSVC_SUFFIX "VS2013")
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})
......
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