From: Pasi Kallinen Date: Mon, 6 Apr 2020 08:54:30 +0000 (+0300) Subject: Fix even more warnings X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e215f09ddb6257687cc064b1a9d18bbf0c36d17c;p=nethack Fix even more warnings --- diff --git a/include/decl.h b/include/decl.h index 0d4048dd2..615d26e4e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -631,6 +631,17 @@ struct role_filter { short mask; }; +/* read.c, create_particular() & create_particular_parse() */ +struct _create_particular_data { + int quan; + int which; + int fem; + char monclass; + boolean randmonst; + boolean maketame, makepeaceful, makehostile; + boolean sleeping, saddled, invisible, hidden; +}; + /* instance_globals holds engine state that does not need to be * persisted upon game exit. The initialization state is well defined * an set in decl.c during early early engine initialization. diff --git a/include/extern.h b/include/extern.h index fc93068b9..8d4bdb55f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2492,6 +2492,7 @@ E boolean FDECL(load_special, (const char *)); E xchar FDECL(selection_getpoint, (int, int, struct selectionvar *)); E struct selectionvar *NDECL(selection_new); E void FDECL(selection_free, (struct selectionvar *, BOOLEAN_P)); +E struct selectionvar *FDECL(selection_clone, (struct selectionvar *)); E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int)))); E void FDECL(selection_floodfill, (struct selectionvar *, int, int, BOOLEAN_P)); diff --git a/src/dungeon.c b/src/dungeon.c index fc01a44af..d588a8c8d 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -49,6 +49,7 @@ static int FDECL(possible_places, (int, boolean *, struct proto_dungeon *)); static xchar FDECL(pick_level, (boolean *, int)); static boolean FDECL(place_level, (int, struct proto_dungeon *)); +static int FDECL(get_dgn_flags, (lua_State *)); static boolean FDECL(unplaced_floater, (struct dungeon *)); static boolean FDECL(unreachable_level, (d_level *, BOOLEAN_P)); static void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *, diff --git a/src/files.c b/src/files.c index e81d3645a..1aa2f5d51 100644 --- a/src/files.c +++ b/src/files.c @@ -127,6 +127,8 @@ extern char *sounddir; #define SELECTSAVED #endif +static NHFILE *NDECL(new_nhfile); +static void FDECL(free_nhfile, (NHFILE *)); #ifdef SELECTSAVED static int FDECL(CFDECLSPEC strcmp_wrap, (const void *, const void *)); #endif @@ -163,6 +165,7 @@ static void NDECL(free_config_sections); static char *FDECL(choose_random_part, (char *, CHAR_P)); static boolean FDECL(is_config_section, (const char *)); static boolean FDECL(handle_config_section, (char *)); +static char *FDECL(find_optparam, (const char *)); static void FDECL(parseformat, (int *, char *)); #ifdef SELF_RECOVER @@ -422,7 +425,7 @@ NHFILE *nhfp; } } -NHFILE * +static NHFILE * new_nhfile() { NHFILE *nhfp = (NHFILE *)alloc(sizeof(NHFILE)); @@ -431,7 +434,7 @@ new_nhfile() return nhfp; } -void +static void free_nhfile(nhfp) NHFILE *nhfp; { @@ -2407,7 +2410,7 @@ char *buf; #define match_varname(INP, NAM, LEN) match_optname(INP, NAM, LEN, TRUE) /* find the '=' or ':' */ -char * +static char * find_optparam(buf) const char *buf; { diff --git a/src/hack.c b/src/hack.c index 34b18f1c1..49a8fef7e 100644 --- a/src/hack.c +++ b/src/hack.c @@ -16,6 +16,7 @@ static boolean FDECL(trapmove, (int, int, struct trap *)); static struct monst *FDECL(monstinroom, (struct permonst *, int)); static boolean FDECL(doorless_door, (int, int)); static void FDECL(move_update, (BOOLEAN_P)); +static int NDECL(pickup_checks); static void FDECL(maybe_smudge_engr, (int, int, int, int)); static void NDECL(domove_core); @@ -2620,7 +2621,7 @@ boolean newlev; 0 = cannot pickup, no time taken -1 = do normal pickup -2 = loot the monster */ -int +static int pickup_checks() { /* uswallow case added by GAN 01/29/87 */ diff --git a/src/mkmaze.c b/src/mkmaze.c index c7e1ab5fc..e431a6cca 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -10,6 +10,7 @@ static int FDECL(iswall, (int, int)); static int FDECL(iswall_or_stone, (int, int)); static boolean FDECL(is_solid, (int, int)); static int FDECL(extend_spine, (int[3][3], int, int, int)); +static void FDECL(wall_cleanup, (int, int, int, int)); static boolean FDECL(okay, (int, int, int)); static void FDECL(maze0xy, (coord *)); static boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, @@ -21,7 +22,11 @@ static void NDECL(unsetup_waterlevel); static void FDECL(check_ransacked, (char *)); static void FDECL(migr_booty_item, (int, const char *)); static void FDECL(migrate_orc, (struct monst *, unsigned long)); +static void FDECL(shiny_orc_stuff, (struct monst *)); static void NDECL(stolen_booty); +static boolean FDECL(maze_inbounds, (int, int)); +static void FDECL(maze_remove_deadends, (XCHAR_P)); +static void FDECL(create_maze, (int, int)); /* adjust a coordinate one step in the specified direction */ #define mz_move(X, Y, dir) \ @@ -119,7 +124,7 @@ int wall_there, dx, dy; } /* Remove walls totally surrounded by stone */ -void +static void wall_cleanup(x1, y1, x2, y2) int x1, y1, x2, y2; { @@ -635,7 +640,7 @@ unsigned long mflags; migrate_to_level(mtmp, ledger_no(&dest), MIGR_RANDOM, (coord *) 0); } -void +static void shiny_orc_stuff(mtmp) struct monst *mtmp; { @@ -782,7 +787,7 @@ stolen_booty(VOID_ARGS) #undef ORC_LEADER -boolean +static boolean maze_inbounds(x, y) int x, y; { @@ -790,7 +795,7 @@ int x, y; && x < g.x_maze_max && y < g.y_maze_max && isok(x, y)); } -void +static void maze_remove_deadends(typ) xchar typ; { @@ -837,7 +842,7 @@ xchar typ; /* Create a maze with specified corridor width and wall thickness * TODO: rewrite walkfrom so it works on temp space, not levl */ -void +static void create_maze(corrwid, wallthick) int corrwid; int wallthick; diff --git a/src/mkroom.c b/src/mkroom.c index d5196ce1a..c8e3b677e 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -20,6 +20,7 @@ static boolean FDECL(isbig, (struct mkroom *)); static struct mkroom *FDECL(pick_room, (BOOLEAN_P)); static void NDECL(mkshop), FDECL(mkzoo, (int)), NDECL(mkswamp); +static void FDECL(mk_zoo_thronemon, (int, int)); static void NDECL(mktemple); static coord *FDECL(shrine_pos, (int)); static struct permonst *NDECL(morguemon); @@ -240,7 +241,7 @@ int type; } } -void +static void mk_zoo_thronemon(x,y) int x,y; { diff --git a/src/music.c b/src/music.c index 50e1de995..86a49b85a 100644 --- a/src/music.c +++ b/src/music.c @@ -34,6 +34,7 @@ static void FDECL(charm_snakes, (int)); static void FDECL(calm_nymphs, (int)); static void FDECL(charm_monsters, (int)); static void FDECL(do_earthquake, (int)); +static const char *NDECL(generic_lvl_desc); static int FDECL(do_improvisation, (struct obj *)); /* @@ -463,7 +464,7 @@ int force; } } -const char * +static const char * generic_lvl_desc() { if (Is_astralevel(&u.uz)) diff --git a/src/nhlobj.c b/src/nhlobj.c index 1b5f7d82b..ca9567d8d 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -5,6 +5,12 @@ #include "hack.h" #include "sp_lev.h" +struct _lua_obj { + int state; /* UNUSED */ + struct obj *obj; +}; + +static struct _lua_obj *FDECL(l_obj_check, (lua_State *, int)); static int FDECL(l_obj_add_to_container, (lua_State *)); static int FDECL(l_obj_gc, (lua_State *)); static int FDECL(l_obj_getcontents, (lua_State *)); @@ -17,14 +23,9 @@ static int FDECL(l_obj_to_table, (lua_State *)); static int FDECL(l_obj_at, (lua_State *)); static int FDECL(l_obj_container, (lua_State *)); -struct _lua_obj { - int state; /* UNUSED */ - struct obj *obj; -}; - #define lobj_is_ok(lo) ((lo) && (lo)->obj && (lo)->obj->where != OBJ_LUAFREE) -struct _lua_obj * +static struct _lua_obj * l_obj_check(L, index) lua_State *L; int index; diff --git a/src/nhlsel.c b/src/nhlsel.c index 456936c84..9a10d1098 100644 --- a/src/nhlsel.c +++ b/src/nhlsel.c @@ -146,7 +146,7 @@ lua_State *L; schar x = -1, y = -1; int val = 1; int argc = lua_gettop(L); - long coord = 0L; + long crd = 0L; if (argc == 0) { (void) l_selection_new(L); @@ -172,11 +172,11 @@ lua_State *L; } if (x == -1 && y == -1) - coord = SP_COORD_PACK_RANDOM(0); + crd = SP_COORD_PACK_RANDOM(0); else - coord = SP_COORD_PACK(x,y); + crd = SP_COORD_PACK(x,y); get_location_coord(&x, &y, ANY_LOC, - g.coder ? g.coder->croom : NULL, coord); + g.coder ? g.coder->croom : NULL, crd); selection_setpoint(x, y, sel, val); lua_settop(L, 1); return 1; @@ -191,13 +191,13 @@ lua_State *L; schar x = (schar) luaL_checkinteger(L, 2); schar y = (schar) luaL_checkinteger(L, 3); int val; - long coord; + long crd; if (x == -1 && y == -1) - coord = SP_COORD_PACK_RANDOM(0); + crd = SP_COORD_PACK_RANDOM(0); else - coord = SP_COORD_PACK(x,y); - get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, coord); + crd = SP_COORD_PACK(x,y); + get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, crd); val = selection_getpoint(x, y, sel); lua_settop(L, 0); diff --git a/src/nhlua.c b/src/nhlua.c index a8ec32edb..b0addae53 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -16,6 +16,8 @@ /* lua_CFunction prototypes */ static int FDECL(nhl_test, (lua_State *)); static int FDECL(nhl_getmap, (lua_State *)); +static void FDECL(nhl_add_table_entry_bool, (lua_State *, const char *, BOOLEAN_P)); +static char FDECL(splev_typ2chr, (SCHAR_P)); static int FDECL(nhl_gettrap, (lua_State *)); static int FDECL(nhl_deltrap, (lua_State *)); #if 0 @@ -32,10 +34,14 @@ static int FDECL(nhl_ing_suffix, (lua_State *)); static int FDECL(nhl_an, (lua_State *)); static int FDECL(nhl_rn2, (lua_State *)); static int FDECL(nhl_random, (lua_State *)); +static void FDECL(init_nhc_data, (lua_State *)); +static int FDECL(nhl_push_anything, (lua_State *, int, void *)); static int FDECL(nhl_meta_u_index, (lua_State *)); static int FDECL(nhl_meta_u_newindex, (lua_State *)); static int FDECL(nhl_u_clear_inventory, (lua_State *)); static int FDECL(nhl_u_giveobj, (lua_State *)); +static void FDECL(init_u_data, (lua_State *)); +static int FDECL(nhl_set_package_path, (lua_State *, const char *)); static int FDECL(traceback_handler, (lua_State *)); void @@ -224,7 +230,7 @@ const char *s; return INVALID_TYPE; } -char +static char splev_typ2chr(typ) schar typ; { @@ -837,7 +843,7 @@ static const struct { }; /* register and init the constants table */ -void +static void init_nhc_data(L) lua_State *L; { @@ -854,7 +860,7 @@ lua_State *L; lua_setglobal(L, "nhc"); } -int +static int nhl_push_anything(L, anytype, src) lua_State *L; int anytype; @@ -960,7 +966,7 @@ static const struct luaL_Reg nhl_u_functions[] = { { NULL, NULL } }; -void +static void init_u_data(L) lua_State *L; { @@ -975,7 +981,7 @@ lua_State *L; lua_setglobal(L, "u"); } -int +static int nhl_set_package_path(L, path) lua_State *L; const char *path; diff --git a/src/options.c b/src/options.c index 63740330d..fc486fd50 100644 --- a/src/options.c +++ b/src/options.c @@ -2531,7 +2531,8 @@ char *op; return optn_ok; } -int optfn_paranoid_confirmation(optidx, req, negated, opts, op) +int +optfn_paranoid_confirmation(optidx, req, negated, opts, op) int optidx; int req; boolean negated; diff --git a/src/pager.c b/src/pager.c index 72ebd2807..ad55cdc47 100644 --- a/src/pager.c +++ b/src/pager.c @@ -32,6 +32,7 @@ static void NDECL(hmenu_dohistory); static void NDECL(hmenu_dowhatis); static void NDECL(hmenu_dowhatdoes); static void NDECL(hmenu_doextlist); +static void NDECL(domenucontrols); #ifdef PORT_HELP extern void NDECL(port_help); #endif @@ -2068,7 +2069,7 @@ hmenu_doextlist(VOID_ARGS) (void) doextlist(); } -void +static void domenucontrols(VOID_ARGS) { winid cwin = create_nhwindow(NHW_TEXT); diff --git a/src/questpgr.c b/src/questpgr.c index 5df059fd1..5b8ab5a05 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -24,6 +24,7 @@ static void FDECL(convert_line, (char *,char *)); static void FDECL(deliver_by_pline, (const char *)); static void FDECL(deliver_by_window, (const char *, int)); static boolean FDECL(skip_pager, (BOOLEAN_P)); +static boolean FDECL(com_pager_core, (const char *, const char *, BOOLEAN_P)); short quest_info(typ) @@ -431,7 +432,7 @@ boolean common UNUSED; return FALSE; } -boolean +static boolean com_pager_core(section, msgid, showerror) const char *section; const char *msgid; diff --git a/src/read.c b/src/read.c index 19aabab13..35f4cf8d4 100644 --- a/src/read.c +++ b/src/read.c @@ -18,7 +18,7 @@ static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 }; static boolean FDECL(learnscrolltyp, (SHORT_P)); static char *FDECL(erode_obj_text, (struct obj *, char *)); -static char *FDECL(apron_text, (struct obj *, char *buf)); +static char *FDECL(apron_text, (struct obj *, char *)); static void FDECL(stripspe, (struct obj *)); static void FDECL(p_glow1, (struct obj *)); static void FDECL(p_glow2, (struct obj *, const char *)); @@ -29,6 +29,8 @@ static boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P)); static void FDECL(display_stinking_cloud_positions, (int)); static void FDECL(set_lit, (int, int, genericptr)); static void NDECL(do_class_genocide); +static boolean FDECL(create_particular_parse, (char *, struct _create_particular_data *)); +static boolean FDECL(create_particular_creation, (struct _create_particular_data *)); static boolean learnscrolltyp(scrolltyp) @@ -2269,17 +2271,7 @@ struct obj *from_obj; return FALSE; } -struct _create_particular_data { - int quan; - int which; - int fem; - char monclass; - boolean randmonst; - boolean maketame, makepeaceful, makehostile; - boolean sleeping, saddled, invisible, hidden; -}; - -boolean +static boolean create_particular_parse(str, d) char *str; struct _create_particular_data *d; @@ -2376,7 +2368,7 @@ struct _create_particular_data *d; return FALSE; } -boolean +static boolean create_particular_creation(d) struct _create_particular_data *d; { diff --git a/src/rnd.c b/src/rnd.c index 0ca649fbb..2a1e92bcf 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -7,6 +7,8 @@ #ifdef USE_ISAAC64 #include "isaac64.h" +static int FDECL(whichrng, (int FDECL((*fn), (int)))); + #if 0 static isaac64_ctx rng_state; #endif diff --git a/src/sp_lev.c b/src/sp_lev.c index 7ef352f22..0fecb55d0 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -32,6 +32,7 @@ static void FDECL(flip_drawbridge_horizontal, (struct rm *)); static void FDECL(flip_drawbridge_vertical, (struct rm *)); static void FDECL(flip_visuals, (int, int, int, int, int)); static int FDECL(flip_encoded_direction_bits, (int, int)); +static void FDECL(sel_set_wall_property, (int, int, genericptr_t)); static void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, int)); static void NDECL(count_features); @@ -96,6 +97,7 @@ static void FDECL(sel_set_ter, (int, int, genericptr_t)); static void FDECL(sel_set_door, (int, int, genericptr_t)); static void FDECL(sel_set_feature, (int, int, genericptr_t)); static int FDECL(get_coord, (lua_State *, int, int *, int *)); +static void FDECL(levregion_add, (lev_region *)); static void FDECL(get_table_xy_or_coord, (lua_State *, int *, int *)); static int FDECL(get_table_region, (lua_State *, const char *, int *, int *, int *, int *, BOOLEAN_P)); @@ -103,6 +105,20 @@ static void FDECL(set_wallprop_in_selection, (lua_State *, int)); static int FDECL(floodfillchk_match_under, (int, int)); static int FDECL(floodfillchk_match_accessible, (int, int)); static void FDECL(l_push_wid_hei_table, (lua_State *, int, int)); +static int FDECL(get_table_align, (lua_State *)); +static int FDECL(get_table_monclass, (lua_State *)); +static int FDECL(find_montype, (lua_State *, const char *)); +static int FDECL(get_table_montype, (lua_State *)); +static int FDECL(get_table_int_or_random, (lua_State *, const char *, int)); +static int FDECL(get_table_buc, (lua_State *)); +static int FDECL(get_table_objclass, (lua_State *)); +static int FDECL(find_objtype, (lua_State *, const char *)); +static int FDECL(get_table_objtype, (lua_State *)); +static int FDECL(get_table_roomtype_opt, (lua_State *, const char *, int)); +static int FDECL(get_table_traptype_opt, (lua_State *, const char *, int)); +static int FDECL(get_traptype_byname, (const char *)); +static int FDECL(get_table_intarray_entry, (lua_State *, int, int)); +static struct sp_coder *NDECL(sp_level_coder_init); /* lua_CFunction prototypes */ int FDECL(lspo_altar, (lua_State *)); @@ -842,7 +858,7 @@ boolean extras; } -void +static void sel_set_wall_property(x, y, arg) int x, y; genericptr_t arg; @@ -2985,7 +3001,7 @@ lua_State *L; return 0; /* number of results */ } -int +static int get_table_align(L) lua_State *L; { @@ -3003,7 +3019,7 @@ lua_State *L; return a; } -int +static int get_table_monclass(L) lua_State *L; { @@ -3016,7 +3032,7 @@ lua_State *L; return ret; } -int +static int find_montype(L, s) lua_State *L; const char *s; @@ -3030,7 +3046,7 @@ const char *s; return NON_PM; } -int +static int get_table_montype(L) lua_State *L; { @@ -3212,7 +3228,7 @@ lua_State *L; /* the hash key 'name' is an integer or "random", or if not existent, also return rndval. */ -int +static int get_table_int_or_random(L, name, rndval) lua_State *L; const char *name; @@ -3244,7 +3260,7 @@ int rndval; return ret; } -int +static int get_table_buc(L) lua_State *L; { @@ -3258,7 +3274,7 @@ lua_State *L; return curse_state; } -int +static int get_table_objclass(L) lua_State *L; { @@ -3271,7 +3287,7 @@ lua_State *L; return ret; } -int +static int find_objtype(L, s) lua_State *L; const char *s; @@ -3311,7 +3327,7 @@ const char *s; return STRANGE_OBJECT; } -int +static int get_table_objtype(L) lua_State *L; { @@ -3695,7 +3711,7 @@ static const struct { { 0, 0 } }; -int +static int get_table_roomtype_opt(L, name, defval) lua_State *L; const char *name; @@ -3962,7 +3978,7 @@ lua_State *L; int x, y; long acoord; int shrine; - int align; + int al; create_des_coder(); @@ -3970,7 +3986,7 @@ lua_State *L; get_table_xy_or_coord(L, &x, &y); - align = get_table_align(L); + al = get_table_align(L); shrine = shrines2i[get_table_option(L, "type", "altar", shrines)]; if (x == -1 && y == -1) @@ -3979,7 +3995,7 @@ lua_State *L; acoord = SP_COORD_PACK(x, y); tmpaltar.coord = acoord; - tmpaltar.align = align; + tmpaltar.align = al; tmpaltar.shrine = shrine; create_altar(&tmpaltar, g.coder->croom); @@ -4016,7 +4032,7 @@ static const struct { { "random", -1 }, { 0, NO_TRAP } }; -int +static int get_table_traptype_opt(L, name, defval) lua_State *L; const char *name; @@ -4049,7 +4065,7 @@ int ttyp; return NULL; } -int +static int get_traptype_byname(trapname) const char *trapname; { @@ -4299,38 +4315,6 @@ struct selectionvar *s; return s; } -struct selectionvar * -selection_logical_oper(s1, s2, oper) -struct selectionvar *s1, *s2; -char oper; -{ - struct selectionvar *ov; - int x, y; - - ov = selection_new(); - if (!ov) - return NULL; - - for (x = 0; x < ov->wid; x++) - for (y = 0; y < ov->hei; y++) { - switch (oper) { - default: - case '|': - if (selection_getpoint(x, y, s1) - || selection_getpoint(x, y, s2)) - selection_setpoint(x, y, ov, 1); - break; - case '&': - if (selection_getpoint(x, y, s1) - && selection_getpoint(x, y, s2)) - selection_setpoint(x, y, ov, 1); - break; - } - } - - return ov; -} - struct selectionvar * selection_filter_mapchar(ov, typ, lit) struct selectionvar *ov; @@ -5350,7 +5334,7 @@ ensure_way_out() selection_free(ov, TRUE); } -int +static int get_table_intarray_entry(L, tableidx, entrynum) lua_State *L; int tableidx, entrynum; @@ -5433,7 +5417,7 @@ int *x, *y; return 0; } -void +static void levregion_add(lregion) lev_region *lregion; { @@ -6009,8 +5993,6 @@ int lspo_map(L) lua_State *L; { - xchar tmpxstart, tmpystart, tmpxsize, tmpysize; - /* TODO: allow passing an array of strings as map data TODO: handle if map lines aren't same length @@ -6062,11 +6044,6 @@ TODO: g.coder->croom needs to be updated return 0; } - tmpxsize = g.xsize; - tmpysize = g.ysize; - tmpxstart = g.xstart; - tmpystart = g.ystart; - g.xsize = mf->wid; g.ysize = mf->hei; @@ -6197,11 +6174,6 @@ TODO: g.coder->croom needs to be updated lua_call(L, 1, 0); } - tmpxsize = g.xsize; - tmpysize = g.ysize; - tmpxstart = g.xstart; - tmpystart = g.ystart; - return 0; } @@ -6217,7 +6189,7 @@ update_croom() g.coder->croom = NULL; } -struct sp_coder * +static struct sp_coder * sp_level_coder_init() { int tmpi;