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;

0 commit comments

Comments
 (0)