Login
User Name:

Password:



Register

Forgot your password?
I3 and IMC
Dec 26, 2024 3:27 am
By GatewaySysop
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
LOP 1.6
Author: Remcon
Submitted by: Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
Users Online
Google, Bing

Members: 0
Guests: 35
Stats
Files
Topics
Posts
Members
Newest Member
495
3,802
19,702
594
Merlin0760

» SmaugMuds » Codebases » SWFOTE FUSS » gcc 4.6 and set but not used ...
Forum Rules | Mark all | Recent Posts

gcc 4.6 and set but not used [-Wunused-but-set-variable] warnings:
< Newer Topic :: Older Topic > Or how I learned to hate gcc

Pages:<< prev 1 next >>
Post is unread #1 Oct 16, 2011 11:20 pm   
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

 
So, for fun times I decided to start working on a SWFOTEFUSS game. Basically porting everything I have done in swfote 2.1.5 to SWFOTEFUSS 1.4. Anyhow I did a clean build without any modifications to the code with gcc 4.6 and I'm seeing quite a few "set but not used [-Wunused-but-set-variable]" warnings.

Some of them seem to be valid as I can't find anything using the variable however some of the others I'm not exactly sure.

This is the nasty chunk o warnings:
[mudserv@cuda2 src]$ make
make -s swr
  Compiling o/imc.o....
imc.c: In function "void imclog(const char*, ...)":
imc.c:212:10: warning: variable "strtime" set but not used [-Wunused-but-set-variable]
imc.c: In function "void imcbug(const char*, ...)":
imc.c:236:10: warning: variable "strtime" set but not used [-Wunused-but-set-variable]
  Compiling o/11.o....
  Compiling o/act_comm.o....
  Compiling o/act_info.o....
act_info.c: In function "void do_slist(CHAR_DATA*, const char*)":
act_info.c:4204:15: warning: variable "lFound" set but not used [-Wunused-but-set-variable]
  Compiling o/act_move.o....
act_move.c: In function "void do_climb(CHAR_DATA*, const char*)":
act_move.c:2211:9: warning: variable "found" set but not used [-Wunused-but-set-variable]
act_move.c: In function "void do_enter(CHAR_DATA*, const char*)":
act_move.c:2241:9: warning: variable "found" set but not used [-Wunused-but-set-variable]
act_move.c: In function "void do_leave(CHAR_DATA*, const char*)":
act_move.c:2271:9: warning: variable "found" set but not used [-Wunused-but-set-variable]
  Compiling o/act_obj.o....
  Compiling o/act_wiz.o....
act_wiz.c: In function "void do_loadup(CHAR_DATA*, const char*)":
act_wiz.c:4027:9: warning: variable "loaded" set but not used [-Wunused-but-set-variable]
  Compiling o/boards.o....
  Compiling o/bounty.o....
  Compiling o/build.o....
  Compiling o/clans.o....
  Compiling o/color.o....
  Compiling o/comm.o....
comm.c: In function "int init_socket(int)":
comm.c:282:20: warning: variable "hp" set but not used [-Wunused-but-set-variable]
comm.c:283:20: warning: variable "sp" set but not used [-Wunused-but-set-variable]
comm.c: In function "void nanny_get_old_password(DESCRIPTOR_DATA*, char*)":
comm.c:1626:9: warning: variable "fOld" set but not used [-Wunused-but-set-variable]
  Compiling o/comments.o....
  Compiling o/const.o....
  Compiling o/db.o....
db.c: In function "EXTRA_DESCR_DATA* fread_fuss_exdesc(FILE*)":
db.c:5608:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_exit(FILE*, ROOM_INDEX_DATA*)":
db.c:5699:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void rprog_file_read(ROOM_INDEX_DATA*, const char*)":
db.c:5793:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_roomprog(FILE*, MPROG_DATA*, ROOM_INDEX_DATA*)":
db.c:5894:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_room(FILE*, AREA_DATA*)":
db.c:5954:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void oprog_file_read(OBJ_INDEX_DATA*, const char*)":
db.c:6172:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_objprog(FILE*, MPROG_DATA*, OBJ_INDEX_DATA*)":
db.c:6273:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_object(FILE*, AREA_DATA*)":
db.c:6333:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void mprog_file_read(MOB_INDEX_DATA*, const char*)":
db.c:6590:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_mobprog(FILE*, MPROG_DATA*, MOB_INDEX_DATA*)":
db.c:6691:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_mobile(FILE*, AREA_DATA*)":
db.c:6751:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
db.c: In function "void fread_fuss_areadata(FILE*, AREA_DATA*)":
db.c:7314:9: warning: variable "fMatch" set but not used [-Wunused-but-set-variable]
  Compiling o/dns.o....
  Compiling o/editor.o....
