Explicitly disable certain warnings in code

This code is good as-is, they cannot be adjusted to suppress the warnings while still guaranteeing its functionality.
This commit is contained in:
Kawe Mazidjatari 2023-04-03 14:55:16 +02:00
parent d620a7efe8
commit fe0cce731b
4 changed files with 14 additions and 0 deletions

View File

@ -75,11 +75,16 @@ void CHostState::FrameUpdate(CHostState* pHostState, double flCurrentTime, float
#endif // !DEDICATED
HostStates_t oldState{};
// Disable "warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable"
#pragma warning(push)
#pragma warning(disable : 4611)
if (setjmp(*host_abortserver))
{
g_pHostState->Init();
return;
}
#pragma warning(pop)
else
{
#ifndef CLIENT_DLL

View File

@ -144,7 +144,10 @@ bool CSigCache::LoadCache(const string& svCacheFile)
return false;
}
#pragma warning(push) // Disabled type conversion warning, as it is possible
#pragma warning(disable : 4244) // for Protobuf to migrate this code to feature size_t.
if (!m_Cache.ParseFromArray(pDstBuf.get(), header.m_nBlobSizeMem))
#pragma warning(pop)
{
return false;
}

View File

@ -34,7 +34,10 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...)
eDLL_T remoteContext;
// We use the sqvm pointer as index for SDK usage as the function prototype has to match assembly.
// The compiler 'pointer truncation' warning couldn't be avoided, but it's safe to ignore it.
#pragma warning(push)
#pragma warning(disable : 4302 4311)
switch (static_cast<SQCONTEXT>(reinterpret_cast<int>(v)))
#pragma warning(pop)
{
case SQCONTEXT::SERVER:
remoteContext = eDLL_T::SCRIPT_SERVER;

View File

@ -629,8 +629,11 @@ V_MakeAbsolutePath(char* pOut, size_t outLen, const char* pPath, const char* pSt
}
#else
{
#pragma warning(push) // Disabled type conversion warning, as some implementations of '_getcwd' take a size_t.
#pragma warning(disable : 4267)
if (!_getcwd(pOut, outLen))
Error(eDLL_T::COMMON, EXIT_FAILURE, "V_MakeAbsolutePath: _getcwd failed.");
#pragma warning(pop)
}
#endif