Bringing Smaug1.4a to gcc v4.2.4 standards

Posted by Rash on Thu 04 Feb 2010 06:02 PM — 3 posts, 19,090 views.

United Kingdom #0
I'm not quite sure if this should fall under Compiling or Coding but since it's compile errors and relates to gcc v4.2.4 I thought here may be best.

Here's some of the error's (There is quite a few). This set is just from comm.c


gcc -c  -g3 -Wall    -Ddwc  -DTIMEFORMAT  comm.c
comm.c: In function turn_on_mxp:
comm.c:364: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c: In function new_descriptor:
comm.c:863: warning: pointer targets in passing argument 3 of accept differ in signedness
comm.c: In function read_from_buffer:
comm.c:1206: warning: pointer targets in assignment differ in signedness
comm.c:1209: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1213: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1213: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1213: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1216: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1220: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1220: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c:1220: warning: pointer targets in passing argument 1 of strlen differ in signedness
comm.c: In function flush_buffer:
comm.c:1369: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c: In function nanny:
comm.c:1849: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:1883: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:1941: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2075: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2086: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2101: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2117: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2135: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2152: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2172: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2192: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness
comm.c:2669: warning: pointer targets in passing argument 2 of write_to_buffer differ in signedness


Here's Line 364-372. Line pointed to is in Bold.

/* set up MXP */
void turn_on_mxp (DESCRIPTOR_DATA *d)
  {
  d->mxp = TRUE;  /* turn it on now */
 	write_to_buffer( d, start_mxp_str, 0 );
	write_to_buffer( d, MXPMODE (6), 0 );   /* permanent secure mode */
  write_to_buffer( d, MXPTAG ("!-- Set up MXP elements --"), 0);
  /* Exit tag */
  write_to_buffer( d, MXPTAG ("!ELEMENT Ex '<send>' FLAG=RoomExit"), 0);
  /* Room Set Up tag ===== - Rash */
  write_to_buffer( d, MXPTAG ("!ELEMENT rl '<send>' FLAG=RoomLine"), 0);
  /* Room description tag */
  write_to_buffer( d, MXPTAG ("!ELEMENT rdesc '<p>' FLAG=RoomDesc"), 0);


Here's lines 860-871. Line pointed to is in Bold.

void new_descriptor( int new_desc )
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *dnew;
    struct sockaddr_in sock;
    struct hostent *from;
    int desc;
    int size;
    char bugbuf[MAX_STRING_LENGTH];
#ifdef WIN32
    unsigned long arg = 1;
#endif


There's two to start. Perhaps someone can link me to a document on just how much stricter gcc v4 now is or something that may help?

Thanks, Rash
USA #1
Quote:
write_to_buffer( d, start_mxp_str, 0 );

This one is easy enough, the warning is telling you that the function expects signed or unsigned char* whereas you're giving it the opposite. I.e., it takes signed and you're giving it unsigned, or it takes unsigned and you're giving it signed.

Quote:
DESCRIPTOR_DATA *dnew;

This cannot be the right line because the warning message refers to a call to 'accept' but clearly there is none here.
The line numbers can get confused if your file mixes Unix and Windows line endings; try running 'dos2unix' on the file in question to see if that fixes the line numbers.
Australia Forum Administrator #2
Are you using SmaugFUSS? That fixes a lot of bugs and compiles under gcc 4.