]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
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 4961647e248970ba6cc218d4168451b7ba2fc3bd..bb3be0ea50b1ce99bda7178dc50e3c0b6d9a993d 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 58d42ed58fcee12321697918c90887b45ff37607..5ade8802ca7eac347f2ebe14f81c85b36c89802c 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 eae54d3baffd26e1db521551c428d39ff8c37914..a4d7f38bf64c6c1bad6260012f13097beb62f87c 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 fd38ef9f9c70cfb13098aa7119daf99e372a3f3c..0fb78ac4bd5963251b6c9a165fd38bdc2403c1f6 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 b7dfeffd893acc77b90412a77af75800cd6d55eb..9db3260954f45cdaf5950eca08fb53ef6c67b533 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 e253720c82b56d3cdbbbdb5b8d5508e86ca216c7..104213b2724062f39389878b2e37dab4bcf83032 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 91f4aae93ada5b7eba79eb5bc989daf51c87f182..e5f97a40c1dbc8d4d71531bbc237926ef033020f 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 bcda949b477331d116323600b216b649588e45b6..3a82d2cb614ab1d157a00d9896e5e78c7025e603 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 98f208ab2149e3b2e76d12091de175451152b2c2..584ed68f87a81488be7c2d4540d299472e640b4d 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));