Merge the GCC5 and build fix branches.

This fixes all warnings produced by GCC 5, except the ones related to
system functions.  Those could be fixed by including the proper headers,
but it would be better to replace the system-dependent code with
functions from mdport.c.
This commit is contained in:
John "Elwin" Edwards 2016-03-11 19:47:52 -05:00
commit 8df0a6308d
52 changed files with 416 additions and 392 deletions

View file

@ -48,7 +48,7 @@ d_slot(void)
* Find a particular slot in the table
*/
struct delayed_action *
find_slot(int (*func)())
find_slot(void (*func)())
{
register int i;
register struct delayed_action *dev;
@ -64,7 +64,7 @@ find_slot(int (*func)())
* Start a daemon, takes a function.
*/
void
start_daemon(int (*func)(), int arg, int type)
start_daemon(void (*func)(), int arg, int type)
{
register struct delayed_action *dev;
@ -80,7 +80,7 @@ start_daemon(int (*func)(), int arg, int type)
* Remove a daemon from the list
*/
void
kill_daemon(int (*func)())
kill_daemon(void (*func)())
{
register struct delayed_action *dev;
@ -118,7 +118,7 @@ do_daemons(int flag)
* Start a fuse to go off in a certain number of turns
*/
void
fuse(int (*func)(), int arg, int time, int type)
fuse(void (*func)(), int arg, int time, int type)
{
register struct delayed_action *wire;
@ -134,7 +134,7 @@ fuse(int (*func)(), int arg, int time, int type)
* Increase the time until a fuse goes off
*/
void
lengthen(int (*func)(), int xtime)
lengthen(void (*func)(), int xtime)
{
register struct delayed_action *wire;
@ -148,7 +148,7 @@ lengthen(int (*func)(), int xtime)
* Put out a fuse
*/
void
extinguish(int (*func)())
extinguish(void (*func)())
{
register struct delayed_action *wire;

View file

@ -22,8 +22,8 @@ long e_levels[] = {
};
bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl);
void hit(char *er, char *ee);
void miss(char *er, char *ee);
void hit(const char *er, const char *ee);
void miss(const char *er, const char *ee);
int str_plus(str_t str);
int add_dam(str_t str);
void thunk(THING *weap, const char *mname);
@ -446,7 +446,7 @@ roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl)
* The print name of a combatant
*/
char *
prname(char *who, bool upper)
prname(const char *who, bool upper)
{
static char tbuf[MAXSTR];
@ -470,7 +470,7 @@ prname(char *who, bool upper)
* Print a message to indicate a succesful hit
*/
void
hit(char *er, char *ee)
hit(const char *er, const char *ee)
{
register char *s = "";
@ -496,7 +496,7 @@ hit(char *er, char *ee)
* Print a message to indicate a poor swing
*/
void
miss(char *er, char *ee)
miss(const char *er, const char *ee)
{
register char *s = "";

View file

@ -345,7 +345,7 @@ aggravate(void)
* "an".
*/
char *
vowelstr(char *str)
vowelstr(const char *str)
{
switch (*str)
{

View file

@ -27,8 +27,8 @@
struct optstruct {
char *o_name; /* option name */
char *o_prompt; /* prompt for interactive entry */
int *o_opt; /* pointer to thing to set */
int (*o_putfunc)(); /* function to print value */
void *o_opt; /* pointer to thing to set */
void (*o_putfunc)(); /* function to print value */
int (*o_getfunc)(); /* function to get value interactively */
};
@ -43,23 +43,23 @@ int get_str(char *opt, WINDOW *win);
OPTION optlist[] = {
{"terse", "Terse output: ",
(int *) &terse, put_bool, get_bool },
(void *) &terse, put_bool, get_bool },
{"flush", "Flush typeahead during battle: ",
(int *) &fight_flush, put_bool, get_bool },
(void *) &fight_flush, put_bool, get_bool },
{"jump", "Show position only at end of run: ",
(int *) &jump, put_bool, get_bool },
(void *) &jump, put_bool, get_bool },
{"step", "Do inventories one line at a time: ",
(int *) &slow_invent, put_bool, get_bool },
(void *) &slow_invent, put_bool, get_bool },
{"askme", "Ask me about unidentified things: ",
(int *) &askme, put_bool, get_bool },
(void *) &askme, put_bool, get_bool },
{"passgo", "Follow turnings in passageways: ",
(int *) &passgo, put_bool, get_bool },
(void *) &passgo, put_bool, get_bool },
{"name", "Name: ",
(int *) whoami, put_str, get_str },
(void *) whoami, put_str, get_str },
{"fruit", "Fruit: ",
(int *) fruit, put_str, get_str },
(void *) fruit, put_str, get_str },
{"file", "Save file: ",
(int *) file_name, put_str, get_str }
(void *) file_name, put_str, get_str }
};
/*

View file

@ -324,7 +324,7 @@ typedef struct {
struct delayed_action {
int d_type;
int (*d_func)();
void (*d_func)();
int d_arg;
int d_time;
};
@ -484,6 +484,7 @@ void _attach(THING **list, THING *item);
void _detach(THING **list, THING *item);
void _free_list(THING **ptr);
bool add_haste(bool potion);
void add_line(char *fmt, char *arg);
void add_pack(THING *obj, bool silent);
void add_str(str_t *sp, int amt);
void addmsg(char *fmt, ...);
@ -515,9 +516,10 @@ bool dropcheck(THING *op);
void eat(void);
int encread(void *starta, int size, int inf);
void encwrite(void *starta, int size, FILE *outf);
void end_line(void);
void endmsg(void);
void enter_room(coord *cp);
void extinguish(int (*func)());
void extinguish(void (*func)());
void fall(THING *obj, bool pr);
bool fallpos(coord *pos, coord *newpos, bool pass);
void fatal(char *s);
@ -526,7 +528,7 @@ THING *find_obj(int y, int x);
void fire_bolt(coord *start, coord *dir, char *name);
void fix_stick(THING *cur);
void flush_type(void);
void fuse(int (*func)(), int arg, int time, int type);
void fuse(void (*func)(), int arg, int time, int type);
void genocide(void);
bool get_dir(void);
THING *get_item(char *purpose, int type);
@ -547,11 +549,11 @@ void invis_on(void);
bool is_current(THING *obj);
bool is_magic(THING *obj);
bool issymlink(char *sp);
void kill_daemon(int (*func)());
void kill_daemon(void (*func)());
void killed(THING *tp, bool pr);
void leave(int sig);
void leave_room(coord *cp);
void lengthen(int (*func)(), int xtime);
void lengthen(void (*func)(), int xtime);
bool lock_sc(void);
void look(bool wakeup);
void missile(int ydelta, int xdelta);
@ -601,7 +603,7 @@ void shell(void);
void show_win(WINDOW *scr, char *message);
void sight(void);
int sign(int nm);
void start_daemon(int (*func)(), int arg, int type);
void start_daemon(void (*func)(), int arg, int type);
void start_score(void);
void status(void);
bool step_ok(char ch);
@ -619,7 +621,7 @@ void unconfuse(void);
char *unctrol(char ch);
void unlock_sc(void);
void unsee(void);
char *vowelstr(char *str);
char *vowelstr(const char *str);
char *xcrypt(const char *key, const char *setting);
void w_wait_for(WINDOW *win, char ch);
void wait_for(char ch);

View file

@ -70,6 +70,9 @@
#define READSTAT ((format_error == 0) && (read_error == 0))
#define WRITESTAT (write_error == 0)
int rs_write_int(FILE *savef, int c);
int rs_read_int(int inf, int *i);
int read_error = FALSE;
int write_error = FALSE;
int format_error = FALSE;
@ -1533,7 +1536,7 @@ rs_write_thing(FILE *savef, THING *t)
return(WRITESTAT);
}
int
void
rs_fix_thing(THING *t)
{
THING *item;

View file

@ -438,11 +438,11 @@ discovered(void)
if (ch == '*')
{
print_disc(POTION);
add_line("");
add_line("", NULL);
print_disc(SCROLL);
add_line("");
add_line("", NULL);
print_disc(RING);
add_line("");
add_line("", NULL);
print_disc(STICK);
end_line();
}
@ -505,7 +505,7 @@ print_disc(char type)
num_found++;
}
if (num_found == 0)
add_line(nothing(type));
add_line(nothing(type), NULL);
}
/*
@ -533,9 +533,8 @@ set_order(short *order, int numthings)
* add_line:
* Add a line to the list of discoveries
*/
/* VARARGS1 */
add_line(fmt, arg)
char *fmt, *arg;
void
add_line(char *fmt, char *arg)
{
if (line_cnt == 0)
{
@ -545,7 +544,7 @@ char *fmt, *arg;
}
if (slow_invent)
{
if (*fmt != '\0')
if (fmt != NULL && *fmt != '\0')
msg(fmt, arg);
line_cnt++;
}
@ -575,7 +574,8 @@ char *fmt, *arg;
* end_line:
* End the list of lines
*/
end_line()
void
end_line(void)
{
if (!slow_invent)
if (line_cnt == 1 && !newpage)
@ -584,7 +584,7 @@ end_line()
msg(lastfmt, lastarg);
}
else
add_line(NULL);
add_line(NULL, NULL);
line_cnt = 0;
newpage = FALSE;
}