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
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -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")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
......
......@@ -157,14 +157,12 @@ typedef uint rf_SetTimer;
#define Socket_defined
#define my_socket SOCKET
#define bool BOOL
#define SIGPIPE SIGINT
#define RETQSORTTYPE void
#define QSORT_TYPE_IS_VOID
#define RETSIGTYPE void
#define SOCKET_SIZE_TYPE int
#define my_socket_defined
#define bool_defined
#define byte_defined
#define HUGE_PTR
#define STDCALL __stdcall /* Used by libmysql.dll */
......@@ -457,4 +455,4 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_CHARSET_ujis 1
#define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1
#define HAVE_BOOL 1
......@@ -980,7 +980,7 @@ typedef int myf; /* Type of MyFlags in my_funcs */
typedef char byte; /* Smallest addressable unit */
#endif
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 */
#endif
/* Macros for converting *constants* to the right type */
......
......@@ -815,7 +815,7 @@ class handler :public Sql_alloc
{ return HA_ADMIN_NOT_IMPLEMENTED; }
/* 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 disable_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,
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_delete_precheck(THD *thd, TABLE_LIST *tables);
bool mysql_multi_update_prepare(THD *thd);
bool mysql_multi_delete_prepare(THD *thd);
int mysql_multi_update_prepare(THD *thd);
int mysql_multi_delete_prepare(THD *thd);
bool mysql_insert_select_prepare(THD *thd);
bool update_precheck(THD *thd, TABLE_LIST *tables);
bool delete_precheck(THD *thd, TABLE_LIST *tables);
......@@ -691,7 +691,7 @@ struct Query_cache_query_flags
uint build_table_path(char *buff, size_t bufflen, const char *db,
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_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);
......@@ -731,7 +731,7 @@ pthread_handler_t handle_one_connection(void *arg);
pthread_handler_t handle_bootstrap(void *arg);
void end_thread(THD *thd,bool put_in_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,
char* packet, uint packet_length);
void log_slow_statement(THD *thd);
......@@ -862,7 +862,7 @@ void prepare_triggers_for_insert_stmt(THD *thd, TABLE *table,
enum_duplicates duplic);
void mark_fields_used_by_triggers_for_insert_stmt(THD *thd, TABLE *table,
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,
SQL_LIST *order, ha_rows rows, ulonglong options,
bool reset_auto_increment);
......@@ -1106,7 +1106,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
void wait_for_refresh(THD *thd);
int open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags);
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);
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,
......@@ -1177,7 +1177,7 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
bool eval_const_cond(COND *cond);
/* 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> &set_values_list,
enum enum_duplicates handle_duplicates, bool ignore,
......
......@@ -144,7 +144,7 @@ class Procedure {
virtual int send_row(List<Item> &fields)=0;
virtual bool change_columns(List<Item> &fields)=0;
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,
......
......@@ -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.
*/
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)
{
if (!initialized)
......@@ -2763,7 +2763,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
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_COLUMN> &columns, ulong rights,
bool revoke_grant)
......@@ -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.
*/
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)
{
Security_context *sctx= thd->security_ctx;
......
......@@ -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,
char *ip, char *db);
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);
bool change_password(THD *thd, const char *host, const char *user,
char *password);
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
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,
bool revoke);
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,
const char *db, const char *table);
bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
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 check_routine_level_acl(THD *thd, const char *db, const char *name,
bool is_proc);
......
......@@ -683,7 +683,7 @@ int analyse::send_row(List<Item> &field_list __attribute__((unused)))
} // analyse::send_row
bool analyse::end_of_records()
int analyse::end_of_records()
{
field_info **f = f_info;
char buff[MAX_FIELD_WIDTH];
......
......@@ -350,7 +350,7 @@ class analyse: public Procedure
virtual bool change_columns(List<Item> &fields);
virtual int send_row(List<Item> &fields);
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,
select_result *result,
List<Item> &field_list);
......
......@@ -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()
*/
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
{
uint counter;
bool need_reopen;
......
......@@ -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)
{
char path[FN_REFLEN+16];
......
......@@ -370,7 +370,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
FALSE OK
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;
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)
TRUE Error
*/
bool mysql_multi_delete_prepare(THD *thd)
int mysql_multi_delete_prepare(THD *thd)
{
LEX *lex= thd->lex;
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,
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> &set_values,
enum enum_duplicates handle_duplicates, bool ignore,
......
......@@ -2500,10 +2500,10 @@ static void reset_one_shot_variables(THD *thd)
TRUE Error
*/
bool
int
mysql_execute_command(THD *thd)
{
bool res= FALSE;
int res= FALSE;
bool need_start_waiting= FALSE; // have protection against global read lock
int up_result= 0;
LEX *lex= thd->lex;
......
......@@ -1403,7 +1403,7 @@ static bool mysql_test_set_fields(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)
{
DBUG_ENTER("select_like_stmt_test");
......@@ -1441,7 +1441,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt,
static bool
select_like_stmt_test_with_open_n_lock(Prepared_statement *stmt,
TABLE_LIST *tables,
bool (*specific_prepare)(THD *thd),
int (*specific_prepare)(THD *thd),
ulong setup_tables_done_option)
{
DBUG_ENTER("select_like_stmt_test_with_open_n_lock");
......@@ -1630,7 +1630,7 @@ static bool mysql_test_multidelete(Prepared_statement *stmt,
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;
TABLE_LIST *second_table= ((TABLE_LIST*)first_select->table_list.first)->
......
......@@ -716,7 +716,7 @@ static table_map get_table_map(List<Item> *items)
TRUE Error
*/
bool mysql_multi_update_prepare(THD *thd)
int mysql_multi_update_prepare(THD *thd)
{
LEX *lex= thd->lex;
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