Windows : reenable warning C4805 (unsafe mix of types in bool operations)

This commit is contained in:
Vladislav Vaintroub 2018-02-06 17:14:05 +00:00
parent 7bcf5e2907
commit d995dd2865
27 changed files with 43 additions and 43 deletions

View File

@ -146,8 +146,8 @@ IF(MSVC)
ENDIF()
#TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4805 /wd4291 /wd4996 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4291 /wd4996 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")

View File

@ -40,7 +40,7 @@ ulong interval= 60*60*24*7; ///< in seconds (one week)
*/
static int table_to_string(TABLE *table, String *result)
{
bool res;
int res;
char buff1[MAX_FIELD_WIDTH], buff2[MAX_FIELD_WIDTH];
String str1(buff1, sizeof(buff1), system_charset_info);
String str2(buff2, sizeof(buff2), system_charset_info);
@ -64,7 +64,7 @@ static int table_to_string(TABLE *table, String *result)
}
}
res = res || result->append('\n');
res = res || (int)result->append('\n');
/*
Note, "|=" and not "||" - because we want to call ha_rnd_end()

View File

@ -11577,7 +11577,7 @@ static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD * thd)
already. So there should be no need to rollback the transaction.
*/
DBUG_ASSERT(! thd->transaction_rollback_request);
error|= (error ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
error|= (int)(error ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
/*
Now what if this is not a transactional engine? we still need to

View File

@ -185,13 +185,13 @@ public:
// mixup
elem_type type()
{
return (elem_type)(signed_flag << 1 | max_value);
return (elem_type)(int(signed_flag) << 1 | int(max_value));
}
void type(elem_type val)
{
max_value= val & 1;
signed_flag= val & 2;
max_value= (bool)(val & 1);
signed_flag= (bool)(val & 2);
}
partition_element()

View File

@ -7602,8 +7602,8 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
we need to modify the requested access rights depending on how the
sequence is used.
*/
if (t_ref->sequence &
(orig_want_access &
if (t_ref->sequence &&
(bool)(orig_want_access &
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL)))
{
/*

View File

@ -8303,7 +8303,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
List<Item> &values, bool ignore_errors,
enum trg_event_type event)
{
bool result;
int result;
Table_triggers_list *triggers= table->triggers;
result= fill_record(thd, table, fields, values, ignore_errors,

View File

@ -1653,7 +1653,7 @@ bool mysql_opt_change_db(THD *thd,
bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db)
{
int error= 0, change_to_newdb= 0;
bool error= 0, change_to_newdb= 0;
char path[FN_REFLEN+16];
uint length;
Schema_specification_st create_info;

View File

@ -4964,7 +4964,7 @@ end_with_restore_list:
SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE) & ~OPTION_BUFFER_RESULT,
result, unit, select_lex);
res|= thd->is_error();
res|= (int)(thd->is_error());
MYSQL_MULTI_DELETE_DONE(res, result->num_deleted());
if (res)

View File

@ -4269,7 +4269,7 @@ err:
if (free_join)
{
THD_STAGE_INFO(thd, stage_end);
err|= select_lex->cleanup();
err|= (int)(select_lex->cleanup());
DBUG_RETURN(err || thd->is_error());
}
DBUG_RETURN(join->error ? join->error: err);

View File

@ -2803,7 +2803,7 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
const LEX_CSTRING *table_name, uint flags, const char *table_path)
{
char path[FN_REFLEN + 1];
bool error= 0;
int error= 0;
DBUG_ENTER("quick_rm_table");
size_t path_length= table_path ?

View File

@ -906,7 +906,7 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
{
long period, sign;
sign= (interval.neg == ltime->neg ? 1 : -1);
sign= (interval.neg == (bool)ltime->neg ? 1 : -1);
switch (int_type) {
case INTERVAL_SECOND:

View File

@ -2746,7 +2746,7 @@ bool Type_handler_int_result::
Type_all_attributes *func,
Item **items, uint nitems) const
{
uint unsigned_flag= items[0]->unsigned_flag;
bool unsigned_flag= items[0]->unsigned_flag;
for (uint i= 1; i < nitems; i++)
{
if (unsigned_flag != items[i]->unsigned_flag)

View File

@ -1725,7 +1725,7 @@ err:
bool st_select_lex_unit::cleanup()
{
int error= 0;
bool error= 0;
DBUG_ENTER("st_select_lex_unit::cleanup");
if (cleaned)

View File

@ -6493,7 +6493,7 @@ void TABLE::mark_columns_needed_for_update()
for (KEY *k= key_info; k < end; k++)
{
KEY_PART_INFO *kpend= k->key_part + k->ext_key_parts;
bool any_written= false, all_read= true;
int any_written= 0, all_read= 1;
for (KEY_PART_INFO *kp= k->key_part; kp < kpend; kp++)
{
int idx= kp->fieldnr - 1;

View File

@ -895,7 +895,7 @@ dict_index_get_nth_col_or_prefix_pos(
@param[in] n column number
@param[in] is_virtual whether it is a virtual col
@return TRUE if contains the column or its prefix */
ibool
bool
dict_index_contains_col_or_prefix(
const dict_index_t* index,
ulint n,
@ -926,11 +926,11 @@ dict_index_contains_col_or_prefix(
if (col == field->col) {
return(TRUE);
return(true);
}
}
return(FALSE);
return(false);
}
/********************************************************************//**

View File

@ -4742,7 +4742,7 @@ prepare_inplace_alter_table_dict(
index_def_t* index_defs; /* index definitions */
dict_table_t* user_table;
dict_index_t* fts_index = NULL;
ulint new_clustered = 0;
bool new_clustered = false;
dberr_t error;
ulint num_fts_index;
dict_add_v_col_t* add_v = NULL;
@ -4819,7 +4819,7 @@ prepare_inplace_alter_table_dict(
fts_doc_id_col, add_fts_doc_id, add_fts_doc_id_idx,
old_table);
new_clustered = DICT_CLUSTERED & index_defs[0].ind_type;
new_clustered = (DICT_CLUSTERED & index_defs[0].ind_type) != 0;
/* The primary index would be rebuilt if a FTS Doc ID
column is to be added, and the primary index definition

View File

@ -285,7 +285,7 @@ struct btr_search_t{
ulint n_bytes; /*!< recommended prefix: number of bytes in
an incomplete field
@see BTR_PAGE_MAX_REC_SIZE */
ibool left_side; /*!< TRUE or FALSE, depending on whether
bool left_side; /*!< true or false, depending on whether
the leftmost record of several records with
the same prefix should be indexed in the
hash index */

View File

@ -929,7 +929,7 @@ dict_index_get_min_size(
Check whether the table uses the compact page format.
@return TRUE if table uses the compact page format */
UNIV_INLINE
ibool
bool
dict_table_is_comp(
/*===============*/
const dict_table_t* table) /*!< in: table */
@ -1275,7 +1275,7 @@ Returns TRUE if the index contains a column or a prefix of that column.
@param[in] n column number
@param[in] is_virtual whether it is a virtual col
@return TRUE if contains the column or its prefix */
ibool
bool
dict_index_contains_col_or_prefix(
/*==============================*/
const dict_index_t* index, /*!< in: index */

View File

@ -570,7 +570,7 @@ dict_table_get_sys_col_no(
Check whether the table uses the compact page format.
@return TRUE if table uses the compact page format */
UNIV_INLINE
ibool
bool
dict_table_is_comp(
/*===============*/
const dict_table_t* table) /*!< in: table */
@ -581,7 +581,7 @@ dict_table_is_comp(
#error "DICT_TF_COMPACT must be 1"
#endif
return(table->flags & DICT_TF_COMPACT);
return (table->flags & DICT_TF_COMPACT) != 0;
}
/************************************************************************

View File

@ -367,7 +367,7 @@ rec_set_deleted_flag_new(
The following function tells if a new-style record is a node pointer.
@return TRUE if node pointer */
UNIV_INLINE
ibool
bool
rec_get_node_ptr_flag(
/*==================*/
const rec_t* rec) /*!< in: physical record */

View File

@ -731,7 +731,7 @@ rec_set_deleted_flag_new(
The following function tells if a new-style record is a node pointer.
@return TRUE if node pointer */
UNIV_INLINE
ibool
bool
rec_get_node_ptr_flag(
/*==================*/
const rec_t* rec) /*!< in: physical record */

View File

@ -507,7 +507,7 @@ rw_lock_lock_word_decr(
/******************************************************************//**
Checks if the thread has locked the rw-lock in the specified mode, with
the pass value == 0. */
ibool
bool
rw_lock_own(
/*========*/
rw_lock_t* lock, /*!< in: rw-lock */

View File

@ -5544,10 +5544,10 @@ lock_table_queue_validate(
Validates the lock queue on a single record.
@return TRUE if ok */
static
ibool
bool
lock_rec_queue_validate(
/*====================*/
ibool locked_lock_trx_sys,
bool locked_lock_trx_sys,
/*!< in: if the caller holds
both the lock mutex and
trx_sys_t->lock. */

View File

@ -1415,7 +1415,7 @@ srv_prepare_to_delete_redo_log_files(
|| srv_log_file_size
!= srv_log_file_size_requested) {
if (srv_encrypt_log
== log_sys->is_encrypted()) {
== (my_bool)log_sys->is_encrypted()) {
info << (srv_encrypt_log
? "Resizing encrypted"
: "Resizing");

View File

@ -1011,7 +1011,7 @@ rw_lock_remove_debug_info(
Checks if the thread has locked the rw-lock in the specified mode, with
the pass value == 0.
@return TRUE if locked */
ibool
bool
rw_lock_own(
/*========*/
rw_lock_t* lock, /*!< in: rw-lock */
@ -1034,12 +1034,12 @@ rw_lock_own(
rw_lock_debug_mutex_exit();
/* Found! */
return(TRUE);
return(true);
}
}
rw_lock_debug_mutex_exit();
return(FALSE);
return(false);
}
/** For collecting the debug information for a thread's rw-lock */

View File

@ -938,7 +938,7 @@ void ha_myisam::setup_vcols_for_repair(HA_CHECK *param)
{
uint vf_end= (*vf)->offset(table->record[0]) + (*vf)->pack_length_in_rec();
set_if_bigger(new_vreclength, vf_end);
indexed_vcols|= (*vf)->flags & PART_KEY_FLAG;
indexed_vcols|= ((*vf)->flags & PART_KEY_FLAG) != 0;
}
if (!indexed_vcols)
return;

View File

@ -374,11 +374,11 @@ static my_bool rocksdb_pause_background_work = 0;
static mysql_mutex_t rdb_sysvars_mutex;
static void rocksdb_set_pause_background_work(
my_core::THD *const thd MY_ATTRIBUTE((__unused__)),
struct st_mysql_sys_var *const var MY_ATTRIBUTE((__unused__)),
void *const var_ptr MY_ATTRIBUTE((__unused__)), const void *const save) {
my_core::THD *const,
struct st_mysql_sys_var *const,
void *const, const void *const save) {
RDB_MUTEX_LOCK_CHECK(rdb_sysvars_mutex);
const bool pause_requested = *static_cast<const bool *>(save);
const my_bool pause_requested = *static_cast<const my_bool *>(save);
if (rocksdb_pause_background_work != pause_requested) {
if (pause_requested) {
rdb->PauseBackgroundWork();