Skip to content

Commit e53a73e

Browse files
author
monty@mysql.com/nosik.monty.fi
committed
Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm() Added 'Opened_files' status variable to track calls to my_open() Don't give warnings when running mysql_install_db Added option --source-install to mysql_install_db I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map()
1 parent 113cd2d commit e53a73e

File tree

131 files changed

+1109
-884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1109
-884
lines changed

BUILD/compile-solaris-sparc-forte

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
# Assume Forte is installed in /opt/SUNWSpro and ld is installed in
44
# /usr/ccs/bin
55

6-
PATH=/opt/SUNWspro/bin/:/usr/ccs/bin:$PATH
6+
PATH=/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:$PATH
7+
8+
prefix="/usr/local/mysql"
9+
if test -n "$MYSQL_BUILD_PREFIX"
10+
then
11+
prefix="$MYSQL_BUILD_PREFIX"
12+
fi
713

814
make -k maintainer-clean || true
915
/bin/rm -f */.deps/*.P config.cache
@@ -12,20 +18,19 @@ path=`dirname $0`
1218
. "$path/autorun.sh"
1319

1420
# For "optimal" code for this computer add -fast to EXTRA
15-
# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT
21+
# To compile 32/64 bit, uncomment/comment EXTRA_64_BIT
1622

17-
EXTRA_64_BIT="-xarch=v9" # Remove comment to get 64 bit binaries
23+
EXTRA_64_BIT="-m64"
1824
EXTRA="-fast" # Remove comment to target current machine
1925

2026
#
2127
# The following should not need to be touched
2228
#
2329

2430
STD="-mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
25-
ASFLAGS="$EXTRA_64_BIT" \
2631
CC=cc-5.0 CFLAGS="-Xa -xstrconst $STD" \
2732
CXX=CC CXXFLAGS="-noex $STD" \
28-
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
33+
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --prefix=$PREFIX
2934

3035
make -j 4
3136
if [ $? = 0 ]

client/mysql.cc

+11-9
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ void tee_putc(int c, FILE *file);
193193
static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
194194
/* The names of functions that actually do the manipulation. */
195195
static int get_options(int argc,char **argv);
196+
extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
197+
char *argument);
196198
static int com_quit(String *str,char*),
197199
com_go(String *str,char*), com_ego(String *str,char*),
198200
com_print(String *str,char*),
@@ -343,8 +345,8 @@ static ulong start_timer(void);
343345
static void end_timer(ulong start_time,char *buff);
344346
static void mysql_end_timer(ulong start_time,char *buff);
345347
static void nice_time(double sec,char *buff,bool part_second);
346-
static sig_handler mysql_end(int sig);
347-
static sig_handler handle_sigint(int sig);
348+
extern "C" sig_handler mysql_end(int sig);
349+
extern "C" sig_handler handle_sigint(int sig);
348350

349351
int main(int argc,char *argv[])
350352
{
@@ -812,7 +814,7 @@ and you are welcome to modify and redistribute it under the GPL license\n");
812814
}
813815

814816

815-
static my_bool
817+
my_bool
816818
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
817819
char *argument)
818820
{
@@ -1403,7 +1405,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
14031405
#ifdef HAVE_READLINE
14041406

14051407
static char *new_command_generator(const char *text, int);
1406-
static char **new_mysql_completion (const char *text, int start, int end);
1408+
extern "C" char **new_mysql_completion (const char *text, int start, int end);
14071409

14081410
/*
14091411
Tell the GNU Readline library how to complete. We want to try to complete
@@ -1412,9 +1414,9 @@ static char **new_mysql_completion (const char *text, int start, int end);
14121414
*/
14131415

14141416
#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE)
1415-
char *no_completion(const char*,int)
1417+
extern "C" char *no_completion(const char*,int)
14161418
#else
1417-
char *no_completion()
1419+
extern "C" char *no_completion()
14181420
#endif
14191421
{
14201422
return 0; /* No filename completion */
@@ -1516,9 +1518,9 @@ static void initialize_readline (char *name)
15161518
array of matches, or NULL if there aren't any.
15171519
*/
15181520

1519-
static char **new_mysql_completion (const char *text,
1520-
int start __attribute__((unused)),
1521-
int end __attribute__((unused)))
1521+
char **new_mysql_completion (const char *text,
1522+
int start __attribute__((unused)),
1523+
int end __attribute__((unused)))
15221524
{
15231525
if (!status.batch && !quick)
15241526
#if defined(USE_NEW_READLINE_INTERFACE)

client/mysql_upgrade.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
451451
MYF(MY_WME))) < 0)
452452
die("Failed to create temporary file for defaults");
453453

