diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-04-24 11:18:59 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-04-24 18:15:20 +0200 |
commit | ce38adddfa91949b30956abd0e4cab201effcdef (patch) | |
tree | 42337144be11133176c8f0ef8f06f9bac5d9395e /storage | |
parent | 7b58fd5ef0c1ecdc7c6d6d3347110620e67313c2 (diff) | |
download | mariadb-git-ce38adddfa91949b30956abd0e4cab201effcdef.tar.gz |
MDEV-9617 solaris sparc build fails on 10.0
Spider:
SunPro only supports array declarations with
constant size. Spider already has a workaround for
that, inside #ifdef _MSC_VER. Enable this code
also for __SUNPRO_CC
Connect:
Don't use anonymous union.
Cast for mmap.
Don't pass gcc-ish -W... options to SunPro
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storage/connect/maputil.cpp | 4 | ||||
-rwxr-xr-x | storage/connect/xindex.cpp | 26 | ||||
-rw-r--r-- | storage/connect/xindex.h | 4 | ||||
-rw-r--r-- | storage/spider/spd_conn.cc | 34 | ||||
-rw-r--r-- | storage/spider/spd_db_conn.cc | 4 | ||||
-rw-r--r-- | storage/spider/spd_ping_table.cc | 4 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 16 | ||||
-rw-r--r-- | storage/spider/spd_trx.cc | 12 |
9 files changed, 54 insertions, 52 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 7ff2ca7753c..0702e44bcf2 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -45,6 +45,7 @@ add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT -DPIVOT_SUPPORT ) # OS specific C flags, definitions and source files. # IF(UNIX) + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") # Bar: -Wfatal-errors removed (does not present in gcc on solaris10) if(WITH_WARNINGS) add_definitions(-Wall -Wextra -Wmissing-declarations) @@ -71,6 +72,7 @@ IF(UNIX) #message(STATUS "CONNECT: GCC: Some warnings disabled") endif(WITH_WARNINGS) + endif() add_definitions( -DUNIX -DLINUX -DUBUNTU ) diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp index c4e016f1511..87263b3adf6 100644 --- a/storage/connect/maputil.cpp +++ b/storage/connect/maputil.cpp @@ -190,8 +190,8 @@ bool CloseMemMap(void *memory, size_t dwSize) { if (memory) { // All this must be redesigned - int rc = msync(memory, dwSize, MS_SYNC); - return (munmap(memory, dwSize) < 0) ? true : false; + int rc = msync((char*)memory, dwSize, MS_SYNC); + return (munmap((char*)memory, dwSize) < 0) ? true : false; } else return false; diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index a2d75cec8ab..69aa7e2c20e 100755 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -1279,7 +1279,7 @@ bool XINDEX::MapInit(PGLOBAL g) IOFF *noff = (IOFF*)mbase; // Position the memory base at the offset of this index - mbase += noff[id].Low; + mbase += noff[id].v.Low; } // endif id // Now start the mapping process. @@ -2347,10 +2347,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) return true; } // endif - NewOff.Low = (int)ftell(Xfile); + NewOff.v.Low = (int)ftell(Xfile); if (trace) - htrc("XFILE Open: NewOff.Low=%d\n", NewOff.Low); + htrc("XFILE Open: NewOff.v.Low=%d\n", NewOff.v.Low); } else if (mode == MODE_WRITE) { if (id >= 0) { @@ -2358,10 +2358,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) memset(noff, 0, sizeof(noff)); Write(g, noff, sizeof(IOFF), MAX_INDX, rc); fseek(Xfile, 0, SEEK_END); - NewOff.Low = (int)ftell(Xfile); + NewOff.v.Low = (int)ftell(Xfile); if (trace) - htrc("XFILE Open: NewOff.Low=%d\n", NewOff.Low); + htrc("XFILE Open: NewOff.v.Low=%d\n", NewOff.v.Low); } // endif id @@ -2373,10 +2373,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) } // endif MAX_INDX if (trace) - htrc("XFILE Open: noff[%d].Low=%d\n", id, noff[id].Low); + htrc("XFILE Open: noff[%d].v.Low=%d\n", id, noff[id].v.Low); // Position the cursor at the offset of this index - if (fseek(Xfile, noff[id].Low, SEEK_SET)) { + if (fseek(Xfile, noff[id].v.Low, SEEK_SET)) { sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek"); return true; } // endif @@ -2566,14 +2566,14 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) return true; } // endif - NewOff.Low = (int)rc; - NewOff.High = (int)high; + NewOff.v.Low = (int)rc; + NewOff.v.High = (int)high; } else if (mode == MODE_WRITE) { if (id >= 0) { // New not sep index file. Write the header. memset(noff, 0, sizeof(noff)); rc = WriteFile(Hfile, noff, sizeof(noff), &drc, NULL); - NewOff.Low = (int)drc; + NewOff.v.Low = (int)drc; } // endif id } else if (mode == MODE_READ && id >= 0) { @@ -2586,8 +2586,8 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) } // endif rc // Position the cursor at the offset of this index - rc = SetFilePointer(Hfile, noff[id].Low, - (PLONG)&noff[id].High, FILE_BEGIN); + rc = SetFilePointer(Hfile, noff[id].v.Low, + (PLONG)&noff[id].v.High, FILE_BEGIN); if (rc == INVALID_SET_FILE_POINTER) { sprintf(g->Message, MSG(FUNC_ERRNO), GetLastError(), "SetFilePointer"); @@ -2649,7 +2649,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) if (id >= 0) { // New not sep index file. Write the header. memset(noff, 0, sizeof(noff)); - NewOff.Low = write(Hfile, &noff, sizeof(noff)); + NewOff.v.Low = write(Hfile, &noff, sizeof(noff)); } // endif id if (trace) diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h index 51b678992ea..ef2e934e5ee 100644 --- a/storage/connect/xindex.h +++ b/storage/connect/xindex.h @@ -66,9 +66,9 @@ typedef struct index_def : public BLOCK { typedef struct index_off { union { #if defined(WORDS_BIGENDIAN) - struct {int High; int Low;}; + struct {int High; int Low;} v; #else // !WORDS_BIGENDIAN - struct {int Low; int High;}; + struct {int Low; int High;} v; #endif //!WORDS_BIGENDIAN longlong Val; // File position }; // end of union diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index c5c47064403..2f7fdb62ad4 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -2706,7 +2706,7 @@ void *spider_bg_sts_action( SPIDER_TRX *trx; int error_num = 0, roop_count; ha_spider spider; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) int *need_mons; SPIDER_CONN **conns; uint *conn_link_idx; @@ -2733,7 +2733,7 @@ void *spider_bg_sts_action( my_thread_init(); DBUG_ENTER("spider_bg_sts_action"); /* init start */ -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) if (!(need_mons = (int *) spider_bulk_malloc(spider_current_trx, 21, MYF(MY_WME), @@ -2777,7 +2777,7 @@ void *spider_bg_sts_action( share->bg_sts_init = FALSE; pthread_mutex_unlock(&share->sts_mutex); my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -2801,7 +2801,7 @@ void *spider_bg_sts_action( my_pthread_setspecific_ptr(THR_THD, NULL); #endif my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -2866,7 +2866,7 @@ void *spider_bg_sts_action( my_pthread_setspecific_ptr(THR_THD, NULL); #endif my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -2897,7 +2897,7 @@ void *spider_bg_sts_action( my_pthread_setspecific_ptr(THR_THD, NULL); #endif my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -3088,7 +3088,7 @@ void *spider_bg_crd_action( int error_num = 0, roop_count; ha_spider spider; TABLE table; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) int *need_mons; SPIDER_CONN **conns; uint *conn_link_idx; @@ -3115,7 +3115,7 @@ void *spider_bg_crd_action( my_thread_init(); DBUG_ENTER("spider_bg_crd_action"); /* init start */ -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) if (!(need_mons = (int *) spider_bulk_malloc(spider_current_trx, 22, MYF(MY_WME), @@ -3159,7 +3159,7 @@ void *spider_bg_crd_action( share->bg_crd_init = FALSE; pthread_mutex_unlock(&share->crd_mutex); my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -3183,7 +3183,7 @@ void *spider_bg_crd_action( my_pthread_setspecific_ptr(THR_THD, NULL); #endif my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -3252,7 +3252,7 @@ void *spider_bg_crd_action( my_pthread_setspecific_ptr(THR_THD, NULL); #endif my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -3283,7 +3283,7 @@ void *spider_bg_crd_action( my_pthread_setspecific_ptr(THR_THD, NULL); #endif my_thread_end(); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(NULL, need_mons, MYF(MY_WME)); #endif DBUG_RETURN(NULL); @@ -3417,7 +3417,7 @@ int spider_create_mon_threads( { char link_idx_str[SPIDER_SQL_INT_LEN]; int link_idx_str_length; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_string conv_name_str(share->table_name_length + SPIDER_SQL_INT_LEN + 1); conv_name_str.set_charset(system_charset_info); @@ -3748,7 +3748,7 @@ int spider_conn_first_link_idx( int roop_count, active_links = 0; longlong balance_total = 0, balance_val; double rand_val; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) int *link_idxs, link_idx; long *balances; #else @@ -3756,7 +3756,7 @@ int spider_conn_first_link_idx( long balances[link_count]; #endif DBUG_ENTER("spider_conn_first_link_idx"); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) if (!(link_idxs = (int *) spider_bulk_malloc(spider_current_trx, 24, MYF(MY_WME), &link_idxs, sizeof(int) * link_count, @@ -3782,7 +3782,7 @@ int spider_conn_first_link_idx( if (active_links == 0) { DBUG_PRINT("info",("spider all links are failed")); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(spider_current_trx, link_idxs, MYF(MY_WME)); #endif DBUG_RETURN(-1); @@ -3811,7 +3811,7 @@ int spider_conn_first_link_idx( } DBUG_PRINT("info",("spider first link_idx=%d", link_idxs[roop_count])); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) link_idx = link_idxs[roop_count]; spider_free(spider_current_trx, link_idxs, MYF(MY_WME)); DBUG_RETURN(link_idx); diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 9f46e55ca09..c29172a474a 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -9294,7 +9294,7 @@ int spider_db_udf_ping_table( { int init_sql_alloc_size = spider_param_init_sql_alloc_size(trx->thd, share->init_sql_alloc_size); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_string sql_str(init_sql_alloc_size); sql_str.set_charset(system_charset_info); spider_string where_str(init_sql_alloc_size); @@ -9517,7 +9517,7 @@ int spider_db_udf_ping_table_mon_next( SPIDER_SHARE *share = table_mon->share; int init_sql_alloc_size = spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_string sql_str(init_sql_alloc_size); sql_str.set_charset(thd->variables.character_set_client); #else diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index 41c5c240dd3..f59f7760359 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -241,7 +241,7 @@ void spider_release_ping_table_mon_list( DBUG_PRINT("info", ("spider link_idx=%d", link_idx)); link_idx_str_length = my_sprintf(link_idx_str, (link_idx_str, "%010d", link_idx)); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_string conv_name_str(conv_name_length + link_idx_str_length + 1); conv_name_str.set_charset(system_charset_info); #else @@ -1362,7 +1362,7 @@ int spider_ping_table_mon_from_table( link_idx_str_length = my_sprintf(link_idx_str, (link_idx_str, "%010d", link_idx)); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_string conv_name_str(conv_name_length + link_idx_str_length + 1); conv_name_str.set_charset(system_charset_info); *((char *)(conv_name_str.ptr() + conv_name_length + link_idx_str_length)) = diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 07572fa7973..ead335c07ea 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -3703,7 +3703,7 @@ int spider_create_conn_keys( #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) char *tmp_hs_r_name, *tmp_hs_w_name; #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) uint *conn_keys_lengths; #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) uint *hs_r_conn_keys_lengths; @@ -3717,7 +3717,7 @@ int spider_create_conn_keys( #endif #endif DBUG_ENTER("spider_create_conn_keys"); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) if (!(conn_keys_lengths = (uint *) spider_bulk_alloc_mem(spider_current_trx, 44, __func__, __FILE__, __LINE__, MYF(MY_WME), @@ -3806,7 +3806,7 @@ int spider_create_conn_keys( #endif NullS)) ) { -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(spider_current_trx, conn_keys_lengths, MYF(MY_WME)); #endif DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3823,7 +3823,7 @@ int spider_create_conn_keys( sizeof(uint) * share->all_link_count); #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(spider_current_trx, conn_keys_lengths, MYF(MY_WME)); #endif @@ -4676,7 +4676,7 @@ SPIDER_SHARE *spider_get_share( share->link_count, SPIDER_LINK_STATUS_OK); if (search_link_idx == -1) { -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) char *db, *table_name; if (!(db = (char *) spider_bulk_malloc(spider_current_trx, 48, MYF(MY_WME), @@ -4702,7 +4702,7 @@ SPIDER_SHARE *spider_get_share( table_name[table_share->table_name.length] = '\0'; my_printf_error(ER_SPIDER_ALL_LINKS_FAILED_NUM, ER_SPIDER_ALL_LINKS_FAILED_STR, MYF(0), db, table_name); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(spider->trx, db, MYF(MY_WME)); #endif *error_num = ER_SPIDER_ALL_LINKS_FAILED_NUM; @@ -5100,7 +5100,7 @@ SPIDER_SHARE *spider_get_share( share->link_count, SPIDER_LINK_STATUS_OK); if (search_link_idx == -1) { -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) char *db, *table_name; if (!(db = (char *) spider_bulk_malloc(spider_current_trx, 50, MYF(MY_WME), @@ -5123,7 +5123,7 @@ SPIDER_SHARE *spider_get_share( table_name[table_share->table_name.length] = '\0'; my_printf_error(ER_SPIDER_ALL_LINKS_FAILED_NUM, ER_SPIDER_ALL_LINKS_FAILED_STR, MYF(0), db, table_name); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(spider->trx, db, MYF(MY_WME)); #endif *error_num = ER_SPIDER_ALL_LINKS_FAILED_NUM; diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index d7127fa0084..18b6fd5ec89 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -3710,7 +3710,7 @@ int spider_check_trx_and_get_conn( { TABLE *table = spider->get_table(); TABLE_SHARE *table_share = table->s; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) char *db, *table_name; if (!(db = (char *) spider_bulk_malloc(spider_current_trx, 57, MYF(MY_WME), @@ -3732,7 +3732,7 @@ int spider_check_trx_and_get_conn( table_name[table_share->table_name.length] = '\0'; my_printf_error(ER_SPIDER_ALL_LINKS_FAILED_NUM, ER_SPIDER_ALL_LINKS_FAILED_STR, MYF(0), db, table_name); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(trx, db, MYF(MY_WME)); #endif DBUG_RETURN(ER_SPIDER_ALL_LINKS_FAILED_NUM); @@ -3869,7 +3869,7 @@ int spider_check_trx_and_get_conn( { TABLE *table = spider->get_table(); TABLE_SHARE *table_share = table->s; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) char *db, *table_name; if (!(db = (char *) spider_bulk_malloc(spider_current_trx, 57, MYF(MY_WME), @@ -3891,7 +3891,7 @@ int spider_check_trx_and_get_conn( table_name[table_share->table_name.length] = '\0'; my_printf_error(ER_SPIDER_LINK_MON_JUST_NG_NUM, ER_SPIDER_LINK_MON_JUST_NG_STR, MYF(0), db, table_name); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(trx, db, MYF(MY_WME)); #endif DBUG_RETURN(ER_SPIDER_LINK_MON_JUST_NG_NUM); @@ -4015,7 +4015,7 @@ int spider_check_trx_and_get_conn( { TABLE *table = spider->get_table(); TABLE_SHARE *table_share = table->s; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) char *db, *table_name; if (!(db = (char *) spider_bulk_malloc(spider_current_trx, 57, MYF(MY_WME), @@ -4037,7 +4037,7 @@ int spider_check_trx_and_get_conn( table_name[table_share->table_name.length] = '\0'; my_printf_error(ER_SPIDER_LINK_MON_JUST_NG_NUM, ER_SPIDER_LINK_MON_JUST_NG_STR, MYF(0), db, table_name); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__SUNPRO_CC) spider_free(trx, db, MYF(MY_WME)); #endif DBUG_RETURN(ER_SPIDER_LINK_MON_JUST_NG_NUM); |