Commit 27444871 authored by Sergey Vojtovich's avatar Sergey Vojtovich

UNINIT_VAR() fixes

Restored self-initialization version of UNINIT_VAR() for all gcc versions.
Fixed UNINIT_VAR() usage: it is supposed to be used along with declaration.
parent c18110bd
......@@ -468,7 +468,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
/*
Suppress uninitialized variable warning without generating code.
*/
#if defined(__GNUC__) && (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 8)
#if defined(__GNUC__)
/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
#elif defined(_lint) || defined(FORCE_INIT_OF_VARS)
......
......@@ -1152,11 +1152,9 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
const char *mask)
{
int do_store_shapes=1;
uint shape_a, shape_b;
uint UNINIT_VAR(shape_a), UNINIT_VAR(shape_b);
uint n_operands= 0;
int last_shape_pos;
UNINIT_VAR(shape_a);
UNINIT_VAR(shape_b);
last_shape_pos= func->get_next_expression_pos();
if (func->reserve_op_buffer(1))
......@@ -2396,12 +2394,10 @@ String *Item_func_pointonsurface::val_str(String *str)
Geometry *g;
MBR mbr;
const char *c_end;
double px, py, x0, y0;
double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0;
String *result= 0;
const Gcalc_scan_iterator::point *pprev= NULL;
uint32 srid;
UNINIT_VAR(px);
UNINIT_VAR(py);
null_value= 1;
if ((args[0]->null_value ||
......
......@@ -2933,8 +2933,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
}
if (i)
{
double selectivity_mult;
UNINIT_VAR(selectivity_mult);
double UNINIT_VAR(selectivity_mult);
/*
There is at least 1-column prefix of columns whose selectivity has
......
......@@ -1129,12 +1129,10 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
SERVER_STATUS_LAST_ROW_SENT;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
Diagnostics_area *da= thd->get_stmt_da();
Warning_info sp_wi(da->warning_info_id(), false, true);
UNINIT_VAR(saved_creation_ctx);
/* this 7*STACK_MIN_SIZE is a complex matter with a long history (see it!) */
if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet))
DBUG_RETURN(TRUE);
......
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