Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
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
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yahoo!

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » LoP Codebase » rawrghuuuuuuuuuugh... (Bugs a...
Forum Rules | Mark all | Recent Posts

rawrghuuuuuuuuuugh... (Bugs are the Devil)
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 19, 2009, 1:12 am   Last edited Apr 19, 2009, 1:18 am by Sanus Compleo
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

I'm tired. Life is hectic. All I want to do is relax in an environment where I have full control over it's most inner workings, so once again I wish to have a world. All seemed well until I actually began to compile my very favorite source, and I got four nasty bugs which have stopped my progress. I switched over from Windows to Ubuntu Intrepid Ibex (8.10) for good not too long ago, and after a far too long hiatus, I'm back here again, asking for help. The bug messages are as below.

make -s lop
  Compiling o/imc.o....
cc1plus: warnings being treated as errors
imc.c: In function ‘bool imc_startup_network(bool)’:
imc.c:4848: error: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result
make[1]: *** [o/imc.o] Error 1
  Compiling o/db.o....
cc1plus: warnings being treated as errors
db.c: In function ‘void load_buildlist()’:
db.c:5290: error: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result
make[1]: *** [o/db.o] Error 1
  Compiling o/handler.o....
cc1plus: warnings being treated as errors
handler.c: In function ‘bool get_big_num(char*, int*, int*)’:
handler.c:4115: error: the address of ‘arg’ will always evaluate as ‘true’
make[1]: *** [o/handler.o] Error 1
  Compiling o/hotboot.o....
cc1plus: warnings being treated as errors
hotboot.c: In function ‘void hotboot_recover()’:
hotboot.c:204: error: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result
make[1]: *** [o/hotboot.o] Error 1
make[1]: Target `lop' not remade because of errors.
make: *** [all] Error 2


Please help me out, it would be greatly appreciated as always.

G++ 4.3.2, not sure what else, actually.
       
Post is unread #2 Apr 19, 2009, 7:17 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

For the one in handler.c
change
   if( !arg )

to this
   if( arg == NULL || arg[0] == '\0' )


I'll see if I can get those errors by updating the gcc for cygwin so I can figure them out. My guess is that it's complaining about not using the int that they return.
       
Post is unread #3 Apr 19, 2009, 7:22 am
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

Remcom, you be awesome as always.
       
Post is unread #4 Apr 19, 2009, 8:08 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Well updated my cygwin to g++-4 ( GCC ) 4.3.2 20080827 (beta) 2 and still not getting those complaints on compile in cygwin.

Try adding in an int fscannum at the start of the functions it is complaining about and see if changing those lines to be like
fscannum = fscanf
and
fscannum = fgets
not sure if that's what its complaining about, but it's worth a try at least :)
       
Post is unread #5 Apr 19, 2009, 8:44 am   Last edited Apr 19, 2009, 8:53 am by Sanus Compleo
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

It doesn't make sense though, the output is used directly under it... Maybe I don't have the proper libs or something?
       
Post is unread #6 Apr 19, 2009, 7:32 pm   Last edited Apr 19, 2009, 8:51 pm by Sanus Compleo
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

Sorry, I passed out soon after that last post, didn't get it fixed, still don't know what's going on, and I couldn't fix it at all :<

EDIT: I also tried to compile Smaugfuss 1.9, and the section in imc.c is veeeeery similar, but it compiled cleanly... D'huh?

EDIT2: Any way to just have the compiler compile and ignore these warnings? After all, it doesn't look like it would cause a crash or anything.

EDIT3: Removed -Werror flag on the Makefile, though I'd still like some way to resolve this sometime in the future.
       
Post is unread #7 Apr 19, 2009, 9:09 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

You must have missed what I said to do :)
It isn't that the output is missed etc... it's that on your server fscanf and fgets both return an int and have an attribute to give a warning message if you don't make use of the int they return.
So try changing
int fscannum;

fscannum = fscanf
fscannum = fgets

for example of course basically just add an int somewhere above the fscanf and fgets lines and then set the new number to equal what fscanf and fgets return. At least I think that is the problem and since no way to test it, it's hard to know till you give it a try.
       
Post is unread #8 Apr 19, 2009, 9:16 pm
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

I did that with the fscanfs, but it didn't work for the fgets, it said something about an invalid conversion.
       
Post is unread #9 Apr 19, 2009, 9:36 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

hmm well thats my fault it looks like for fgets it returns a char * so do some kind of char * to equal fgets (no clue what it actually returns maybe someone who has some knowledge of it can let us know) (I'll look tomorrow sometime if no one has let us know before then).
       
Post is unread #10 Apr 20, 2009, 3:20 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005


Returned Value

If successful, fgets() returns a pointer to the string buffer.

If unsuccessful, fgets() returns NULL to indicate failure.

If n is less than or equal to 0, it indicates a domain error; errno is set to EDOM to indicate the cause of the failure.

When n equals 1, it indicates a valid result. It means that the string buffer has only room for the NULL terminator; nothing is physically read from the file. (Such an operation is still considered a read operation, so it cannot immediately follow a write operation unless there is an intervening flush or reposition operation first.)

If n is greater than 1, fgets() will only fail if an I/O error occurs or if EOF is reached, and no data is read from the file.

The ferror() and feof() functions are used to distinguish between a read error and an EOF. Note that EOF is only reached when an attempt is made to read “past” the last byte of data. Reading up to and including the last byte of data does not turn on the EOF indicator.

If EOF is reached after data has already been read into the string buffer, fgets() returns a pointer to the string buffer to indicate success. A subsequent call would result in NULL being returned since EOF would be reached without any data being read.

Example

CELEBF18

/* CELEBF18

This example gets a line of input from a data stream.
It reads no more than MAX_LEN - 1 characters, or up
to a new-line character, from the stream.

*/
#include <stdio.h>
#define MAX_LEN 100

int main(void)
{
FILE *stream;
char line[MAX_LEN], *result;

stream = fopen("myfile.dat","r";);

if ((result = fgets(line,MAX_LEN,stream)) != NULL)
printf("The string is %s\n", result);

if (fclose(stream))
printf("fclose error\n";);
}

So yea use a char *result type thing and set it to what fgets returns.
       
Pages:<< prev 1 next >>