summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorStaale Smedseng <staale.smedseng@sun.com>2009-08-28 17:51:31 +0200
committerStaale Smedseng <staale.smedseng@sun.com>2009-08-28 17:51:31 +0200
commit1ba25ae47caace207cda0be2b7994a1a845e6cce (patch)
tree4278d9f3353d5c86ca327f6ac2680c001e809843 /myisam
parent5edd807a7ab72fc16472293fc94a7eb8e762e2b7 (diff)
downloadmariadb-git-1ba25ae47caace207cda0be2b7994a1a845e6cce.tar.gz
Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2 This patch fixes a number of GCC warnings about variables used before initialized. A new macro UNINIT_VAR() is introduced for use in the variable declaration, and LINT_INIT() usage will be gradually deprecated. (A workaround is used for g++, pending a patch for a g++ bug.) GCC warnings for unused results (attribute warn_unused_result) for a number of system calls (present at least in later Ubuntus, where the usual void cast trick doesn't work) are also fixed. client/mysqlmanager-pwgen.c: A fix for warn_unused_result, adding fallback to use of srand()/rand() if /dev/random cannot be used. Also actually adds calls to rand() in the second branch so that it actually creates a random password.
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_boolean_search.c4
-rw-r--r--myisam/mi_check.c18
-rw-r--r--myisam/mi_create.c2
-rw-r--r--myisam/mi_delete.c2
-rw-r--r--myisam/mi_dynrec.c9
-rw-r--r--myisam/mi_open.c2
-rw-r--r--myisam/mi_packrec.c2
-rw-r--r--myisam/mi_search.c5
-rw-r--r--myisam/mi_update.c5
-rw-r--r--myisam/sort.c4
10 files changed, 20 insertions, 33 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 255c51fd33a..50f2cd52b3d 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -218,11 +218,9 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
int subkeys=1;
my_bool can_go_down;
MI_INFO *info=ftb->info;
- uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength;
+ uint UNINIT_VAR(off), extra=HA_FT_WLEN+info->s->base.rec_reflength;
byte *lastkey_buf=ftbw->word+ftbw->off;
- LINT_INIT(off);
- LINT_INIT(off);
if (ftbw->flags & FTB_FLAG_TRUNC)
lastkey_buf+=ftbw->len;
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 285a31d34c6..80a90977609 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -140,11 +140,10 @@ int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag)
{
reg2 ha_rows i;
uint delete_link_length;
- my_off_t empty,next_link,old_link;
+ my_off_t empty,next_link,UNINIT_VAR(old_link);
char buff[22],buff2[22];
DBUG_ENTER("chk_del");
- LINT_INIT(old_link);
param->record_checksum=0;
delete_link_length=((info->s->options & HA_OPTION_PACK_RECORD) ? 20 :
info->s->rec_reflength+1);
@@ -936,11 +935,11 @@ static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo)
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
{
int error,got_error,flag;
- uint key,left_length,b_type,field;
+ uint key,UNINIT_VAR(left_length),b_type,field;
ha_rows records,del_blocks;
- my_off_t used,empty,pos,splits,start_recpos,
+ my_off_t used,empty,pos,splits,UNINIT_VAR(start_recpos),
del_length,link_used,start_block;
- byte *record= 0, *to;
+ byte *record= 0, *UNINIT_VAR(to);
char llbuff[22],llbuff2[22],llbuff3[22];
ha_checksum intern_record_checksum;
ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY];
@@ -965,7 +964,6 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
records=del_blocks=0;
used=link_used=splits=del_length=0;
intern_record_checksum=param->glob_crc=0;
- LINT_INIT(left_length); LINT_INIT(start_recpos); LINT_INIT(to);
got_error=error=0;
empty=info->s->pack.header_length;
@@ -2222,9 +2220,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
ulong *rec_per_key_part;
char llbuff[22];
SORT_INFO sort_info;
- ulonglong key_map;
+ ulonglong UNINIT_VAR(key_map);
DBUG_ENTER("mi_repair_by_sort");
- LINT_INIT(key_map);
start_records=info->state->records;
got_error=1;
@@ -2620,11 +2617,10 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
IO_CACHE new_data_cache; /* For non-quick repair. */
IO_CACHE_SHARE io_share;
SORT_INFO sort_info;
- ulonglong key_map;
+ ulonglong UNINIT_VAR(key_map);
pthread_attr_t thr_attr;
ulong max_pack_reclength;
DBUG_ENTER("mi_repair_parallel");
- LINT_INIT(key_map);
start_records=info->state->records;
got_error=1;
@@ -3206,7 +3202,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
int parallel_flag;
uint found_record,b_type,left_length;
my_off_t pos;
- byte *to;
+ byte *UNINIT_VAR(to);
MI_BLOCK_INFO block_info;
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param=sort_info->param;
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index bb53393c345..43639409014 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -37,7 +37,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
MI_CREATE_INFO *ci,uint flags)
{
register uint i,j;
- File dfile,file;
+ File UNINIT_VAR(dfile),file;
int errpos,save_errno, create_mode= O_RDWR | O_TRUNC;
myf create_flag;
uint fields,length,max_key_length,packed,pointer,real_length_diff,
diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c
index e08e5097e33..327a977dcca 100644
--- a/myisam/mi_delete.c
+++ b/myisam/mi_delete.c
@@ -220,7 +220,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
uint length,nod_flag,search_key_length;
my_bool last_key;
uchar *leaf_buff,*keypos;
- my_off_t leaf_page,next_block;
+ my_off_t UNINIT_VAR(leaf_page),next_block;
uchar lastkey[MI_MAX_KEY_BUFF];
DBUG_ENTER("d_search");
DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff));
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index 3542a82be59..af911428d11 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -1234,16 +1234,14 @@ void _my_store_blob_length(byte *pos,uint pack_length,uint length)
int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
{
int block_of_record;
- uint b_type,left_length;
- byte *to;
+ uint b_type,UNINIT_VAR(left_length);
+ byte *UNINIT_VAR(to);
MI_BLOCK_INFO block_info;
File file;
DBUG_ENTER("mi_read_dynamic_record");
if (filepos != HA_OFFSET_ERROR)
{
- LINT_INIT(to);
- LINT_INIT(left_length);
file=info->dfile;
block_of_record= 0; /* First block of record is numbered as zero. */
block_info.second_read= 0;
@@ -1506,13 +1504,12 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
{
int block_of_record, info_read, save_errno;
uint left_len,b_type;
- byte *to;
+ byte *UNINIT_VAR(to);
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_read_rnd_dynamic_record");
info_read=0;
- LINT_INIT(to);
if (info->lock_type == F_UNLCK)
{
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index d9b7f6453db..285e295d999 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -678,7 +678,7 @@ err:
byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
{
uint extra;
- uint32 old_length;
+ uint32 UNINIT_VAR(old_length);
LINT_INIT(old_length);
if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf)))
diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c
index 68911d7f129..75cf45d5434 100644
--- a/myisam/mi_packrec.c
+++ b/myisam/mi_packrec.c
@@ -1362,7 +1362,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
File file, my_off_t filepos)
{
uchar *header=info->header;
- uint head_length,ref_length;
+ uint head_length, UNINIT_VAR(ref_length);
LINT_INIT(ref_length);
if (file >= 0)
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 795c7ee55c3..3b1cd6158f2 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -240,12 +240,11 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
uchar *key, uint key_len, uint comp_flag, uchar **ret_pos,
uchar *buff, my_bool *last_key)
{
- int flag;
- uint nod_flag,length,not_used[2];
+ int UNINIT_VAR(flag);
+ uint nod_flag,UNINIT_VAR(length),not_used[2];
uchar t_buff[MI_MAX_KEY_BUFF],*end;
DBUG_ENTER("_mi_seq_search");
- LINT_INIT(flag); LINT_INIT(length);
end= page+mi_getint(page);
nod_flag=mi_test_if_nod(page);
page+=2+nod_flag;
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index bea457d2e9a..fa0797b1d61 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -27,11 +27,8 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
bool auto_key_changed=0;
ulonglong changed;
MYISAM_SHARE *share=info->s;
- ha_checksum old_checksum;
+ ha_checksum UNINIT_VAR(old_checksum);
DBUG_ENTER("mi_update");
- LINT_INIT(new_key);
- LINT_INIT(changed);
- LINT_INIT(old_checksum);
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage",
mi_print_error(info->s, HA_ERR_CRASHED);
diff --git a/myisam/sort.c b/myisam/sort.c
index 2465227a449..f418be6a72d 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -489,7 +489,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
{
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param=sort_info->param;
- ulong length, keys;
+ ulong UNINIT_VAR(length), keys;
ulong *rec_per_key_part=param->rec_per_key_part;
int got_error=sort_info->got_error;
uint i;
@@ -896,7 +896,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
int error;
uint sort_length,maxcount;
ha_rows count;
- my_off_t to_start_filepos;
+ my_off_t UNINIT_VAR(to_start_filepos);
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;