# At a local mysql-5.1-bugteam repository of davi
3503 Davi Arnaut 2010-11-10
Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
Bug#57994: Compiler flag change build error : my_redel.c
Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
Fix assorted compiler generated warnings.
@ cmd-line-utils/readline/bind.c
Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
Initialize variable to work around a false positive warning.
@ include/m_string.h
Bug#57994: Compiler flag change build error : my_redel.c
The expansion of stpcpy (in glibc) causes warnings if the
return value of strmov is not being used. Since stpcpy is
a GNU extension and the expansion ends up using a built-in
provided by GCC, use the compiler provided built-in directly
when possible.
@ include/my_compiler.h
Define a dummy MY_GNUC_PREREQ when not compiling with GCC.
@ libmysql/libmysql.c
Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
Variable might not be used in some cases. So, tag it as unused.
@ mysys/mf_keycache.c
Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
Use UNINIT_VAR to work around a false positive warning.
@ mysys/my_getncpus.c
Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
Declare variable in the same block where it is used.
@ regex/regexec.c
Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
Work around a compiler bug which causes the cast to not be enforced.
@ sql/debug_sync.cc
Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
Use UNINIT_VAR to work around a false positive warning.
@ sql/handler.cc
Use UNINIT_VAR to work around a false positive warning.
@ sql/slave.cc
Use UNINIT_VAR to work around a false positive warning.
@ sql/sql_partition.cc
Use UNINIT_VAR to work around a false positive warning.
@ storage/myisam/ft_nlq_search.c
Use UNINIT_VAR to work around a false positive warning.
@ storage/myisam/mi_create.c
Use UNINIT_VAR to work around a false positive warning.
@ storage/myisammrg/myrg_open.c
Use UNINIT_VAR to work around a false positive warning.
@ tests/mysql_client_test.c
Change function to take a pointer to const, no need for a cast.
modified:
cmd-line-utils/readline/bind.c
include/m_string.h
include/my_compiler.h
libmysql/libmysql.c
mysys/mf_keycache.c
mysys/my_getncpus.c
regex/regexec.c
sql/debug_sync.cc
sql/handler.cc
sql/slave.cc
sql/sql_partition.cc
storage/myisam/ft_nlq_search.c
storage/myisam/mi_create.c
storage/myisammrg/myrg_open.c
tests/mysql_client_test.c
=== modified file 'cmd-line-utils/readline/bind.c'
--- a/cmd-line-utils/readline/bind.c 2009-08-28 16:21:54 +0000
+++ b/cmd-line-utils/readline/bind.c 2010-11-10 21:14:47 +0000
@@ -855,7 +855,7 @@ _rl_read_init_file (filename, include_le
{
register int i;
char *buffer, *openname, *line, *end;
- size_t file_size;
+ size_t file_size = 0;
current_readline_init_file = filename;
current_readline_init_include_level = include_level;
=== modified file 'include/m_string.h'
--- a/include/m_string.h 2010-07-02 21:42:32 +0000
+++ b/include/m_string.h 2010-11-10 21:14:47 +0000
@@ -73,7 +73,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
-#if defined(HAVE_STPCPY)
+#if MY_GNUC_PREREQ(3, 4)
+#define strmov(dest, src) __builtin_stpcpy(dest, src)
+#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
=== modified file 'include/my_compiler.h'
--- a/include/my_compiler.h 2010-10-20 18:21:40 +0000
+++ b/include/my_compiler.h 2010-11-10 21:14:47 +0000
@@ -76,6 +76,11 @@
/**
Generic (compiler-independent) features.
*/
+
+#ifndef MY_GNUC_PREREQ
+# define MY_GNUC_PREREQ(maj, min) (0)
+#endif
+
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2010-09-07 07:18:01 +0000
+++ b/libmysql/libmysql.c 2010-11-10 21:14:47 +0000
@@ -131,8 +131,8 @@ int STDCALL mysql_server_init(int argc _
mysql_port = MYSQL_PORT;
#ifndef MSDOS
{
- struct servent *serv_ptr;
- char *env;
+ char *env;
+ struct servent *serv_ptr __attribute__((unused));
/*
if builder specifically requested a default port, use that
=== modified file 'mysys/mf_keycache.c'
--- a/mysys/mf_keycache.c 2009-10-16 16:40:25 +0000
+++ b/mysys/mf_keycache.c 2010-11-10 21:14:47 +0000
@@ -3917,11 +3917,11 @@ restart:
if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
BLOCK_REASSIGNED)))
{
- struct st_hash_link *next_hash_link;
- my_off_t next_diskpos;
- File next_file;
- uint next_status;
- uint hash_requests;
+ struct st_hash_link *UNINIT_VAR(next_hash_link);
+ my_off_t UNINIT_VAR(next_diskpos);
+ File UNINIT_VAR(next_file);
+ uint UNINIT_VAR(next_status);
+ uint UNINIT_VAR(hash_requests);
total_found++;
found++;
=== modified file 'mysys/my_getncpus.c'
--- a/mysys/my_getncpus.c 2006-12-27 01:23:51 +0000
+++ b/mysys/my_getncpus.c 2010-11-10 21:14:47 +0000
@@ -18,9 +18,10 @@
#include "mysys_priv.h"
#include <unistd.h>
+#ifdef _SC_NPROCESSORS_ONLN
+
static int ncpus=0;
-#ifdef _SC_NPROCESSORS_ONLN
int my_getncpus()
{
if (!ncpus)
=== modified file 'regex/regexec.c'
--- a/regex/regexec.c 2007-03-28 17:46:42 +0000
+++ b/regex/regexec.c 2010-11-10 21:14:47 +0000
@@ -117,6 +117,7 @@ size_t nmatch;
my_regmatch_t pmatch[];
int eflags;
{
+ char *pstr = (char *) str;
register struct re_guts *g = preg->re_g;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
@@ -133,7 +134,7 @@ int eflags;
if ((size_t) g->nstates <= CHAR_BIT*sizeof(states1) &&
!(eflags®_LARGE))
- return(smatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
+ return(smatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
else
- return(lmatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
+ return(lmatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
}
=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc 2010-03-19 09:06:40 +0000
+++ b/sql/debug_sync.cc 2010-11-10 21:14:47 +0000
@@ -1718,7 +1718,7 @@ static void debug_sync_execute(THD *thd,
if (action->execute)
{
- const char *old_proc_info;
+ const char *UNINIT_VAR(old_proc_info);
action->execute--;
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2010-10-18 11:24:34 +0000
+++ b/sql/handler.cc 2010-11-10 21:14:47 +0000
@@ -4141,7 +4141,7 @@ int handler::read_multi_range_first(KEY_
*/
int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
{
- int result;
+ int UNINIT_VAR(result);
DBUG_ENTER("handler::read_multi_range_next");
/* We should not be called after the last call returned EOF. */
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2010-10-16 12:03:44 +0000
+++ b/sql/slave.cc 2010-11-10 21:14:47 +0000
@@ -2321,7 +2321,7 @@ static int exec_relay_log_event(THD* thd
if (slave_trans_retries)
{
- int temp_err;
+ int UNINIT_VAR(temp_err);
if (exec_res && (temp_err= has_temporary_error(thd)))
{
const char *errmsg;
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2010-10-20 18:21:40 +0000
+++ b/sql/sql_partition.cc 2010-11-10 21:14:47 +0000
@@ -6747,8 +6747,8 @@ int get_part_iter_for_interval_via_mappi
{
DBUG_ASSERT(!is_subpart);
Field *field= part_info->part_field_array[0];
- uint32 max_endpoint_val;
- get_endpoint_func get_endpoint;
+ uint32 UNINIT_VAR(max_endpoint_val);
+ get_endpoint_func UNINIT_VAR(get_endpoint);
bool can_match_multiple_values; /* is not '=' */
uint field_len= field->pack_length_in_rec();
part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE;
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2010-06-10 20:16:43 +0000
+++ b/storage/myisam/ft_nlq_search.c 2010-11-10 21:14:47 +0000
@@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int UNINIT_VAR(subkeys), r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
=== modified file 'storage/myisam/mi_create.c'
--- a/storage/myisam/mi_create.c 2009-08-28 16:21:54 +0000
+++ b/storage/myisam/mi_create.c 2010-11-10 21:14:47 +0000
@@ -38,7 +38,7 @@ int mi_create(const char *name,uint keys
MI_CREATE_INFO *ci,uint flags)
{
register uint i,j;
- File UNINIT_VAR(dfile),file;
+ File UNINIT_VAR(dfile), UNINIT_VAR(file);
int errpos,save_errno, create_mode= O_RDWR | O_TRUNC;
myf create_flag;
uint fields,length,max_key_length,packed,pointer,real_length_diff,
@@ -73,8 +73,6 @@ int mi_create(const char *name,uint keys
{
DBUG_RETURN(my_errno=HA_WRONG_CREATE_OPTION);
}
- LINT_INIT(dfile);
- LINT_INIT(file);
errpos=0;
options=0;
bzero((uchar*) &share,sizeof(share));
=== modified file 'storage/myisammrg/myrg_open.c'
--- a/storage/myisammrg/myrg_open.c 2010-07-20 18:07:36 +0000
+++ b/storage/myisammrg/myrg_open.c 2010-11-10 21:14:47 +0000
@@ -221,7 +221,7 @@ MYRG_INFO *myrg_parent_open(const char *
int (*callback)(void*, const char*),
void *callback_param)
{
- MYRG_INFO *m_info;
+ MYRG_INFO *UNINIT_VAR(m_info);
int rc;
int errpos;
int save_errno;
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2010-11-01 18:44:43 +0000
+++ b/tests/mysql_client_test.c 2010-11-10 21:14:47 +0000
@@ -1175,7 +1175,7 @@ my_bool fetch_n(const char **query_list,
/* Separate thread query to test some cases */
-static my_bool thread_query(char *query)
+static my_bool thread_query(const char *query)
{
MYSQL *l_mysql;
my_bool error;
@@ -1197,7 +1197,7 @@ static my_bool thread_query(char *query)
goto end;
}
l_mysql->reconnect= 1;
- if (mysql_query(l_mysql, (char *)query))
+ if (mysql_query(l_mysql, query))
{
fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
error= 1;
@@ -5821,7 +5821,7 @@ static void test_prepare_alter()
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
- if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)"))
+ if (thread_query("ALTER TABLE test_prep_alter change id id_new varchar(20)"))
exit(1);
is_null= 1;
Attachment: [text/bzr-bundle] bzr/davi.arnaut@oracle.com-20101110211447-s2bh59zd3dk3527o.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (davi:3503) Bug#57992 Bug#57993Bug#57994 Bug#57995 Bug#57996 Bug#57997 Bug#58057 | Davi Arnaut | 10 Nov |