Pages:<< prev 1 next >>
#1 Dec 26, 2011 11:57 am
Fledgling
GroupMembers
Posts11
JoinedApr 10, 2010
In Ubuntu 11.10 i'm getting this error while trying to compile swrfuss:
make -s swreality
Compiling o/imc.c
imc.c: In Function 'void imclog(const char*, ...)':
imc.c:212:10: error: variable 'strtime' set but not used [-Werror=unused-but-set-variable]
imc.c: In Function 'void imcbug(const char*, ...)':
imc.c:236:10: error: variable 'strtime' set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
make[1]: ** [o/imc.o] Error 1
make: ** [all] Error 2
then i edited the Makefile and added to W_FLAGS the following: -Wno-unused-but-set-variable
and that error stopped.
but then i get other error:
swskills.c: In Function 'void do_torture(CHAR_DATA*, const char*)':
swskills.c:2855:40: error: operation on 'ch->char_data::alignment' may be undefined [-Werror=sequence-point]
cc1plus: all warnings being treated as errors
make[1]: ** [o/swskills.o] Error 1
make: ** [all] Error 2
then, if i remove the -Werror flag from W_FLAGS, it works...
but it won't crash the mud or make it buggy later or make something stops working?
there's a better or another way to fix it?
Thanks in advance for the help...
Dekar
make -s swreality
Compiling o/imc.c
imc.c: In Function 'void imclog(const char*, ...)':
imc.c:212:10: error: variable 'strtime' set but not used [-Werror=unused-but-set-variable]
imc.c: In Function 'void imcbug(const char*, ...)':
imc.c:236:10: error: variable 'strtime' set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
make[1]: ** [o/imc.o] Error 1
make: ** [all] Error 2
then i edited the Makefile and added to W_FLAGS the following: -Wno-unused-but-set-variable
and that error stopped.
but then i get other error:
swskills.c: In Function 'void do_torture(CHAR_DATA*, const char*)':
swskills.c:2855:40: error: operation on 'ch->char_data::alignment' may be undefined [-Werror=sequence-point]
cc1plus: all warnings being treated as errors
make[1]: ** [o/swskills.o] Error 1
make: ** [all] Error 2
then, if i remove the -Werror flag from W_FLAGS, it works...
but it won't crash the mud or make it buggy later or make something stops working?
there's a better or another way to fix it?
Thanks in advance for the help...
Dekar
#3 Jan 3, 2012 9:24 am
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006
Sorry, somehow I missed this one.
Turning off -wError could have some consequences down the line, but there won't be any immediate consequences from what I can see in what you posted. I'll have to make sure my GCC is up to date at some point this week and have a look at this, but time is something I don't have a lot of atm unfortunately.
Turning off -wError could have some consequences down the line, but there won't be any immediate consequences from what I can see in what you posted. I'll have to make sure my GCC is up to date at some point this week and have a look at this, but time is something I don't have a lot of atm unfortunately.
#4 Jan 3, 2012 4:58 pm
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002
I missed this too. Since the IMC2 layer in these codebases is all the same, the problem comes from here:
It's because the strtime variable isn't actually needed for Smaug. The simple solution would be to just remove the lines that include it from the two functions the compiler complained about.
The long term solution would be for us to go over the IMC2 code and remove all the optional parts since there's about zero chance the generic snippet will ever get updated again. That's the only reason the compile-time options weren't removed to begin with.
/* Generic log function which will route the log messages to the appropriate system logging function */ void imclog( const char *format, ... ) { char buf[LGST], buf2[LGST]; char *strtime; va_list ap; va_start( ap, format ); vsnprintf( buf, LGST, format, ap ); va_end( ap ); snprintf( buf2, LGST, "IMC: %s", buf ); strtime = ctime( &imc_time ); #if defined(IMCSMAUG) log_string( buf2 ); #elif defined(IMCACK) monitor_chan( buf2, MONITOR_IMC ); #else strtime[strlen( strtime ) - 1] = '\0'; fprintf( stderr, "%s :: %s\n", strtime, buf2 ); #endif }
It's because the strtime variable isn't actually needed for Smaug. The simple solution would be to just remove the lines that include it from the two functions the compiler complained about.
The long term solution would be for us to go over the IMC2 code and remove all the optional parts since there's about zero chance the generic snippet will ever get updated again. That's the only reason the compile-time options weren't removed to begin with.
#5 Jan 9, 2012 12:43 am
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002
A followup to this. My server is running GCC 4.6.1. now and I was going through the several files of SmaugFUSS this error crops up in. It was all going well until I hit the db.c file and all the file reading functions that use the fMatch variable. All of which have a comment saying fMatch isn't used but it shuts the compiler up about it. Oh, the irony.
Thing is, changing the KEY() macro would almost certainly cause any snippets built against the codebase to fail if they're using older logic that requires the fMatch variable to exist.
Thing is, changing the KEY() macro would almost certainly cause any snippets built against the codebase to fail if they're using older logic that requires the fMatch variable to exist.
#7 May 7, 2013 8:28 am
Fledgling
GroupMembers
Posts1
JoinedMay 7, 2013
The second bit in void_torture is an easy fix.
Line 2980 of swskills.c:
This code is changing ch->alignment twice between sequence points, once through = and once through -=.
That's whats causing your undefined operation error.
The line should read:
That was the only error I needed to fix out of the box. Hope that helps
Line 2980 of swskills.c:
ch->alignment = ch>alignment -= 100;
This code is changing ch->alignment twice between sequence points, once through = and once through -=.
That's whats causing your undefined operation error.
The line should read:
ch->alignment -= 100; OR ch->alignment = ch_alignment - 100;
That was the only error I needed to fix out of the box. Hope that helps
Pages:<< prev 1 next >>