From bc5479101045014d2a2c9c6cc7c7d358e87a6530 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Mon, 25 Jan 2010 23:19:34 +0100 Subject: [PATCH] fixes for gcc 4.4.1 warnings --- sql/mysql_priv.h | 1 + sql/mysqld.cc | 25 +++++++++++++------------ sql/sql_select.cc | 2 +- sql/sql_yacc.yy | 4 ++-- sql/sys_vars.cc | 4 ++-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 4d5490e8219..6e35291b1c7 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -235,6 +235,7 @@ typedef struct my_locale_errmsgs extern char err_shared_dir[]; +/** @note Keep this a POD-type because we use offsetof() on it */ typedef struct my_locale_st { uint number; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 756ce7be5dc..05442643e23 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -928,8 +928,6 @@ static bool add_terminator(DYNAMIC_ARRAY *options); extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *); static void set_server_version(void); static int init_thread_environment(); -static void init_error_log_mutex(); -static void clean_up_error_log_mutex(); static char *get_relative_path(const char *path); static int fix_paths(void); void handle_connections_sockets(); @@ -1346,6 +1344,18 @@ extern "C" sig_handler print_signal_warning(int sig) #ifndef EMBEDDED_LIBRARY +static void init_error_log_mutex() +{ + mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST); +} + + +static void clean_up_error_log_mutex() +{ + mysql_mutex_destroy(&LOCK_error_log); +} + + /** cleanup all memory and end program nicely. @@ -3360,7 +3370,7 @@ static int init_common_variables() set the def_value member to 0 in my_long_options and initialize it to the correct value here. */ - default_storage_engine="MyISAM"; + default_storage_engine= const_cast("MyISAM"); /* Add server status variables to the dynamic list of @@ -3701,15 +3711,6 @@ You should consider changing lower_case_table_names to 1 or 2", return 0; } -static void init_error_log_mutex() -{ - mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST); -} - -static void clean_up_error_log_mutex() -{ - mysql_mutex_destroy(&LOCK_error_log); -} static int init_thread_environment() { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4775a297b0c..030c12de897 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4378,7 +4378,7 @@ best_access_path(JOIN *join, */ if (table->quick_keys.is_set(key) && (const_part & ((1 << table->quick_key_parts[key])-1)) == - ((1 << table->quick_key_parts[key])-1) && + (((key_part_map)1 << table->quick_key_parts[key])-1) && table->quick_n_ranges[key] == 1 && records > (double) table->quick_rows[key]) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ab128a9b701..5ee6f292204 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9218,8 +9218,8 @@ table_factor: lex->pop_context(); lex->nest_level--; } - else if ($3->select_lex && - $3->select_lex->master_unit()->is_union() || $5) + else if (($3->select_lex && + $3->select_lex->master_unit()->is_union()) || $5) { /* simple nested joins cannot have aliases or unions */ my_parse_error(ER(ER_SYNTAX_ERROR)); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index fe3114c9d50..e4dc0026128 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2956,14 +2956,14 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var) static Sys_var_struct Sys_lc_messages( "lc_messages", "Set the language used for the error messages", SESSION_VAR(lc_messages), NO_CMD_LINE, - offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_messages), + my_offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_messages), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_locale)); static Sys_var_struct Sys_lc_time_names( "lc_time_names", "Set the language used for the month " "names and the days of the week", SESSION_VAR(lc_time_names), NO_CMD_LINE, - offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_time_names), + my_offsetof(MY_LOCALE, name), DEFAULT(&my_default_lc_time_names), NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_locale)); static Sys_var_tz Sys_time_zone(