454-
if (my_write(fd, query, strlen(query),
454+
if (my_write(fd, (uchar*) query, strlen(query),
455455
MYF(MY_FNABP | MY_WME)))
456456
die("Failed to write to '%s'", query_file_path);
457457

client/mysqladmin.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ static uint ex_var_count, max_var_length, max_val_length;
7171

7272
static void print_version(void);
7373
static void usage(void);
74+
extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
75+
char *argument);
7476
static my_bool sql_connect(MYSQL *mysql, uint wait);
7577
static int execute_commands(MYSQL *mysql,int argc, char **argv);
7678
static int drop_db(MYSQL *mysql,const char *db);
77-
static sig_handler endprog(int signal_number);
79+
extern "C" sig_handler endprog(int signal_number);
7880
static void nice_time(ulong sec,char *buff);
7981
static void print_header(MYSQL_RES *result);
8082
static void print_top(MYSQL_RES *result);
@@ -230,7 +232,7 @@ static struct my_option my_long_options[] =
230232

231233
static const char *load_default_groups[]= { "mysqladmin","client",0 };
232234

233-
static my_bool
235+
my_bool
234236
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
235237
char *argument)
236238
{
@@ -430,7 +432,7 @@ int main(int argc,char *argv[])
430432
}
431433

432434

433-
static sig_handler endprog(int signal_number __attribute__((unused)))
435+
sig_handler endprog(int signal_number __attribute__((unused)))
434436
{
435437
interrupted=1;
436438
}

client/mysqlcheck.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ static void print_result()
677677
*/
678678
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
679679
strcmp(row[3],"OK"))
680-
insert_dynamic(&tables4repair, prev);
680+
insert_dynamic(&tables4repair, (uchar*) prev);
681681
found_error=0;
682682
if (opt_silent)
683683
continue;
@@ -697,7 +697,7 @@ static void print_result()
697697
}
698698
/* add the last table to be repaired to the list */
699699
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
700-
insert_dynamic(&tables4repair, prev);
700+
insert_dynamic(&tables4repair, (uchar*) prev);
701701
mysql_free_result(res);
702702
}
703703

client/mysqldump.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -3737,9 +3737,9 @@ static int init_dumping(char *database, int init_func(char*))
37373737

37383738
/* Return 1 if we should copy the table */
37393739

3740-
my_bool include_table(uchar* hash_key, uint len)
3740+
my_bool include_table(uchar *hash_key, size_t len)
37413741
{
3742-
return !hash_search(&ignore_table, (uchar*) hash_key, len);
3742+
return !hash_search(&ignore_table, hash_key, len);
37433743
}
37443744

37453745

