Fixed format strings warnings reported by GCC/Clang

See https://forum.zdoom.org/viewtopic.php?t=54541 and https://forum.zdoom.org/viewtopic.php?t=54709
This commit is contained in:
alexey.lysiuk 2016-12-24 14:33:50 +02:00 committed by Christoph Oelckers
parent 54822c29eb
commit e825918451
6 changed files with 11 additions and 11 deletions

View file

@ -2677,13 +2677,13 @@ void FParser::SF_PlayerWeapon()
if (playernum==-1) return;
if (weaponnum<0 || weaponnum>9)
{
script_error("weaponnum out of range! %s\n", weaponnum);
script_error("weaponnum out of range! %d\n", weaponnum);
return;
}
PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum]));
if (!ti)
{
script_error("incompatibility in playerweapon\n", weaponnum);
script_error("incompatibility in playerweapon %d\n", weaponnum);
return;
}
@ -2758,13 +2758,13 @@ void FParser::SF_PlayerSelectedWeapon()
if (weaponnum<0 || weaponnum>=9)
{
script_error("weaponnum out of range! %s\n", weaponnum);
script_error("weaponnum out of range! %d\n", weaponnum);
return;
}
PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum]));
if (!ti)
{
script_error("incompatibility in playerweapon\n", weaponnum);
script_error("incompatibility in playerweapon %d\n", weaponnum);
return;
}

View file

@ -246,7 +246,7 @@ void FMapInfoParser::ParseDoomEdNums()
}
if (error > 0)
{
sc.ScriptError("%d errors encountered in DoomEdNum definition");
sc.ScriptError("%d errors encountered in DoomEdNum definition", error);
}
}

View file

@ -7493,7 +7493,7 @@ isresolved:
else
{
// Todo: If this is a qualified call to a parent class function, let it through (but this needs to disable virtual calls later.)
ScriptPosition.Message(MSG_ERROR, "Qualified member call to parent class not yet implemented\n", cls->TypeName.GetChars(), MethodName.GetChars());
ScriptPosition.Message(MSG_ERROR, "Qualified member call to parent class %s::%s is not yet implemented\n", cls->TypeName.GetChars(), MethodName.GetChars());
delete this;
return nullptr;
}
@ -7897,7 +7897,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
// For a reference argument the types must match 100%.
if (type != ArgList[i]->ValueType)
{
ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument", Function->SymbolName.GetChars());
ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s", Function->SymbolName.GetChars());
x = nullptr;
}
else
@ -8346,7 +8346,7 @@ FxExpression *FxGetDefaultByType::Resolve(FCompileContext &ctx)
{
// this is the ugly case. We do not know what we have and cannot do proper type casting.
// For now error out and let this case require explicit handling on the user side.
ScriptPosition.Message(MSG_ERROR, "GetDefaultByType() requires an actor class type", static_cast<FxConstant *>(Self)->GetValue().GetString().GetChars());
ScriptPosition.Message(MSG_ERROR, "GetDefaultByType() requires an actor class type, but got %s", static_cast<FxConstant *>(Self)->GetValue().GetString().GetChars());
delete this;
return nullptr;
}

View file

@ -272,7 +272,7 @@ static void CheckForUnsafeStates(PClassActor *obj)
// 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);
GetStateSource(state).Message(MSG_ERROR, TEXTCOLOR_RED "Unsafe state call in state %s.%d which accesses user variables, reached by %s.%s.\n",
owner->TypeName.GetChars(), state - owner->OwnedStates, obj->TypeName.GetChars(), FName(*test).GetChars());
owner->TypeName.GetChars(), int(state - owner->OwnedStates), obj->TypeName.GetChars(), FName(*test).GetChars());
}
state = state->NextState;
}

View file

@ -525,7 +525,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
if (info->Size != actorclass->Size)
{
bag.ScriptPosition.Message(MSG_OPTERROR,
"'skip_super' is only allowed in subclasses of AActor with no additional fields and will be ignored.", info->TypeName.GetChars());
"'skip_super' is only allowed in subclasses of AActor with no additional fields and will be ignored in type %s.", info->TypeName.GetChars());
return;
}
if (bag.StateSet)

View file

@ -1323,7 +1323,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
}
else if (hasnativechildren)
{
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", type->TypeName.GetChars(), fd->FieldSize, FName(name->Name).GetChars());
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", FName(name->Name).GetChars(), type->TypeName.GetChars(), FName(name->Name).GetChars());
}
else
{