1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-24 19:42:23 +03:00

Bug#12727287: Maintainer mode compilation fails with gcc 4.6

GCC 4.6 has new -Wunused-but-set-variable flag, which is enabled
by -Wall, that causes GCC to emit a warning whenever a local variable
is assigned to, but otherwise unused (aside from its declaration).

Since the maintainer mode uses -Wall and -Werror, source code which
triggers these warnings will be rejected. That is, these warnings
become hard errors.

The solution is to fix the code which triggers these specific warnings.
In most of the cases, this is a welcome cleanup as code which triggers
this warning is probably dead anyway.
This commit is contained in:
Davi Arnaut
2011-07-07 08:22:43 -03:00
parent 9fc5102673
commit 017281da24
11 changed files with 35 additions and 48 deletions

View File

@ -1144,8 +1144,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char *sqlstate)
{
uint error;
uchar converted_err[MYSQL_ERRMSG_SIZE];
uint32 converted_err_len;
char converted_err[MYSQL_ERRMSG_SIZE];
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
@ -1160,12 +1159,12 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
ei= data->embedded_info;
ei->last_errno= sql_errno;
converted_err_len= convert_error_message((char*)converted_err,
sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
strmake(ei->info, (const char*) converted_err, sizeof(ei->info)-1);
convert_error_message(converted_err, sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
/* Converted error message is always null-terminated. */
strmake(ei->info, converted_err, sizeof(ei->info)-1);
strmov(ei->sqlstate, sqlstate);
ei->server_status= thd->server_status;
thd->cur_data= 0;