diff options
author | Staale Smedseng <staale.smedseng@sun.com> | 2009-09-23 15:21:29 +0200 |
---|---|---|
committer | Staale Smedseng <staale.smedseng@sun.com> | 2009-09-23 15:21:29 +0200 |
commit | 6a89842e3642729fbac20a92a1655452f4d45487 (patch) | |
tree | be24d592bff31a5a07c28cb307d81ed4f01b925a /sql | |
parent | d49913877064778d8301c7bbd610238b3f5422cd (diff) | |
download | mariadb-git-6a89842e3642729fbac20a92a1655452f4d45487.tar.gz |
Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
Cleaning up warnings not present in 5.0.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_db_repository.cc | 2 | ||||
-rw-r--r-- | sql/ha_partition.cc | 2 | ||||
-rw-r--r-- | sql/ha_partition.h | 8 | ||||
-rw-r--r-- | sql/handler.cc | 12 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 10 | ||||
-rw-r--r-- | sql/item_xmlfunc.cc | 6 | ||||
-rw-r--r-- | sql/log_event_old.cc | 6 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/partition_info.cc | 6 | ||||
-rw-r--r-- | sql/rpl_rli.cc | 4 | ||||
-rw-r--r-- | sql/set_var.cc | 9 | ||||
-rw-r--r-- | sql/set_var.h | 3 | ||||
-rw-r--r-- | sql/slave.cc | 14 | ||||
-rw-r--r-- | sql/sql_cache.cc | 2 | ||||
-rw-r--r-- | sql/sql_connect.cc | 2 | ||||
-rw-r--r-- | sql/sql_db.cc | 6 | ||||
-rw-r--r-- | sql/sql_partition.cc | 4 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/strfunc.cc | 2 |
20 files changed, 51 insertions, 54 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 9a253d74546..8faab5023da 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -711,7 +711,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data, DBUG_ENTER("Event_db_repository::update_event"); /* None or both must be set */ - DBUG_ASSERT(new_dbname && new_name || new_dbname == new_name); + DBUG_ASSERT((new_dbname && new_name) || new_dbname == new_name); /* Reset sql_mode during data dictionary operations. */ thd->variables.sql_mode= 0; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index b27f493b80a..df5badccb1e 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1001,7 +1001,7 @@ static bool print_admin_msg(THD* thd, const char* msg_type, if (!thd->vio_ok()) { - sql_print_error(msgbuf); + sql_print_error("%s", msgbuf); return TRUE; } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 1c863d6c294..c08b1f77eca 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -773,10 +773,10 @@ public: if (m_handler_status < handler_initialized || m_handler_status >= handler_closed) DBUG_RETURN(PARTITION_ENABLED_TABLE_FLAGS); - else - DBUG_RETURN((m_file[0]->ha_table_flags() & - ~(PARTITION_DISABLED_TABLE_FLAGS)) | - (PARTITION_ENABLED_TABLE_FLAGS)); + + DBUG_RETURN((m_file[0]->ha_table_flags() & + ~(PARTITION_DISABLED_TABLE_FLAGS)) | + (PARTITION_ENABLED_TABLE_FLAGS)); } /* diff --git a/sql/handler.cc b/sql/handler.cc index a4d88e84f4c..d07ebed8ab9 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3501,14 +3501,10 @@ int handler::index_next_same(uchar *buf, const uchar *key, uint keylen) if (!(error=index_next(buf))) { my_ptrdiff_t ptrdiff= buf - table->record[0]; - uchar *save_record_0; - KEY *key_info; - KEY_PART_INFO *key_part; - KEY_PART_INFO *key_part_end; - LINT_INIT(save_record_0); - LINT_INIT(key_info); - LINT_INIT(key_part); - LINT_INIT(key_part_end); + uchar *UNINIT_VAR(save_record_0); + KEY *UNINIT_VAR(key_info); + KEY_PART_INFO *UNINIT_VAR(key_part); + KEY_PART_INFO *UNINIT_VAR(key_part_end); /* key_cmp_if_same() compares table->record[0] against 'key'. diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index cf38a294e55..b5037c08b3c 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1344,15 +1344,11 @@ bool get_interval_value(Item *args,interval_type int_type, String *str_value, INTERVAL *interval) { ulonglong array[5]; - longlong value; - const char *str; - size_t length; + longlong UNINIT_VAR(value); + const char *UNINIT_VAR(str); + size_t UNINIT_VAR(length); CHARSET_INFO *cs=str_value->charset(); - LINT_INIT(value); - LINT_INIT(str); - LINT_INIT(length); - bzero((char*) interval,sizeof(*interval)); if ((int) int_type <= INTERVAL_MICROSECOND) { diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 6320873e4d3..1eff00027f2 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -1354,7 +1354,7 @@ my_xpath_lex_scan(MY_XPATH *xpath, MY_XPATH_LEX *lex, const char *beg, const char *end) { int ch, ctype, length; - for ( ; beg < end && *beg == ' ' ; beg++); // skip leading spaces + for ( ; beg < end && *beg == ' ' ; beg++) ; // skip leading spaces lex->beg= beg; if (beg >= end) @@ -1423,7 +1423,7 @@ my_xpath_lex_scan(MY_XPATH *xpath, if (my_xdigit(ch)) // a sequence of digits { - for ( ; beg < end && my_xdigit(*beg) ; beg++); + for ( ; beg < end && my_xdigit(*beg) ; beg++) ; lex->end= beg; lex->term= MY_XPATH_LEX_DIGITS; return; @@ -1431,7 +1431,7 @@ my_xpath_lex_scan(MY_XPATH *xpath, if (ch == '"' || ch == '\'') // a string: either '...' or "..." { - for ( ; beg < end && *beg != ch ; beg++); + for ( ; beg < end && *beg != ch ; beg++) ; if (beg < end) { lex->end= beg+1; diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 68cd2bf4673..f14ebe49706 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1245,8 +1245,8 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, solution, to be able to terminate a started statement in the binary log: the extraneous events will be removed in the future. */ - DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ~0UL || - !tbl_arg && !cols && tid == ~0UL); + DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) || + (!tbl_arg && !cols && tid == ~0UL)); if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS) set_flags(NO_FOREIGN_KEY_CHECKS_F); @@ -1409,7 +1409,7 @@ int Old_rows_log_event::do_add_row_data(uchar *row_data, size_t length) #endif DBUG_ASSERT(m_rows_buf <= m_rows_cur); - DBUG_ASSERT(!m_rows_buf || m_rows_end && m_rows_buf < m_rows_end); + DBUG_ASSERT(!m_rows_buf || (m_rows_end && m_rows_buf < m_rows_end)); DBUG_ASSERT(m_rows_cur <= m_rows_end); /* The cast will always work since m_rows_cur <= m_rows_end */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5778e6ab4aa..3433b54cb29 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3719,6 +3719,7 @@ static void end_ssl() static int init_server_components() { + FILE* reopen; DBUG_ENTER("init_server_components"); /* We need to call each of these following functions to ensure that @@ -3761,7 +3762,7 @@ static int init_server_components() if (freopen(log_error_file, "a+", stdout)) #endif { - freopen(log_error_file, "a+", stderr); + reopen= freopen(log_error_file, "a+", stderr); setbuf(stderr, NULL); } } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index e2027d3571e..ba9ea0e876e 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -483,10 +483,8 @@ static bool check_engine_condition(partition_element *p_elem, { DBUG_RETURN(TRUE); } - else - { - DBUG_RETURN(FALSE); - } + + DBUG_RETURN(FALSE); } diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 18fbae9bb9d..0c6cc15297f 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -33,10 +33,10 @@ Relay_log_info::Relay_log_info() :Slave_reporting_capability("SQL"), no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), info_fd(-1), cur_log_fd(-1), save_temporary_tables(0), + cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0), #if HAVE_purify is_fake(FALSE), #endif - cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0), group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), sql_thd(0), @@ -300,7 +300,7 @@ Failed to open the existing relay log info file '%s' (errno %d)", DBUG_RETURN(error); err: - sql_print_error(msg); + sql_print_error("%s", msg); end_io_cache(&rli->info_file); if (info_fd >= 0) my_close(info_fd, MYF(0)); diff --git a/sql/set_var.cc b/sql/set_var.cc index 51c6ca219c6..cd01f6c8624 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3349,7 +3349,7 @@ int set_var_init() uint count= 0; DBUG_ENTER("set_var_init"); - for (sys_var *var=vars.first; var; var= var->next, count++); + for (sys_var *var=vars.first; var; var= var->next, count++) ; if (hash_init(&system_variable_hash, system_charset_info, count, 0, 0, (hash_get_key) get_sys_var_length, 0, HASH_UNIQUE)) @@ -4184,10 +4184,10 @@ bool sys_var_opt_readonly::update(THD *thd, set_var *var) can cause to wait on a read lock, it's required for the client application to unlock everything, and acceptable for the server to wait on all locks. */ - if (result= close_cached_tables(thd, NULL, FALSE, TRUE, TRUE)) + if ((result= close_cached_tables(thd, NULL, FALSE, TRUE, TRUE))) goto end_with_read_lock; - if (result= make_global_read_lock_block_commit(thd)) + if ((result= make_global_read_lock_block_commit(thd))) goto end_with_read_lock; /* Change the opt_readonly system variable, safe because the lock is held */ @@ -4200,6 +4200,7 @@ end_with_read_lock: } +#ifndef DBUG_OFF /* even session variable here requires SUPER, because of -#o,file */ bool sys_var_thd_dbug::check(THD *thd, set_var *var) { @@ -4226,6 +4227,8 @@ uchar *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b) DBUG_EXPLAIN(buf, sizeof(buf)); return (uchar*) thd->strdup(buf); } +#endif /* DBUG_OFF */ + #ifdef HAVE_EVENT_SCHEDULER bool sys_var_event_scheduler::check(THD *thd, set_var *var) diff --git a/sql/set_var.h b/sql/set_var.h index 10e6e0f9c35..a54591b0fd6 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -621,6 +621,7 @@ public: uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; +#ifndef DBUG_OFF class sys_var_thd_dbug :public sys_var_thd { public: @@ -634,7 +635,7 @@ public: void set_default(THD *thd, enum_var_type type) { DBUG_POP(); } uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b); }; - +#endif /* DBUG_OFF */ /* some variables that require special handling */ diff --git a/sql/slave.cc b/sql/slave.cc index 8bf126ce2c2..66cbef1029a 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1195,7 +1195,7 @@ err: if (master_res) mysql_free_result(master_res); DBUG_ASSERT(err_code != 0); - mi->report(ERROR_LEVEL, err_code, err_buff); + mi->report(ERROR_LEVEL, err_code, "%s", err_buff); DBUG_RETURN(1); } @@ -2386,7 +2386,7 @@ static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info) if (io_slave_killed(thd, mi)) { if (info && global_system_variables.log_warnings) - sql_print_information(info); + sql_print_information("%s", info); return TRUE; } return FALSE; @@ -2456,13 +2456,13 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, } else { - sql_print_information(buf); + sql_print_information("%s", buf); } } if (safe_reconnect(thd, mysql, mi, 1) || io_slave_killed(thd, mi)) { if (global_system_variables.log_warnings) - sql_print_information(messages[SLAVE_RECON_MSG_KILLED_AFTER]); + sql_print_information("%s", messages[SLAVE_RECON_MSG_KILLED_AFTER]); return 1; } return 0; @@ -2679,7 +2679,7 @@ slave. If the entry is correct, restart the server with a higher value of \ max_allowed_packet", thd->variables.max_allowed_packet); mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE, - ER(ER_NET_PACKET_TOO_LARGE)); + "%s", ER(ER_NET_PACKET_TOO_LARGE)); goto err; case ER_MASTER_FATAL_ERROR_READING_BINLOG: mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG, @@ -2690,7 +2690,7 @@ max_allowed_packet", sql_print_error("\ Stopping slave I/O thread due to out-of-memory error from master"); mi->report(ERROR_LEVEL, ER_OUT_OF_RESOURCES, - ER(ER_OUT_OF_RESOURCES)); + "%s", ER(ER_OUT_OF_RESOURCES)); goto err; } if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, @@ -3050,7 +3050,7 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, This function is reporting an error which was not reported while executing exec_relay_log_event(). */ - rli->report(ERROR_LEVEL, thd->main_da.sql_errno(), errmsg); + rli->report(ERROR_LEVEL, thd->main_da.sql_errno(), "%s", errmsg); } else if (last_errno != thd->main_da.sql_errno()) { diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index df19fd05417..a41b7bd40bb 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -383,7 +383,7 @@ static void debug_wait_for_kill(const char *info) thd= current_thd; prev_info= thd->proc_info; thd->proc_info= info; - sql_print_information(info); + sql_print_information("%s", info); while(!thd->killed) my_sleep(1000); thd->killed= THD::NOT_KILLED; diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 98574a07a4e..bb4ba2bf21b 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -985,7 +985,7 @@ static void end_connection(THD *thd) if (thd->user_connect) decrease_user_connections(thd->user_connect); - if (thd->killed || net->error && net->vio != 0) + if (thd->killed || (net->error && net->vio != 0)) { statistic_increment(aborted_threads,&LOCK_status); } diff --git a/sql/sql_db.cc b/sql/sql_db.cc index bcc8fcf54fc..c19bfba9fc1 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1450,11 +1450,11 @@ cmp_db_names(const char *db1_name, { return /* db1 is NULL and db2 is NULL */ - !db1_name && !db2_name || + (!db1_name && !db2_name) || /* db1 is not-NULL, db2 is not-NULL, db1 == db2. */ - db1_name && db2_name && - my_strcasecmp(system_charset_info, db1_name, db2_name) == 0; + (db1_name && db2_name && + my_strcasecmp(system_charset_info, db1_name, db2_name) == 0); } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 08ff2daacb9..2fb09ab7566 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -7098,9 +7098,9 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter) longlong dummy; field->store(part_iter->field_vals.cur++, ((Field_num*)field)->unsigned_flag); - if (part_iter->part_info->is_sub_partitioned() && + if ((part_iter->part_info->is_sub_partitioned() && !part_iter->part_info->get_part_partition_id(part_iter->part_info, - &part_id, &dummy) || + &part_id, &dummy)) || !part_iter->part_info->get_partition_id(part_iter->part_info, &part_id, &dummy)) return part_id; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 025c8a8248d..b411d5e3095 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -368,7 +368,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) if (report & REPORT_TO_USER) my_error(ER_UDF_NO_PATHS, MYF(0)); if (report & REPORT_TO_LOG) - sql_print_error(ER(ER_UDF_NO_PATHS)); + sql_print_error("%s", ER(ER_UDF_NO_PATHS)); DBUG_RETURN(0); } /* If this dll is already loaded just increase ref_count. */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 5c2c351652b..bb377e676e2 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3529,7 +3529,9 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, TABLE_SHARE *share= show_table->s; handler *file= show_table->file; handlerton *tmp_db_type= share->db_type(); +#ifdef WITH_PARTITION_STORAGE_ENGINE bool is_partitioned= FALSE; +#endif if (share->tmp_table == SYSTEM_TMP_TABLE) table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs); else if (share->tmp_table) diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 1fb9c1a8451..56fa4a380ea 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -147,7 +147,7 @@ static uint parse_name(TYPELIB *lib, const char **strpos, const char *end, } } else - for (; pos != end && *pos != '=' && *pos !=',' ; pos++); + for (; pos != end && *pos != '=' && *pos !=',' ; pos++) ; uint var_len= (uint) (pos - start); /* Determine which flag it is */ |