From 81ab1fe02f887ccf43e1755ed44811ff4fd693c3 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 6 Aug 2017 19:24:03 +1000 Subject: [PATCH 1/1] Remove -Wno-unused-but-set-variable --- CMakeLists.txt | 4 ++-- libs/generic/callback.cpp | 24 ++++++++++++------------ libs/profile/profile.cpp | 2 +- libs/splines/splines.cpp | 12 ++++++------ libs/splines/util_str.cpp | 2 ++ libs/xml/xmlparser.h | 1 + plugins/entity/light.cpp | 4 ++-- plugins/image/jpeg.cpp | 1 + plugins/imagehl/hlw.cpp | 3 +-- plugins/imagehl/mip.cpp | 3 +-- plugins/imagehl/sprite.cpp | 4 +--- radiant/brush_primit.cpp | 2 -- radiant/camwindow.cpp | 13 ++----------- tools/quake3/common/bspfile.c | 5 +---- tools/quake3/q3data/images.c | 2 -- tools/quake3/q3data/models.c | 8 +++----- tools/quake3/q3map2/surface.c | 3 ++- 17 files changed, 38 insertions(+), 55 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa7f76a0..f1c9555a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,12 +87,12 @@ addflags("-Wall") addflags("-Wextra") addflags("-pedantic") +addflags_c("-Wno-deprecated-declarations") # vfs.c: g_strdown + addflags("-Wno-sign-compare") addflags("-Wno-unused-function") addflags("-Wno-unused-variable") addflags("-Wno-unused-parameter") -addflags("-Wno-deprecated-declarations") -addflags("-Wno-unused-but-set-variable") addflags("-Wno-missing-field-initializers") addflags_c("-Wno-int-conversion") diff --git a/libs/generic/callback.cpp b/libs/generic/callback.cpp index db04d53e..c4fefb8e 100644 --- a/libs/generic/callback.cpp +++ b/libs/generic/callback.cpp @@ -213,10 +213,10 @@ void instantiate(){ b = makeCallback0( Test::Test0(), test ); Callback c = Test::Test0ConstCaller( testconst ); c = makeCallback0( Test::Test0Const(), test ); - Callback d = Test0Caller( test ); - Callback e = Test0ConstCaller( testconst ); - Callback f = Test0PCaller( &test ); - Callback g = Test0ConstPCaller( &testconst ); + Test0Caller{ test }; + Test0ConstCaller{ testconst }; + Test0PCaller{ &test }; + Test0ConstPCaller{ &testconst }; a(); bool u = a != b; } @@ -227,10 +227,10 @@ void instantiate(){ b = makeCallback1( Test::Test1(), test ); TestCallback1 c = Test::Test1ConstCaller( testconst ); c = makeCallback1( Test::Test1Const(), test ); - TestCallback1 d = Test1Caller( test ); - TestCallback1 e = Test1ConstCaller( testconst ); - TestCallback1 f = Test1PCaller( &test ); - TestCallback1 g = Test1ConstPCaller( &testconst ); + Test1Caller{ test }; + Test1ConstCaller{ testconst }; + Test1PCaller{ &test }; + Test1ConstPCaller{ &testconst }; a( A1() ); bool u = a != b; } @@ -238,8 +238,8 @@ void instantiate(){ typedef Callback2 TestCallback2; TestCallback2 a = makeStatelessCallback2( Test2Free() ); TestCallback2 b = makeCallback2( Test2(), test ); - TestCallback2 c = makeCallback2( Test::Test2(), test ); - TestCallback2 d = makeCallback2( Test::Test2Const(), test ); + makeCallback2( Test::Test2(), test ); + makeCallback2( Test::Test2Const(), test ); a( A1(), A2() ); bool u = a != b; } @@ -247,8 +247,8 @@ void instantiate(){ typedef Callback3 TestCallback3; TestCallback3 a = makeStatelessCallback3( Test3Free() ); TestCallback3 b = makeCallback3( Test3(), test ); - TestCallback3 c = makeCallback3( Test::Test3(), test ); - TestCallback3 d = makeCallback3( Test::Test3Const(), test ); + makeCallback3( Test::Test3(), test ); + makeCallback3( Test::Test3Const(), test ); a( A1(), A2(), A3() ); bool u = a != b; } diff --git a/libs/profile/profile.cpp b/libs/profile/profile.cpp index 71d2ae1b..c1505e07 100644 --- a/libs/profile/profile.cpp +++ b/libs/profile/profile.cpp @@ -252,7 +252,7 @@ bool profile_load_buffer( const char * rc_path, const char *name, void *buffer, fclose( f ); } - return true; + return ret; } int profile_load_int( const char *filename, const char *section, const char *key, int default_value ){ diff --git a/libs/splines/splines.cpp b/libs/splines/splines.cpp index 940b938b..901b4f2c 100644 --- a/libs/splines/splines.cpp +++ b/libs/splines/splines.cpp @@ -1167,7 +1167,7 @@ void idFixedPosition::parse( const char *( *text ) ) { Com_UngetToken(); idStr key = Com_ParseOnLine( text ); - const char *token = Com_Parse( text ); + Com_Parse( text ); if ( Q_stricmp( key.c_str(), "pos" ) == 0 ) { Com_UngetToken(); Com_Parse1DMatrix( text, 3, pos ); @@ -1176,7 +1176,7 @@ void idFixedPosition::parse( const char *( *text ) ) { Com_UngetToken(); idCameraPosition::parseToken( key.c_str(), text ); } - token = Com_Parse( text ); + Com_Parse( text ); } while ( 1 ); @@ -1213,7 +1213,7 @@ void idInterpolatedPosition::parse( const char *( *text ) ) { Com_UngetToken(); idStr key = Com_ParseOnLine( text ); - const char *token = Com_Parse( text ); + Com_Parse( text ); if ( Q_stricmp( key.c_str(), "startPos" ) == 0 ) { Com_UngetToken(); Com_Parse1DMatrix( text, 3, startPos ); @@ -1226,7 +1226,7 @@ void idInterpolatedPosition::parse( const char *( *text ) ) { Com_UngetToken(); idCameraPosition::parseToken( key.c_str(), text ); } - token = Com_Parse( text ); + Com_Parse( text ); } while ( 1 ); @@ -1264,7 +1264,7 @@ void idSplinePosition::parse( const char *( *text ) ) { Com_UngetToken(); idStr key = Com_ParseOnLine( text ); - const char *token = Com_Parse( text ); + Com_Parse( text ); if ( Q_stricmp( key.c_str(), "target" ) == 0 ) { target.parse( text ); } @@ -1272,7 +1272,7 @@ void idSplinePosition::parse( const char *( *text ) ) { Com_UngetToken(); idCameraPosition::parseToken( key.c_str(), text ); } - token = Com_Parse( text ); + Com_Parse( text ); } while ( 1 ); diff --git a/libs/splines/util_str.cpp b/libs/splines/util_str.cpp index 62fdaedc..2d8554e7 100644 --- a/libs/splines/util_str.cpp +++ b/libs/splines/util_str.cpp @@ -475,6 +475,7 @@ void TestStringClass void ){ char ch; // ch == ? + (void) ch; idStr *t; // t == ? idStr a; // a.len == 0, a.data == "\0" idStr b; // b.len == 0, b.data == "\0" @@ -483,6 +484,7 @@ void TestStringClass idStr e( reinterpret_cast( NULL ) ); // e.len == 0, e.data == "\0" ASSERT! int i; // i == ? + (void) i; i = a.length(); // i == 0 i = c.length(); // i == 4 diff --git a/libs/xml/xmlparser.h b/libs/xml/xmlparser.h index b11d355b..cdfdd8fb 100644 --- a/libs/xml/xmlparser.h +++ b/libs/xml/xmlparser.h @@ -208,6 +208,7 @@ virtual void exportXML( XMLImporter& importer ){ xmlFreeParserCtxt( ctxt ); } + (void) wellFormed; //return wellFormed; } private: diff --git a/plugins/entity/light.cpp b/plugins/entity/light.cpp index dbde66c1..0e89e921 100644 --- a/plugins/entity/light.cpp +++ b/plugins/entity/light.cpp @@ -648,8 +648,8 @@ void render( RenderStateFlags state ) const { points[5] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[5], 1 ) ) ); points[6] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[6], 1 ) ) ); points[7] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[7], 1 ) ) ); - Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) ); - Vector3 test2 = vector4_projected( test1 ); +// Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) ); +// Vector3 test2 = vector4_projected( test1 ); aabb_draw_wire( points ); } }; diff --git a/plugins/image/jpeg.cpp b/plugins/image/jpeg.cpp index 138151a2..d36bd57a 100644 --- a/plugins/image/jpeg.cpp +++ b/plugins/image/jpeg.cpp @@ -316,6 +316,7 @@ static void j_putRGBAScanline( unsigned char* jpegline, int widthPix, unsigned c //!\todo fix jpeglib, it leaves alpha channel uninitialised #if 1 + (void) iAlp; *oAlp = 255; #else *oAlp = iAlp; diff --git a/plugins/imagehl/hlw.cpp b/plugins/imagehl/hlw.cpp index 2731e15a..73275547 100644 --- a/plugins/imagehl/hlw.cpp +++ b/plugins/imagehl/hlw.cpp @@ -91,7 +91,7 @@ typedef struct Image* LoadHLWBuff( byte* buffer ){ byte *buf_p; unsigned long mipdatasize; - int columns, rows, numPixels; + int columns, rows; byte *pixbuf; int row, column; byte *palette; @@ -108,7 +108,6 @@ Image* LoadHLWBuff( byte* buffer ){ columns = lpMip->width; rows = lpMip->height; - numPixels = columns * rows; RGBAImage* image = new RGBAImage( columns, rows ); diff --git a/plugins/imagehl/mip.cpp b/plugins/imagehl/mip.cpp index 51dbfd7e..a9d5a71b 100644 --- a/plugins/imagehl/mip.cpp +++ b/plugins/imagehl/mip.cpp @@ -138,7 +138,6 @@ static const byte quakepalette[768] = Image* LoadMIPBuff( byte* buffer ){ byte *buf_p; int palettelength; - unsigned long mipdatasize; int columns, rows, numPixels; byte *pixbuf; int i; @@ -158,7 +157,7 @@ Image* LoadMIPBuff( byte* buffer ){ return 0; } - mipdatasize = GET_MIP_DATA_SIZE( columns, rows ); +// unsigned long mipdatasize = GET_MIP_DATA_SIZE( columns, rows ); palettelength = vfsLoadFile( "gfx/palette.lmp", (void **) &loadedpalette ); if ( palettelength == 768 ) { diff --git a/plugins/imagehl/sprite.cpp b/plugins/imagehl/sprite.cpp index b6347ec4..6e469562 100644 --- a/plugins/imagehl/sprite.cpp +++ b/plugins/imagehl/sprite.cpp @@ -102,7 +102,7 @@ typedef struct { Image* LoadIDSPBuff( byte *buffer ){ byte *buf_p; - int columns, rows, numPixels; + int columns, rows; byte *pixbuf; int row, column; @@ -159,8 +159,6 @@ Image* LoadIDSPBuff( byte *buffer ){ // palette = buffer+mipdatasize+2; // buf_p = buffer+lpMip->offsets[0]; - numPixels = columns * rows; - RGBAImage* image = new RGBAImage( columns, rows ); #ifdef DEBUG diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index b4dab4d0..066adfcd 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -1253,8 +1253,6 @@ inline Matrix4 matrix4_reflection_for_plane45( const Plane3& plane, const Vector Matrix4 swap = matrix4_swap_axes( first, second ); - Matrix4 tmp = matrix4_reflection_for_plane( plane ); - swap.tx() = -static_cast( -2 * plane.a * plane.d ); swap.ty() = -static_cast( -2 * plane.b * plane.d ); swap.tz() = -static_cast( -2 * plane.c * plane.d ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index e1f09679..005ab9b8 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -322,17 +322,8 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){ } void Cam_MouseControl( camera_t& camera, int x, int y ){ - int xl, xh; - int yl, yh; - float xf, yf; - - xf = (float)( x - camera.width / 2 ) / ( camera.width / 2 ); - yf = (float)( y - camera.height / 2 ) / ( camera.height / 2 ); - - xl = camera.width / 3; - xh = xl * 2; - yl = camera.height / 3; - yh = yl * 2; + float xf = (float)( x - camera.width / 2 ) / ( camera.width / 2 ); + float yf = (float)( y - camera.height / 2 ) / ( camera.height / 2 ); xf *= 1.0f - fabsf( yf ); if ( xf < 0 ) { diff --git a/tools/quake3/common/bspfile.c b/tools/quake3/common/bspfile.c index 9214550a..8bc0fc8d 100644 --- a/tools/quake3/common/bspfile.c +++ b/tools/quake3/common/bspfile.c @@ -294,10 +294,7 @@ void SwapBSPFile( void ) { ============= */ int GetLumpElements( dheader_t *header, int lump, int size ) { - int length, ofs; - - length = header->lumps[lump].filelen; - ofs = header->lumps[lump].fileofs; + int length = header->lumps[lump].filelen; if ( length % size ) { Error( "LoadBSPFile: odd lump size" ); diff --git a/tools/quake3/q3data/images.c b/tools/quake3/q3data/images.c index 6de25fdc..54e75e4f 100644 --- a/tools/quake3/q3data/images.c +++ b/tools/quake3/q3data/images.c @@ -381,11 +381,9 @@ byte AveragePixels( int count ){ int pix; int bestcolor; byte *pal; - int fullbright; vis = 0; r = g = b = 0; - fullbright = 0; for ( i = 0 ; i < count ; i++ ) { pix = pixdata[i]; diff --git a/tools/quake3/q3data/models.c b/tools/quake3/q3data/models.c index 65fde858..5f4d2026 100644 --- a/tools/quake3/q3data/models.c +++ b/tools/quake3/q3data/models.c @@ -559,7 +559,6 @@ static void CopyTrianglesToBaseTriangles( triangle_t *ptri, int numtri, baseTria // float s_scale, t_scale; // float scale; // vec3_t mins, maxs; - float *pbasevert; /* // @@ -618,8 +617,6 @@ static void CopyTrianglesToBaseTriangles( triangle_t *ptri, int numtri, baseTria for ( j = 0 ; j < 3 ; j++ ) { - pbasevert = ptri->verts[j]; - VectorCopy( ptri->verts[j], bTri->v[j].xyz ); VectorCopy( ptri->normals[j], bTri->v[j].normal ); @@ -1905,8 +1902,9 @@ static void ConvertASE( const char *filename, int type, qboolean grabAnims ){ } } - if ( !tagWeapon ) { - Error( "Missing tag_weapon!" ); + if ( !tagHead ) { + // todo: was never being checked; should we error now that it is? + // Error( "Missing tag_head!" ); } if ( !tagTorso ) { Error( "Missing tag_torso!" ); diff --git a/tools/quake3/q3map2/surface.c b/tools/quake3/q3map2/surface.c index 3dcf5f55..c8c6e4f4 100644 --- a/tools/quake3/q3map2/surface.c +++ b/tools/quake3/q3map2/surface.c @@ -2183,7 +2183,8 @@ int FilterWindingIntoTree_r( winding_t *w, mapDrawSurface_t *ds, node_t *node ){ if ( DotProduct( plane1, reverse ) > 0.999f && fabs( plane1[ 3 ] - reverse[ 3 ] ) < 0.001f ) { return FilterWindingIntoTree_r( w, ds, node->children[ 1 ] ); } - #else + #else + (void) plane2; /* div0: this is the cholera (doesn't hit enough) */ /* the drawsurf might have an associated plane, if so, force a filter here */ -- 2.39.2