@@ -3767,7 +3767,7 @@ static int dump_all_tables_in_db(char *database)
37673767
for (numrows= 0 ; (table= getTableName(1)) ; )
37683768
{
37693769
char *end= strmov(afterdot, table);
3770-
if (include_table(hash_key,end - hash_key))
3770+
if (include_table((uchar*) hash_key,end - hash_key))
37713771
{
37723772
numrows++;
37733773
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
@@ -3788,7 +3788,7 @@ static int dump_all_tables_in_db(char *database)
37883788
while ((table= getTableName(0)))
37893789
{
37903790
char *end= strmov(afterdot, table);
3791-
if (include_table(hash_key, end - hash_key))
3791+
if (include_table((uchar*) hash_key, end - hash_key))
37923792
{
37933793
dump_table(table,database);
37943794
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
@@ -3860,7 +3860,7 @@ static my_bool dump_all_views_in_db(char *database)
38603860
for (numrows= 0 ; (table= getTableName(1)); )
38613861
{
38623862
char *end= strmov(afterdot, table);
3863-
if (include_table(hash_key,end - hash_key))
3863+
if (include_table((uchar*) hash_key,end - hash_key))
38643864
{
38653865
numrows++;
38663866
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
@@ -3881,7 +3881,7 @@ static my_bool dump_all_views_in_db(char *database)
38813881
while ((table= getTableName(0)))
38823882
{
38833883
char *end= strmov(afterdot, table);
3884-
if (include_table(hash_key, end - hash_key))
3884+
if (include_table((uchar*) hash_key, end - hash_key))
38853885
get_view_structure(table, database);
38863886
}
38873887
if (opt_xml)

client/mysqlslap.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ get_options(int *argc,char ***argv)
13541354
}
13551355
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
13561356
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
1357-
my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
1357+
my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
13581358
tmp_string[sbuf.st_size]= '\0';
13591359
my_close(data_file,MYF(0));
13601360
parse_delimiter(tmp_string, &create_statements, delimiter[0]);
@@ -1381,7 +1381,7 @@ get_options(int *argc,char ***argv)
13811381
}
13821382
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
13831383
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
1384-
my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
1384+
my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
13851385
tmp_string[sbuf.st_size]= '\0';
13861386
my_close(data_file,MYF(0));
13871387
if (user_supplied_query)
@@ -1412,7 +1412,7 @@ get_options(int *argc,char ***argv)
14121412
}
14131413
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
14141414
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
1415-
my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
1415+
my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
14161416
tmp_string[sbuf.st_size]= '\0';
14171417
my_close(data_file,MYF(0));
14181418
if (user_supplied_pre_statements)
@@ -1443,7 +1443,7 @@ get_options(int *argc,char ***argv)
14431443
}
14441444
tmp_string= (char *)my_malloc(sbuf.st_size + 1,
14451445
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
1446-
my_read(data_file, tmp_string, sbuf.st_size, MYF(0));
1446+
my_read(data_file, (uchar*) tmp_string, sbuf.st_size, MYF(0));
14471447
tmp_string[sbuf.st_size]= '\0';
14481448
my_close(data_file,MYF(0));
14491449
if (user_supplied_post_statements)
@@ -2076,7 +2076,7 @@ print_conclusions_csv(conclusions *con)
20762076
con->users, /* Children used */
20772077
con->avg_rows /* Queries run */
20782078
);
2079-
my_write(csv_file, buffer, (uint)strlen(buffer), MYF(0));
2079+
my_write(csv_file, (uchar*) buffer, (uint)strlen(buffer), MYF(0));
20802080
}
20812081

20822082
void

client/mysqltest.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
15141514

15151515
void var_set_query_get_value(struct st_command *command, VAR *var)
15161516
{
1517-
ulong row_no;
1517+
long row_no;
15181518
int col_no= -1;
15191519
MYSQL_RES* res;
15201520
MYSQL* mysql= &cur_con->mysql;
@@ -1591,7 +1591,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
15911591

15921592
while ((row= mysql_fetch_row(res)))
15931593
{
1594-
if (++rows == row_no)
1594+
if (++rows == (ulong) row_no)
15951595
{
15961596

15971597
DBUG_PRINT("info", ("At row %ld, column %d is '%s'",
@@ -2584,7 +2584,7 @@ void do_send_quit(struct st_command *command)
25842584
DBUG_PRINT("info", ("con->name: %s", con->name));
25852585
if (!strcmp(con->name, name))
25862586
{
2587-
simple_command(&con->mysql,COM_QUIT,NullS,0,1);
2587+
simple_command(&con->mysql,COM_QUIT,0,0,1);
25882588
DBUG_VOID_RETURN;
25892589
}
25902590
}

client/sql_string.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,8 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
805805
const uchar *from_end= (const uchar*) from+from_length;
806806
char *to_start= to;
807807
uchar *to_end= (uchar*) to+to_length;
808-
int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *,
809-
const uchar *) = from_cs->cset->mb_wc;
810-
int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)=
811-
to_cs->cset->wc_mb;
808+
my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
809+
my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
812810
uint error_count= 0;
813811

814812
while (1)

configure.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
743743
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
744744
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
745745
sys/prctl.h \
746-
sys/resource.h sys/param.h port.h)
746+
sys/resource.h sys/param.h port.h ieeefp.h)
747747

748748
AC_CHECK_HEADERS([xfs/xfs.h])
749749

@@ -757,6 +757,7 @@ AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
757757
AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
758758
AC_CHECK_LIB(nsl, gethostbyname_r))
759759
AC_CHECK_FUNC(gethostbyname_r)
760+
AC_CHECK_LIB(mtmalloc, malloc)
760761

