Fix/work around other misc. compiler warnings

or, in the case of AF.cpp, at least comment on them

I think this fixes most of the remaining "interesting" GCC 12 on Linux
warnings, except for some in idParser::ExpandBuiltinDefine() that I'll
fix in the next commit
This commit is contained in:
Daniel Gibson 2023-01-05 08:07:51 +01:00
parent 996947eec6
commit dbe4174c0b
7 changed files with 29 additions and 4 deletions

View file

@ -3479,6 +3479,11 @@ idCollisionModelManagerLocal::GetModelPolygon
===================
*/
bool idCollisionModelManagerLocal::GetModelPolygon( cmHandle_t model, int polygonNum, idFixedWinding &winding ) const {
assert(0 && "if this is ever called, it must be fixed first!"); // DG: see below
return false;
#if 0
int i, edgeNum;
cm_polygon_t *poly;
@ -3487,6 +3492,9 @@ bool idCollisionModelManagerLocal::GetModelPolygon( cmHandle_t model, int polygo
return false;
}
// FIXME: DG: WTF is this, casting an int to a pointer?! we're lucky this is unused..
// (it's called by idClip::GetModelContactFeature() which is called by
// idClip()::DrawModelContactFeatuer(), but that is never called)
poly = *reinterpret_cast<cm_polygon_t **>(&polygonNum);
winding.Clear();
for ( i = 0; i < poly->numEdges; i++ ) {
@ -3495,6 +3503,7 @@ bool idCollisionModelManagerLocal::GetModelPolygon( cmHandle_t model, int polygo
}
return true;
#endif // 0
}
/*

View file

@ -892,6 +892,11 @@ bool idAF::Load( idEntity *ent, const char *fileName ) {
for ( i = 0; i < physicsObj.GetNumConstraints(); i++ ) {
idAFConstraint *constraint = physicsObj.GetConstraint( i );
for ( j = 0; j < file->constraints.Num(); j++ ) {
// DG: FIXME: GCC rightfully complains that file->constraints[j]->type and constraint->GetType()
// are of different enum types, and their values are different in some cases:
// CONSTRAINT_HINGESTEERING has no DECLAF_CONSTRAINT_ equivalent,
// and thus DECLAF_CONSTRAINT_SLIDER != CONSTRAINT_SLIDER (5 != 6)
// and DECLAF_CONSTRAINT_SPRING != CONSTRAINT_SPRING (6 != 10)
if ( file->constraints[j]->name.Icmp( constraint->GetName() ) == 0 &&
file->constraints[j]->type == constraint->GetType() ) {
break;

View file

@ -872,7 +872,8 @@ void idPVS::Shutdown( void ) {
delete[] areaPVS;
areaPVS = NULL;
}
if ( currentPVS ) {
// if ( currentPVS ) - DG: can't be NULL
{
for ( int i = 0; i < MAX_CURRENT_PVS; i++ ) {
delete[] currentPVS[i].pvs;
currentPVS[i].pvs = NULL;

View file

@ -172,7 +172,7 @@ index 0 will never be NULL. Any anim >= NumAnims will return NULL.
=====================
*/
const idMD5Anim *idAnim::MD5Anim( int num ) const {
if ( anims == NULL || anims[0] == NULL ) {
if ( anims[0] == NULL ) {
return NULL;
}
return anims[ num ];
@ -3057,6 +3057,7 @@ idDeclModelDef::NumJointsOnChannel
int idDeclModelDef::NumJointsOnChannel( int channel ) const {
if ( ( channel < 0 ) || ( channel >= ANIM_NumAnimChannels ) ) {
gameLocal.Error( "idDeclModelDef::NumJointsOnChannel : channel out of range" );
return 0; // unreachable, (Error() doesn't return) just to shut up compiler
}
return channelJoints[ channel ].Num();
}
@ -3069,6 +3070,7 @@ idDeclModelDef::GetChannelJoints
const int * idDeclModelDef::GetChannelJoints( int channel ) const {
if ( ( channel < 0 ) || ( channel >= ANIM_NumAnimChannels ) ) {
gameLocal.Error( "idDeclModelDef::GetChannelJoints : channel out of range" );
return NULL; // unreachable, (Error() doesn't return) just to shut up compiler
}
return channelJoints[ channel ].Ptr();
}

View file

@ -892,6 +892,11 @@ bool idAF::Load( idEntity *ent, const char *fileName ) {
for ( i = 0; i < physicsObj.GetNumConstraints(); i++ ) {
idAFConstraint *constraint = physicsObj.GetConstraint( i );
for ( j = 0; j < file->constraints.Num(); j++ ) {
// DG: FIXME: GCC rightfully complains that file->constraints[j]->type and constraint->GetType()
// are of different enum types, and their values are different in some cases:
// CONSTRAINT_HINGESTEERING has no DECLAF_CONSTRAINT_ equivalent,
// and thus DECLAF_CONSTRAINT_SLIDER != CONSTRAINT_SLIDER (5 != 6)
// and DECLAF_CONSTRAINT_SPRING != CONSTRAINT_SPRING (6 != 10)
if ( file->constraints[j]->name.Icmp( constraint->GetName() ) == 0 &&
file->constraints[j]->type == constraint->GetType() ) {
break;

View file

@ -872,7 +872,8 @@ void idPVS::Shutdown( void ) {
delete[] areaPVS;
areaPVS = NULL;
}
if ( currentPVS ) {
// if ( currentPVS ) - DG: can't be NULL
{
for ( int i = 0; i < MAX_CURRENT_PVS; i++ ) {
delete[] currentPVS[i].pvs;
currentPVS[i].pvs = NULL;

View file

@ -172,7 +172,7 @@ index 0 will never be NULL. Any anim >= NumAnims will return NULL.
=====================
*/
const idMD5Anim *idAnim::MD5Anim( int num ) const {
if ( anims == NULL || anims[0] == NULL ) {
if ( anims[0] == NULL ) {
return NULL;
}
return anims[ num ];
@ -2971,6 +2971,7 @@ idDeclModelDef::NumJointsOnChannel
int idDeclModelDef::NumJointsOnChannel( int channel ) const {
if ( ( channel < 0 ) || ( channel >= ANIM_NumAnimChannels ) ) {
gameLocal.Error( "idDeclModelDef::NumJointsOnChannel : channel out of range" );
return 0; // unreachable, (Error() doesn't return) just to shut up compiler
}
return channelJoints[ channel ].Num();
}
@ -2983,6 +2984,7 @@ idDeclModelDef::GetChannelJoints
const int * idDeclModelDef::GetChannelJoints( int channel ) const {
if ( ( channel < 0 ) || ( channel >= ANIM_NumAnimChannels ) ) {
gameLocal.Error( "idDeclModelDef::GetChannelJoints : channel out of range" );
return NULL; // unreachable, (Error() doesn't return) just to shut up compiler
}
return channelJoints[ channel ].Ptr();
}