From ae431c6ac2a67f88c03f752d66a171ccbac1395c Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 2 Apr 2023 17:02:04 +0200 Subject: [PATCH] /W4: Fix unreferenced symbol warnings Fix verbose unreferenced symbol warnings. --- r5dev/core/dllmain.cpp | 5 +++- r5dev/engine/cmodel_bsp.cpp | 4 +-- r5dev/engine/common.cpp | 8 +----- r5dev/gameui/IConsole.cpp | 3 ++- r5dev/mathlib/halton.cpp | 2 +- r5dev/mathlib/halton.h | 1 - r5dev/mathlib/mathlib.h | 2 +- r5dev/mathlib/vector.h | 4 +-- r5dev/public/engine/IEngineTrace.h | 14 +++++----- r5dev/public/networkvar.cpp | 2 +- r5dev/thirdparty/detours/include/idetour.h | 4 +-- r5dev/tier0/dbg.cpp | 30 ++++++++++++++++++---- r5dev/tier0/dbg.h | 17 ++++++------ 13 files changed, 57 insertions(+), 39 deletions(-) diff --git a/r5dev/core/dllmain.cpp b/r5dev/core/dllmain.cpp index 6235b58a..cf7135f8 100644 --- a/r5dev/core/dllmain.cpp +++ b/r5dev/core/dllmain.cpp @@ -93,8 +93,11 @@ void SDK_Shutdown() // ENTRYPOINT //############################################################################# -BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) +BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) { + NOTE_UNUSED(hModule); + NOTE_UNUSED(lpReserved); + #if !defined (DEDICATED) && !defined (CLIENT_DLL) // This dll is imported by the game executable, we cannot circumvent it. // To solve the recursive init problem, we check if -noworkerdll is passed. diff --git a/r5dev/engine/cmodel_bsp.cpp b/r5dev/engine/cmodel_bsp.cpp index 13e4422b..68b10868 100644 --- a/r5dev/engine/cmodel_bsp.cpp +++ b/r5dev/engine/cmodel_bsp.cpp @@ -341,10 +341,10 @@ void Mod_ProcessPakQueue() *(_DWORD*)v15 = g_pakLoadApi->LoadAsync(v17, g_pMallocPool, 4, 0); if (strcmp(v17, "common_mp.rpak") == 0 || strcmp(v17, "common_sp.rpak") == 0 || strcmp(v17, "common_pve.rpak") == 0) - RPakHandle_t pakHandle = g_pakLoadApi->LoadAsync("common_sdk.rpak", g_pMallocPool, 4, 0); + g_pakLoadApi->LoadAsync("common_sdk.rpak", g_pMallocPool, 4, 0); #ifndef DEDICATED if (strcmp(v17, "ui_mp.rpak") == 0) - RPakHandle_t pakHandle = g_pakLoadApi->LoadAsync("ui_sdk.rpak", g_pMallocPool, 4, 0); + g_pakLoadApi->LoadAsync("ui_sdk.rpak", g_pMallocPool, 4, 0); #endif // !DEDICATED LABEL_37: diff --git a/r5dev/engine/common.cpp b/r5dev/engine/common.cpp index 4e0a5fcb..c43aaf9e 100644 --- a/r5dev/engine/common.cpp +++ b/r5dev/engine/common.cpp @@ -10,16 +10,10 @@ /* ============================== -COM_ExplainDisconnection +COM_FormatSeconds ============================== */ -void* HCOM_ExplainDisconnection(void* unused, const char* fmt, ...) -{ - // !TODO: rebuild. - return nullptr; -} - const char* COM_FormatSeconds(int seconds) { static char string[64]; diff --git a/r5dev/gameui/IConsole.cpp b/r5dev/gameui/IConsole.cpp index e612fc98..6bcbb849 100644 --- a/r5dev/gameui/IConsole.cpp +++ b/r5dev/gameui/IConsole.cpp @@ -773,10 +773,11 @@ bool CConsole::LoadFlagIcons(void) m_vFlagIcons.push_back(MODULERESOURCE(GetModuleResource(i))); MODULERESOURCE& rFlagIcon = m_vFlagIcons[k]; - ret = LoadTextureBuffer(reinterpret_cast(rFlagIcon.m_pData), + ret = LoadTextureBuffer(reinterpret_cast(rFlagIcon.m_pData), // !TODO: Fall-back texture. static_cast(rFlagIcon.m_nSize), &rFlagIcon.m_idIcon, &rFlagIcon.m_nWidth, &rFlagIcon.m_nHeight); IM_ASSERT(ret); + NOTE_UNUSED(ret); } return ret; } diff --git a/r5dev/mathlib/halton.cpp b/r5dev/mathlib/halton.cpp index e16a556b..5f978b1e 100644 --- a/r5dev/mathlib/halton.cpp +++ b/r5dev/mathlib/halton.cpp @@ -19,7 +19,7 @@ HaltonSequenceGenerator_t::HaltonSequenceGenerator_t(int b) } -float HaltonSequenceGenerator_t::GetElement(int elem) +float HaltonSequenceGenerator_t::GetElement(int /*elem*/) { int tmpseed = seed; float ret = 0.0f; diff --git a/r5dev/mathlib/halton.h b/r5dev/mathlib/halton.h index dc8715ff..4fa2b56c 100644 --- a/r5dev/mathlib/halton.h +++ b/r5dev/mathlib/halton.h @@ -35,7 +35,6 @@ public: { return GetElement(seed++); } - }; diff --git a/r5dev/mathlib/mathlib.h b/r5dev/mathlib/mathlib.h index cc407ef4..13b95bda 100644 --- a/r5dev/mathlib/mathlib.h +++ b/r5dev/mathlib/mathlib.h @@ -2336,7 +2336,7 @@ float CalcDistanceToLineSegment2D(Vector2D const& P, Vector2D const& vLineA, Vec float CalcDistanceSqrToLineSegment2D(Vector2D const& P, Vector2D const& vLineA, Vector2D const& vLineB, float* t = 0); // Init the mathlib -void MathLib_Init(float gamma = 2.2f, float texGamma = 2.2f, float brightness = 0.0f, int overbright = 2.0f, bool bAllow3DNow = true, bool bAllowSSE = true, bool bAllowSSE2 = true, bool bAllowMMX = true); +void MathLib_Init(float gamma = 2.2f, float texGamma = 2.2f, float brightness = 0.0f, int overbright = 2.0f); bool MathLib_MMXEnabled(void); bool MathLib_SSEEnabled(void); bool MathLib_SSE2Enabled(void); diff --git a/r5dev/mathlib/vector.h b/r5dev/mathlib/vector.h index 981ddfb9..85d2c6bd 100644 --- a/r5dev/mathlib/vector.h +++ b/r5dev/mathlib/vector.h @@ -1782,7 +1782,7 @@ inline Vector3D RandomVector(float minVal, float maxVal) //----------------------------------------------------------------------------- // Helper debugging stuff.... //----------------------------------------------------------------------------- - +/* inline bool operator==(float const* f, const Vector3D& v) { // AIIIEEEE!!!! @@ -1810,7 +1810,7 @@ inline bool operator!=(const Vector3D& v, float const* f) Assert(0); return false; } - +*/ // return a vector perpendicular to another, with smooth variation. The difference between this and // something like VectorVectors is that there are now discontinuities. _unlike_ VectorVectors, diff --git a/r5dev/public/engine/IEngineTrace.h b/r5dev/public/engine/IEngineTrace.h index 61e42076..bf30674d 100644 --- a/r5dev/public/engine/IEngineTrace.h +++ b/r5dev/public/engine/IEngineTrace.h @@ -33,18 +33,18 @@ abstract_class ITraceFilter { public: virtual ~ITraceFilter() {}; - virtual bool ShouldHitEntity(IHandleEntity* pEntity, int contentsMask) { return false; }; - virtual TraceType_t GetTraceType() const { return TRACE_EVERYTHING; }; - virtual bool Unknown() const { return false; }; + virtual bool ShouldHitEntity(IHandleEntity* pEntity, int contentsMask) = 0; + virtual TraceType_t GetTraceType() const = 0; + virtual bool Unknown() const = 0; }; class CTraceFilter : public ITraceFilter { public: - virtual TraceType_t GetTraceType() const - { - return TRACE_EVERYTHING; - } + //virtual TraceType_t GetTraceType() const + //{ + // return TRACE_EVERYTHING; + //} }; //----------------------------------------------------------------------------- diff --git a/r5dev/public/networkvar.cpp b/r5dev/public/networkvar.cpp index 9f61c604..f0c23aaf 100644 --- a/r5dev/public/networkvar.cpp +++ b/r5dev/public/networkvar.cpp @@ -79,7 +79,7 @@ CNetVarTables::Table CNetVarTables::LoadTable(CRecvTable* recvTable) #endif // !DEDICATED #ifndef CLIENT_DLL -CNetVarTables::Table CNetVarTables::LoadTable(SendTable* sendTable) +CNetVarTables::Table CNetVarTables::LoadTable(SendTable* /*sendTable*/) { Table nvTable = Table{}; return nvTable; diff --git a/r5dev/thirdparty/detours/include/idetour.h b/r5dev/thirdparty/detours/include/idetour.h index f5dc7d1a..372443e1 100644 --- a/r5dev/thirdparty/detours/include/idetour.h +++ b/r5dev/thirdparty/detours/include/idetour.h @@ -1,7 +1,7 @@ #ifndef IDETOUR_H #define IDETOUR_H -#define ADDDETOUR(x,y) static std::size_t dummy_reg_##y = AddDetour( new x(), #x ); +#define ADDDETOUR(x,y) static std::size_t dummy_reg_##y = AddDetour( new x() ); #define XREGISTER(x,y) ADDDETOUR(x, y) #define REGISTER(x) XREGISTER(x, __COUNTER__) @@ -31,7 +31,7 @@ class VDetour : public IDetour inline static std::vector g_DetourVector; inline static std::unordered_set g_DetourSet; -inline std::size_t AddDetour(IDetour* pDetour, const char* pszName) +inline std::size_t AddDetour(IDetour* pDetour) { IDetour* pVFTable = reinterpret_cast(pDetour)[0]; auto p = g_DetourSet.insert(pVFTable); // Only register if VFTable isn't already registered. diff --git a/r5dev/tier0/dbg.cpp b/r5dev/tier0/dbg.cpp index faabf842..5102b573 100644 --- a/r5dev/tier0/dbg.cpp +++ b/r5dev/tier0/dbg.cpp @@ -44,34 +44,46 @@ bool HushAsserts() //----------------------------------------------------------------------------- // Templates to assist in validating pointers: //----------------------------------------------------------------------------- -PLATFORM_INTERFACE void _AssertValidReadPtr(void* ptr, int count/* = 1*/) +/*PLATFORM_INTERFACE*/ void _AssertValidReadPtr(void* ptr, int count/* = 1*/) { #if defined( _WIN32 ) && !defined( _X360 ) Assert(!IsBadReadPtr(ptr, count)); #else Assert(!count || ptr); #endif +#ifdef NDEBUG + NOTE_UNUSED(ptr); + NOTE_UNUSED(count); +#endif // NDEBUG } -PLATFORM_INTERFACE void _AssertValidWritePtr(void* ptr, int count/* = 1*/) +/*PLATFORM_INTERFACE*/ void _AssertValidWritePtr(void* ptr, int count/* = 1*/) { #if defined( _WIN32 ) && !defined( _X360 ) Assert(!IsBadWritePtr(ptr, count)); #else Assert(!count || ptr); #endif +#ifdef NDEBUG + NOTE_UNUSED(ptr); + NOTE_UNUSED(count); +#endif // NDEBUG } -PLATFORM_INTERFACE void _AssertValidReadWritePtr(void* ptr, int count/* = 1*/) +/*PLATFORM_INTERFACE*/ void _AssertValidReadWritePtr(void* ptr, int count/* = 1*/) { #if defined( _WIN32 ) && !defined( _X360 ) Assert(!(IsBadWritePtr(ptr, count) || IsBadReadPtr(ptr, count))); #else Assert(!count || ptr); #endif +#ifdef NDEBUG + NOTE_UNUSED(ptr); + NOTE_UNUSED(count); +#endif // NDEBUG } -PLATFORM_INTERFACE void _AssertValidStringPtr(const TCHAR* ptr, int maxchar/* = 0xFFFFFF */) +/*PLATFORM_INTERFACE*/ void _AssertValidStringPtr(const TCHAR* ptr, int maxchar/* = 0xFFFFFF */) { #if defined( _WIN32 ) && !defined( _X360 ) #ifdef TCHAR_IS_CHAR @@ -82,15 +94,23 @@ PLATFORM_INTERFACE void _AssertValidStringPtr(const TCHAR* ptr, int maxchar/* = #else Assert(ptr); #endif +#ifdef NDEBUG + NOTE_UNUSED(ptr); + NOTE_UNUSED(maxchar); +#endif // NDEBUG } -PLATFORM_INTERFACE void AssertValidWStringPtr(const wchar_t* ptr, int maxchar/* = 0xFFFFFF */) +/*PLATFORM_INTERFACE*/ void AssertValidWStringPtr(const wchar_t* ptr, int maxchar/* = 0xFFFFFF */) { #if defined( _WIN32 ) && !defined( _X360 ) Assert(!IsBadStringPtrW(ptr, maxchar)); #else Assert(ptr); #endif +#ifdef NDEBUG + NOTE_UNUSED(ptr); + NOTE_UNUSED(maxchar); +#endif // NDEBUG } #if !defined (DEDICATED) && !defined (NETCONSOLE) diff --git a/r5dev/tier0/dbg.h b/r5dev/tier0/dbg.h index 26e80437..cfd53cdf 100644 --- a/r5dev/tier0/dbg.h +++ b/r5dev/tier0/dbg.h @@ -136,10 +136,10 @@ PLATFORM_INTERFACE void Error(eDLL_T context, const UINT code, const char* fmt, // Templates to assist in validating pointers: // Have to use these stubs so we don't have to include windows.h here. -PLATFORM_INTERFACE void _AssertValidReadPtr(void* ptr, int count = 1); -PLATFORM_INTERFACE void _AssertValidWritePtr(void* ptr, int count = 1); -PLATFORM_INTERFACE void _AssertValidReadWritePtr(void* ptr, int count = 1); -PLATFORM_INTERFACE void _AssertValidStringPtr(const TCHAR* ptr, int maxchar); +/*PLATFORM_INTERFACE*/ void _AssertValidReadPtr(void* ptr, int count = 1); +/*PLATFORM_INTERFACE*/ void _AssertValidWritePtr(void* ptr, int count = 1); +/*PLATFORM_INTERFACE*/ void _AssertValidReadWritePtr(void* ptr, int count = 1); +/*PLATFORM_INTERFACE*/ void _AssertValidStringPtr(const TCHAR* ptr, int maxchar); #ifdef DBGFLAG_ASSERT inline void AssertValidStringPtr(const TCHAR* ptr, int maxchar = 0xFFFFFF) { _AssertValidStringPtr(ptr, maxchar); } @@ -150,10 +150,11 @@ template inline void AssertValidReadWritePtr(T* ptr, int count = 1) { _ #else -inline void AssertValidStringPtr(const TCHAR* ptr, int maxchar = 0xFFFFFF) { } -template inline void AssertValidReadPtr(T* ptr, int count = 1) { } -template inline void AssertValidWritePtr(T* ptr, int count = 1) { } -template inline void AssertValidReadWritePtr(T* ptr, int count = 1) { } +inline void AssertValidStringPtr(const TCHAR* /*ptr*/, int maxchar = 0xFFFFFF) { NOTE_UNUSED(maxchar); } +template inline void AssertValidReadPtr(T* /*ptr*/, int count = 1) { NOTE_UNUSED(count); } +template inline void AssertValidWritePtr(T* /*ptr*/, int count = 1) { NOTE_UNUSED(count); } +template inline void AssertValidReadWritePtr(T* /*ptr*/, int count = 1) { NOTE_UNUSED(count); } #define AssertValidThis() #endif + #endif /* DBG_H */