Skip to content

Commit

Permalink
Fix TFE warnings and lots of unused variable warnings
Browse files Browse the repository at this point in the history
.. still, didn't look at unused variable warnings from *.es because
so many are generated.
  • Loading branch information
DanielGibson committed Apr 24, 2016
1 parent a3e2a6a commit f285b03
Show file tree
Hide file tree
Showing 27 changed files with 88 additions and 67 deletions.
3 changes: 1 addition & 2 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-unused-value) # same here (the Scripts generate tons of unused variables and values)
add_compile_options(-Wno-missing-braces)
add_compile_options(-Wno-overloaded-virtual)
add_compile_options(-Wno-invalid-offsetof)
MESSAGE(WARNING, "re-enable some of the warnings some day!")

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
add_compile_options(-Wno-tautological-undefined-compare) # don't complain about if(this!=NULL)
add_compile_options(-Wno-c++11-compat-deprecated-writable-strings)
else() # most probably GCC
add_compile_options(-Wno-unused-but-set-variable) # my clang doesn't know this FIXME: re-enable?
endif()

if(MACOSX)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Base/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ void CTFileStream::Create_t(const CTFileName &fnFileName,
}

CTFileName fnmFullFileName;
INDEX iFile = ExpandFilePath(EFP_WRITE, fnFileNameAbsolute, fnmFullFileName);
/* INDEX iFile = */ ExpandFilePath(EFP_WRITE, fnFileNameAbsolute, fnmFullFileName);

// check parameters
ASSERT(strlen(fnFileNameAbsolute)>0);
Expand Down Expand Up @@ -1317,7 +1317,7 @@ BOOL FileExistsForWriting(const CTFileName &fnmFile)
}
// expand the filename to full path for writing
CTFileName fnmFullFileName;
INDEX iFile = ExpandFilePath(EFP_WRITE, fnmFile, fnmFullFileName);
/* INDEX iFile = */ ExpandFilePath(EFP_WRITE, fnmFile, fnmFullFileName);

// check if it exists
FILE *f = fopen(fnmFullFileName, "rb");
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Brushes/BrushTriangularize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void CTriangularizer::MakeEdgesForTriangularization(void)
// get number of edges in polygon
INDEX ctEdges = tr_abpeOriginalEdges.Count();
// create that much edges in the array
CBrushEdge *pbedEdges = tr_abedEdges.New(ctEdges);
/* CBrushEdge *pbedEdges = */ tr_abedEdges.New(ctEdges);

tr_abedEdges.Lock();

Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Classes/MovableEntity.es
Original file line number Diff line number Diff line change
Expand Up @@ -2863,7 +2863,7 @@ out:;

_pfPhysicsProfile.IncrementCounter((INDEX) CPhysicsProfile::PCI_DOMOVING);

FLOAT fTickQuantum=_pTimer->TickQuantum; // used for normalizing from SI units to game ticks
//FLOAT fTickQuantum=_pTimer->TickQuantum; // used for normalizing from SI units to game ticks

