3248 Davi Arnaut 2011-07-07
Bug#12727287: Maintainer mode compilation fails with gcc 4.6 (#trunk)
GCC 4.6 has a new -Wunused-but-set-variable flag, which is enabled
by -Wall, that causes GCC to emit a warning whenever a local variable
is assigned to, but otherwise unused (aside from its declaration).
Since the maintainer mode uses -Wall and -Werror, source code which
triggers these warnings will be rejected. That is, these warnings
become hard errors.
The solution is to fix the code which triggers these specific warnings.
In most of the cases, this is a welcome cleanup as code which triggers
this warning is probably dead anyway.
@ sql/handler.cc
Unused but set.
@ sql/item_geofunc.cc
Unused but set.
@ sql/partition_info.cc
Unused but set.
@ sql/rpl_info_file.cc
buffer_act is a pointer-to-pointer used to pass out the allocated
buffer. For this, set the pointer properly (and from the desired
source) and check if allocation fails.
@ sql/sql_load.cc
Unused but set.
@ sql/sql_select.cc
Unused but set.
@ storage/innobase/trx/trx0purge.c
Unused but set.
@ storage/innobase/trx/trx0rec.c
Unused but set.
@ storage/perfschema/pfs_instr.cc
Unused but set.
@ storage/perfschema/unittest/pfs_instr_class-t.cc
Declare within the same ifdef where it's used.
modified:
sql/handler.cc
sql/item_geofunc.cc
sql/partition_info.cc
sql/rpl_info_file.cc
sql/sql_load.cc
sql/sql_select.cc
storage/innobase/trx/trx0purge.c
storage/innobase/trx/trx0rec.c
storage/perfschema/pfs_instr.cc
storage/perfschema/unittest/pfs_instr_class-t.cc
3247 Georgi Kodinov 2011-07-08
Addendum to bug #11757216: fix a test that expects SET DEFAULT_STORAGE_ENGINE to
set default temp storage engine too.
modified:
mysql-test/include/mix1.inc
mysql-test/suite/innodb/r/innodb_mysql.result
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-07-07 11:51:59 +0000
+++ b/sql/handler.cc 2011-07-07 14:26:36 +0000
@@ -5278,7 +5278,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost
uint *buffer_size, COST_VECT *cost)
{
ulong max_buff_entries, elem_size;
- ha_rows rows_in_full_step, rows_in_last_step;
+ ha_rows rows_in_last_step;
uint n_full_steps;
double index_read_cost;
@@ -5290,15 +5290,13 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost
/* Number of iterations we'll make with full buffer */
n_full_steps= (uint)floor(rows2double(rows) / max_buff_entries);
-
- /*
- Get numbers of rows we'll be processing in
- - non-last sweep, with full buffer
- - last iteration, with non-full buffer
+
+ /*
+ Get numbers of rows we'll be processing in last iteration, with
+ non-full buffer
*/
- rows_in_full_step= max_buff_entries;
rows_in_last_step= rows % max_buff_entries;
-
+
/* Adjust buffer size if we expect to use only part of the buffer */
if (n_full_steps)
{
@@ -5312,11 +5310,11 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost
(size_t)(1.2*rows_in_last_step) * elem_size +
h->ref_length + table->key_info[keynr].key_length);
}
-
+
COST_VECT last_step_cost;
get_sort_and_sweep_cost(table, rows_in_last_step, &last_step_cost);
cost->add(&last_step_cost);
-
+
if (n_full_steps != 0)
cost->mem_cost= *buffer_size;
else
=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc 2011-06-30 15:50:45 +0000
+++ b/sql/item_geofunc.cc 2011-07-07 14:26:36 +0000
@@ -661,7 +661,7 @@ static double distance_points(const Gcal
static int calc_distance(double *result, Gcalc_heap *collector, uint obj2_si,
Gcalc_function *func, Gcalc_scan_iterator *scan_it)
{
- bool above_cur_point, cur_point_edge;
+ bool cur_point_edge;
const Gcalc_scan_iterator::point *evpos;
const Gcalc_heap::Info *cur_point, *dist_point;
Gcalc_scan_events ev;
@@ -670,7 +670,6 @@ static int calc_distance(double *result,
DBUG_ENTER("calc_distance");
- above_cur_point= false;
distance= DBL_MAX;
while (scan_it->more_points())
@@ -781,7 +780,6 @@ mem_error:
int Item_func_spatial_rel::func_touches()
{
- bool above_cur_point;
double x1, x2, y1, y2, ex, ey;
double distance, area;
int result= 0;
@@ -836,7 +834,6 @@ int Item_func_spatial_rel::func_touches(
scan_it.reset();
scan_it.init(&collector);
- above_cur_point= false;
distance= DBL_MAX;
while (scan_it.more_trapezoids())
@@ -1677,7 +1674,7 @@ longlong Item_func_srid::val_int()
double Item_func_distance::val_real()
{
- bool above_cur_point, cur_point_edge;
+ bool cur_point_edge;
const Gcalc_scan_iterator::point *evpos;
const Gcalc_heap::Info *cur_point, *dist_point;
Gcalc_scan_events ev;
@@ -1724,7 +1721,6 @@ double Item_func_distance::val_real()
collector.prepare_operation();
scan_it.init(&collector);
- above_cur_point= false;
distance= DBL_MAX;
while (scan_it.more_points())
{
=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc 2011-07-03 23:56:47 +0000
+++ b/sql/partition_info.cc 2011-07-07 14:26:36 +0000
@@ -636,12 +636,11 @@ char *partition_info::find_duplicate_nam
HASH partition_names;
uint max_names;
const uchar *curr_name= NULL;
- size_t length;
List_iterator<partition_element> parts_it(partitions);
- partition_element *p_elem;
+ partition_element *p_elem;
DBUG_ENTER("partition_info::find_duplicate_name");
-
+
/*
TODO: If table->s->ha_part_data->partition_name_hash.elements is > 0,
then we could just return NULL, but that has not been verified.
@@ -661,7 +660,6 @@ char *partition_info::find_duplicate_nam
while ((p_elem= (parts_it++)))
{
curr_name= (const uchar*) p_elem->partition_name;
- length= strlen(p_elem->partition_name);
if (my_hash_insert(&partition_names, curr_name))
goto error;
@@ -676,7 +674,7 @@ char *partition_info::find_duplicate_nam
goto error;
}
}
- }
+ }
my_hash_free(&partition_names);
DBUG_RETURN(NULL);
error:
=== modified file 'sql/rpl_info_file.cc'
--- a/sql/rpl_info_file.cc 2011-06-30 15:50:45 +0000
+++ b/sql/rpl_info_file.cc 2011-07-07 14:26:36 +0000
@@ -482,8 +482,9 @@ bool init_dynarray_intvar_from_file(char
(decimal size + space) - 1 + `\n' + '\0'
*/
size_t max_size= (1 + num_items) * (sizeof(long) * 3 + 1) + 1;
- buf_act= (char*) my_malloc(max_size, MYF(MY_WME));
- buffer_act= &buf_act;
+ if (! (buf_act= (char*) my_malloc(max_size, MYF(MY_WME))))
+ DBUG_RETURN(TRUE);
+ *buffer_act= buf_act;
memcpy(buf_act, buf, read_size);
snd_size= my_b_gets(f, buf_act + read_size, max_size - read_size);
if (snd_size == 0 ||
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2011-07-07 11:24:33 +0000
+++ b/sql/sql_load.cc 2011-07-07 14:26:36 +0000
@@ -1122,12 +1122,9 @@ read_xml_field(THD *thd, COPY_INFO &info
List_iterator_fast<Item> it(fields_vars);
Item *item;
TABLE *table= table_list->table;
- bool no_trans_update_stmt;
const CHARSET_INFO *cs= read_info.read_charset;
DBUG_ENTER("read_xml_field");
-
- no_trans_update_stmt= !table->file->has_transactions();
-
+
for ( ; ; it.rewind())
{
if (thd->killed)
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-07-07 13:22:43 +0000
+++ b/sql/sql_select.cc 2011-07-07 14:26:36 +0000
@@ -3955,7 +3955,7 @@ bool convert_subquery_to_semijoin(JOIN *
st_select_lex *subq_lex= subq_pred->unit->first_select();
nested_join->join_list.empty();
List_iterator_fast<TABLE_LIST> li(subq_lex->top_join_list);
- TABLE_LIST *tl, *last_leaf;
+ TABLE_LIST *tl;
while ((tl= li++))
{
tl->embedding= sj_nest;
@@ -3973,7 +3973,6 @@ bool convert_subquery_to_semijoin(JOIN *
for (tl= parent_lex->leaf_tables; tl->next_leaf; tl= tl->next_leaf)
{}
tl->next_leaf= subq_lex->leaf_tables;
- last_leaf= tl;
/*
Same as above for next_local chain
@@ -4258,7 +4257,6 @@ bool JOIN::flatten_subqueries()
DBUG_RETURN(TRUE);
}
skip_conversion:
- bool converted= FALSE;
/*
3. Finalize the subqueries that we did not convert,
ie. perform IN->EXISTS rewrite.
@@ -4272,7 +4270,6 @@ skip_conversion:
SELECT_LEX *save_select_lex= thd->lex->current_select;
thd->lex->current_select= (*subq)->unit->first_select();
- converted= TRUE;
res= (*subq)->select_transformer(child_join);
@@ -11822,8 +11819,6 @@ static bool
make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
{
const bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
- uint first_sjm_table= MAX_TABLES;
- uint last_sjm_table= MAX_TABLES;
/* First table sorted if ORDER or GROUP BY was specified */
bool sorted= (join->order || join->group_list);
@@ -11857,8 +11852,6 @@ make_join_readinfo(JOIN *join, ulonglong
if (sj_is_materialize_strategy(join->best_positions[i].sj_strategy))
{
/* This is a start of semi-join nest */
- first_sjm_table= i;
- last_sjm_table= i + join->best_positions[i].n_sj_tables;
if (i == join->const_tables)
join->first_select= sub_select_sjm;
else
@@ -16841,7 +16834,7 @@ TABLE *create_duplicate_weedout_tmp_tabl
bool using_unique_constraint=FALSE;
bool use_packed_rows= FALSE;
Field *field, *key_field;
- uint blob_count, null_pack_length, null_count;
+ uint null_pack_length, null_count;
uchar *null_flags;
uchar *pos;
DBUG_ENTER("create_duplicate_weedout_tmp_table");
@@ -16922,8 +16915,6 @@ TABLE *create_duplicate_weedout_tmp_tabl
share->keys_for_keyread.init();
share->keys_in_use.init();
- blob_count= 0;
-
/* Create the field */
{
/*
=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c 2011-06-02 07:05:42 +0000
+++ b/storage/innobase/trx/trx0purge.c 2011-07-07 14:26:36 +0000
@@ -216,7 +216,6 @@ trx_purge_add_update_undo_to_history(
trx_rseg_t* rseg;
trx_rsegf_t* rseg_header;
trx_ulogf_t* undo_header;
- trx_upagef_t* page_header;
undo = trx->update_undo;
rseg = undo->rseg;
@@ -226,7 +225,6 @@ trx_purge_add_update_undo_to_history(
mtr);
undo_header = undo_page + undo->hdr_offset;
- page_header = undo_page + TRX_UNDO_PAGE_HDR;
if (undo->state != TRX_UNDO_CACHED) {
ulint hist_size;
@@ -559,7 +557,6 @@ trx_purge_rseg_get_next_history_log(
const void* ptr;
page_t* undo_page;
trx_ulogf_t* log_hdr;
- trx_usegf_t* seg_hdr;
fil_addr_t prev_log_addr;
trx_id_t trx_no;
ibool del_marks;
@@ -580,7 +577,6 @@ trx_purge_rseg_get_next_history_log(
rseg->space, rseg->zip_size, rseg->last_page_no, &mtr);
log_hdr = undo_page + rseg->last_offset;
- seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
/* Increase the purge page count by one for every handled log */
=== modified file 'storage/innobase/trx/trx0rec.c'
--- a/storage/innobase/trx/trx0rec.c 2011-06-16 09:26:09 +0000
+++ b/storage/innobase/trx/trx0rec.c 2011-07-07 14:26:36 +0000
@@ -1468,7 +1468,6 @@ trx_undo_prev_version_build(
table_id_t table_id;
trx_id_t trx_id;
roll_ptr_t roll_ptr;
- roll_ptr_t old_roll_ptr;
upd_t* update;
byte* ptr;
ulint info_bits;
@@ -1486,7 +1485,6 @@ trx_undo_prev_version_build(
ut_a(dict_index_is_clust(index));
roll_ptr = row_get_rec_roll_ptr(rec, index, offsets);
- old_roll_ptr = roll_ptr;
*old_vers = NULL;
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2011-07-06 18:58:53 +0000
+++ b/storage/perfschema/pfs_instr.cc 2011-07-07 14:26:36 +0000
@@ -1411,12 +1411,10 @@ void aggregate_all_event_names(PFS_singl
PFS_single_stat *from;
PFS_single_stat *from_last;
PFS_single_stat *to;
- PFS_single_stat *to_last;
from= from_array;
from_last= from_array + wait_class_max;
to= to_array;
- to_last= to_array + wait_class_max;
for ( ; from < from_last ; from++, to++)
{
@@ -1435,16 +1433,12 @@ void aggregate_all_event_names(PFS_singl
PFS_single_stat *from;
PFS_single_stat *from_last;
PFS_single_stat *to_1;
- PFS_single_stat *to_1_last;
PFS_single_stat *to_2;
- PFS_single_stat *to_2_last;
from= from_array;
from_last= from_array + wait_class_max;
to_1= to_array_1;
- to_1_last= to_array_1 + wait_class_max;
to_2= to_array_2;
- to_2_last= to_array_2 + wait_class_max;
for ( ; from < from_last ; from++, to_1++, to_2++)
{
@@ -1463,12 +1457,10 @@ void aggregate_all_stages(PFS_stage_stat
PFS_stage_stat *from;
PFS_stage_stat *from_last;
PFS_stage_stat *to;
- PFS_stage_stat *to_last;
from= from_array;
from_last= from_array + stage_class_max;
to= to_array;
- to_last= to_array + stage_class_max;
for ( ; from < from_last ; from++, to++)
{
@@ -1486,12 +1478,10 @@ void aggregate_all_statements(PFS_statem
PFS_statement_stat *from;
PFS_statement_stat *from_last;
PFS_statement_stat *to;
- PFS_statement_stat *to_last;
from= from_array;
from_last= from_array + statement_class_max;
to= to_array;
- to_last= to_array + statement_class_max;
for ( ; from < from_last ; from++, to++)
{
=== modified file 'storage/perfschema/unittest/pfs_instr_class-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc 2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc 2011-07-07 14:26:36 +0000
@@ -80,10 +80,10 @@ void test_no_registration()
file_key= register_file_class("FOO", 3, 0);
ok(file_key == 0, "no file registered");
+#ifdef LATER
PFS_thread fake_thread;
fake_thread.m_table_share_hash_pins= NULL;
-#ifdef LATER
table= find_or_create_table_share(& fake_thread, false, "foo_db", 6, "foo_table", 9);
ok(table == NULL, "not created");
table= find_or_create_table_share(& fake_thread, false, "bar_db", 6, "bar_table", 9);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (davi:3247 to 3248) Bug#12727287 | Davi Arnaut | 10 Jul |