Skip to content

Commit 2744487

Browse files
committed
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.
1 parent c18110b commit 2744487

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

include/my_global.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
468468
/*
469469
Suppress uninitialized variable warning without generating code.
470470
*/
471-
#if defined(__GNUC__) && (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 8)
471+
#if defined(__GNUC__)
472472
/* GCC specific self-initialization which inhibits the warning. */
473473
#define UNINIT_VAR(x) x= x
474474
#elif defined(_lint) || defined(FORCE_INIT_OF_VARS)

sql/item_geofunc.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,11 +1152,9 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
11521152
const char *mask)
11531153
{
11541154
int do_store_shapes=1;
1155-
uint shape_a, shape_b;
1155+
uint UNINIT_VAR(shape_a), UNINIT_VAR(shape_b);
11561156
uint n_operands= 0;
11571157
int last_shape_pos;
1158-
UNINIT_VAR(shape_a);
1159-
UNINIT_VAR(shape_b);
11601158

11611159
last_shape_pos= func->get_next_expression_pos();
11621160
if (func->reserve_op_buffer(1))
@@ -2396,12 +2394,10 @@ String *Item_func_pointonsurface::val_str(String *str)
23962394
Geometry *g;
23972395
MBR mbr;
23982396
const char *c_end;
2399-
double px, py, x0, y0;
2397+
double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0;
24002398
String *result= 0;
24012399
const Gcalc_scan_iterator::point *pprev= NULL;
24022400
uint32 srid;
2403-
UNINIT_VAR(px);
2404-
UNINIT_VAR(py);
24052401

24062402
null_value= 1;
24072403
if ((args[0]->null_value ||

sql/opt_range.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,8 +2933,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
29332933
}
29342934
if (i)
29352935
{
2936-
double selectivity_mult;
2937-
UNINIT_VAR(selectivity_mult);
2936+
double UNINIT_VAR(selectivity_mult);
29382937

29392938
/*
29402939
There is at least 1-column prefix of columns whose selectivity has

sql/sp_head.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,12 +1129,10 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
11291129
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
11301130
SERVER_STATUS_LAST_ROW_SENT;
11311131
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
1132-
Object_creation_ctx *saved_creation_ctx;
1132+
Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
11331133
Diagnostics_area *da= thd->get_stmt_da();
11341134
Warning_info sp_wi(da->warning_info_id(), false, true);
11351135

1136-
UNINIT_VAR(saved_creation_ctx);
1137-
11381136
/* this 7*STACK_MIN_SIZE is a complex matter with a long history (see it!) */
11391137
if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet))
11401138
DBUG_RETURN(TRUE);

0 commit comments

Comments
 (0)