diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2011-07-07 08:22:43 -0300 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2011-07-07 08:22:43 -0300 |
commit | 017281da2443fa8a4ff7db455f0a79fde37d4d68 (patch) | |
tree | 6d193c324bd54e5fd5f41e5d052f067d2f8c1fc8 /libmysqld | |
parent | 9fc51026734880056a2da6cbe0ee584fc0e707da (diff) | |
download | mariadb-git-017281da2443fa8a4ff7db455f0a79fde37d4d68.tar.gz |
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.
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/lib_sql.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index eed5e90edcd..93790082fba 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -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; |