Add -werror option to q3map2 to make all warnings into errors 114/head
authormaek <maek@paranoici.org>
Wed, 28 Nov 2018 08:59:27 +0000 (08:59 +0000)
committermaek <maek@paranoici.org>
Wed, 28 Nov 2018 22:29:12 +0000 (22:29 +0000)
tools/quake3/common/aselib.c
tools/quake3/common/inout.c
tools/quake3/common/inout.h
tools/quake3/common/threads.c
tools/quake3/q3map2/convert_bsp.c
tools/quake3/q3map2/help.c
tools/quake3/q3map2/image.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/vis.c

index 4961647..bb3be0e 100644 (file)
@@ -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 );
                }
        }
 
index 58d42ed..5ade880 100644 (file)
@@ -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 );
 }
 
index eae54d3..a4d7f38 100644 (file)
@@ -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, ... );
 
index fd38ef9..0fb78ac 100644 (file)
@@ -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 )
index b7dfeff..9db3260 100644 (file)
@@ -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 ] );
                                }
                        }
                }
index e253720..104213b 100644 (file)
@@ -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));
index 91f4aae..e5f97a4 100644 (file)
@@ -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;
        }
 
index bcda949..3a82d2c 100644 (file)
@@ -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;
index 98f208a..584ed68 100644 (file)
@@ -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));