From 859447ee690a3436f0d093c37fbcaea6a717a857 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Sun, 7 Jun 2020 14:47:49 +1000 Subject: [PATCH] Hiding squirrel compiler warnings when building vscript (fixes #14) --- sp/src/vscript/vscript.vpc | 54 +++++++++++++++++------------ sp/src/vscript/vscript_squirrel.cpp | 4 +-- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/sp/src/vscript/vscript.vpc b/sp/src/vscript/vscript.vpc index cdb28391..1d660ccc 100644 --- a/sp/src/vscript/vscript.vpc +++ b/sp/src/vscript/vscript.vpc @@ -13,9 +13,6 @@ $Configuration $Compiler { $AdditionalIncludeDirectories "$BASE;.\squirrel\include" - - // Squirrel third party library is full of warnings, so we disable warnings as errors - $TreatWarningsAsErrors "No" } } @@ -29,26 +26,37 @@ $Project "VScript" $Folder "squirrel" { - $File ".\squirrel\sqstdlib\sqstdaux.cpp" - $File ".\squirrel\sqstdlib\sqstdblob.cpp" - $File ".\squirrel\sqstdlib\sqstdio.cpp" - $File ".\squirrel\sqstdlib\sqstdmath.cpp" - $File ".\squirrel\sqstdlib\sqstdrex.cpp" - $File ".\squirrel\sqstdlib\sqstdstream.cpp" - $File ".\squirrel\sqstdlib\sqstdstring.cpp" - $File ".\squirrel\sqstdlib\sqstdsystem.cpp" - $File ".\squirrel\squirrel\sqapi.cpp" - $File ".\squirrel\squirrel\sqbaselib.cpp" - $File ".\squirrel\squirrel\sqclass.cpp" - $File ".\squirrel\squirrel\sqcompiler.cpp" - $File ".\squirrel\squirrel\sqdebug.cpp" - $File ".\squirrel\squirrel\sqfuncstate.cpp" - $File ".\squirrel\squirrel\sqlexer.cpp" - $File ".\squirrel\squirrel\sqmem.cpp" - $File ".\squirrel\squirrel\sqobject.cpp" - $File ".\squirrel\squirrel\sqstate.cpp" - $File ".\squirrel\squirrel\sqtable.cpp" - $File ".\squirrel\squirrel\sqvm.cpp" + $File ".\squirrel\sqstdlib\sqstdaux.cpp" \ + ".\squirrel\sqstdlib\sqstdblob.cpp" \ + ".\squirrel\sqstdlib\sqstdio.cpp" \ + ".\squirrel\sqstdlib\sqstdmath.cpp" \ + ".\squirrel\sqstdlib\sqstdrex.cpp" \ + ".\squirrel\sqstdlib\sqstdstream.cpp" \ + ".\squirrel\sqstdlib\sqstdstring.cpp" \ + ".\squirrel\sqstdlib\sqstdsystem.cpp" \ + ".\squirrel\squirrel\sqapi.cpp" \ + ".\squirrel\squirrel\sqbaselib.cpp" \ + ".\squirrel\squirrel\sqclass.cpp" \ + ".\squirrel\squirrel\sqcompiler.cpp" \ + ".\squirrel\squirrel\sqdebug.cpp" \ + ".\squirrel\squirrel\sqfuncstate.cpp" \ + ".\squirrel\squirrel\sqlexer.cpp" \ + ".\squirrel\squirrel\sqmem.cpp" \ + ".\squirrel\squirrel\sqobject.cpp" \ + ".\squirrel\squirrel\sqstate.cpp" \ + ".\squirrel\squirrel\sqtable.cpp" \ + ".\squirrel\squirrel\sqvm.cpp" + { + $Configuration + { + $Compiler + { + // Squirrel third party library is full of warnings + $AdditionalOptions "$BASE /wd4100 /wd4611 /wd4127 /wd4244 /wd4702 /wd4706 /wd4800" + $TreatWarningsAsErrors "No" + } + } + } } } } diff --git a/sp/src/vscript/vscript_squirrel.cpp b/sp/src/vscript/vscript_squirrel.cpp index abb4febe..7026e991 100644 --- a/sp/src/vscript/vscript_squirrel.cpp +++ b/sp/src/vscript/vscript_squirrel.cpp @@ -802,7 +802,7 @@ bool getVariant(HSQUIRRELVM vm, SQInteger idx, ScriptVariant_t& variant) { return false; } - variant = (bool)val; + variant = val ? true : false; return true; } case OT_STRING: @@ -911,7 +911,7 @@ SQInteger function_stub(HSQUIRRELVM vm) SQBool val = 0; if (SQ_FAILED(sq_getbool(vm, i + 2, &val))) return sq_throwerror(vm, "Expected bool"); - params[i] = (bool)val; + params[i] = val ? true : false; break; } case FIELD_CHARACTER: