From d8cee4d3a5867525f6661f2fac3ea20586b467cf Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 4 Mar 2017 12:17:53 +0200 Subject: [PATCH] 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] --- src/p_acs.cpp | 12 ++++++------ src/scripting/zscript/zcc_compile.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 027b614ea..8c2859479 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4765,24 +4765,24 @@ static int ScriptCall(unsigned argc, int32_t *args) auto cls = PClass::FindClass(clsname); 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(cls->Symbols.FindSymbol(funcname, true)); 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; 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 params; for (unsigned i = 2; i < argc; i++) { 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]; // 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 { - 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()) @@ -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. 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 diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 1f7e66442..d1cb78282 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -613,7 +613,7 @@ void ZCCCompiler::CreateClassTypes() // static int incompatible[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope }; 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 (incompatiblecnt > 1) @@ -1117,7 +1117,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray &Fiel static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope }; int excludeflags = 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]) { @@ -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 }; int excludeflags = 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]) { @@ -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 }; excludeflags = 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]) {