Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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, 9: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 27, 2011, 10:56 pm   Last edited Oct 27, 2011, 11:01 pm 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 >>