editor.c: In function "void editor_format_lines(CHAR_DATA*, EDITOR_DATA*)":
editor.c:549:10: warning: variable "from" set but not used [-Wunused-but-set-variable]
editor.c:549:16: warning: variable "to" set but not used [-Wunused-but-set-variable]
  Compiling o/fight.o....
fight.c: In function "ch_ret damage(CHAR_DATA*, CHAR_DATA*, int, int)":
fight.c:1267:8: warning: variable "room" set but not used [-Wunused-but-set-variable]
fight.c:1274:8: warning: variable "nocorpse" set but not used [-Wunused-but-set-variable]
fight.c: In function "void do_retreat(CHAR_DATA*, const char*)":
fight.c:3223:15: warning: variable "xit" set but not used [-Wunused-but-set-variable]
  Compiling o/finfo.o....
  Compiling o/force.o....
  Compiling o/fskills.o....
  Compiling o/functions.o....
  Compiling o/handler.o....
  Compiling o/hashstr.o....
  Compiling o/hotboot.o....
hotboot.c: In function "void read_obj_file(char*, char*)":
hotboot.c:767:12: warning: variable "found" set but not used [-Wunused-but-set-variable]
  Compiling o/hunter.o....
  Compiling o/interp.o....
  Compiling o/magic.o....
magic.c: In function "ch_ret spell_area_attack(int, int, CHAR_DATA*, void*)":
magic.c:4407:9: warning: variable "ch_died" set but not used [-Wunused-but-set-variable]
  Compiling o/makeobjs.o....
  Compiling o/marriage.o....
  Compiling o/mccp.o....
  Compiling o/misc.o....
  Compiling o/mssp.o....
  Compiling o/mud_comm.o....
mud_comm.c: In function "ch_ret simple_damage(CHAR_DATA*, CHAR_DATA*, int, int)":
mud_comm.c:1741:11: warning: variable "retcode" set but not used [-Wunused-but-set-variable]
  Compiling o/mud_prog.o....
mud_prog.c: In function "int mprog_do_command(char*, CHAR_DATA*, CHAR_DATA*, OBJ_DATA*, void*, CHAR_DATA*, bool, bool)":
mud_prog.c:1700:17: warning: variable "vnum" set but not used [-Wunused-but-set-variable]
mud_prog.c: In function "void set_supermob(OBJ_DATA*)":
mud_prog.c:2375:15: warning: variable "mob" set but not used [-Wunused-but-set-variable]
  Compiling o/newarena.o....
  Compiling o/pfiles.o....
pfiles.c: In function "void fread_pfile(FILE*, time_t, char*, bool)":
pfiles.c:200:10: warning: variable "file_ver" set but not used [-Wunused-but-set-variable]
  Compiling o/planets.o....
planets.c: In function "void do_makeplanet(CHAR_DATA*, const char*)":
planets.c:654:9: warning: variable "found" set but not used [-Wunused-but-set-variable]
  Compiling o/player.o....
  Compiling o/reset.o....
  Compiling o/save.o....
save.c: In function "void fread_char(CHAR_DATA*, FILE*, bool, bool)":
save.c:976:12: warning: variable "extra" set but not used [-Wunused-but-set-variable]
save.c: In function "void load_plr_home(CHAR_DATA*)":
save.c:2400:14: warning: variable "found" set but not used [-Wunused-but-set-variable]
  Compiling o/sha256.o....
  Compiling o/ships.o....
ships.c: In function "void do_buymobship(CHAR_DATA*, const char*)":
ships.c:119:13: warning: variable "mainclan" set but not used [-Wunused-but-set-variable]
ships.c: In function "void do_orderclanship(CHAR_DATA*, const char*)":
ships.c:399:13: warning: variable "mainclan" set but not used [-Wunused-but-set-variable]
ships.c: In function "SHIP_DATA* make_prototype_ship(int, int, CHAR_DATA*, char*)":
ships.c:872:19: warning: variable "room" set but not used [-Wunused-but-set-variable]
ships.c: In function "int load_prototype(const char*, int)":
ships.c:1567:7: warning: variable "found" set but not used [-Wunused-but-set-variable]
ships.c: In function "void add_market_ship(SHIP_DATA*)":
ships.c:2138:7: warning: variable "found" set but not used [-Wunused-but-set-variable]
  Compiling o/shops.o....
  Compiling o/skills.o....
