Skip to content

Commit

Permalink
Windows : reenable warning C4805 (unsafe mix of types in bool operati…
Browse files Browse the repository at this point in the history
…ons)
  • Loading branch information
vaintroub committed Feb 7, 2018
1 parent 7bcf5e2 commit d995dd2
Show file tree
Hide file tree
Showing 27 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions cmake/os/Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions plugin/feedback/sender_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions sql/partition_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ class partition_element :public Sql_alloc
// 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()
Expand Down
4 changes: 2 additions & 2 deletions sql/sql_acl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
{
/*
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4964,7 +4964,7 @@ mysql_execute_command(THD *thd)
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)
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4269,7 +4269,7 @@ mysql_select(THD *thd,
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);
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_union.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ bool st_select_lex_unit::exec_recursive()

bool st_select_lex_unit::cleanup()
{
int error= 0;
bool error= 0;
DBUG_ENTER("st_select_lex_unit::cleanup");

if (cleaned)
Expand Down
2 changes: 1 addition & 1 deletion sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -926,11 +926,11 @@ dict_index_contains_col_or_prefix(

if (col == field->col) {

return(TRUE);
return(true);
}
}

return(FALSE);
return(false);
}

/********************************************************************//**
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/btr0sea.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/include/dict0dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/include/dict0dict.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
}

/************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/rem0rec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/rem0rec.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/sync0rw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/lock/lock0lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/sync/sync0rw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion storage/myisam/ha_myisam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d995dd2

Please sign in to comment.