Skip to content

Commit 80246ac

Browse files
author
Davi Arnaut
committed
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.
1 parent 5bbe83f commit 80246ac

File tree

15 files changed

+32
-25
lines changed

15 files changed

+32
-25
lines changed

cmd-line-utils/readline/bind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ _rl_read_init_file (filename, include_level)
855855
{
856856
register int i;
857857
char *buffer, *openname, *line, *end;
858-
size_t file_size;
858+
size_t file_size = 0;
859859

860860
current_readline_init_file = filename;
861861
current_readline_init_include_level = include_level;

include/m_string.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ extern "C" {
7373
extern void *(*my_str_malloc)(size_t);
7474
extern void (*my_str_free)(void *);
7575

76-
#if defined(HAVE_STPCPY)
76+
#if MY_GNUC_PREREQ(3, 4)
77+
#define strmov(dest, src) __builtin_stpcpy(dest, src)
78+
#elif defined(HAVE_STPCPY)
7779
#define strmov(A,B) stpcpy((A),(B))
7880
#ifndef stpcpy
7981
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */

include/my_compiler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
/**
7777
Generic (compiler-independent) features.
7878
*/
79+
80+
#ifndef MY_GNUC_PREREQ
81+
# define MY_GNUC_PREREQ(maj, min) (0)
82+
#endif
83+
7984
#ifndef MY_ALIGNOF
8085
# ifdef __cplusplus
8186
template<typename type> struct my_alignof_helper { char m1; type m2; };

libmysql/libmysql.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
131131
mysql_port = MYSQL_PORT;
132132
#ifndef MSDOS
133133
{
134-
struct servent *serv_ptr;
135-
char *env;
134+
char *env;
135+
struct servent *serv_ptr __attribute__((unused));
136136

137137
/*
138138
if builder specifically requested a default port, use that

mysys/mf_keycache.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3917,11 +3917,11 @@ static int flush_key_blocks_int(KEY_CACHE *keycache,
39173917
if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
39183918
BLOCK_REASSIGNED)))
39193919
{
3920-
struct st_hash_link *next_hash_link;
3921-
my_off_t next_diskpos;
3922-
File next_file;
3923-
uint next_status;
3924-
uint hash_requests;
3920+
struct st_hash_link *UNINIT_VAR(next_hash_link);
3921+
my_off_t UNINIT_VAR(next_diskpos);
3922+
File UNINIT_VAR(next_file);
3923+
uint UNINIT_VAR(next_status);
3924+
uint UNINIT_VAR(hash_requests);
39253925

39263926
total_found++;
39273927
found++;

mysys/my_getncpus.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
#include "mysys_priv.h"
1919
#include <unistd.h>
2020

21+
#ifdef _SC_NPROCESSORS_ONLN
22+
2123
static int ncpus=0;
2224

23-
#ifdef _SC_NPROCESSORS_ONLN
2425
int my_getncpus()
2526
{
2627
if (!ncpus)

regex/regexec.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ size_t nmatch;
117117
my_regmatch_t pmatch[];
118118
int eflags;
119119
{
120+
char *pstr = (char *) str;
120121
register struct re_guts *g = preg->re_g;
121122
#ifdef REDEBUG
122123
# define GOODFLAGS(f) (f)
@@ -133,7 +134,7 @@ int eflags;
133134

134135
if ((size_t) g->nstates <= CHAR_BIT*sizeof(states1) &&
135136
!(eflags&REG_LARGE))
136-
return(smatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
137+
return(smatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
137138
else
138-
return(lmatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
139+
return(lmatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
139140
}

sql/debug_sync.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,7 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
17181718

17191719
if (action->execute)
17201720
{
1721-
const char *old_proc_info;
1721+
const char *UNINIT_VAR(old_proc_info);
17221722

17231723
action->execute--;
17241724

sql/handler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4141,7 +4141,7 @@ int handler::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
41414141
*/
41424142
int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
41434143
{
4144-
int result;
4144+
int UNINIT_VAR(result);
41454145
DBUG_ENTER("handler::read_multi_range_next");
41464146

41474147
/* We should not be called after the last call returned EOF. */

sql/slave.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
23212321

23222322
if (slave_trans_retries)
23232323
{
2324-
int temp_err;
2324+
int UNINIT_VAR(temp_err);
23252325
if (exec_res && (temp_err= has_temporary_error(thd)))
23262326
{
23272327
const char *errmsg;

sql/sql_partition.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6747,8 +6747,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
67476747
{
67486748
DBUG_ASSERT(!is_subpart);
67496749
Field *field= part_info->part_field_array[0];
6750-
uint32 max_endpoint_val;
6751-
get_endpoint_func get_endpoint;
6750+
uint32 UNINIT_VAR(max_endpoint_val);
6751+
get_endpoint_func UNINIT_VAR(get_endpoint);
67526752
bool can_match_multiple_values; /* is not '=' */
67536753
uint field_len= field->pack_length_in_rec();
67546754
part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE;

storage/myisam/ft_nlq_search.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
6363

6464
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
6565
{
66-
int subkeys, r;
66+
int UNINIT_VAR(subkeys), r;
6767
uint keylen, doc_cnt;
6868
FT_SUPERDOC sdoc, *sptr;
6969
TREE_ELEMENT *selem;

storage/myisam/mi_create.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
3838
MI_CREATE_INFO *ci,uint flags)
3939
{
4040
register uint i,j;
41-
File UNINIT_VAR(dfile),file;
41+
File UNINIT_VAR(dfile), UNINIT_VAR(file);
4242
int errpos,save_errno, create_mode= O_RDWR | O_TRUNC;
4343
myf create_flag;
4444
uint fields,length,max_key_length,packed,pointer,real_length_diff,
@@ -73,8 +73,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
7373
{
7474
DBUG_RETURN(my_errno=HA_WRONG_CREATE_OPTION);
7575
}
76-
LINT_INIT(dfile);
77-
LINT_INIT(file);
7876
errpos=0;
7977
options=0;
8078
bzero((uchar*) &share,sizeof(share));

storage/myisammrg/myrg_open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
221221
int (*callback)(void*, const char*),
222222
void *callback_param)
223223
{
224-
MYRG_INFO *m_info;
224+
MYRG_INFO *UNINIT_VAR(m_info);
225225
int rc;
226226
int errpos;
227227
int save_errno;

tests/mysql_client_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ my_bool fetch_n(const char **query_list, unsigned query_count,
11751175

11761176
/* Separate thread query to test some cases */
11771177

1178-
static my_bool thread_query(char *query)
1178+
static my_bool thread_query(const char *query)
11791179
{
11801180
MYSQL *l_mysql;
11811181
my_bool error;
@@ -1197,7 +1197,7 @@ static my_bool thread_query(char *query)
11971197
goto end;
11981198
}
11991199
l_mysql->reconnect= 1;
1200-
if (mysql_query(l_mysql, (char *)query))
1200+
if (mysql_query(l_mysql, query))
12011201
{
12021202
fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
12031203
error= 1;
@@ -5821,7 +5821,7 @@ static void test_prepare_alter()
58215821
rc= mysql_stmt_execute(stmt);
58225822
check_execute(stmt, rc);
58235823

5824-
if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)"))
5824+
if (thread_query("ALTER TABLE test_prep_alter change id id_new varchar(20)"))
58255825
exit(1);
58265826

58275827
is_null= 1;

0 commit comments

Comments
 (0)