skills.c: In function "void learn_from_failure(CHAR_DATA*, int)":
skills.c:1267:15: warning: variable "gain" set but not used [-Wunused-but-set-variable]
skills.c: In function "void do_search(CHAR_DATA*, const char*)":
skills.c:1664:16: warning: variable "room" set but not used [-Wunused-but-set-variable]
  Compiling o/slicers.o....
slicers.c: In function "void do_inquire(CHAR_DATA*, const char*)":
slicers.c:594:8: warning: variable "x" set but not used [-Wunused-but-set-variable]
slicers.c: In function "void do_disableship(CHAR_DATA*, const char*)":
slicers.c:1302:17: warning: variable "x" set but not used [-Wunused-but-set-variable]
slicers.c: In function "void do_checkprints(CHAR_DATA*, const char*)":
slicers.c:1921:8: warning: variable "x" set but not used [-Wunused-but-set-variable]
  Compiling o/space.o....
space.c: In function "void fread_ship(SHIP_DATA*, FILE*)":
space.c:2861:8: warning: variable "dummy_number" set but not used [-Wunused-but-set-variable]
space.c: In function "void damage_ship_ch_ion(SHIP_DATA*, int, int, CHAR_DATA*)":
space.c:5260:17: warning: variable "numloop" set but not used [-Wunused-but-set-variable]
space.c: In function "void do_board(CHAR_DATA*, const char*)":
space.c:5701:21: warning: variable "fromroom" set but not used [-Wunused-but-set-variable]
space.c: In function "ch_ret drive_ship(CHAR_DATA*, SHIP_DATA*, EXIT_DATA*, int)":
space.c:10122:21: warning: variable "from_room" set but not used [-Wunused-but-set-variable]
space.c:10128:16: warning: variable "distance" set but not used [-Wunused-but-set-variable]
  Compiling o/special.o....
  Compiling o/swskills.o....
swskills.c: In function "void do_torture(CHAR_DATA*, const char*)":
swskills.c:2980:40: warning: operation on "ch->char_data::alignment" may be undefined [-Wsequence-point]
  Compiling o/tables.o....
  Compiling o/track.o....
  Compiling o/tech.o....
  Compiling o/update.o....
update.c: In function "void gain_addiction(CHAR_DATA*)":
update.c:890:11: warning: variable "retcode" set but not used [-Wunused-but-set-variable]
Generating dependency file ...
Done compiling mud.
make -s dns
Done compiling DNS resolver.

If someone wants a gcc 4.6 dev environment, let me know, I'll open up my cluster for you (Fedora core15 x86 or x64 gcc4.6 ssh and freenx accessible).

Also, once I get my port finished (I want to do it while I'm still motivated damn it!) I'll see if I can't track down some and look at maybe even fixing them. I can't say when that will be, as I've quite a fair bit of code to move.

Thanks,
ayuri

Post is unread #2 Oct 28, 2011 12:56 am   Last edited Oct 28, 2011 1:01 am by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

 
Ok well here's a few to knock out that don't do anything in slicers.c
slicers.c: In function "void do_inquire(CHAR_DATA*, const char*)":
slicers.c:594:8: warning: variable "x" set but not used [-Wunused-but-set-variable]
slicers.c: In function "void do_disableship(CHAR_DATA*, const char*)":
slicers.c:1302:17: warning: variable "x" set but not used [-Wunused-but-set-variable]
slicers.c: In function "void do_checkprints(CHAR_DATA*, const char*)":
slicers.c:1921:8: warning: variable "x" set but not used [-Wunused-but-set-variable]

I think it is safe to remove all 'int x' and all 'x = number_percent( );'
in functions do_inquire, do_disableship, and do_checkprints. Nothing is actually using it.

in act_info.c function do_slist
change
int sn, i, lFound;

to
int sn, i;

Little further down, looking for the lFound remove
lFound = 0;

ayuri

Pages:<< prev 1 next >>