diff --git a/include/my_global.h b/include/my_global.h index 7590bf00b82..e654d567d42 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -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) diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 065ba6d30b4..07059fed4be 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -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 || diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 8e9a0cbd445..0522e0f21a0 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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 diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 72a1faf7276..1b525a9593b 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -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);