#At file:///export/home/tmp/ss156133/z/43414-pe/ based on revid:joro@stripped
3914 Staale Smedseng 2010-02-19
Bug #43414 Parenthesis (and other) warnings compiling
MySQL with gcc 4.3.2
This is the final patch in the context of this bug. This
patch will also be pushed to 5.1-bugteam (a subset of
this patch).
modified:
cmd-line-utils/readline/text.c
extra/comp_err.c
extra/yassl/src/yassl_error.cpp
sql/backup/stream_v1.c
sql/mysqld.cc
sql/repl_failsafe.cc
sql/repl_failsafe.h
sql/rpl_handler.cc
sql/rpl_utility.cc
sql/sql_partition.cc
sql/sql_select.cc
sql/sql_show.cc
sql/sql_table.cc
sql/sql_update.cc
sql/sys_vars.cc
storage/archive/azio.c
strings/dtoa.c
=== modified file 'cmd-line-utils/readline/text.c'
--- a/cmd-line-utils/readline/text.c 2009-06-29 14:56:06 +0000
+++ b/cmd-line-utils/readline/text.c 2010-02-19 17:49:56 +0000
@@ -614,7 +614,8 @@ rl_arrow_keys (count, c)
#ifdef HANDLE_MULTIBYTE
static char pending_bytes[MB_LEN_MAX];
static int pending_bytes_length = 0;
-static mbstate_t ps = {0};
+static mbstate_t ps;
+static int ps_init= 0;
#endif
/* Insert the character C at the current location, moving point forward.
@@ -632,6 +633,10 @@ _rl_insert_char (count, c)
int incoming_length = 0;
mbstate_t ps_back;
static int stored_count = 0;
+ if (!ps_init) {
+ memset(&ps, 0, sizeof(mbstate_t));
+ ps_init= 1;
+ }
#endif
if (count <= 0)
=== modified file 'extra/comp_err.c'
--- a/extra/comp_err.c 2009-12-15 06:57:50 +0000
+++ b/extra/comp_err.c 2010-02-19 17:49:56 +0000
@@ -241,7 +241,6 @@ static void clean_up(struct languages *l
static int create_header_files(struct errors *error_head);
static int create_sys_files(struct languages *lang_head,
struct errors *error_head, unsigned int row_count);
-static char *strmov(char *dst, const char *src);
int main(int argc, char *argv[])
@@ -1322,9 +1321,3 @@ static char *dup_string(const char *str,
return buf;
}
-
-static char *strmov(char *dst, const char *src)
-{
- while ((*dst++ = *src++)) ;
- return dst-1;
-}
=== modified file 'extra/yassl/src/yassl_error.cpp'
--- a/extra/yassl/src/yassl_error.cpp 2008-11-18 16:45:44 +0000
+++ b/extra/yassl/src/yassl_error.cpp 2010-02-19 17:49:56 +0000
@@ -60,7 +60,10 @@ void SetErrorString(YasslError error, ch
using namespace TaoCrypt;
const int max = MAX_ERROR_SZ; // shorthand
- switch (error) {
+ /* Cast to int to avoid gcc warnings about case label exceeding
+ max value for the enumeration (i.e., the OpenSSL and TaoCrypt
+ errors). */
+ switch ((int)error) {
// yaSSL proper errors
case range_error :
=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c 2009-10-12 09:08:34 +0000
+++ b/sql/backup/stream_v1.c 2010-02-19 17:49:56 +0000
@@ -2446,7 +2446,7 @@ int bstream_wr_time(backup_stream *s, ti
*/
int bstream_rd_time(backup_stream *s, time_t *time)
{
- unsigned long long time_8;
+ unsigned long long time_8= time_8; // assignment avoids compiler warning
int ret= bstream_rd_int8(s, &time_8);
*time= (time_t) time_8;
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-02-05 13:44:27 +0000
+++ b/sql/mysqld.cc 2010-02-19 17:49:56 +0000
@@ -3491,7 +3491,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= (char*)"MyISAM";
/*
Add server status variables to the dynamic list of
@@ -4070,6 +4070,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
@@ -4115,7 +4116,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);
}
}
=== modified file 'sql/repl_failsafe.cc'
--- a/sql/repl_failsafe.cc 2010-01-22 11:58:06 +0000
+++ b/sql/repl_failsafe.cc 2010-02-19 17:49:56 +0000
@@ -38,7 +38,7 @@
#define SLAVE_ERRMSG_SIZE (FN_REFLEN+64)
-uint rpl_status=RPL_NULL;
+RPL_STATUS rpl_status=RPL_NULL;
mysql_mutex_t LOCK_rpl_status;
mysql_cond_t COND_rpl_status;
HASH slave_list;
=== modified file 'sql/repl_failsafe.h'
--- a/sql/repl_failsafe.h 2010-01-07 05:48:46 +0000
+++ b/sql/repl_failsafe.h 2010-02-19 17:49:56 +0000
@@ -26,7 +26,7 @@ typedef enum {RPL_AUTH_MASTER=0,RPL_IDLE
RPL_LOST_SOLDIER,RPL_TROOP_SOLDIER,
RPL_RECOVERY_CAPTAIN,RPL_NULL /* inactive */,
RPL_ANY /* wild card used by change_rpl_status */ } RPL_STATUS;
-extern uint rpl_status;
+extern RPL_STATUS rpl_status;
extern mysql_mutex_t LOCK_rpl_status;
extern mysql_cond_t COND_rpl_status;
=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc 2009-12-05 02:58:48 +0000
+++ b/sql/rpl_handler.cc 2010-02-19 17:49:56 +0000
@@ -188,7 +188,8 @@ void delegates_destroy()
int Trans_delegate::after_commit(THD *thd, bool all)
{
- Trans_param param;
+ Trans_param param= {0, 0, NULL, 0};
+
bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
if (is_real_trans)
param.flags |= TRANS_IS_REAL_TRANS;
@@ -216,7 +217,8 @@ int Trans_delegate::after_commit(THD *th
int Trans_delegate::after_rollback(THD *thd, bool all)
{
- Trans_param param;
+ Trans_param param= {0, 0, NULL, 0};
+
bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
if (is_real_trans)
param.flags |= TRANS_IS_REAL_TRANS;
=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc 2010-01-13 14:34:46 +0000
+++ b/sql/rpl_utility.cc 2010-02-19 17:49:56 +0000
@@ -733,6 +733,7 @@ can_convert_field_to(Field *field,
case MYSQL_TYPE_NULL:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
+ default:
DBUG_RETURN(false);
}
DBUG_RETURN(false); // To keep GCC happy
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2010-01-24 07:18:16 +0000
+++ b/sql/sql_partition.cc 2010-02-19 17:49:56 +0000
@@ -149,12 +149,14 @@ int get_part_iter_for_interval_via_walki
uint min_len, uint max_len,
uint flags,
PARTITION_ITERATOR *part_iter);
+
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+
static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec);
static int cmp_rec_and_tuple_prune(part_column_list_val *val,
uint32 n_vals_in_rec,
bool tail_is_min);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
Convert constants in VALUES definition to the character set the
corresponding field uses.
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2010-02-16 09:41:23 +0000
+++ b/sql/sql_select.cc 2010-02-19 17:49:56 +0000
@@ -7998,8 +7998,8 @@ static void fix_semijoin_strategies_for_
{
POSITION *pos= join->best_positions + tablenr;
JOIN_TAB *s= pos->table;
- uint first;
- LINT_INIT(first); // Set by every branch except SJ_OPT_NONE which doesn't use it
+ // Set by every branch except SJ_OPT_NONE which doesn't use it
+ uint UNINIT_VAR(first);
if ((handled_tabs & s->table->map) || pos->sj_strategy == SJ_OPT_NONE)
{
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2010-02-02 17:20:45 +0000
+++ b/sql/sql_show.cc 2010-02-19 17:49:56 +0000
@@ -80,11 +80,13 @@ static TYPELIB grant_types = { sizeof(gr
static void store_key_options(THD *thd, String *packet, TABLE *table,
KEY *key_info);
+#ifdef WITH_PARTITION_STORAGE_ENGINE
static void get_cs_converted_string_value(THD *thd,
String *input_str,
String *output_str,
CHARSET_INFO *cs,
bool use_hex);
+#endif
static void
append_algorithm(TABLE_LIST *table, String *buff);
@@ -5380,7 +5382,6 @@ static void collect_partition_expr(List<
return;
}
-
/*
Convert a string in a given character set to a string which can be
used for FRM file storage in which case use_hex is TRUE and we store
@@ -7973,6 +7974,7 @@ void initialize_information_schema_acl()
&is_internal_schema_access);
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
Convert a string in character set in column character set format
to utf8 character set if possible, the utf8 character set string
@@ -8064,3 +8066,4 @@ static void get_cs_converted_string_valu
}
return;
}
+#endif
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2010-02-16 10:45:54 +0000
+++ b/sql/sql_table.cc 2010-02-19 17:49:56 +0000
@@ -1866,8 +1866,8 @@ int mysql_rm_table_part2(THD *thd, TABLE
bool dont_log_query)
{
TABLE_LIST *table;
- char path[FN_REFLEN + 1], *alias;
- uint path_length;
+ char path[FN_REFLEN + 1], *UNINIT_VAR(alias);
+ uint UNINIT_VAR(path_length);
String wrong_tables;
int error= 0;
int non_temp_tables_count= 0;
@@ -1876,9 +1876,6 @@ int mysql_rm_table_part2(THD *thd, TABLE
String built_tmp_query;
DBUG_ENTER("mysql_rm_table_part2");
- LINT_INIT(alias);
- LINT_INIT(path_length);
-
if (thd->is_current_stmt_binlog_format_row() && !dont_log_query)
{
built_query.set_charset(system_charset_info);
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2010-02-15 11:27:43 +0000
+++ b/sql/sql_update.cc 2010-02-19 17:49:56 +0000
@@ -1290,7 +1290,8 @@ bool mysql_multi_update(THD *thd,
if (using_handler)
{
- Internal_error_handler *top_handler= thd->pop_internal_handler();
+ Internal_error_handler *top_handler;
+ top_handler= thd->pop_internal_handler();
DBUG_ASSERT(&handler == top_handler);
}
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-02-09 13:16:14 +0000
+++ b/sql/sys_vars.cc 2010-02-19 17:49:56 +0000
@@ -2795,8 +2795,8 @@ static Sys_var_mybool Sys_backup_progres
static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type)
{
bool res;
- my_bool *newvalptr, newval, oldval;
- uint log_type;
+ my_bool *UNINIT_VAR(newvalptr), newval, UNINIT_VAR(oldval);
+ uint UNINIT_VAR(log_type);
if (self == &Sys_general_log || self == &Sys_log)
{
@@ -3083,17 +3083,24 @@ static bool check_locale(sys_var *self,
}
return false;
}
+
+/* Calculation of offset of MY_LOCALE::name using dummy struct to avoid
+ compiler warnings when using offsetof() macro. */
+static MY_LOCALE dummy_locale(0, NULL, NULL, false, NULL, NULL, NULL, NULL,
+ 0, 0, 0, 0, NULL, NULL);
+#define name_offset (char*)&dummy_locale.name - (char*)&dummy_locale
+
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),
+ name_offset, 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),
+ name_offset, DEFAULT(&my_default_lc_time_names),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_locale));
static Sys_var_tz Sys_time_zone(
=== modified file 'storage/archive/azio.c'
--- a/storage/archive/azio.c 2009-11-17 12:17:40 +0000
+++ b/storage/archive/azio.c 2010-02-19 17:49:56 +0000
@@ -361,10 +361,7 @@ int get_byte(s)
*/
void check_header(azio_stream *s)
{
- int method; /* method uchar */
- int flags; /* flags uchar */
uInt len;
- int c;
/* Assure two bytes in the buffer so we can peek ahead -- handle case
where first byte of header is at the end of the buffer after the last
=== modified file 'strings/dtoa.c'
--- a/strings/dtoa.c 2009-10-02 09:33:37 +0000
+++ b/strings/dtoa.c 2010-02-19 17:49:56 +0000
@@ -1327,7 +1327,7 @@ static const double tinytens[]=
static double my_strtod_int(const char *s00, char **se, int *error, char *buf, size_t buf_size)
{
int scale;
- int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
+ int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, UNINIT_VAR(c), dsign,
e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
const char *s, *s0, *s1, *end = *se;
double aadj, aadj1, adj, rv, rv0;
@@ -1341,7 +1341,6 @@ static double my_strtod_int(const char *
int rounding;
#endif
Stack_alloc alloc;
- LINT_INIT(c);
*error= 0;
Attachment: [text/bzr-bundle] bzr/staale.smedseng@sun.com-20100219174956-kk2b5q1ejfaxoytg.bundle