| Message |
Just for the hell of it, I was going over my code with the -Wswitch-default flag and have run into one warning I cannot resolve:
mud_prog.h: In function 'void mprog_file_read(N*, char*)':
mud_prog.h:173: warning: switch missing default case
Yes, this is a c++ templated function, which looks like:
template< class N > void mprog_file_read( N *prog_target, char *f )
{
mud_prog_data *mprg = NULL;
char MUDProgfile[256];
FILE *progfile;
char letter;
snprintf( MUDProgfile, 256, "%s%s", PROG_DIR, f );
if( !( progfile = fopen( MUDProgfile, "r" ) ) )
{
bug( "%s: couldn't open mudprog file", __FUNCTION__ );
return;
}
for( ; ; )
{
letter = fread_letter( progfile );
if( letter == '|' )
break;
if( letter != '>' )
{
bug( "%s: MUDPROG char", __FUNCTION__ );
break;
}
mprg = new mud_prog_data;
mprg->type = mprog_name_to_type( fread_word( progfile ) );
switch( mprg->type )
{
default:
mprg->arglist = fread_string( progfile );
mprg->comlist = fread_string( progfile );
mprg->fileprog = true;
prog_target->progtypes.set( mprg->type );
prog_target->mudprogs.push_back( mprg );
break;
case ERROR_PROG:
bug( "%s: mudprog file type error", __FUNCTION__ );
deleteptr( mprg );
continue;
case IN_FILE_PROG:
bug( "%s: Nested file programs are not allowed.", __FUNCTION__ );
deleteptr( mprg );
continue;
}
}
FCLOSE( progfile );
return;
}
Is there any way to silence the warning properly since it's pretty obvious there *IS* a default case? |
SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center
"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984 | top |
|