Commit 99343685 authored by maek's avatar maek

Add -werror option to q3map2 to make all warnings into errors

parent 7ce48a41
......@@ -882,7 +882,7 @@ static void ASE_Process( void ){
}
}
else if ( s_token[0] ) {
Sys_Printf( "Unknown token '%s'\n", s_token );
Error( "Unknown token '%s'\n", s_token );
}
}
......
......@@ -56,6 +56,7 @@ socket_t *brdcst_socket;
netmessage_t msg;
qboolean verbose = qfalse;
qboolean werror = qfalse;
// our main document
// is streamed through the network to Radiant
......@@ -316,6 +317,11 @@ void Sys_FPrintf( int flag, const char *format, ... ){
vsprintf( out_buffer, format, argptr );
va_end( argptr );
if ( ( flag == SYS_WRN ) && ( werror == qtrue ) ) {
Error( out_buffer );
return;
}
FPrintf( flag, out_buffer );
}
......
......@@ -49,6 +49,7 @@ void Broadcast_Shutdown();
#define SYS_NOXML 4 // don't send that down the XML stream
extern qboolean verbose;
extern qboolean werror;
void Sys_Printf( const char *text, ... );
void Sys_FPrintf( int flag, const char *text, ... );
......
......@@ -61,7 +61,7 @@ int GetThreadWork( void ){
f = 40 * dispatch / workcount;
if ( f < oldf ) {
Sys_Printf( "warning: progress went backwards (should never happen)\n" );
Sys_FPrintf( SYS_WRN, "WARNING: progress went backwards (should never happen)\n" );
oldf = f;
}
while ( f > oldf )
......
......@@ -183,7 +183,7 @@ int ConvertBSPMain( int argc, char **argv ){
convertGame = GetGame( argv[ i ] );
map_allowed = qfalse;
if ( convertGame == NULL ) {
Sys_Printf( "Unknown conversion format \"%s\". Defaulting to ASE.\n", argv[ i ] );
Sys_FPrintf( SYS_WRN, "Unknown conversion format \"%s\". Defaulting to ASE.\n", argv[ i ] );
}
}
}
......
......@@ -363,7 +363,8 @@ void HelpCommon()
{"-game <gamename>", "Load settings for the given game (default: quake3)"},
{"-subdivisions <F>", "multiplier for patch subdivisions quality"},
{"-threads <N>", "number of threads to use"},
{"-v", "Verbose mode"}
{"-v", "Verbose mode"},
{"-werror", "Make all warnings into errors"}
};
HelpOptions("Common Options", 0, 80, common, sizeof(common)/sizeof(struct HelpOption));
......
......@@ -255,7 +255,7 @@ static void LoadWEBPBuffer( byte *buffer, int size, byte **pixels, int *width, i
if ( !WebPGetInfo( buffer, ( size_t) size, &image_width, &image_height ) )
{
Sys_Printf( "WARNING: An error occurred reading WEBP image info\n" );
Sys_FPrintf( SYS_WRN, "WARNING: An error occurred reading WEBP image info\n" );
return;
}
......
......@@ -101,6 +101,7 @@ static void ExitQ3Map( void ){
int main( int argc, char **argv ){
int i, r;
double start, end;
extern qboolean werror;
/* we want consistent 'randomness' */
......@@ -147,6 +148,12 @@ int main( int argc, char **argv ){
argv[ i ] = NULL;
}
/* make all warnings into errors */
else if ( !strcmp( argv[ i ], "-werror" ) ) {
werror = qtrue;
argv[ i ] = NULL;
}
/* patch subdivisions */
else if ( !strcmp( argv[ i ], "-subdivisions" ) ) {
argv[ i ] = NULL;
......
......@@ -206,7 +206,7 @@ void ClusterMerge( int leafnum ){
numvis = LeafVectorFromPortalVector( portalvector, uncompressed );
// if (uncompressed[leafnum>>3] & (1<<(leafnum&7)))
// Sys_Printf ("WARNING: Leaf portals saw into leaf\n");
// Sys_FPrintf (SYS_WRN, "WARNING: Leaf portals saw into leaf\n");
// uncompressed[leafnum>>3] |= (1<<(leafnum&7));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment