1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Fixed compiler warnings

sql/item_subselect.cc:
  Added purecov info
sql/sql_select.cc:
  Added cast
storage/innobase/handler/ha_innodb.cc:
  Added cast
storage/xtradb/btr/btr0btr.c:
  Added buf_block_get_frame_fast() to avoid compiler warning
storage/xtradb/handler/ha_innodb.cc:
  Added cast
storage/xtradb/include/buf0buf.h:
  Innodb has buf_block_get_frame(block) defined as (block)->frame.
  Didn't want to do a big change to break xtradb as it may use block_get_frame() differently, so I mad this quick hack to patch one compiler warning.
This commit is contained in:
Michael Widenius
2012-08-15 09:34:18 +03:00
parent b886cac712
commit dd8bd2e4c3
7 changed files with 20 additions and 10 deletions

View File

@@ -56,10 +56,10 @@ ENDIF()
# Always enable -Wall for gnu C/C++ # Always enable -Wall for gnu C/C++
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter") SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
ENDIF() ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}")
ENDIF() ENDIF()

View File

@@ -5169,13 +5169,17 @@ Ordered_key::cmp_keys_by_row_data(ha_rows a, ha_rows b)
/* Fetch the rows for comparison. */ /* Fetch the rows for comparison. */
if ((error= tbl->file->ha_rnd_pos(tbl->record[0], rowid_a))) if ((error= tbl->file->ha_rnd_pos(tbl->record[0], rowid_a)))
{ {
/* purecov: begin inspected */
tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error
return 0; return 0;
/* purecov: end */
} }
if ((error= tbl->file->ha_rnd_pos(tbl->record[1], rowid_b))) if ((error= tbl->file->ha_rnd_pos(tbl->record[1], rowid_b)))
{ {
/* purecov: begin inspected */
tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error
return 0; return 0;
/* purecov: end */
} }
/* /*
Compare the two rows by the corresponding values of the indexed Compare the two rows by the corresponding values of the indexed
@@ -5253,8 +5257,10 @@ int Ordered_key::cmp_key_with_search_key(rownum_t row_num)
if ((error= tbl->file->ha_rnd_pos(tbl->record[0], cur_rowid))) if ((error= tbl->file->ha_rnd_pos(tbl->record[0], cur_rowid)))
{ {
/* purecov: begin inspected */
tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error
return 0; return 0;
/* purecov: end */
} }
for (uint i= 0; i < key_column_count; i++) for (uint i= 0; i < key_column_count; i++)

View File

@@ -6657,7 +6657,7 @@ double JOIN::get_examined_rows()
while ((tab= next_breadth_first_tab(this, tab))) while ((tab= next_breadth_first_tab(this, tab)))
{ {
prev_fanout *= prev_tab->records_read; prev_fanout *= prev_tab->records_read;
examined_rows+= tab->get_examined_rows() * prev_fanout; examined_rows+= (ha_rows) (tab->get_examined_rows() * prev_fanout);
prev_tab= tab; prev_tab= tab;
} }
return examined_rows; return examined_rows;

View File

@@ -8418,9 +8418,10 @@ ha_innobase::info_low(
} }
else if (rec_per_key > 1) { else if (rec_per_key > 1) {
rec_per_key = rec_per_key =
k_rec_per_key * (ha_rows)
(double)rec_per_key / (k_rec_per_key *
n_rows; (double)rec_per_key /
n_rows);
} }
key_info->rec_per_key[k++]= key_info->rec_per_key[k++]=

View File

@@ -61,7 +61,7 @@ btr_corruption_report(
buf_block_get_zip_size(block), buf_block_get_zip_size(block),
BUF_PAGE_PRINT_NO_CRASH); BUF_PAGE_PRINT_NO_CRASH);
} }
buf_page_print(buf_block_get_frame(block), 0, 0); buf_page_print(buf_block_get_frame_fast(block), 0, 0);
} }
#ifdef UNIV_BLOB_DEBUG #ifdef UNIV_BLOB_DEBUG

View File

@@ -9281,9 +9281,10 @@ ha_innobase::info_low(
} }
else if (rec_per_key > 1) { else if (rec_per_key > 1) {
rec_per_key = rec_per_key =
k_rec_per_key * (ha_rows)
(double)rec_per_key / (k_rec_per_key *
n_rows; (double)rec_per_key /
n_rows);
} }
key_info->rec_per_key[k++]= key_info->rec_per_key[k++]=

View File

@@ -1063,8 +1063,10 @@ buf_block_get_frame(
/*================*/ /*================*/
const buf_block_t* block) /*!< in: pointer to the control block */ const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure)); __attribute__((pure));
# define buf_block_get_frame_fast(block) buf_block_get_frame(block)
#else /* UNIV_DEBUG */ #else /* UNIV_DEBUG */
# define buf_block_get_frame(block) (block ? (block)->frame : 0) # define buf_block_get_frame(block) (block ? (block)->frame : 0)
# define buf_block_get_frame_fast(block) (block)->frame
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/*********************************************************************//** /*********************************************************************//**
Gets the space id of a block. Gets the space id of a block.