Bug #26461: Intrinsic data type bool (1 byte) redefined to BOOL (4 bytes)

The bool data type was redefined to BOOL (4 bytes on windows).
Removed the #define and fixed some of the warnings that were uncovered
by this.
Note that the fix also disables 2 warnings :
4800 : 'type' : forcing value to bool 'true' or 'false' (performance warning)
4805: 'operation' : unsafe mix of type 'type' and type 'type' in operation

These warnings will be handled in a separate bug, as they are performance related or bogus.

Fixed to int the return type of functions that return more than 
2 distinct values.
parent 3bff5b59
...@@ -78,6 +78,10 @@ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF ...@@ -78,6 +78,10 @@ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF") SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
#TODO: update the code and remove the disabled warnings
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
......
...@@ -157,14 +157,12 @@ typedef uint rf_SetTimer; ...@@ -157,14 +157,12 @@ typedef uint rf_SetTimer;
#define Socket_defined #define Socket_defined
#define my_socket SOCKET #define my_socket SOCKET
#define bool BOOL
#define SIGPIPE SIGINT #define SIGPIPE SIGINT
#define RETQSORTTYPE void #define RETQSORTTYPE void
#define QSORT_TYPE_IS_VOID #define QSORT_TYPE_IS_VOID
#define RETSIGTYPE void #define RETSIGTYPE void
#define SOCKET_SIZE_TYPE int #define SOCKET_SIZE_TYPE int
#define my_socket_defined #define my_socket_defined
#define bool_defined
#define byte_defined #define byte_defined
#define HUGE_PTR #define HUGE_PTR
#define STDCALL __stdcall /* Used by libmysql.dll */ #define STDCALL __stdcall /* Used by libmysql.dll */
...@@ -457,4 +455,4 @@ inline double ulonglong2double(ulonglong value) ...@@ -457,4 +455,4 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_ujis 1
#define HAVE_CHARSET_utf8 1 #define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1 #define HAVE_UCA_COLLATIONS 1
#define HAVE_BOOL 1
...@@ -980,7 +980,7 @@ typedef int myf; /* Type of MyFlags in my_funcs */ ...@@ -980,7 +980,7 @@ typedef int myf; /* Type of MyFlags in my_funcs */
typedef char byte; /* Smallest addressable unit */ typedef char byte; /* Smallest addressable unit */
#endif #endif
typedef char my_bool; /* Small bool */ typedef char my_bool; /* Small bool */
#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) #if !defined(bool) && (!defined(HAVE_BOOL) || !defined(__cplusplus))
typedef char bool; /* Ordinary boolean values 0 1 */ typedef char bool; /* Ordinary boolean values 0 1 */
#endif #endif
/* Macros for converting *constants* to the right type */ /* Macros for converting *constants* to the right type */
......
...@@ -815,7 +815,7 @@ public: ...@@ -815,7 +815,7 @@ public:
{ return HA_ADMIN_NOT_IMPLEMENTED; } { return HA_ADMIN_NOT_IMPLEMENTED; }
/* end of the list of admin commands */ /* end of the list of admin commands */
virtual bool check_and_repair(THD *thd) { return HA_ERR_WRONG_COMMAND; } virtual bool check_and_repair(THD *thd) { return TRUE; }
virtual int dump(THD* thd, int fd = -1) { return HA_ERR_WRONG_COMMAND; } virtual int dump(THD* thd, int fd = -1) { return HA_ERR_WRONG_COMMAND; }
virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
......
...@@ -597,8 +597,8 @@ bool check_merge_table_access(THD *thd, char *db, ...@@ -597,8 +597,8 @@ bool check_merge_table_access(THD *thd, char *db,
bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc); bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
bool multi_update_precheck(THD *thd, TABLE_LIST *tables); bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables); bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
bool mysql_multi_update_prepare(THD *thd); int mysql_multi_update_prepare(THD *thd);
bool mysql_multi_delete_prepare(THD *thd); int mysql_multi_delete_prepare(THD *thd);
bool mysql_insert_select_prepare(THD *thd); bool mysql_insert_select_prepare(THD *thd);
bool update_precheck(THD *thd, TABLE_LIST *tables); bool update_precheck(THD *thd, TABLE_LIST *tables);
bool delete_precheck(THD *thd, TABLE_LIST *tables); bool delete_precheck(THD *thd, TABLE_LIST *tables);
...@@ -691,7 +691,7 @@ struct Query_cache_query_flags ...@@ -691,7 +691,7 @@ struct Query_cache_query_flags
uint build_table_path(char *buff, size_t bufflen, const char *db, uint build_table_path(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext); const char *table, const char *ext);
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags); void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
...@@ -731,7 +731,7 @@ pthread_handler_t handle_one_connection(void *arg); ...@@ -731,7 +731,7 @@ pthread_handler_t handle_one_connection(void *arg);
pthread_handler_t handle_bootstrap(void *arg); pthread_handler_t handle_bootstrap(void *arg);
void end_thread(THD *thd,bool put_in_cache); void end_thread(THD *thd,bool put_in_cache);
void flush_thread_cache(); void flush_thread_cache();
bool mysql_execute_command(THD *thd); int mysql_execute_command(THD *thd);
bool dispatch_command(enum enum_server_command command, THD *thd, bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length); char* packet, uint packet_length);
void log_slow_statement(THD *thd); void log_slow_statement(THD *thd);
...@@ -862,7 +862,7 @@ void prepare_triggers_for_insert_stmt(THD *thd, TABLE *table, ...@@ -862,7 +862,7 @@ void prepare_triggers_for_insert_stmt(THD *thd, TABLE *table,
enum_duplicates duplic); enum_duplicates duplic);
void mark_fields_used_by_triggers_for_insert_stmt(THD *thd, TABLE *table, void mark_fields_used_by_triggers_for_insert_stmt(THD *thd, TABLE *table,
enum_duplicates duplic); enum_duplicates duplic);
bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds); int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
SQL_LIST *order, ha_rows rows, ulonglong options, SQL_LIST *order, ha_rows rows, ulonglong options,
bool reset_auto_increment); bool reset_auto_increment);
...@@ -1106,7 +1106,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); ...@@ -1106,7 +1106,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
void wait_for_refresh(THD *thd); void wait_for_refresh(THD *thd);
int open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags); int open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags);
int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables); int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables);
bool open_and_lock_tables(THD *thd,TABLE_LIST *tables); int open_and_lock_tables(THD *thd,TABLE_LIST *tables);
bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags); bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter, bool *need_reopen); int lock_tables(THD *thd, TABLE_LIST *tables, uint counter, bool *need_reopen);
TABLE *open_temporary_table(THD *thd, const char *path, const char *db, TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
...@@ -1177,7 +1177,7 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table, ...@@ -1177,7 +1177,7 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
bool eval_const_cond(COND *cond); bool eval_const_cond(COND *cond);
/* sql_load.cc */ /* sql_load.cc */
bool mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields, List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values_list, List<Item> &set_values_list,
enum enum_duplicates handle_duplicates, bool ignore, enum enum_duplicates handle_duplicates, bool ignore,
......
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
virtual int send_row(List<Item> &fields)=0; virtual int send_row(List<Item> &fields)=0;
virtual bool change_columns(List<Item> &fields)=0; virtual bool change_columns(List<Item> &fields)=0;
virtual void update_refs(void) {} virtual void update_refs(void) {}
virtual bool end_of_records() { return 0; } virtual int end_of_records() { return 0; }
}; };
Procedure *setup_procedure(THD *thd,ORDER *proc_param,select_result *result, Procedure *setup_procedure(THD *thd,ORDER *proc_param,select_result *result,
......
...@@ -1382,7 +1382,7 @@ bool acl_check_host(const char *host, const char *ip) ...@@ -1382,7 +1382,7 @@ bool acl_check_host(const char *host, const char *ip)
1 ERROR ; In this case the error is sent to the client. 1 ERROR ; In this case the error is sent to the client.
*/ */
bool check_change_password(THD *thd, const char *host, const char *user, int check_change_password(THD *thd, const char *host, const char *user,
char *new_password, uint new_password_len) char *new_password, uint new_password_len)
{ {
if (!initialized) if (!initialized)
...@@ -2763,7 +2763,7 @@ table_error: ...@@ -2763,7 +2763,7 @@ table_error:
TRUE error TRUE error
*/ */
bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
List <LEX_USER> &user_list, List <LEX_USER> &user_list,
List <LEX_COLUMN> &columns, ulong rights, List <LEX_COLUMN> &columns, ulong rights,
bool revoke_grant) bool revoke_grant)
...@@ -5805,7 +5805,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, ...@@ -5805,7 +5805,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
< 0 Error. Error message not yet sent. < 0 Error. Error message not yet sent.
*/ */
bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, int sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
bool is_proc) bool is_proc)
{ {
Security_context *sctx= thd->security_ctx; Security_context *sctx= thd->security_ctx;
......
...@@ -183,13 +183,13 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd, ...@@ -183,13 +183,13 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd,
bool acl_getroot_no_password(Security_context *sctx, char *user, char *host, bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
char *ip, char *db); char *ip, char *db);
bool acl_check_host(const char *host, const char *ip); bool acl_check_host(const char *host, const char *ip);
bool check_change_password(THD *thd, const char *host, const char *user, int check_change_password(THD *thd, const char *host, const char *user,
char *password, uint password_len); char *password, uint password_len);
bool change_password(THD *thd, const char *host, const char *user, bool change_password(THD *thd, const char *host, const char *user,
char *password); char *password);
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list, bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
ulong rights, bool revoke); ulong rights, bool revoke);
bool mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
List <LEX_COLUMN> &column_list, ulong rights, List <LEX_COLUMN> &column_list, ulong rights,
bool revoke); bool revoke);
bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc, bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc,
...@@ -225,7 +225,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, ...@@ -225,7 +225,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
const char *db, const char *table); const char *db, const char *table);
bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
bool is_proc); bool is_proc);
bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, int sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
bool is_proc); bool is_proc);
bool check_routine_level_acl(THD *thd, const char *db, const char *name, bool check_routine_level_acl(THD *thd, const char *db, const char *name,
bool is_proc); bool is_proc);
......
...@@ -683,7 +683,7 @@ int analyse::send_row(List<Item> &field_list __attribute__((unused))) ...@@ -683,7 +683,7 @@ int analyse::send_row(List<Item> &field_list __attribute__((unused)))
} // analyse::send_row } // analyse::send_row
bool analyse::end_of_records() int analyse::end_of_records()
{ {
field_info **f = f_info; field_info **f = f_info;
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
......
...@@ -350,7 +350,7 @@ public: ...@@ -350,7 +350,7 @@ public:
virtual bool change_columns(List<Item> &fields); virtual bool change_columns(List<Item> &fields);
virtual int send_row(List<Item> &fields); virtual int send_row(List<Item> &fields);
virtual void end_group(void) {} virtual void end_group(void) {}
virtual bool end_of_records(void); virtual int end_of_records(void);
friend Procedure *proc_analyse_init(THD *thd, ORDER *param, friend Procedure *proc_analyse_init(THD *thd, ORDER *param,
select_result *result, select_result *result,
List<Item> &field_list); List<Item> &field_list);
......
...@@ -3046,7 +3046,7 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables) ...@@ -3046,7 +3046,7 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
The lock will automaticaly be freed by close_thread_tables() The lock will automaticaly be freed by close_thread_tables()
*/ */
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables) int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
{ {
uint counter; uint counter;
bool need_reopen; bool need_reopen;
......
...@@ -449,7 +449,7 @@ bool load_db_opt_by_name(THD *thd, const char *db_name, ...@@ -449,7 +449,7 @@ bool load_db_opt_by_name(THD *thd, const char *db_name,
*/ */
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
bool silent) bool silent)
{ {
char path[FN_REFLEN+16]; char path[FN_REFLEN+16];
......
...@@ -370,7 +370,7 @@ cleanup: ...@@ -370,7 +370,7 @@ cleanup:
FALSE OK FALSE OK
TRUE error TRUE error
*/ */
bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
{ {
Item *fake_conds= 0; Item *fake_conds= 0;
SELECT_LEX *select_lex= &thd->lex->select_lex; SELECT_LEX *select_lex= &thd->lex->select_lex;
...@@ -433,7 +433,7 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b) ...@@ -433,7 +433,7 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b)
TRUE Error TRUE Error
*/ */
bool mysql_multi_delete_prepare(THD *thd) int mysql_multi_delete_prepare(THD *thd)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxiliary_table_list.first; TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxiliary_table_list.first;
......
...@@ -110,7 +110,7 @@ static bool write_execute_load_query_log_event(THD *thd, ...@@ -110,7 +110,7 @@ static bool write_execute_load_query_log_event(THD *thd,
TRUE - error / FALSE - success TRUE - error / FALSE - success
*/ */
bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields, List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, List<Item> &set_values,
enum enum_duplicates handle_duplicates, bool ignore, enum enum_duplicates handle_duplicates, bool ignore,
......
...@@ -2500,10 +2500,10 @@ static void reset_one_shot_variables(THD *thd) ...@@ -2500,10 +2500,10 @@ static void reset_one_shot_variables(THD *thd)
TRUE Error TRUE Error
*/ */
bool int
mysql_execute_command(THD *thd) mysql_execute_command(THD *thd)
{ {
bool res= FALSE; int res= FALSE;
bool need_start_waiting= FALSE; // have protection against global read lock bool need_start_waiting= FALSE; // have protection against global read lock
int up_result= 0; int up_result= 0;
LEX *lex= thd->lex; LEX *lex= thd->lex;
......
...@@ -1403,7 +1403,7 @@ error: ...@@ -1403,7 +1403,7 @@ error:
*/ */
static bool select_like_stmt_test(Prepared_statement *stmt, static bool select_like_stmt_test(Prepared_statement *stmt,
bool (*specific_prepare)(THD *thd), int (*specific_prepare)(THD *thd),
ulong setup_tables_done_option) ulong setup_tables_done_option)
{ {
DBUG_ENTER("select_like_stmt_test"); DBUG_ENTER("select_like_stmt_test");
...@@ -1441,7 +1441,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt, ...@@ -1441,7 +1441,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt,
static bool static bool
select_like_stmt_test_with_open_n_lock(Prepared_statement *stmt, select_like_stmt_test_with_open_n_lock(Prepared_statement *stmt,
TABLE_LIST *tables, TABLE_LIST *tables,
bool (*specific_prepare)(THD *thd), int (*specific_prepare)(THD *thd),
ulong setup_tables_done_option) ulong setup_tables_done_option)
{ {
DBUG_ENTER("select_like_stmt_test_with_open_n_lock"); DBUG_ENTER("select_like_stmt_test_with_open_n_lock");
...@@ -1630,7 +1630,7 @@ error: ...@@ -1630,7 +1630,7 @@ error:
because mysql_handle_derived uses local tables lists. because mysql_handle_derived uses local tables lists.
*/ */
static bool mysql_insert_select_prepare_tester(THD *thd) static int mysql_insert_select_prepare_tester(THD *thd)
{ {
SELECT_LEX *first_select= &thd->lex->select_lex; SELECT_LEX *first_select= &thd->lex->select_lex;
TABLE_LIST *second_table= ((TABLE_LIST*)first_select->table_list.first)-> TABLE_LIST *second_table= ((TABLE_LIST*)first_select->table_list.first)->
......
...@@ -716,7 +716,7 @@ static table_map get_table_map(List<Item> *items) ...@@ -716,7 +716,7 @@ static table_map get_table_map(List<Item> *items)
TRUE Error TRUE Error
*/ */
bool mysql_multi_update_prepare(THD *thd) int mysql_multi_update_prepare(THD *thd)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
TABLE_LIST *table_list= lex->query_tables; TABLE_LIST *table_list= lex->query_tables;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment