- Fixed more GCC/Clang warnings.

This commit is contained in:
Edoardo Prezioso 2016-11-26 12:45:17 +01:00
parent ab03b016e9
commit 6eff1cb8be
6 changed files with 21 additions and 9 deletions

View file

@ -72,11 +72,11 @@ static inline void *RoundPointer(void *ptr)
//
//==========================================================================
FMemArena::FMemArena(int bs)
FMemArena::FMemArena(size_t blocksize)
{
TopBlock = NULL;
FreeBlocks = NULL;
BlockSize = bs;
BlockSize = blocksize;
}
//==========================================================================

View file

@ -40,7 +40,7 @@
class FMemArena
{
public:
FMemArena(int blocksize = 10*1024);
FMemArena(size_t blocksize = 10*1024);
~FMemArena();
void *Alloc(size_t size);
@ -55,7 +55,7 @@ protected:
Block *TopBlock;
Block *FreeBlocks;
int BlockSize;
size_t BlockSize;
};
// An arena specializing in storage of FStrings. It knows how to free them,
@ -87,4 +87,4 @@ private:
};
#endif
#endif

View file

@ -143,7 +143,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
// If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash.
auto owner = FState::StaticFindStateOwner(state);
Printf(TEXTCOLOR_RED "Unsafe state call in state %s.%d to %s which accesses user variables. The action function has been removed from this state\n",
owner->TypeName.GetChars(), state - owner->OwnedStates, state->ActionFunc->PrintableName.GetChars());
owner->TypeName.GetChars(), int(state - owner->OwnedStates), state->ActionFunc->PrintableName.GetChars());
state->ActionFunc = nullptr;
}

View file

@ -409,7 +409,7 @@ void DPSprite::SetState(FState *newstate, bool pending)
// If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash.
auto owner = FState::StaticFindStateOwner(newstate);
Printf(TEXTCOLOR_RED "Unsafe state call in state %s.%d to %s which accesses user variables. The action function has been removed from this state\n",
owner->TypeName.GetChars(), newstate - owner->OwnedStates, newstate->ActionFunc->PrintableName.GetChars());
owner->TypeName.GetChars(), int(newstate - owner->OwnedStates), newstate->ActionFunc->PrintableName.GetChars());
newstate->ActionFunc = nullptr;
}
if (newstate->CallAction(Owner->mo, Caller, &stp, &nextstate))

View file

@ -7771,7 +7771,7 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
}
VMFunction *vmfunc = Function->Variants[0].Implementation;
bool staticcall = (vmfunc->Final || vmfunc->VirtualIndex == -1 || NoVirtual);
bool staticcall = (vmfunc->Final || vmfunc->VirtualIndex == ~0u || NoVirtual);
count = 0;
// Emit code to pass implied parameters

View file

@ -1469,6 +1469,9 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
break;
}
break;
default:
break;
}
break;
}
@ -1520,6 +1523,9 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
}
break;
}
default:
break;
}
if (retval != TypeError && retval->MemberOnly && !formember)
{
@ -1997,6 +2003,9 @@ void ZCCCompiler::InitDefaults()
case AST_FlagStmt:
ProcessDefaultFlag(ti, static_cast<ZCC_FlagStmt *>(content));
break;
default:
break;
}
content = static_cast<decltype(content)>(content->SiblingNext);
} while (content != d->Content);
@ -3215,6 +3224,9 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
}
return new FxMultiAssign(args, ConvertNode(ass->Sources), *ast);
}
default:
break;
}
// only for development. I_Error is more convenient here than a normal error.
I_Error("ConvertNode encountered unsupported node of type %d", ast->NodeType);
@ -3234,4 +3246,4 @@ FArgumentList &ZCCCompiler::ConvertNodeList(FArgumentList &args, ZCC_TreeNode *h
} while (node != head);
}
return args;
}
}