Commit ce38addd authored by Sergei Golubchik's avatar Sergei Golubchik

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
parent 7b58fd5e
......@@ -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 )
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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)) =
......
......@@ -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;
......
......@@ -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);
......
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