// if rotation and translation are synchronized
if (en_ulPhysicsFlags&EPF_RT_SYNCHRONIZED) {
Expand All @@ -2878,7 +2878,7 @@ out:;
if ((en_ulPhysicsFlags&EPF_ONBLOCK_MASK)==EPF_ONBLOCK_PUSH) {
penPusher = this;
}
BOOL bMoveSuccessfull = TryToMove(penPusher, TRUE, TRUE);
/* BOOL bMoveSuccessfull = */ TryToMove(penPusher, TRUE, TRUE);

// if rotation and translation are asynchronious
} else {
Expand Down
6 changes: 3 additions & 3 deletions Sources/Engine/Graphics/DrawPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ void CDrawPort::Fill( PIX pixI, PIX pixJ, PIX pixWidth, PIX pixHeight,
// thru OpenGL
gfxResetArrays();
GFXVertex *pvtx = _avtxCommon.Push(4);
GFXTexCoord *ptex = _atexCommon.Push(4);
/* GFXTexCoord *ptex = */ _atexCommon.Push(4);
GFXColor *pcol = _acolCommon.Push(4);
const GFXColor glcolUL(colUL); const GFXColor glcolUR(colUR);
const GFXColor glcolDL(colDL); const GFXColor glcolDR(colDR);
Expand Down Expand Up @@ -1617,7 +1617,7 @@ void CDrawPort::AddTriangle( const FLOAT fI0, const FLOAT fJ0,
const GFXColor glCol( AdjustColor( col, _slTexHueShift, _slTexSaturation));
const INDEX iStart = _avtxCommon.Count();
GFXVertex *pvtx = _avtxCommon.Push(3);
GFXTexCoord *ptex = _atexCommon.Push(3);
/* GFXTexCoord *ptex = */ _atexCommon.Push(3);
GFXColor *pcol = _acolCommon.Push(3);
INDEX *pelm = _aiCommonElements.Push(3);
pvtx[0].x = fI0; pvtx[0].y = fJ0; pvtx[0].z = 0;
Expand Down Expand Up @@ -1699,7 +1699,7 @@ void CDrawPort::BlendScreen(void)
// set arrays
gfxResetArrays();
GFXVertex *pvtx = _avtxCommon.Push(4);
GFXTexCoord *ptex = _atexCommon.Push(4);
/* GFXTexCoord *ptex = */ _atexCommon.Push(4);
GFXColor *pcol = _acolCommon.Push(4);
const INDEX iW = dp_Width;
const INDEX iH = dp_Height;
Expand Down
3 changes: 2 additions & 1 deletion Sources/Engine/Graphics/DrawPort_RenderScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ static void RSSetTextureCoords( ScenePolygon *pspoGroup, INDEX iLayer, INDEX iUn
// generate tex coord for all scene polygons in list
const FLOATmatrix3D &mViewer = _ppr->pr_ViewerRotationMatrix;
const INDEX iMappingOffset = iLayer * sizeof(CMappingVectors);
(void)iMappingOffset; // shut up compiler, this is used if inline ASM is used

for( ScenePolygon *pspo=pspoGroup; pspo!=NULL; pspo=pspo->spo_pspoSucc)
{
Expand Down Expand Up @@ -2010,7 +2011,7 @@ void RenderSceneBackground(CDrawPort *pDP, COLOR col)
// set arrays
gfxResetArrays();
GFXVertex *pvtx = _avtxCommon.Push(4);
GFXTexCoord *ptex = _atexCommon.Push(4);
/* GFXTexCoord *ptex = */ _atexCommon.Push(4);
GFXColor *pcol = _acolCommon.Push(4);
pvtx[0].x = 0; pvtx[0].y = 0; pvtx[0].z = 1;
pvtx[1].x = 0; pvtx[1].y = iH; pvtx[1].z = 1;
Expand Down
1 change: 1 addition & 0 deletions Sources/Engine/Graphics/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ void DitherBitmap( INDEX iDitherType, ULONG *pulSrc, ULONG *pulDst, PIX pixWidth
ASSERT( pixCanvasWidth>=pixWidth && pixCanvasHeight>=pixHeight);
SLONG slModulo = (pixCanvasWidth-pixWidth) *BYTES_PER_TEXEL;
SLONG slWidthModulo = pixWidth*BYTES_PER_TEXEL +slModulo;
(void)slWidthModulo; // shut up compiler, this is used if inline ASM is used

// if bitmap is smaller than 4x2 pixels
if( pixWidth<4 || pixHeight<2)
Expand Down
7 changes: 7 additions & 0 deletions Sources/Engine/Models/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,9 +1397,11 @@ void CModelData::Read_t( CTStream *pFile) // throw char *
if( cidVerticesChunk == CChunkID("AV16"))
{
CChunkID cidDummy = pFile->GetID_t();
(void)cidDummy; // shut up about unused variable, compiler.
ULONG ulDummy;
// skip chunk size
*pFile >> ulDummy;
(void)ulDummy; // shut up about unused variable, compiler.
for( INDEX iVtx=0; iVtx<md_VerticesCt * md_FramesCt; iVtx++)
{
(*pFile)>>md_FrameVertices16[iVtx];
Expand Down Expand Up @@ -2859,22 +2861,26 @@ void CModelObject::AutoSetTextures(void)
if( id == CChunkID("WTEX"))
{
CChunkID idDummy = strmIni.GetID_t();
(void)idDummy; // shut up about unused variable, compiler.
strmIni >> ctDiffuseTextures;
strmIni >> fnDiffuse;
}
else if( id == CChunkID("FXTR"))
{
CChunkID idDummy = strmIni.GetID_t();
(void)idDummy; // shut up about unused variable, compiler.
strmIni >> fnReflection;
}
else if( id == CChunkID("FXTS"))
{
CChunkID idDummy = strmIni.GetID_t();
(void)idDummy; // shut up about unused variable, compiler.
strmIni >> fnSpecular;
}
else if( id == CChunkID("FXTB"))
{
CChunkID idDummy = strmIni.GetID_t();
(void)idDummy; // shut up about unused variable, compiler.
strmIni >> fnBump;
}
else
Expand Down Expand Up @@ -2914,6 +2920,7 @@ void CModelObject::AutoSetAttachments(void)
if( id == CChunkID("ATTM"))
{
CChunkID idDummy = strmIni.GetID_t();
(void)idDummy; // shut up about unused variable, compiler.
// try to load attached models
INDEX ctAttachedModels;
strmIni >> ctAttachedModels;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Rendering/RendASER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ CScreenPolygon *CRenderer::ScanOneLine(void)
}
// remove all left-over polygons from stack
do {
BOOL bWasTop = RemPolygonFromSurfaceStack(*pspoTop);
/* BOOL bWasTop = */ RemPolygonFromSurfaceStack(*pspoTop);
pspoTop = LIST_HEAD(re_lhSurfaceStack, CScreenPolygon, spo_lnInStack);
} while (&re_spoFarSentinel != pspoTop);
// mark start of background span at right border
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Rendering/RenderBrushes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void CRenderer::DrawBrushPolygonVerticesAndEdges(CBrushPolygon &bpo)
*/
void CRenderer::DrawBrushSectorVerticesAndEdges(CBrushSector &bscSector)
{
CBrushMip *pbm = bscSector.bsc_pbmBrushMip;
//CBrushMip *pbm = bscSector.bsc_pbmBrushMip;
//CBrush3D &br = *pbm->bm_pbrBrush;

// clear all vertex drawn flags
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Terrain/TerrainArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void CTerrainArchive::Read_t( CTStream *istrFile) // throw char *
// if there are some terrains
if (ctTerrains!=0) {
// create that much terrains
CTerrain *atrBrushes = ta_atrTerrains.New(ctTerrains);
/* CTerrain *atrBrushes = */ ta_atrTerrains.New(ctTerrains);
// for each of the new terrains
for (INDEX iTerrain=0; iTerrain<ctTerrains; iTerrain++) {
// read it from stream
Expand Down
4 changes: 4 additions & 0 deletions Sources/Engine/World/WorldCSG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,12 +1008,14 @@ void CheckOnePolygon(CBrushSector &bsc, CBrushPolygon &bpo)
// "try to access stuff and make sure it doesn't segfault", so keep it
// like it is even if the compiler complains about unused values?
CBrushPlane *pbplPlane=bpo.bpo_pbplPlane;
(void)pbplPlane; // shut up, compiler - I know this is unused, but I think it's intended like that.
INDEX ctEdges=bpo.bpo_abpePolygonEdges.Count();
INDEX ctVertices=bpo.bpo_apbvxTriangleVertices.Count();
for(INDEX iEdge=0;iEdge<ctEdges;iEdge++)
{
CBrushPolygonEdge &edg=bpo.bpo_abpePolygonEdges[iEdge];
CBrushEdge &be=*edg.bpe_pbedEdge;
(void)be; // shut up, compiler
CBrushVertex *pbvx0, *pbvx1;
edg.GetVertices(pbvx0, pbvx1);
}
Expand All @@ -1025,11 +1027,13 @@ void CheckOnePolygon(CBrushSector &bsc, CBrushPolygon &bpo)
DOUBLE3D vdRel=vtx.bvx_vdPreciseRelative;
DOUBLE3D *pvdPreciseAbsolute=vtx.bvx_pvdPreciseAbsolute;
CBrushSector &bsc=*vtx.bvx_pbscSector;
(void)vAbs; (void)vRel; (void)vdRel; (void)pvdPreciseAbsolute; (void)bsc; // shut up, compiler
}
for(INDEX ite=0;ite<bpo.bpo_aiTriangleElements.Count();ite++)
{
INDEX iTriangleVtx=bpo.bpo_aiTriangleElements[ite];
CBrushSector &bsc=*bpo.bpo_pbscSector;
(void)iTriangleVtx; (void)bsc; // ...
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/World/WorldIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ void CWorld::ReadState_veryold_t( CTStream *istr) // throw char *
// read entity class index and entity placement
(*istr)>>iEntityClass>>plPlacement;
// create an entity of that class
CEntity *penNew = CreateEntity_t(plPlacement, cecClasses[iEntityClass]);
/* CEntity *penNew = */ CreateEntity_t(plPlacement, cecClasses[iEntityClass]);
}}

// for each entity
Expand Down Expand Up @@ -498,7 +498,7 @@ void CWorld::ReadState_old_t( CTStream *istr) // throw char *
// read entity class index and entity placement
(*istr)>>iEntityClass>>plPlacement;
// create an entity of that class
CEntity *penNew = CreateEntity_t(plPlacement, cecClasses[iEntityClass]);
/* CEntity *penNew = */ CreateEntity_t(plPlacement, cecClasses[iEntityClass]);
}}

// for each entity
Expand Down
6 changes: 4 additions & 2 deletions Sources/Entities/Common/HUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ static int qsort_CompareDeaths( const void *ppPEN0, const void *ppPEN1) {
else return 0;
}

#if 0 // DG: unused
static int qsort_CompareLatencies( const void *ppPEN0, const void *ppPEN1) {
CPlayer &en0 = **(CPlayer**)ppPEN0;
CPlayer &en1 = **(CPlayer**)ppPEN1;
Expand All @@ -243,6 +244,7 @@ static int qsort_CompareLatencies( const void *ppPEN0, const void *ppPEN1) {
else if( sl0>sl1) return -1;
else return 0;
}
#endif // 0 (unused)

// prepare color transitions
static void PrepareColorTransitions( COLOR colFine, COLOR colHigh, COLOR colMedium, COLOR colLow,
Expand Down Expand Up @@ -690,7 +692,7 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO
_fCustomScaling = ClampDn( _fCustomScaling*0.8f, 0.5f);
const FLOAT fOneUnitS = fOneUnit *0.8f;
const FLOAT fAdvUnitS = fAdvUnit *0.8f;
const FLOAT fNextUnitS = fNextUnit *0.8f;
//const FLOAT fNextUnitS = fNextUnit *0.8f;
const FLOAT fHalfUnitS = fHalfUnit *0.8f;

// prepare postition and ammo quantities
Expand Down Expand Up @@ -868,7 +870,7 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO
if( iHealth>25) colHealth = _colHUD;
if( iArmor >25) colArmor = _colHUD;
// eventually print it out
if( hud_iShowPlayers==1 || hud_iShowPlayers==-1 && !bSinglePlay) {
if( hud_iShowPlayers==1 || (hud_iShowPlayers==-1 && !bSinglePlay)) {
// printout location and info aren't the same for deathmatch and coop play
const FLOAT fCharWidth = (PIX)((_pfdDisplayFont->GetWidth()-2) *fTextScale);
if( bCooperative) {
Expand Down
Loading

0 comments on commit f285b03

Please sign in to comment.