1
0
forked from mirrors/0ad

Remove UNUSED

The `UNUSED` macro is used to mark a variable as unused but with a name.
Those usages are replaced with comments so that `UNUSED` can be removed.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
This commit is contained in:
phosit
2025-06-03 14:13:41 +02:00
committed by phosit
parent dd26f3a802
commit 891908b801
127 changed files with 355 additions and 340 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ int MikkTSpace::GetNumFaces(const SMikkTSpaceContext* pContext)
return GetUserDataFromContext(pContext)->m_Model->GetNumFaces();
}
int MikkTSpace::GetNumVerticesOfFace(const SMikkTSpaceContext*, const int UNUSED(iFace))
int MikkTSpace::GetNumVerticesOfFace(const SMikkTSpaceContext*, const int /*iFace*/)
{
return 3;
}
@@ -91,7 +91,7 @@ void MikkTSpace::GetTexCoord(const SMikkTSpaceContext* pContext,
void MikkTSpace::SetTSpace(const SMikkTSpaceContext* pContext, const float* fvTangent,
const float* UNUSED(fvBiTangent), const float UNUSED(fMagS), const float UNUSED(fMagT),
const float* /*fvBiTangent*/, const float /*fMagS*/, const float /*fMagT*/,
const tbool bIsOrientationPreserving, const int iFace, const int iVert)
{
const MikkTSpace* userData = GetUserDataFromContext(pContext);
+3 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -113,8 +113,8 @@ private:
* @param[in] iVert - Array containing the position vector of the face.
*/
static void SetTSpace(const SMikkTSpaceContext* pContext, const float* fvTangent,
const float* UNUSED(fvBiTangent), const float UNUSED(fMagS), const float UNUSED(fMagT),
const tbool bIsOrientationPreserving, const int iFace, const int iVert);
const float* /*fvBiTangent*/, const float /*fMagS*/, const float /*fMagT*/,
const tbool bIsOrientationPreserving, const int iFace, const int iVert);
};
+1 -1
View File
@@ -225,7 +225,7 @@ CStr CRendererStatsTable::GetCellText(size_t row, size_t col)
}
}
AbstractProfileTable* CRendererStatsTable::GetChild(size_t UNUSED(row))
AbstractProfileTable* CRendererStatsTable::GetChild(size_t /*row*/)
{
return 0;
}
+1 -1
View File
@@ -271,7 +271,7 @@ void CSceneRenderer::Initialize()
}
// resize renderer view
void CSceneRenderer::Resize(int UNUSED(width), int UNUSED(height))
void CSceneRenderer::Resize(int /*width*/, int /*height*/)
{
// need to recreate the shadow map object to resize the shadow texture
m->shadow.RecreateTexture();
+2 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2023 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -49,8 +49,7 @@ public:
virtual void RenderBeforeWater(Renderer::Backend::IDeviceCommandContext*) { }
virtual void RenderAfterWater(Renderer::Backend::IDeviceCommandContext*, int UNUSED(cullGroup)) { }
virtual void RenderAfterWater(Renderer::Backend::IDeviceCommandContext*, int /*cullGroup*/) { }
/**
* Draw all ITerrainOverlay objects that exist
* and that should be drawn before water.
+7 -6
View File
@@ -92,9 +92,10 @@ std::unique_ptr<IVertexInputLayout> CDevice::CreateVertexInputLayout(
}
std::unique_ptr<ITexture> CDevice::CreateTexture(
const char* UNUSED(name), const CTexture::Type type, const uint32_t usage,
const char* /*name*/, const CTexture::Type type, const uint32_t usage,
const Format format, const uint32_t width, const uint32_t height,
const Sampler::Desc& UNUSED(defaultSamplerDesc), const uint32_t MIPLevelCount, const uint32_t UNUSED(sampleCount))
const Sampler::Desc& /*defaultSamplerDesc*/, const uint32_t MIPLevelCount,
const uint32_t /*sampleCount*/)
{
return CTexture::Create(this, type, usage, format, width, height, MIPLevelCount);
}
@@ -144,7 +145,7 @@ void CDevice::Present()
// We have nothing to present.
}
void CDevice::OnWindowResize(const uint32_t UNUSED(width), const uint32_t UNUSED(height))
void CDevice::OnWindowResize(const uint32_t /*width*/, const uint32_t /*height*/)
{
}
@@ -169,16 +170,16 @@ uint32_t CDevice::AllocateQuery()
return 0;
}
void CDevice::FreeQuery(const uint32_t UNUSED(handle))
void CDevice::FreeQuery(const uint32_t /*handle*/)
{
}
bool CDevice::IsQueryResultAvailable(const uint32_t UNUSED(handle)) const
bool CDevice::IsQueryResultAvailable(const uint32_t /*handle*/) const
{
return false;
}
uint64_t CDevice::GetQueryResult(const uint32_t UNUSED(handle))
uint64_t CDevice::GetQueryResult(const uint32_t /*handle*/)
{
return 0;
}
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -47,7 +47,7 @@ IDevice* CShaderProgram::GetDevice()
return m_Device;
}
int32_t CShaderProgram::GetBindingSlot(const CStrIntern UNUSED(name)) const
int32_t CShaderProgram::GetBindingSlot(const CStrIntern /*name*/) const
{
return -1;
}
+2 -2
View File
@@ -117,7 +117,7 @@ std::vector<std::string> GetExtensionsImpl()
void GLAD_API_PTR OnDebugMessage(
GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei UNUSED(length), const GLchar* message, const void* UNUSED(user_param))
GLsizei /*length*/, const GLchar* message, const void* /*user_param*/)
{
std::string debugSource = "unknown";
std::string debugType = "unknown";
@@ -1081,7 +1081,7 @@ bool CDevice::IsFramebufferFormatSupported(const Format format) const
}
Format CDevice::GetPreferredDepthStencilFormat(
const uint32_t UNUSED(usage), const bool depth, const bool stencil) const
const uint32_t /*usage*/, const bool depth, const bool stencil) const
{
ENSURE(depth || stencil);
if (stencil)
@@ -488,7 +488,7 @@ void CDeviceCommandContext::UploadBufferRegion(
UploadDynamicBufferRegionImpl(target, buffer->GetSize(), dataOffset, dataSize, uploadFunction);
}
void CDeviceCommandContext::InsertTimestampQuery(const uint32_t handle, const bool UNUSED(isScopeBegin))
void CDeviceCommandContext::InsertTimestampQuery(const uint32_t handle, const bool /*isScopeBegin*/)
{
// GL can have the only one command context so we can call commands on
// the deivce side.
@@ -1293,7 +1293,7 @@ void CDeviceCommandContext::Dispatch(
}
void CDeviceCommandContext::InsertMemoryBarrier(
const uint32_t UNUSED(srcStageMask), const uint32_t dstStageMask,
const uint32_t /*srcStageMask*/, const uint32_t dstStageMask,
const uint32_t srcAccessMask, const uint32_t dstAccessMask)
{
#if !CONFIG2_GLES
+9 -9
View File
@@ -457,7 +457,7 @@ public:
return textureUnit;
}
GLuint GetStorageBuffer(const int32_t UNUSED(bindingSlot)) override
GLuint GetStorageBuffer(const int32_t /*bindingSlot*/) override
{
debug_warn("ARB shaders don't support storage buffers.");
return 0;
@@ -1517,23 +1517,23 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
// These should all be overridden by CShaderProgramGLSL
// (GLES doesn't support any other types of shader program):
void CShaderProgram::VertexPointer(const Renderer::Backend::Format, GLsizei UNUSED(stride),
const void* UNUSED(pointer))
void CShaderProgram::VertexPointer(const Renderer::Backend::Format, GLsizei /*stride*/,
const void* /*pointer*/)
{
debug_warn("CShaderProgram::VertexPointer should be overridden");
}
void CShaderProgram::NormalPointer(const Renderer::Backend::Format, GLsizei UNUSED(stride),
const void* UNUSED(pointer))
void CShaderProgram::NormalPointer(const Renderer::Backend::Format, GLsizei /*stride*/,
const void* /*pointer*/)
{
debug_warn("CShaderProgram::NormalPointer should be overridden");
}
void CShaderProgram::ColorPointer(const Renderer::Backend::Format, GLsizei UNUSED(stride),
const void* UNUSED(pointer))
void CShaderProgram::ColorPointer(const Renderer::Backend::Format, GLsizei /*stride*/,
const void* /*pointer*/)
{
debug_warn("CShaderProgram::ColorPointer should be overridden");
}
void CShaderProgram::TexCoordPointer(GLenum UNUSED(texture), const Renderer::Backend::Format,
GLsizei UNUSED(stride), const void* UNUSED(pointer))
void CShaderProgram::TexCoordPointer(GLenum /*texture*/, const Renderer::Backend::Format,
GLsizei /*stride*/, const void* /*pointer*/)
{
debug_warn("CShaderProgram::TexCoordPointer should be overridden");
}
+1 -1
View File
@@ -131,7 +131,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* callbackData,
void* UNUSED(userData))
void* /*userData*/)
{
if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) || (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT))
LOGMESSAGE("Vulkan: %s", callbackData->pMessage);
@@ -876,7 +876,7 @@ void CDeviceCommandContext::DrawIndexedInstanced(
void CDeviceCommandContext::DrawIndexedInRange(
const uint32_t firstIndex, const uint32_t indexCount,
const uint32_t UNUSED(start), const uint32_t UNUSED(end))
const uint32_t /*start*/, const uint32_t /*end*/)
{
DrawIndexed(firstIndex, indexCount, 0);
}
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -157,7 +157,7 @@ void CRingCommandContext::ScheduleUpload(
}
void CRingCommandContext::ScheduleUpload(
CTexture* texture, const Format UNUSED(dataFormat),
CTexture* texture, const Format /*dataFormat*/,
const void* data, const size_t dataSize,
const uint32_t xOffset, const uint32_t yOffset,
const uint32_t width, const uint32_t height,