summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-02-19 14:05:15 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-02-19 14:05:15 +0400
commitd12c7adf715677b118104d4e5adf6f978c27b4ee (patch)
tree04cdbaf4509cbe485cb992e271ab8d711a867011 /storage/myisam
parentfd1437dfe532ed78ce2a1c8e05a989fcbf79832e (diff)
downloadmariadb-git-d12c7adf715677b118104d4e5adf6f978c27b4ee.tar.gz
MDEV-5314 - Compiling fails on OSX using clang
This is port of fix for MySQL BUG#17647863. revno: 5572 revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj committer: Jon Olav Hauglid <jon.hauglid@oracle.com> timestamp: Thu 2013-10-31 00:22:43 +0100 message: Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM Rename test() macro to MY_TEST() to avoid conflict with libc++.
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/ft_boolean_search.c2
-rw-r--r--storage/myisam/ha_myisam.cc20
-rw-r--r--storage/myisam/mi_check.c14
-rw-r--r--storage/myisam/mi_checksum.c2
-rw-r--r--storage/myisam/mi_create.c7
-rw-r--r--storage/myisam/mi_delete.c4
-rw-r--r--storage/myisam/mi_dynrec.c10
-rw-r--r--storage/myisam/mi_extra.c4
-rw-r--r--storage/myisam/mi_locking.c2
-rw-r--r--storage/myisam/mi_open.c6
-rw-r--r--storage/myisam/mi_search.c4
-rw-r--r--storage/myisam/mi_test1.c7
-rw-r--r--storage/myisam/myisamchk.c7
13 files changed, 46 insertions, 43 deletions
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 70a7037a446..6befe3b2d7a 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -533,7 +533,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
{
if (ftbe->flags & FTB_FLAG_NO || /* 2 */
ftbe->up->ythresh - ftbe->up->yweaks >
- (uint) test(ftbe->flags & FTB_FLAG_YES)) /* 1 */
+ (uint) MY_TEST(ftbe->flags & FTB_FLAG_YES)) /* 1 */
{
FTB_EXPR *top_ftbe=ftbe->up;
ftbw->docid[0]=HA_OFFSET_ERROR;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 0178e2abfa9..18f0c3b7f60 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -480,8 +480,8 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{
DBUG_PRINT("error", ("Key %d has different definition", i));
DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d",
- test(t1_keyinfo[i].flag & HA_FULLTEXT),
- test(t2_keyinfo[i].flag & HA_FULLTEXT)));
+ MY_TEST(t1_keyinfo[i].flag & HA_FULLTEXT),
+ MY_TEST(t2_keyinfo[i].flag & HA_FULLTEXT)));
DBUG_RETURN(1);
}
if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL)
@@ -491,8 +491,8 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{
DBUG_PRINT("error", ("Key %d has different definition", i));
DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d",
- test(t1_keyinfo[i].flag & HA_SPATIAL),
- test(t2_keyinfo[i].flag & HA_SPATIAL)));
+ MY_TEST(t1_keyinfo[i].flag & HA_SPATIAL),
+ MY_TEST(t2_keyinfo[i].flag & HA_SPATIAL)));
DBUG_RETURN(1);
}
if ((!mysql_40_compat &&
@@ -913,7 +913,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
my_default_record_cache_size, READ_CACHE,
share->pack.header_length, 1, MYF(MY_WME))))
{
- error= chk_data_link(&param, file, test(param.testflag & T_EXTEND));
+ error= chk_data_link(&param, file, MY_TEST(param.testflag & T_EXTEND));
end_io_cache(&(param.read_cache));
}
param.testflag= old_testflag;
@@ -1109,7 +1109,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
share->state.key_map);
ulonglong testflag= param.testflag;
#ifdef HAVE_MMAP
- bool remap= test(share->file_map);
+ bool remap= MY_TEST(share->file_map);
/*
mi_repair*() functions family use file I/O even if memory
mapping is available.
@@ -1131,14 +1131,14 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
/* TODO: respect myisam_repair_threads variable */
thd_proc_info(thd, "Parallel repair");
error = mi_repair_parallel(&param, file, fixed_name,
- test(param.testflag & T_QUICK));
+ MY_TEST(param.testflag & T_QUICK));
}
else
{
thd_proc_info(thd, "Repair by sorting");
DEBUG_SYNC(thd, "myisam_before_repair_by_sort");
error = mi_repair_by_sort(&param, file, fixed_name,
- test(param.testflag & T_QUICK));
+ MY_TEST(param.testflag & T_QUICK));
}
if (error && file->create_unique_index_by_sort &&
share->state.dupp_key != MAX_KEY)
@@ -1150,7 +1150,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
thd_proc_info(thd, "Repair with keycache");
param.testflag &= ~T_REP_BY_SORT;
error= mi_repair(&param, file, fixed_name,
- test(param.testflag & T_QUICK));
+ MY_TEST(param.testflag & T_QUICK));
}
param.testflag= testflag | (param.testflag & T_RETRY_WITHOUT_QUICK);
#ifdef HAVE_MMAP
@@ -1562,7 +1562,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows, uint flags)
}
else
{
- my_bool all_keys= test(flags & HA_CREATE_UNIQUE_INDEX_BY_SORT);
+ my_bool all_keys= MY_TEST(flags & HA_CREATE_UNIQUE_INDEX_BY_SORT);
mi_disable_indexes_for_rebuild(file, rows, all_keys);
}
}
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index a44a6236293..b3c9355cb8b 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -1147,7 +1147,7 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend)
if (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE))
{
if (_mi_rec_check(info,record, info->rec_buff,block_info.rec_len,
- test(info->s->calc_checksum)))
+ MY_TEST(info->s->calc_checksum)))
{
mi_check_print_error(param,"Found wrong packed record at %s",
llstr(start_recpos,llbuff));
@@ -2364,7 +2364,7 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info,
if (keyseg[i].flag & HA_SPACE_PACK)
sort_param.key_length+=get_pack_length(keyseg[i].length);
if (keyseg[i].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART))
- sort_param.key_length+=2 + test(keyseg[i].length >= 127);
+ sort_param.key_length+= 2 + MY_TEST(keyseg[i].length >= 127);
if (keyseg[i].flag & HA_NULL_PART)
sort_param.key_length++;
}
@@ -2866,7 +2866,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
if (keyseg->flag & HA_SPACE_PACK)
sort_param[i].key_length+=get_pack_length(keyseg->length);
if (keyseg->flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART))
- sort_param[i].key_length+=2 + test(keyseg->length >= 127);
+ sort_param[i].key_length+= 2 + MY_TEST(keyseg->length >= 127);
if (keyseg->flag & HA_NULL_PART)
sort_param[i].key_length++;
}
@@ -2884,7 +2884,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
sort_info.total_keys=i;
sort_param[0].master= 1;
sort_param[0].fix_datafile= (my_bool)(! rep_quick);
- sort_param[0].calc_checksum= test(param->testflag & T_CALC_CHECKSUM);
+ sort_param[0].calc_checksum= MY_TEST(param->testflag & T_CALC_CHECKSUM);
if (!ftparser_alloc_param(info))
goto err;
@@ -3573,7 +3573,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
sort_param->find_length,
(param->testflag & T_QUICK) &&
sort_param->calc_checksum &&
- test(info->s->calc_checksum)))
+ MY_TEST(info->s->calc_checksum)))
{
mi_check_print_info(param,"Found wrong packed record at %s",
llstr(sort_param->start_recpos,llbuff));
@@ -3734,7 +3734,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
do
{
- block_length=reclength+ 3 + test(reclength >= (65520-3));
+ block_length= reclength + 3 + MY_TEST(reclength >= (65520 - 3));
if (block_length < share->base.min_block_length)
block_length=share->base.min_block_length;
info->update|=HA_STATE_WRITE_AT_END;
@@ -4661,7 +4661,7 @@ static ha_checksum mi_byte_checksum(const uchar *buf, uint length)
const uchar *end=buf+length;
for (crc=0; buf != end; buf++)
crc=((crc << 1) + *((uchar*) buf)) +
- test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1)));
+ MY_TEST(crc & (((ha_checksum) 1) << (8 * sizeof(ha_checksum) - 1)));
return crc;
}
diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c
index e0a8672760d..01adae3edac 100644
--- a/storage/myisam/mi_checksum.c
+++ b/storage/myisam/mi_checksum.c
@@ -23,7 +23,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
const uchar *record= buf;
MI_COLUMNDEF *column= info->s->rec;
MI_COLUMNDEF *column_end= column+ info->s->base.fields;
- my_bool skip_null_bits= test(info->s->options & HA_OPTION_NULL_FIELDS);
+ my_bool skip_null_bits= MY_TEST(info->s->options & HA_OPTION_NULL_FIELDS);
for ( ; column != column_end ; buf+= column++->length)
{
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 4de218864de..88b9da6f8a9 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -138,7 +138,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
pack_reclength++;
min_pack_length++;
/* We must test for 257 as length includes pack-length */
- if (test(rec->length >= 257))
+ if (MY_TEST(rec->length >= 257))
{
long_varchar_count++;
pack_reclength+= 2; /* May be packed on 3 bytes */
@@ -205,7 +205,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
pack_bytes= (packed+7)/8;
if (pack_reclength != INT_MAX32)
pack_reclength+= reclength+packed +
- test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_OPTION_PACK_RECORD));
+ MY_TEST(test_all_bits(options, HA_OPTION_CHECKSUM |
+ HA_OPTION_PACK_RECORD));
min_pack_length+= pack_bytes;
if (!ci->data_file_length && ci->max_rows)
@@ -557,7 +558,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
share.base.records=ci->max_rows;
share.base.reloc= ci->reloc_rows;
share.base.reclength=real_reclength;
- share.base.pack_reclength=reclength+ test(options & HA_OPTION_CHECKSUM);
+ share.base.pack_reclength= reclength + MY_TEST(options & HA_OPTION_CHECKSUM);
share.base.max_pack_length=pack_reclength;
share.base.min_pack_length=min_pack_length;
share.base.pack_bits= pack_bytes;
diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c
index 907d8e291f6..3fffa55341b 100644
--- a/storage/myisam/mi_delete.c
+++ b/storage/myisam/mi_delete.c
@@ -353,8 +353,8 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_RETURN(-1);
}
/* Page will be update later if we return 1 */
- DBUG_RETURN(test(length <= (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH :
- (uint) keyinfo->underflow_block_length)));
+ DBUG_RETURN(MY_TEST(length <= (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH :
+ (uint) keyinfo->underflow_block_length)));
}
save_flag=1;
ret_value=del(info,keyinfo,key,anc_buff,leaf_page,leaf_buff,keypos,
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 021809ed892..5241d72014c 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -416,7 +416,7 @@ static int _mi_find_writepos(MI_INFO *info,
{
/* No deleted blocks; Allocate a new block */
*filepos=info->state->data_file_length;
- if ((tmp=reclength+3 + test(reclength >= (65520-3))) <
+ if ((tmp= reclength + 3 + MY_TEST(reclength >= (65520 - 3))) <
info->s->base.min_block_length)
tmp= info->s->base.min_block_length;
else
@@ -864,7 +864,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record,
if (length < reclength)
{
uint tmp=MY_ALIGN(reclength - length + 3 +
- test(reclength >= 65520L),MI_DYN_ALIGN_SIZE);
+ MY_TEST(reclength >= 65520L), MI_DYN_ALIGN_SIZE);
/* Don't create a block bigger than MI_MAX_BLOCK_LENGTH */
tmp= MY_MIN(length+tmp, MI_MAX_BLOCK_LENGTH)-length;
/* Check if we can extend this block */
@@ -1025,7 +1025,7 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to,
pos++;
}
new_length=(uint) (end-pos);
- if (new_length +1 + test(rec->length > 255 && new_length > 127)
+ if (new_length + 1 + MY_TEST(rec->length > 255 && new_length > 127)
< length)
{
if (rec->length > 255 && new_length > 127)
@@ -1145,7 +1145,7 @@ my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff,
pos++;
}
new_length=(uint) (end-pos);
- if (new_length +1 + test(rec->length > 255 && new_length > 127)
+ if (new_length + 1 + MY_TEST(rec->length > 255 && new_length > 127)
< length)
{
if (!(flag & bit))
@@ -1197,7 +1197,7 @@ my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff,
else
to+= length;
}
- if (packed_length != (uint) (to - rec_buff) + test(info->s->calc_checksum) ||
+ if (packed_length != (uint) (to - rec_buff) + MY_TEST(info->s->calc_checksum) ||
(bit != 1 && (flag & ~(bit - 1))))
goto err;
if (with_checksum && ((uchar) info->checksum != (uchar) *to))
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index f57fba5c2c5..a47c1987e38 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -56,7 +56,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
{
reinit_io_cache(&info->rec_cache,READ_CACHE,0,
(pbool) (info->lock_type != F_UNLCK),
- (pbool) test(info->update & HA_STATE_ROW_CHANGED)
+ (pbool) MY_TEST(info->update & HA_STATE_ROW_CHANGED)
);
}
info->update= ((info->update & HA_STATE_CHANGED) | HA_STATE_NEXT_FOUND |
@@ -117,7 +117,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
{
reinit_io_cache(&info->rec_cache,READ_CACHE,info->nextpos,
(pbool) (info->lock_type != F_UNLCK),
- (pbool) test(info->update & HA_STATE_ROW_CHANGED));
+ (pbool) MY_TEST(info->update & HA_STATE_ROW_CHANGED));
info->update&= ~HA_STATE_ROW_CHANGED;
if (share->concurrent_insert)
info->rec_cache.end_of_file=info->state->data_file_length;
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 663a226d850..531b800c63e 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -646,7 +646,7 @@ int _mi_decrement_open_count(MI_INFO *info)
if (!lock_error && !my_disable_locking)
lock_error=mi_lock_database(info,old_lock);
}
- return test(lock_error || write_error);
+ return MY_TEST(lock_error || write_error);
}
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index f8213b1a3a5..c6af5195f82 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -523,9 +523,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
info.s=share;
if (_mi_read_pack_info(&info,
(pbool)
- test(!(share->options &
- (HA_OPTION_PACK_RECORD |
- HA_OPTION_TEMP_COMPRESS_RECORD)))))
+ MY_TEST(!(share->options &
+ (HA_OPTION_PACK_RECORD |
+ HA_OPTION_TEMP_COMPRESS_RECORD)))))
goto err;
}
else if (share->options & HA_OPTION_PACK_RECORD)
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index 01fa10de7a3..3ce112f7906 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -83,7 +83,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
}
if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
- test(!(nextflag & SEARCH_SAVE_BUFF)))))
+ MY_TEST(!(nextflag & SEARCH_SAVE_BUFF)))))
goto err;
DBUG_DUMP("page", buff, mi_getint(buff));
@@ -129,7 +129,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
uchar *old_buff=buff;
if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
- test(!(nextflag & SEARCH_SAVE_BUFF)))))
+ MY_TEST(!(nextflag & SEARCH_SAVE_BUFF)))))
goto err;
keypos=buff+(keypos-old_buff);
maxpos=buff+(maxpos-old_buff);
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index 9e4e1c46891..87cea2e5566 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -268,14 +268,14 @@ static int run_test(const char *filename)
if (verbose || (flags[j] >= 1 ||
(error && my_errno != HA_ERR_KEY_NOT_FOUND)))
printf("key: '%.*s' mi_rkey: %3d errno: %3d\n",
- (int) key_length,key+test(null_fields),error,my_errno);
+ (int) key_length, key + MY_TEST(null_fields), error, my_errno);
}
else
{
error=mi_delete(file,read_record);
if (verbose || error)
printf("key: '%.*s' mi_delete: %3d errno: %3d\n",
- (int) key_length, key+test(null_fields), error, my_errno);
+ (int) key_length, key + MY_TEST(null_fields), error, my_errno);
if (! error)
{
deleted++;
@@ -296,7 +296,8 @@ static int run_test(const char *filename)
(error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND)))
{
printf("key: '%.*s' mi_rkey: %3d errno: %3d record: %s\n",
- (int) key_length,key+test(null_fields),error,my_errno,record+1);
+ (int) key_length, key + MY_TEST(null_fields), error, my_errno,
+ record + 1);
}
}
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 7ad35c92e6f..0cd01398cbc 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -814,7 +814,7 @@ static void get_options(register int *argc,register char ***argv)
static int myisamchk(HA_CHECK *param, char * filename)
{
int error,lock_type,recreate;
- int rep_quick= test(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS));
+ int rep_quick= MY_TEST(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS));
MI_INFO *info;
File datafile;
char llbuff[22],llbuff2[22];
@@ -1128,7 +1128,8 @@ static int myisamchk(HA_CHECK *param, char * filename)
if ((info->s->options & (HA_OPTION_PACK_RECORD |
HA_OPTION_COMPRESS_RECORD)) ||
(param->testflag & (T_EXTEND | T_MEDIUM)))
- error|=chk_data_link(param, info, test(param->testflag & T_EXTEND));
+ error|= chk_data_link(param, info,
+ MY_TEST(param->testflag & T_EXTEND));
error|=flush_blocks(param, share->key_cache, share->kfile,
&share->dirty_part_map);
(void) end_io_cache(&param->read_cache);
@@ -1152,7 +1153,7 @@ static int myisamchk(HA_CHECK *param, char * filename)
if ((param->testflag & T_AUTO_INC) ||
((param->testflag & T_REP_ANY) && info->s->base.auto_key))
update_auto_increment_key(param, info,
- (my_bool) !test(param->testflag & T_AUTO_INC));
+ (my_bool) !MY_TEST(param->testflag & T_AUTO_INC));
if (!(param->testflag & T_DESCRIPT))
{