/* Declaration of struct foo */
typedef struct foo foo;
/* Definition of bar table */
static const foo bar[] =
{
{ 1, 2 }
};
/* Definition of struct foo */
struct foo
{
int a, b;
};
typedef struct foo foo;
struct bar
{
int a;
struct foo baz;
};
static const struct bar quux[] =
{
{ 1, { 2, 3 } }
};
int main() { int p = gargle_mouthwash(); }
/* for strdup */
#include <string.h>
/* for isascii */
#include <ctype.h>
void *alloc_mem( int sMem )
{
void *pMem;
int *magic;
int iList;
sMem += sizeof(*magic);
for ( iList = 0; iList < MAX_MEM_LIST; iList++ )
{
if ( sMem <= rgSizeList[iList] )
break;
}
if ( iList == MAX_MEM_LIST )
{
bug( "Alloc_mem: size %d too large.", sMem );
exit( 1 );
}
if ( rgFreeList[iList] == NULL )
{
pMem = alloc_perm( rgSizeList[iList] );
}
else
{
pMem = rgFreeList[iList];
rgFreeList[iList] = * ((void **) rgFreeList[iList]);
}
magic = (int *) pMem;
*magic = MAGIC_NUM;
pMem += sizeof(*magic);
return pMem;
}
char index = 128;
foo[index] = 999;
void *pMem;
int *magic;
…
pMem += sizeof(*magic);
pMem = (char*)pMem + sizeof(*magic);
So in my boredom i decided to throw the -pedantic and -ansi flags into my makefile.
WHOOOOWEEEEE there are alot of warnings and errors. Most are pretty straight forward, a couple i have some questions on.
FIRST ONE:
warning: array type has incomplete element type
This one is going off like crazy for all the extern const structs in tables.h
From what i gather this is because the compiler doesnt know what size to expect. However my clan_table is defined as clan_type clan_table[MAX_CLAN] which does set a size obviously, and it still hates that one as well. Any suggestions?
SECOND ONE:
warning: overflow in implicit constant conversion
These are coming from comm.c on the following lines.
const char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' };
const char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' };
const char go_ahead_str [] = { IAC, GA, '\0' };
No clue as to this error, and my googling wasnt very helpful.
THIRD ONE:
implicit declartion of isascii and strdup
these funtions are actually no where in my code leading me to think they are in a library that is supposed to be included or something? Never got these warning without the -pedantic and -ansii flags so im not really sure here.
FOURTH ONE:
warning: pointer of type 'void *' used in arethmetic
ummmm, huh? These are in alloc_mem and free_mem
I have also been compiling with the -Wno-char-subscripts flag. This supresses a bunch of array subscript has type 'char' errors, but also apparently was suppressing some other errors that showed up when i took it out and compiled with the -pedantic -ansi. The other ones i was able to fix, but im not sure how to go about fixing the
array subscript errors. Any ideas? or should i just go back to using the -Wno-char-subscripts flag?
Thanks for the help in advance.
_-RofAdmin-_