1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

fix gcc 8 compiler warnings

There were two newly enabled warnings:
1. cast for a function pointers. Affected sql_analyse.h, mi_write.c
   and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc

2. memcpy/memset of nontrivial structures. Fixed as:
* the warning disabled for InnoDB
* TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which
  does the bzero(), which is safe for these classes, but any other
  bzero() will still cause a warning
* Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial)
  instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to
  bzero now.
* added casts in debug_sync.cc and sql_select.cc (for JOIN)
* move assignment method for MDL_request instead of memcpy()
* PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero()
* remove constructor from READ_RECORD() to make it trivial
* replace some memcpy() with c++ copy assignments
This commit is contained in:
Sergei Golubchik
2019-03-12 16:27:19 +01:00
parent ddfa722a03
commit 3d2d060b62
33 changed files with 166 additions and 136 deletions

View File

@ -2329,7 +2329,7 @@ void JOIN::restore_tmp()
{
DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
DBUG_ASSERT(tmp_join != this);
memcpy(tmp_join, this, (size_t) sizeof(JOIN));
memcpy((void*)tmp_join, this, (size_t) sizeof(JOIN));
}
@ -3610,7 +3610,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
DBUG_RETURN(1);
/* The following should be optimized to only clear critical things */
bzero(stat, sizeof(JOIN_TAB)* table_count);
bzero((void*)stat, sizeof(JOIN_TAB)* table_count);
/* Initialize POSITION objects */
for (i=0 ; i <= table_count ; i++)
(void) new ((char*) (join->positions + i)) POSITION;
@ -8758,7 +8758,7 @@ get_best_combination(JOIN *join)
1. Put into main join order a JOIN_TAB that represents a lookup or scan
in the temptable.
*/
bzero(j, sizeof(JOIN_TAB));
bzero((void*)j, sizeof(JOIN_TAB));
j->join= join;
j->table= NULL; //temporary way to tell SJM tables from others.
j->ref.key = -1;
@ -9360,7 +9360,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
row_limit= unit->select_limit_cnt;
do_send_rows= row_limit ? 1 : 0;
bzero(join_tab, sizeof(JOIN_TAB));
bzero((void*)join_tab, sizeof(JOIN_TAB));
join_tab->table=temp_table;
join_tab->set_select_cond(NULL, __LINE__);
join_tab->type= JT_ALL; /* Map through all records */
@ -17275,11 +17275,11 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
NullS))
return 0;
bzero(table, sizeof(*table));
bzero(share, sizeof(*share));
table->reset();
table->field= field;
table->s= share;
table->temp_pool_slot= MY_BIT_NONE;
share->reset();
share->blob_field= blob_field;
share->fields= field_count;
setup_tmp_table_column_bitmaps(table, bitmaps);