761762
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
762763
AC_CHECK_FUNC(yp_get_default_domain, ,

extra/replace.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
309309
old_count*sizeof(*pa->flag));
310310
}
311311
pa->flag[pa->typelib.count]=0; /* Reset flag */
312-
pa->typelib.type_names[pa->typelib.count++]= pa->str+pa->length;
312+
pa->typelib.type_names[pa->typelib.count++]= (char*) (pa->str+pa->length);
313313
pa->typelib.type_names[pa->typelib.count]= NullS; /* Put end-mark */
314-
VOID(strmov(pa->str+pa->length,name));
314+
VOID(strmov((char*) pa->str + pa->length, name));
315315
pa->length+=length;
316316
DBUG_RETURN(0);
317317
} /* insert_pointer_name */
@@ -988,7 +988,8 @@ int n;
988988
return 0;
989989

990990
/* Read in new stuff. */
991-
if ((i=(int) my_read(fd, buffer + bufbytes, (uint) bufread,MYF(MY_WME))) < 0)
991+
if ((i=(int) my_read(fd, (uchar*) buffer + bufbytes,
992+
(size_t) bufread, MYF(MY_WME))) < 0)
992993
return -1;
993994

994995
/* Kludge to pretend every nonempty file ends with a newline. */
@@ -1039,7 +1040,7 @@ FILE *in,*out;
10391040
return 1;
10401041
if (!my_eof)
10411042
out_buff[length++]=save_char; /* Don't write added newline */
1042-
if (my_fwrite(out,out_buff,length,MYF(MY_WME | MY_NABP)))
1043+
if (my_fwrite(out, (uchar*) out_buff, length, MYF(MY_WME | MY_NABP)))
10431044
DBUG_RETURN(1);
10441045
}
10451046
}

include/m_ctype.h

+15-10
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
164164
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
165165
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
166166

167+
/* Some typedef to make it easy for C++ to make function pointers */
168+
typedef int (*my_charset_conv_mb_wc)(struct charset_info_st *, my_wc_t *,
169+
const uchar *, const uchar *);
170+
typedef int (*my_charset_conv_wc_mb)(struct charset_info_st *, my_wc_t,
171+
uchar *, uchar *);
172+
typedef size_t (*my_charset_conv_case)(struct charset_info_st *,
173+
char *, size_t, char *, size_t);
174+
167175

168176
/* See strings/CHARSET_INFO.txt about information on this structure */
169177
typedef struct my_charset_handler_st
@@ -182,23 +190,20 @@ typedef struct my_charset_handler_st
182190
size_t (*numcells)(struct charset_info_st *, const char *b, const char *e);
183191

184192
/* Unicode conversion */
185-
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
186-
const uchar *s,const uchar *e);
187-
int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
188-
uchar *s,uchar *e);
189-
193+
my_charset_conv_mb_wc mb_wc;
194+
my_charset_conv_wc_mb wc_mb;
195+
190196
/* CTYPE scanner */
191197
int (*ctype)(struct charset_info_st *cs, int *ctype,
192198
const uchar *s, const uchar *e);
193199

194200
/* Functions for case and sort conversion */
195201
size_t (*caseup_str)(struct charset_info_st *, char *);
196202
size_t (*casedn_str)(struct charset_info_st *, char *);
197-
size_t (*caseup)(struct charset_info_st *, char *src, size_t srclen,
198-
char *dst, size_t dstlen);
199-
size_t (*casedn)(struct charset_info_st *, char *src, size_t srclen,
200-
char *dst, size_t dstlen);
201-
203+
204+
my_charset_conv_case caseup;
205+
my_charset_conv_case casedn;
206+
202207
/* Charset dependant snprintf() */
203208
size_t (*snprintf)(struct charset_info_st *, char *to, size_t n,
204209
const char *fmt,

include/my_sys.h

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ extern CHARSET_INFO compiled_charsets[];
225225

226226
/* statistics */
227227
extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
228+
extern ulong my_file_total_opened;
228229
extern uint mysys_usage_id;
229230
extern my_bool my_init_done;
230231

0 commit comments

Comments
 (0)