summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc3
-rw-r--r--client/mysql_upgrade.c3
-rw-r--r--client/mysqladmin.cc6
-rw-r--r--client/mysqlmanager-pwgen.c19
-rw-r--r--client/mysqltest.c15
-rw-r--r--cmd-line-utils/readline/bind.c6
-rw-r--r--cmd-line-utils/readline/histfile.c7
-rw-r--r--cmd-line-utils/readline/undo.c3
-rw-r--r--heap/hp_test2.c3
-rw-r--r--include/my_global.h13
-rw-r--r--libmysql/libmysql.c3
-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
-rw-r--r--myisammrg/myrg_open.c4
-rw-r--r--myisammrg/myrg_rkey.c9
-rw-r--r--mysys/mf_pack.c3
-rw-r--r--mysys/my_copy.c5
-rw-r--r--mysys/my_getopt.c2
-rw-r--r--mysys/my_redel.c3
-rw-r--r--mysys/typelib.c4
-rw-r--r--regex/regcomp.c6
-rw-r--r--sql-common/client.c5
-rw-r--r--sql-common/my_time.c3
-rw-r--r--sql/field.cc19
-rw-r--r--sql/ha_myisammrg.cc2
-rw-r--r--sql/item.cc7
-rw-r--r--sql/item_cmpfunc.cc17
-rw-r--r--sql/item_create.cc6
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/lock.cc3
-rw-r--r--sql/log.cc3
-rw-r--r--sql/opt_range.cc8
-rw-r--r--sql/spatial.cc13
-rw-r--r--sql/sql_acl.cc10
-rw-r--r--sql/sql_base.cc6
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_prepare.cc3
-rw-r--r--sql/sql_show.cc7
-rw-r--r--sql/sql_update.cc4
-rw-r--r--sql/sql_view.cc3
-rw-r--r--strings/ctype-ucs2.c9
-rw-r--r--strings/ctype-utf8.c6
-rw-r--r--strings/decimal.c13
51 files changed, 142 insertions, 191 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 0d61ed4ec88..d103a3eec17 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3728,7 +3728,8 @@ com_edit(String *buffer,char *line __attribute__((unused)))
!(editor = (char *)getenv("VISUAL")))
editor = "vi";
strxmov(buff,editor," ",filename,NullS);
- (void) system(buff);
+ if(system(buff) == -1)
+ goto err;
MY_STAT stat_arg;
if (!my_stat(filename,&stat_arg,MYF(MY_WME)))
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index ff414fff592..efa23610574 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -526,6 +526,7 @@ static int upgrade_already_done(void)
FILE *in;
char upgrade_info_file[FN_REFLEN]= {0};
char buf[sizeof(MYSQL_SERVER_VERSION)+1];
+ char *res;
if (get_upgrade_info_file_name(upgrade_info_file))
return 0; /* Could not get filename => not sure */
@@ -538,7 +539,7 @@ static int upgrade_already_done(void)
will be detected by the strncmp
*/
bzero(buf, sizeof(buf));
- fgets(buf, sizeof(buf), in);
+ res= fgets(buf, sizeof(buf), in);
my_fclose(in, MYF(0));
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 24b95be8626..699c2081b86 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -1050,14 +1050,16 @@ static void usage(void)
static int drop_db(MYSQL *mysql, const char *db)
{
char name_buff[FN_REFLEN+20], buf[10];
+ char *input;
+
if (!option_force)
{
puts("Dropping the database is potentially a very bad thing to do.");
puts("Any data stored in the database will be destroyed.\n");
printf("Do you really want to drop the '%s' database [y/N] ",db);
fflush(stdout);
- VOID(fgets(buf,sizeof(buf)-1,stdin));
- if ((*buf != 'y') && (*buf != 'Y'))
+ input= fgets(buf, sizeof(buf)-1, stdin);
+ if (!input || ((*input != 'y') && (*input != 'Y')))
{
puts("\nOK, aborting database drop!");
return -1;
diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c
index 568358b1cda..1be4d8b6970 100644
--- a/client/mysqlmanager-pwgen.c
+++ b/client/mysqlmanager-pwgen.c
@@ -104,29 +104,34 @@ void get_pass(char* pw, int len)
{
FILE* fp;
char* pw_end=pw+len;
+ size_t elements_read= 0;
/*
/dev/random is more secure than rand() because the seed is easy to
predict, so we resort to rand() only if /dev/random is not available
*/
if ((fp=fopen("/dev/random","r")))
{
- fread(pw,len,1,fp);
- fclose(fp);
- while (pw<pw_end)
+ if ((elements_read= fread(pw,len,1,fp)))
{
- char tmp= 'a'+((uint)*pw % 26);
- *pw++= tmp;
+ while (pw<pw_end)
+ {
+ char tmp= 'a'+((uint)*pw % 26);
+ *pw++= tmp;
+ }
}
+ fclose(fp);
}
- else
+
+ if (elements_read != 1)
{
srand(time(NULL));
while (pw<pw_end)
{
- char tmp= 'a'+((uint)*pw % 26);
+ char tmp= 'a'+((uint)rand() % 26);
*pw++= tmp;
}
}
+
*pw_end=0;
}
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 24d021b7239..79df511641d 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -426,10 +426,12 @@ DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
char builtin_echo[FN_REFLEN];
+static void cleanup_and_exit(int exit_code) __attribute__((noreturn));
+
void die(const char *fmt, ...)
- ATTRIBUTE_FORMAT(printf, 1, 2);
+ ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
void abort_not_supported_test(const char *fmt, ...)
- ATTRIBUTE_FORMAT(printf, 1, 2);
+ ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
void verbose_msg(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void warning_msg(const char *fmt, ...)
@@ -3385,10 +3387,9 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused)))
MYSQL* mysql = &cur_con->mysql;
for (;;)
{
- MYSQL_RES *res;
+ MYSQL_RES *UNINIT_VAR(res);
MYSQL_ROW row;
int done;
- LINT_INIT(res);
if (mysql_query(mysql,"show status like 'Slave_running'") ||
!(res=mysql_store_result(mysql)))
@@ -4710,13 +4711,12 @@ my_bool end_of_query(int c)
int read_line(char *buf, int size)
{
- char c, last_quote;
+ char c, UNINIT_VAR(last_quote);
char *p= buf, *buf_end= buf + size - 1;
int skip_char= 0;
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
R_COMMENT, R_LINE_START} state= R_LINE_START;
DBUG_ENTER("read_line");
- LINT_INIT(last_quote);
start_lineno= cur_file->lineno;
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
@@ -5978,8 +5978,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
if (!disable_result_log)
{
- ulonglong affected_rows; /* Ok to be undef if 'disable_info' is set */
- LINT_INIT(affected_rows);
+ ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */
if (res)
{
diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c
index aa5bd3d829a..85f6b432bf8 100644
--- a/cmd-line-utils/readline/bind.c
+++ b/cmd-line-utils/readline/bind.c
@@ -339,9 +339,7 @@ rl_generic_bind (type, keyseq, data, map)
char *keys;
int keys_len;
register int i;
- KEYMAP_ENTRY k;
-
- k.function = 0;
+ KEYMAP_ENTRY k= { 0, NULL };
/* If no keys to bind to, exit right away. */
if (keyseq == 0 || *keyseq == 0)
@@ -776,7 +774,7 @@ _rl_read_file (filename, sizep)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
-if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
+ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
file_size + 1 < file_size)
{
if (file >= 0)
diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c
index 118c5ebd328..cbd367542ce 100644
--- a/cmd-line-utils/readline/histfile.c
+++ b/cmd-line-utils/readline/histfile.c
@@ -186,7 +186,7 @@ read_history_range (filename, from, to)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
-if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
+ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
file_size + 1 < file_size)
{
errno = overflow_errno;
@@ -311,6 +311,7 @@ history_truncate_file (fname, lines)
int file, chars_read, rv;
struct stat finfo;
size_t file_size;
+ size_t bytes_written;
buffer = (char *)NULL;
filename = history_filename (fname);
@@ -340,7 +341,7 @@ history_truncate_file (fname, lines)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
-if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
+ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
file_size + 1 < file_size)
{
close (file);
@@ -400,7 +401,7 @@ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
truncate to. */
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
- write (file, bp, chars_read - (bp - buffer));
+ bytes_written= write (file, bp, chars_read - (bp - buffer));
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
diff --git a/cmd-line-utils/readline/undo.c b/cmd-line-utils/readline/undo.c
index 79846c26024..c6bd044c3a3 100644
--- a/cmd-line-utils/readline/undo.c
+++ b/cmd-line-utils/readline/undo.c
@@ -137,7 +137,8 @@ UNDO_LIST *
_rl_copy_undo_list (head)
UNDO_LIST *head;
{
- UNDO_LIST *list, *new, *roving, *c;
+ UNDO_LIST *list, *new, *c;
+ UNDO_LIST *roving= NULL;
list = head;
new = 0;
diff --git a/heap/hp_test2.c b/heap/hp_test2.c
index 73cad6c2043..dc4ad316d24 100644
--- a/heap/hp_test2.c
+++ b/heap/hp_test2.c
@@ -61,11 +61,10 @@ int main(int argc, char *argv[])
HP_INFO *file,*file2;
HP_KEYDEF keyinfo[MAX_KEYS];
HA_KEYSEG keyseg[MAX_KEYS*5];
- HEAP_PTR position;
+ HEAP_PTR UNINIT_VAR(position);
HP_CREATE_INFO hp_create_info;
CHARSET_INFO *cs= &my_charset_latin1;
MY_INIT(argv[0]); /* init my_sys library & pthreads */
- LINT_INIT(position);
filename= "test2";
filename2= "test2_2";
diff --git a/include/my_global.h b/include/my_global.h
index 5c07aa00b32..0b5458215c6 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -464,6 +464,19 @@ int __void__;
#define PURIFY_OR_LINT_INIT(var)
#endif
+/*
+ Suppress uninitialized variable warning without generating code.
+
+ The _cplusplus is a temporary workaround for C++ code pending a fix
+ for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
+*/
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
+ !defined(__GNUC__)
+#define UNINIT_VAR(x) x= 0
+#else
+#define UNINIT_VAR(x) x= x
+#endif
+
/* Define some useful general macros */
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index d18ed04e273..1fa3181b1be 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1619,8 +1619,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
char *to;
#ifdef USE_MB
my_bool use_mb_flag=use_mb(mysql->charset);
- char *end;
- LINT_INIT(end);
+ char *UNINIT_VAR(end);
if (use_mb_flag)
for (end=name; *end ; end++) ;
#endif
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;
diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c
index 4e61f42efce..8cccb81f6c7 100644
--- a/myisammrg/myrg_open.c
+++ b/myisammrg/myrg_open.c
@@ -32,7 +32,7 @@
MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
int save_errno,errpos=0;
- uint files= 0, i, dir_length, length, key_parts, min_keys= 0;
+ uint files= 0, i, dir_length, length, UNINIT_VAR(key_parts), min_keys= 0;
ulonglong file_offset=0;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO *m_info=0;
@@ -43,8 +43,6 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
my_bool bad_children= FALSE;
DBUG_ENTER("myrg_open");
- LINT_INIT(key_parts);
-
bzero((char*) &file,sizeof(file));
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))) < 0)
diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c
index 627839331c6..2b8091cb43a 100644
--- a/myisammrg/myrg_rkey.c
+++ b/myisammrg/myrg_rkey.c
@@ -38,16 +38,13 @@
int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
uint key_len, enum ha_rkey_function search_flag)
{
- byte *key_buff;
- uint pack_key_length;
- uint16 last_used_keyseg;
+ byte *UNINIT_VAR(key_buff);
+ uint UNINIT_VAR(pack_key_length);
+ uint16 UNINIT_VAR(last_used_keyseg);
MYRG_TABLE *table;
MI_INFO *mi;
int err;
DBUG_ENTER("myrg_rkey");
- LINT_INIT(key_buff);
- LINT_INIT(pack_key_length);
- LINT_INIT(last_used_keyseg);
if (_myrg_init_queue(info,inx,search_flag))
DBUG_RETURN(my_errno);
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 0157a65311a..d2bac95b391 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -33,12 +33,11 @@ static my_string NEAR_F expand_tilde(my_string *path);
void pack_dirname(my_string to, const char *from)
{
int cwd_err;
- uint d_length,length,buff_length;
+ uint d_length,length,UNINIT_VAR(buff_length);
my_string start;
char buff[FN_REFLEN];
DBUG_ENTER("pack_dirname");
- LINT_INIT(buff_length);
(void) intern_filename(to,from); /* Change to intern name */
#ifdef FN_DEVCHAR
diff --git a/mysys/my_copy.c b/mysys/my_copy.c
index ec642b4083c..b6bb925e898 100644
--- a/mysys/my_copy.c
+++ b/mysys/my_copy.c
@@ -57,6 +57,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
File from_file,to_file;
char buff[IO_SIZE];
MY_STAT stat_buff,new_stat_buff;
+ int res;
DBUG_ENTER("my_copy");
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
@@ -93,9 +94,9 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */
- VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
+ res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
- VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
+ res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
#endif
#if !defined(VMS) && !defined(__ZTC__)
if (MyFlags & MY_COPYTIME)
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 3bb500616a1..22b404bdd25 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -100,7 +100,7 @@ int handle_options(int *argc, char ***argv,
uint opt_found, argvpos= 0, length, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose;
- char **pos, **pos_end, *optend, *prev_found,
+ char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
*opt_str, key_name[FN_REFLEN];
const struct my_option *optp;
gptr *value;
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index 0aec395cf65..03c1021a954 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -77,6 +77,7 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
struct stat statbuf;
+ int res;
if (stat((char*) from, &statbuf))
{
@@ -95,7 +96,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
if (MyFlags & MY_LINK_WARNING)
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
}
- VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */
+ res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */
#endif /* MSDOS */
#ifndef VMS
diff --git a/mysys/typelib.c b/mysys/typelib.c
index 4fab6f20493..7416738ece7 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -44,7 +44,8 @@
int find_type(my_string x, TYPELIB *typelib, uint full_name)
{
- int find,pos,findpos;
+ int find,pos;
+ int UNINIT_VAR(findpos); /* guarded by find */
reg1 my_string i;
reg2 const char *j;
DBUG_ENTER("find_type");
@@ -55,7 +56,6 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name)
DBUG_PRINT("exit",("no count"));
DBUG_RETURN(0);
}
- LINT_INIT(findpos);
find=0;
for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
{
diff --git a/regex/regcomp.c b/regex/regcomp.c
index 9cba56a97dd..0a65c5021fb 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -213,11 +213,11 @@ register struct parse *p;
int stop; /* character this ERE should end at */
{
register char c;
- register sopno prevback;
- register sopno prevfwd;
+ register sopno UNINIT_VAR(prevback);
+ register sopno UNINIT_VAR(prevfwd);
register sopno conc;
register int first = 1; /* is this the first alternative? */
- LINT_INIT(prevback); LINT_INIT(prevfwd);
+
for (;;) {
/* do a bunch of concatenated expressions */
conc = HERE();
diff --git a/sql-common/client.c b/sql-common/client.c
index 0cd7ef78478..8f1f4a1fd5a 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1633,7 +1633,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
*/
const char * STDCALL
-mysql_get_ssl_cipher(MYSQL *mysql)
+mysql_get_ssl_cipher(MYSQL *mysql __attribute__((unused)))
{
DBUG_ENTER("mysql_get_ssl_cipher");
#ifdef HAVE_OPENSSL
@@ -1829,7 +1829,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
uint port, const char *unix_socket,ulong client_flag)
{
char buff[NAME_LEN+USERNAME_LENGTH+100];
- char *end,*host_info;
+ char *end,*host_info= NULL;
my_socket sock;
in_addr_t ip_addr;
struct sockaddr_in sock_addr;
@@ -1847,7 +1847,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
#endif
init_sigpipe_variables
DBUG_ENTER("mysql_real_connect");
- LINT_INIT(host_info);
DBUG_PRINT("enter",("host: %s db: %s user: %s",
host ? host : "(Null)",
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 16a64ebd947..d2ef9da25f5 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -160,7 +160,7 @@ enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut)
{
- uint field_length, year_length, digits, i, number_of_fields;
+ uint field_length, UNINIT_VAR(year_length), digits, i, number_of_fields;
uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS];
uint add_hours= 0, start_loop;
ulong not_zero_date, allow_space;
@@ -174,7 +174,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
DBUG_PRINT("ENTER",("str: %.*s",length,str));
LINT_INIT(field_length);
- LINT_INIT(year_length);
LINT_INIT(last_field_pos);
*was_cut= 0;
diff --git a/sql/field.cc b/sql/field.cc
index 2322c5d7b9d..b61e5fd2d79 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1736,16 +1736,16 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
Pointers used when digits move from the left of the '.' to the
right of the '.' (explained below)
*/
- const char *int_digits_tail_from;
+ const char *UNINIT_VAR(int_digits_tail_from);
/* Number of 0 that need to be added at the left of the '.' (1E3: 3 zeros) */
- uint int_digits_added_zeros;
+ uint UNINIT_VAR(int_digits_added_zeros);
/*
Pointer used when digits move from the right of the '.' to the left
of the '.'
*/
- const char *frac_digits_head_end;
+ const char *UNINIT_VAR(frac_digits_head_end);
/* Number of 0 that need to be added at the right of the '.' (for 1E-3) */
- uint frac_digits_added_zeros;
+ uint UNINIT_VAR(frac_digits_added_zeros);
char *pos,*tmp_left_pos,*tmp_right_pos;
/* Pointers that are used as limits (begin and end of the field buffer) */
char *left_wall,*right_wall;
@@ -1756,11 +1756,6 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
*/
bool is_cuted_fields_incr=0;
- LINT_INIT(int_digits_tail_from);
- LINT_INIT(int_digits_added_zeros);
- LINT_INIT(frac_digits_head_end);
- LINT_INIT(frac_digits_added_zeros);
-
/*
There are three steps in this function :
- parse the input string
@@ -8854,10 +8849,8 @@ Field *make_field(char *ptr, uint32 field_length,
const char *field_name,
struct st_table *table)
{
- uchar *bit_ptr;
- uchar bit_offset;
- LINT_INIT(bit_ptr);
- LINT_INIT(bit_offset);
+ uchar *UNINIT_VAR(bit_ptr);
+ uchar UNINIT_VAR(bit_offset);
if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag))
{
bit_ptr= null_pos;
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index fef2e21d271..7983ffbc6c8 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -78,7 +78,7 @@ static void split_file_name(const char *file_name,
extern "C" void myrg_print_wrong_table(const char *table_name)
{
- LEX_STRING db, name;
+ LEX_STRING db= {NULL, 0}, name;
char buf[FN_REFLEN];
split_file_name(table_name, &db, &name);
memcpy(buf, db.str, db.length);
diff --git a/sql/item.cc b/sql/item.cc
index eecb48aa16f..03d752a85d9 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1635,7 +1635,7 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname,
bool agg_item_set_converter(DTCollation &coll, const char *fname,
Item **args, uint nargs, uint flags, int item_sep)
{
- Item **arg, *safe_args[2];
+ Item **arg, *safe_args[2]= {NULL, NULL};
/*
For better error reporting: save the first and the second argument.
@@ -1644,8 +1644,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
doesn't display each argument's characteristics.
- if nargs is 1, then this error cannot happen.
*/
- LINT_INIT(safe_args[0]);
- LINT_INIT(safe_args[1]);
if (nargs >=2 && nargs <= 3)
{
safe_args[0]= args[0];
@@ -5122,9 +5120,8 @@ bool Item_null::send(Protocol *protocol, String *packet)
bool Item::send(Protocol *protocol, String *buffer)
{
- bool result;
+ bool UNINIT_VAR(result); // Will be set if null_value == 0
enum_field_types f_type;
- LINT_INIT(result); // Will be set if null_value == 0
switch ((f_type=field_type())) {
default:
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index c940c4ab3c0..8c655cdc369 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -352,8 +352,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
/* For comparison purposes allow invalid dates like 2000-01-32 */
ulong orig_sql_mode= thd->variables.sql_mode;
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
- ulonglong orig_field_val; /* original field value if valid */
- LINT_INIT(orig_field_val);
+ ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) |
MODE_INVALID_DATES;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
@@ -2453,19 +2452,13 @@ Item_func_nullif::is_null()
Item *Item_func_case::find_item(String *str)
{
- String *first_expr_str, *tmp;
- my_decimal *first_expr_dec, first_expr_dec_val;
- longlong first_expr_int;
- double first_expr_real;
+ String *UNINIT_VAR(first_expr_str), *tmp;
+ my_decimal *UNINIT_VAR(first_expr_dec), first_expr_dec_val;
+ longlong UNINIT_VAR(first_expr_int);
+ double UNINIT_VAR(first_expr_real);
char buff[MAX_FIELD_WIDTH];
String buff_str(buff,sizeof(buff),default_charset());
- /* These will be initialized later */
- LINT_INIT(first_expr_str);
- LINT_INIT(first_expr_int);
- LINT_INIT(first_expr_real);
- LINT_INIT(first_expr_dec);
-
if (first_expr_num != -1)
{
switch (cmp_type)
diff --git a/sql/item_create.cc b/sql/item_create.cc
index c897b7aef79..cbd015f300b 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -451,10 +451,9 @@ Item *create_func_cast(Item *a, Cast_target cast_type,
const char *c_len, const char *c_dec,
CHARSET_INFO *cs)
{
- Item *res;
+ Item *UNINIT_VAR(res);
ulong len;
uint dec;
- LINT_INIT(res);
switch (cast_type) {
case ITEM_CAST_BINARY: res= new Item_func_binary(a); break;
@@ -542,6 +541,9 @@ Item *create_func_cast(Item *a, Cast_target cast_type,
res= new Item_char_typecast(a, len, cs ? cs :
current_thd->variables.collation_connection);
break;
+
+ default:
+ DBUG_ASSERT(0);
}
return res;
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 6193ab285f2..3c1e2126008 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2275,9 +2275,8 @@ void Item_func_min_max::fix_length_and_dec()
uint Item_func_min_max::cmp_datetimes(ulonglong *value)
{
- longlong min_max;
+ longlong UNINIT_VAR(min_max);
uint min_max_idx= 0;
- LINT_INIT(min_max);
for (uint i=0; i < arg_count ; i++)
{
@@ -2345,8 +2344,7 @@ String *Item_func_min_max::val_str(String *str)
}
case STRING_RESULT:
{
- String *res;
- LINT_INIT(res);
+ String *UNINIT_VAR(res);
for (uint i=0; i < arg_count ; i++)
{
if (i == 0)
@@ -2435,8 +2433,7 @@ longlong Item_func_min_max::val_int()
my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
{
DBUG_ASSERT(fixed == 1);
- my_decimal tmp_buf, *tmp, *res;
- LINT_INIT(res);
+ my_decimal tmp_buf, *tmp, *UNINIT_VAR(res);
if (compare_as_dates)
{
@@ -4974,8 +4971,7 @@ void Item_func_match::init_search(bool no_order)
bool Item_func_match::fix_fields(THD *thd, Item **ref)
{
DBUG_ASSERT(fixed == 0);
- Item *item;
- LINT_INIT(item); // Safe as arg_count is > 1
+ Item *UNINIT_VAR(item); // Safe as arg_count is > 1
maybe_null=1;
join_key=0;
diff --git a/sql/lock.cc b/sql/lock.cc
index 3102497576f..97abd76b7c2 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -1216,11 +1216,10 @@ void unlock_global_read_lock(THD *thd)
bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
bool is_not_commit)
{
- const char *old_message;
+ const char *UNINIT_VAR(old_message);
bool result= 0, need_exit_cond;
DBUG_ENTER("wait_if_global_read_lock");
- LINT_INIT(old_message);
/*
Assert that we do not own LOCK_open. If we would own it, other
threads could not close their tables. This would make a pretty
diff --git a/sql/log.cc b/sql/log.cc
index ec8f5fe820b..c042651216c 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2635,9 +2635,10 @@ bool flush_error_log()
else
result= 1;
#else
+ FILE *reopen;
my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout))
- freopen(log_error_file,"a+",stderr);
+ reopen= freopen(log_error_file,"a+",stderr);
else
result= 1;
#endif
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 778fc418392..fdf6cc03a44 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3514,11 +3514,10 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
{
int idx;
SEL_ARG **key,**end, **key_to_read= NULL;
- ha_rows best_records;
+ ha_rows UNINIT_VAR(best_records); /* protected by key_to_read */
TRP_RANGE* read_plan= NULL;
bool pk_is_clustered= param->table->file->primary_key_is_clustered();
DBUG_ENTER("get_key_scans_params");
- LINT_INIT(best_records); /* protected by key_to_read */
/*
Note that there may be trees that have type SEL_TREE::KEY but contain no
key reads at all, e.g. tree for expression "key1 is not null" where key1
@@ -5370,8 +5369,7 @@ static bool eq_tree(SEL_ARG* a,SEL_ARG *b)
SEL_ARG *
SEL_ARG::insert(SEL_ARG *key)
{
- SEL_ARG *element,**par,*last_element;
- LINT_INIT(par); LINT_INIT(last_element);
+ SEL_ARG *element,**UNINIT_VAR(par),*UNINIT_VAR(last_element);
for (element= this; element != &null_element ; )
{
@@ -7918,7 +7916,9 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
goto next_index;
}
else
+ {
DBUG_ASSERT(FALSE);
+ }
/* Check (SA2). */
if (min_max_arg_item)
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 80506f16d0f..6e1da589527 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -935,13 +935,10 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const
int Gis_polygon::centroid_xy(double *x, double *y) const
{
uint32 n_linear_rings;
- double res_area;
- double res_cx, res_cy;
+ double UNINIT_VAR(res_area);
+ double UNINIT_VAR(res_cx), UNINIT_VAR(res_cy);
const char *data= m_data;
bool first_loop= 1;
- LINT_INIT(res_area);
- LINT_INIT(res_cx);
- LINT_INIT(res_cy);
if (no_data(data, 4))
return 1;
@@ -1634,14 +1631,10 @@ int Gis_multi_polygon::centroid(String *result) const
uint32 n_polygons;
bool first_loop= 1;
Gis_polygon p;
- double res_area, res_cx, res_cy;
+ double UNINIT_VAR(res_area), UNINIT_VAR(res_cx), UNINIT_VAR(res_cy);
double cur_area, cur_cx, cur_cy;
const char *data= m_data;
- LINT_INIT(res_area);
- LINT_INIT(res_cx);
- LINT_INIT(res_cy);
-
if (no_data(data, 4))
return 1;
n_polygons= uint4korr(data);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ab4e518d5dd..ea17a4227ef 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -5067,17 +5067,13 @@ static int handle_grant_struct(uint struct_no, bool drop,
uint elements;
const char *user;
const char *host;
- ACL_USER *acl_user;
- ACL_DB *acl_db;
- GRANT_NAME *grant_name;
+ ACL_USER *UNINIT_VAR(acl_user);
+ ACL_DB *UNINIT_VAR(acl_db);
+ GRANT_NAME *UNINIT_VAR(grant_name);
DBUG_ENTER("handle_grant_struct");
DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'",
struct_no, user_from->user.str, user_from->host.str));
- LINT_INIT(acl_user);
- LINT_INIT(acl_db);
- LINT_INIT(grant_name);
-
safe_mutex_assert_owner(&acl_cache->lock);
/* Get the number of elements in the in-memory structure. */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 6a99d5d1541..db4ab29d6de 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -706,7 +706,7 @@ void close_temporary_tables(THD *thd)
return;
}
- TABLE *next,
+ TABLE *UNINIT_VAR(next),
*prev_table /* prev link is not maintained in TABLE's double-linked list */;
bool was_quote_show= true; /* to assume thd->options has OPTION_QUOTE_SHOW_CREATE */
// Better add "if exists", in case a RESET MASTER has been done
@@ -716,7 +716,6 @@ void close_temporary_tables(THD *thd)
memcpy(buf, stub, stub_len);
String s_query= String(buf, sizeof(buf), system_charset_info);
bool found_user_tables= false;
- LINT_INIT(next);
/*
insertion sort of temp tables by pseudo_thread_id to build ordered list
@@ -4142,8 +4141,7 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
(and not an item that happens to have a name).
*/
bool is_ref_by_name= 0;
- uint unaliased_counter;
- LINT_INIT(unaliased_counter); // Dependent on found_unaliased
+ uint UNINIT_VAR(unaliased_counter); // Dependent on found_unaliased
*resolution= NOT_RESOLVED;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 45f70964f50..65b2a9d60b0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1325,7 +1325,7 @@ pthread_handler_t handle_bootstrap(void *arg)
thd->init_for_queries();
while (fgets(buff, thd->net.max_packet, file))
{
- char *query;
+ char *query, *res;
ulong length= (ulong) strlen(buff);
while (buff[length-1] != '\n' && !feof(file))
{
@@ -1340,7 +1340,7 @@ pthread_handler_t handle_bootstrap(void *arg)
break;
}
buff= (char*) thd->net.buff;
- fgets(buff + length, thd->net.max_packet - length, file);
+ res= fgets(buff + length, thd->net.max_packet - length, file);
length+= (ulong) strlen(buff + length);
}
if (thd->is_fatal_error)
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index d14f14b526e..06f77f9689c 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2072,10 +2072,9 @@ void mysql_sql_stmt_prepare(THD *thd)
LEX_STRING *name= &lex->prepared_stmt_name;
Prepared_statement *stmt;
const char *query;
- uint query_len;
+ uint UNINIT_VAR(query_len);
DBUG_ENTER("mysql_sql_stmt_prepare");
DBUG_ASSERT(thd->protocol == &thd->protocol_simple);
- LINT_INIT(query_len);
if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 9eac750c22e..13045280c5f 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2172,8 +2172,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals;
- char path[FN_REFLEN], *end, *base_name, *orig_base_name, *file_name;
- uint len;
+ char path[FN_REFLEN], *UNINIT_VAR(end), *base_name, *orig_base_name, *file_name;
+ uint UNINIT_VAR(len);
bool with_i_schema;
enum enum_schema_tables schema_table_idx;
List<char> bases;
@@ -2190,9 +2190,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
#endif
DBUG_ENTER("get_all_tables");
- LINT_INIT(end);
- LINT_INIT(len);
-
lex->view_prepare_mode= TRUE;
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index c18c34fc1d1..06d1bcaa8fb 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -125,7 +125,7 @@ int mysql_update(THD *thd,
uint want_privilege;
#endif
uint table_count= 0;
- query_id_t query_id=thd->query_id, timestamp_query_id;
+ query_id_t query_id=thd->query_id, UNINIT_VAR(timestamp_query_id);
ha_rows updated, found;
key_map old_used_keys;
TABLE *table;
@@ -137,8 +137,6 @@ int mysql_update(THD *thd,
THD::killed_state killed_status= THD::NOT_KILLED;
DBUG_ENTER("mysql_update");
- LINT_INIT(timestamp_query_id);
-
for ( ; ; )
{
if (open_tables(thd, &table_list, &table_count, 0))
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 96077aeeb12..8cf25e9d88c 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -955,7 +955,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
TABLE_LIST *top_view= table->top_table();
int res;
bool result, view_is_mergeable;
- TABLE_LIST *view_main_select_tables;
+ TABLE_LIST *UNINIT_VAR(view_main_select_tables);
DBUG_ENTER("mysql_make_view");
DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
@@ -1218,7 +1218,6 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
lex->can_be_merged());
- LINT_INIT(view_main_select_tables);
if (view_is_mergeable)
{
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 65e4182d564..6657ef01785 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -202,11 +202,10 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc),t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
- LINT_INIT(s_wc);
while ( s < se && t < te )
{
@@ -317,11 +316,10 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs,
const char *s, const char *t, uint len)
{
int s_res,t_res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc),t_wc;
const char *se=s+len;
const char *te=t+len;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
- LINT_INIT(s_wc);
while ( s < se && t < te )
{
@@ -1385,10 +1383,9 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc),t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
- LINT_INIT(s_wc);
while ( s < se && t < te )
{
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 4682868562f..3fcde4aca64 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2306,11 +2306,10 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc), t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
- LINT_INIT(s_wc);
while ( s < se && t < te )
{
@@ -2377,10 +2376,9 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
my_bool diff_if_only_endspace_difference)
{
int s_res, t_res, res;
- my_wc_t s_wc,t_wc;
+ my_wc_t UNINIT_VAR(s_wc),t_wc;
const uchar *se= s+slen, *te= t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
- LINT_INIT(s_wc);
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
diff_if_only_endspace_difference= 0;
diff --git a/strings/decimal.c b/strings/decimal.c
index c535d0f73dc..7c2c2999fb8 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1359,8 +1359,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
if (intg0x)
{
int i=dig2bytes[intg0x];
- dec1 x;
- LINT_INIT(x);
+ dec1 UNINIT_VAR(x);
switch (i)
{
case 1: x=mi_sint1korr(from); break;
@@ -1401,8 +1400,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
if (frac0x)
{
int i=dig2bytes[frac0x];
- dec1 x;
- LINT_INIT(x);
+ dec1 UNINIT_VAR(x);
switch (i)
{
case 1: x=mi_sint1korr(from); break;
@@ -1480,7 +1478,7 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
decimal_round_mode mode)
{
int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1,
- frac1=ROUND_UP(from->frac), round_digit,
+ frac1=ROUND_UP(from->frac), UNINIT_VAR(round_digit),
intg0=ROUND_UP(from->intg), error=E_DEC_OK, len=to->len,
intg1=ROUND_UP(from->intg +
(((intg0 + frac0)>0) && (from->buf[0] == DIG_MAX)));
@@ -1489,7 +1487,6 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
sanity(to);
- LINT_INIT(round_digit);
switch (mode) {
case HALF_UP:
case HALF_EVEN: round_digit=5; break;
@@ -2117,13 +2114,11 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2,
{
int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1,
frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2,
- error, i, intg0, frac0, len1, len2, dintg, div_mod=(!mod);
+ UNINIT_VAR(error), i, intg0, frac0, len1, len2, dintg, div_mod=(!mod);
dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1,
*start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry;
dec2 norm_factor, x, guess, y;
- LINT_INIT(error);
-
if (mod)
to=mod;