mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
Fixed most of warnings reported by Clang
src/scripting/zscript/zcc_compile.cpp: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] src/p_acs.cpp: warning: format specifies type 'char *' but the argument has type 'PClass *' [-Wformat]
This commit is contained in:
parent
8a1e0ee4b5
commit
d8cee4d3a5
2 changed files with 10 additions and 10 deletions
|
@ -4765,24 +4765,24 @@ static int ScriptCall(unsigned argc, int32_t *args)
|
||||||
auto cls = PClass::FindClass(clsname);
|
auto cls = PClass::FindClass(clsname);
|
||||||
if (!cls)
|
if (!cls)
|
||||||
{
|
{
|
||||||
I_Error("ACS call to unknown class in script function %s.%s", cls, funcname);
|
I_Error("ACS call to unknown class in script function %s.%s", clsname, funcname);
|
||||||
}
|
}
|
||||||
auto funcsym = dyn_cast<PFunction>(cls->Symbols.FindSymbol(funcname, true));
|
auto funcsym = dyn_cast<PFunction>(cls->Symbols.FindSymbol(funcname, true));
|
||||||
if (funcsym == nullptr)
|
if (funcsym == nullptr)
|
||||||
{
|
{
|
||||||
I_Error("ACS call to unknown script function %s.%s", cls, funcname);
|
I_Error("ACS call to unknown script function %s.%s", clsname, funcname);
|
||||||
}
|
}
|
||||||
auto func = funcsym->Variants[0].Implementation;
|
auto func = funcsym->Variants[0].Implementation;
|
||||||
if (func->ImplicitArgs > 0)
|
if (func->ImplicitArgs > 0)
|
||||||
{
|
{
|
||||||
I_Error("ACS call to non-static script function %s.%s", cls, funcname);
|
I_Error("ACS call to non-static script function %s.%s", clsname, funcname);
|
||||||
}
|
}
|
||||||
TArray<VMValue> params;
|
TArray<VMValue> params;
|
||||||
for (unsigned i = 2; i < argc; i++)
|
for (unsigned i = 2; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (func->Proto->ArgumentTypes.Size() < i - 1)
|
if (func->Proto->ArgumentTypes.Size() < i - 1)
|
||||||
{
|
{
|
||||||
I_Error("Too many parameters in call to %s.%s", cls, funcname);
|
I_Error("Too many parameters in call to %s.%s", clsname, funcname);
|
||||||
}
|
}
|
||||||
auto argtype = func->Proto->ArgumentTypes[i - 2];
|
auto argtype = func->Proto->ArgumentTypes[i - 2];
|
||||||
// The only types allowed are int, bool, double, Name, Sound, Color and String
|
// The only types allowed are int, bool, double, Name, Sound, Color and String
|
||||||
|
@ -4812,7 +4812,7 @@ static int ScriptCall(unsigned argc, int32_t *args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
I_Error("Invalid type %s in call to %s.%s", argtype->DescriptiveName(), cls, funcname);
|
I_Error("Invalid type %s in call to %s.%s", argtype->DescriptiveName(), clsname, funcname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (func->Proto->ArgumentTypes.Size() > params.Size())
|
if (func->Proto->ArgumentTypes.Size() > params.Size())
|
||||||
|
@ -4820,7 +4820,7 @@ static int ScriptCall(unsigned argc, int32_t *args)
|
||||||
// Check if we got enough parameters. That means we either cover the full argument list of the function or the next argument is optional.
|
// Check if we got enough parameters. That means we either cover the full argument list of the function or the next argument is optional.
|
||||||
if (!(funcsym->Variants[0].ArgFlags[params.Size()] & VARF_Optional))
|
if (!(funcsym->Variants[0].ArgFlags[params.Size()] & VARF_Optional))
|
||||||
{
|
{
|
||||||
I_Error("Insufficient parameters in call to %s.%s", cls, funcname);
|
I_Error("Insufficient parameters in call to %s.%s", clsname, funcname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The return value can be the same types as the parameter types, plus void
|
// The return value can be the same types as the parameter types, plus void
|
||||||
|
|
|
@ -613,7 +613,7 @@ void ZCCCompiler::CreateClassTypes()
|
||||||
//
|
//
|
||||||
static int incompatible[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope };
|
static int incompatible[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope };
|
||||||
int incompatiblecnt = 0;
|
int incompatiblecnt = 0;
|
||||||
for (int k = 0; k < countof(incompatible); k++)
|
for (size_t k = 0; k < countof(incompatible); k++)
|
||||||
if (incompatible[k] & c->cls->Flags) incompatiblecnt++;
|
if (incompatible[k] & c->cls->Flags) incompatiblecnt++;
|
||||||
|
|
||||||
if (incompatiblecnt > 1)
|
if (incompatiblecnt > 1)
|
||||||
|
@ -1117,7 +1117,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
|
||||||
static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope };
|
static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope };
|
||||||
int excludeflags = 0;
|
int excludeflags = 0;
|
||||||
int fc = 0;
|
int fc = 0;
|
||||||
for (int i = 0; i < countof(excludescope); i++)
|
for (size_t i = 0; i < countof(excludescope); i++)
|
||||||
{
|
{
|
||||||
if (field->Flags & excludescope[i])
|
if (field->Flags & excludescope[i])
|
||||||
{
|
{
|
||||||
|
@ -2176,7 +2176,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
||||||
static int exclude[] = { ZCC_Virtual, ZCC_Override, ZCC_Action, ZCC_Static };
|
static int exclude[] = { ZCC_Virtual, ZCC_Override, ZCC_Action, ZCC_Static };
|
||||||
int excludeflags = 0;
|
int excludeflags = 0;
|
||||||
int fc = 0;
|
int fc = 0;
|
||||||
for (int i = 0; i < countof(exclude); i++)
|
for (size_t i = 0; i < countof(exclude); i++)
|
||||||
{
|
{
|
||||||
if (f->Flags & exclude[i])
|
if (f->Flags & exclude[i])
|
||||||
{
|
{
|
||||||
|
@ -2213,7 +2213,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
||||||
static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope, ZCC_VirtualScope };
|
static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope, ZCC_VirtualScope };
|
||||||
excludeflags = 0;
|
excludeflags = 0;
|
||||||
fc = 0;
|
fc = 0;
|
||||||
for (int i = 0; i < countof(excludescope); i++)
|
for (size_t i = 0; i < countof(excludescope); i++)
|
||||||
{
|
{
|
||||||
if (f->Flags & excludescope[i])
|
if (f->Flags & excludescope[i])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue