From: maek Date: Wed, 28 Nov 2018 08:59:27 +0000 (+0000) Subject: Add -werror option to q3map2 to make all warnings into errors X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F114%2Fhead;p=xonotic%2Fnetradiant.git Add -werror option to q3map2 to make all warnings into errors --- diff --git a/tools/quake3/common/aselib.c b/tools/quake3/common/aselib.c index 4961647e..bb3be0ea 100644 --- a/tools/quake3/common/aselib.c +++ b/tools/quake3/common/aselib.c @@ -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 ); } } diff --git a/tools/quake3/common/inout.c b/tools/quake3/common/inout.c index 58d42ed5..5ade8802 100644 --- a/tools/quake3/common/inout.c +++ b/tools/quake3/common/inout.c @@ -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 ); } diff --git a/tools/quake3/common/inout.h b/tools/quake3/common/inout.h index eae54d3b..a4d7f38b 100644 --- a/tools/quake3/common/inout.h +++ b/tools/quake3/common/inout.h @@ -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, ... ); diff --git a/tools/quake3/common/threads.c b/tools/quake3/common/threads.c index fd38ef9f..0fb78ac4 100644 --- a/tools/quake3/common/threads.c +++ b/tools/quake3/common/threads.c @@ -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 ) diff --git a/tools/quake3/q3map2/convert_bsp.c b/tools/quake3/q3map2/convert_bsp.c index b7dfeffd..9db32609 100644 --- a/tools/quake3/q3map2/convert_bsp.c +++ b/tools/quake3/q3map2/convert_bsp.c @@ -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 ] ); } } } diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c index e253720c..104213b2 100644 --- a/tools/quake3/q3map2/help.c +++ b/tools/quake3/q3map2/help.c @@ -363,7 +363,8 @@ void HelpCommon() {"-game ", "Load settings for the given game (default: quake3)"}, {"-subdivisions ", "multiplier for patch subdivisions quality"}, {"-threads ", "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)); diff --git a/tools/quake3/q3map2/image.c b/tools/quake3/q3map2/image.c index 91f4aae9..e5f97a40 100644 --- a/tools/quake3/q3map2/image.c +++ b/tools/quake3/q3map2/image.c @@ -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; } diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index bcda949b..3a82d2cb 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -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; diff --git a/tools/quake3/q3map2/vis.c b/tools/quake3/q3map2/vis.c index 98f208ab..584ed68f 100644 --- a/tools/quake3/q3map2/vis.c +++ b/tools/quake3/q3map2/vis.c @@ -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));