mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Prefer [[maybe_unused]] over UNUSED2
`[[maybe_unused]]` is in the C++ standard.
This commit is contained in:
parent
5be02743fa
commit
eb3f0166f8
27 changed files with 83 additions and 196 deletions
|
|
@ -301,7 +301,7 @@ Status debug_WriteCrashlog(const char* text);
|
|||
* (we do not provide an MFC-style VERIFY macro because the distinction
|
||||
* between ENSURE and VERIFY is unclear. to always run code but only
|
||||
* check for success in debug builds without raising unused-variable warnings,
|
||||
* use ASSERT + UNUSED2.)
|
||||
* use [[maybe_unused]].)
|
||||
**/
|
||||
#define ASSERT(expr) ENSURE(expr)
|
||||
#ifdef NDEBUG
|
||||
|
|
|
|||
|
|
@ -552,17 +552,11 @@ template<class T> bool get_container_info(const T& t, size_t size, size_t el_siz
|
|||
// return number of elements and an iterator (any data it needs is stored in
|
||||
// it_mem, which must hold DEBUG_STL_MAX_ITERATOR_SIZE bytes).
|
||||
// returns 0 on success or an StlContainerError.
|
||||
Status debug_stl_get_container_info(const wchar_t* type_name, const u8* p, size_t size,
|
||||
size_t el_size, size_t* el_count, DebugStlIterator* el_iterator, void* it_mem)
|
||||
Status debug_stl_get_container_info([[maybe_unused]] const wchar_t* type_name, [[maybe_unused]] const u8* p,
|
||||
[[maybe_unused]] size_t size, [[maybe_unused]] size_t el_size, [[maybe_unused]] size_t* el_count,
|
||||
[[maybe_unused]] DebugStlIterator* el_iterator, [[maybe_unused]] void* it_mem)
|
||||
{
|
||||
#if MSC_VERSION
|
||||
UNUSED2(type_name);
|
||||
UNUSED2(p);
|
||||
UNUSED2(size);
|
||||
UNUSED2(el_size);
|
||||
UNUSED2(el_count);
|
||||
UNUSED2(el_iterator);
|
||||
UNUSED2(it_mem);
|
||||
return ERR::STL_CNT_UNSUPPORTED; // NOWARN
|
||||
#else
|
||||
|
||||
|
|
|
|||
|
|
@ -37,14 +37,12 @@
|
|||
class Codec_ZLib : public ICodec
|
||||
{
|
||||
public:
|
||||
u32 UpdateChecksum(u32 checksum, const u8* in, size_t inSize) const
|
||||
u32 UpdateChecksum([[maybe_unused]] u32 checksum, [[maybe_unused]] const u8* in,
|
||||
[[maybe_unused]] size_t inSize) const
|
||||
{
|
||||
#if CODEC_COMPUTE_CHECKSUM
|
||||
return (u32)crc32(checksum, in, (uInt)inSize);
|
||||
#else
|
||||
UNUSED2(checksum);
|
||||
UNUSED2(in);
|
||||
UNUSED2(inSize);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace io {
|
|||
// note that the Windows aio implementation requires buffers, sizes and
|
||||
// offsets to be sector-aligned.
|
||||
|
||||
Status Issue(aiocb& cb, size_t queueDepth)
|
||||
Status Issue(aiocb& cb, [[maybe_unused]] size_t queueDepth)
|
||||
{
|
||||
#if CONFIG2_FILE_ENABLE_AIO
|
||||
if(queueDepth > 1)
|
||||
|
|
@ -49,8 +49,6 @@ Status Issue(aiocb& cb, size_t queueDepth)
|
|||
WARN_RETURN(StatusFromErrno());
|
||||
}
|
||||
else
|
||||
#else
|
||||
UNUSED2(queueDepth);
|
||||
#endif
|
||||
{
|
||||
ENSURE(lseek(cb.aio_fildes, cb.aio_offset, SEEK_SET) == cb.aio_offset);
|
||||
|
|
@ -67,7 +65,7 @@ Status Issue(aiocb& cb, size_t queueDepth)
|
|||
}
|
||||
|
||||
|
||||
Status WaitUntilComplete(aiocb& cb, size_t queueDepth)
|
||||
Status WaitUntilComplete([[maybe_unused]] aiocb& cb, [[maybe_unused]] size_t queueDepth)
|
||||
{
|
||||
#if CONFIG2_FILE_ENABLE_AIO
|
||||
if(queueDepth > 1)
|
||||
|
|
@ -94,9 +92,6 @@ SUSPEND_AGAIN:
|
|||
}
|
||||
cb.aio_nbytes = (size_t)bytesTransferred;
|
||||
}
|
||||
#else
|
||||
UNUSED2(cb);
|
||||
UNUSED2(queueDepth);
|
||||
#endif
|
||||
|
||||
return INFO::OK;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "lib/ogl.h"
|
||||
|
||||
#include "lib/code_annotation.h"
|
||||
#include "lib/config2.h"
|
||||
#include "lib/debug.h"
|
||||
#include "lib/external_libraries/libsdl.h"
|
||||
|
|
@ -518,7 +517,7 @@ bool ogl_Init(void* (load)(const char*))
|
|||
|
||||
void ogl_SetVsyncEnabled(bool enabled)
|
||||
{
|
||||
const int interval = enabled ? 1 : 0;
|
||||
[[maybe_unused]] const int interval = enabled ? 1 : 0;
|
||||
#if !CONFIG2_GLES && OS_WIN
|
||||
if (ogl_HaveExtension("WGL_EXT_swap_control"))
|
||||
wglSwapIntervalEXT(interval);
|
||||
|
|
@ -526,10 +525,6 @@ void ogl_SetVsyncEnabled(bool enabled)
|
|||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
if (GLXVersion && ogl_HaveExtension("GLX_SGI_swap_control"))
|
||||
glXSwapIntervalSGI(interval);
|
||||
#else
|
||||
UNUSED2(interval);
|
||||
#endif
|
||||
#else
|
||||
UNUSED2(interval);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ ApicId GetApicId()
|
|||
regs.eax = 1;
|
||||
// note: CPUID function 1 is always supported, but only processors with
|
||||
// an xAPIC (e.g. P4/Athlon XP) will return a nonzero ID.
|
||||
bool ok = x86_x64::cpuid(®s);
|
||||
ASSERT(ok); UNUSED2(ok);
|
||||
[[maybe_unused]] bool ok = x86_x64::cpuid(®s);
|
||||
ASSERT(ok);
|
||||
const u8 apicId = (u8)bits(regs.ebx, 24, 31);
|
||||
return apicId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,15 +138,15 @@ class TestWdbgSym : public CxxTest::TestSuite
|
|||
char s3;
|
||||
}
|
||||
Small;
|
||||
Small small__ = { 0x55, 0xaa, -1 }; UNUSED2(small__);
|
||||
[[maybe_unused]] Small small__ = { 0x55, 0xaa, -1 };
|
||||
|
||||
struct Large
|
||||
{
|
||||
u8 large_member_u8;
|
||||
std::string large_member_string;
|
||||
double large_member_double;
|
||||
}
|
||||
large = { 0xff, "large struct string", 123456.0 }; UNUSED2(large);
|
||||
};
|
||||
[[maybe_unused]] Large large = { 0xff, "large struct string", 123456.0 };
|
||||
|
||||
|
||||
class Base
|
||||
|
|
@ -235,14 +235,15 @@ class TestWdbgSym : public CxxTest::TestSuite
|
|||
|
||||
// also exercises all basic types because we need to display some values
|
||||
// anyway (to see at a glance whether symbol engine addrs are correct)
|
||||
static void m_test_addrs(int p_int, double p_double, char* p_pchar, uintptr_t p_uintptr)
|
||||
static void m_test_addrs([[maybe_unused]] int p_int, [[maybe_unused]] double p_double,
|
||||
[[maybe_unused]] char* p_pchar, [[maybe_unused]] uintptr_t p_uintptr)
|
||||
{
|
||||
size_t l_uint = 0x1234;
|
||||
bool l_bool = true; UNUSED2(l_bool);
|
||||
wchar_t l_wchars[] = L"wchar string";
|
||||
enum TestEnum { VAL1=1, VAL2=2 } l_enum = VAL1;
|
||||
u8 l_u8s[] = { 1,2,3,4 };
|
||||
void (*l_funcptr)(void) = m_test_stl;
|
||||
[[maybe_unused]] size_t l_uint = 0x1234;
|
||||
[[maybe_unused]] bool l_bool = true;
|
||||
[[maybe_unused]] wchar_t l_wchars[] = L"wchar string";
|
||||
[[maybe_unused]] enum TestEnum { VAL1=1, VAL2=2 } l_enum = VAL1;
|
||||
[[maybe_unused]] u8 l_u8s[] = { 1,2,3,4 };
|
||||
[[maybe_unused]] void (*l_funcptr)(void) = m_test_stl;
|
||||
|
||||
static double s_double = -2.718;
|
||||
static char s_chars[] = {'c','h','a','r','s',0};
|
||||
|
|
@ -262,25 +263,15 @@ class TestWdbgSym : public CxxTest::TestSuite
|
|||
debug_printf("l_enum addr=%p val=%d\n", &l_enum, l_enum);
|
||||
debug_printf("l_u8s addr=%p val=%d\n", &l_u8s, l_u8s);
|
||||
debug_printf("l_funcptr addr=%p val=%p\n", &l_funcptr, l_funcptr);
|
||||
#else
|
||||
UNUSED2(p_uintptr);
|
||||
UNUSED2(p_pchar);
|
||||
UNUSED2(p_double);
|
||||
UNUSED2(p_int);
|
||||
UNUSED2(l_funcptr);
|
||||
UNUSED2(l_enum);
|
||||
UNUSED2(l_uint);
|
||||
UNUSED2(l_u8s);
|
||||
UNUSED2(l_wchars);
|
||||
#endif
|
||||
|
||||
m_test_stl();
|
||||
|
||||
int uninit_int; UNUSED2(uninit_int);
|
||||
float uninit_float; UNUSED2(uninit_float);
|
||||
double uninit_double; UNUSED2(uninit_double);
|
||||
bool uninit_bool; UNUSED2(uninit_bool);
|
||||
HWND uninit_hwnd; UNUSED2(uninit_hwnd);
|
||||
[[maybe_unused]] int uninit_int;
|
||||
[[maybe_unused]] float uninit_float;
|
||||
[[maybe_unused]] double uninit_double;
|
||||
[[maybe_unused]] bool uninit_bool;
|
||||
[[maybe_unused]] HWND uninit_hwnd;
|
||||
}
|
||||
|
||||
#pragma optimize("", on)
|
||||
|
|
|
|||
|
|
@ -473,7 +473,8 @@ bool numa_IsMemoryInterleaved()
|
|||
|
||||
#if 0
|
||||
|
||||
static bool VerifyPages(void* mem, size_t size, size_t pageSize, size_t node)
|
||||
static bool VerifyPages([[maybe_unused]] void* mem, [[maybe_unused]] size_t size,
|
||||
[[maybe_unused]] size_t pageSize, [[maybe_unused]] size_t node)
|
||||
{
|
||||
WUTIL_FUNC(pQueryWorkingSetEx, BOOL, (HANDLE, PVOID, DWORD));
|
||||
WUTIL_IMPORT_KERNEL32(QueryWorkingSetEx, pQueryWorkingSetEx);
|
||||
|
|
@ -510,11 +511,6 @@ static bool VerifyPages(void* mem, size_t size, size_t pageSize, size_t node)
|
|||
}
|
||||
|
||||
delete[] wsi;
|
||||
#else
|
||||
UNUSED2(mem);
|
||||
UNUSED2(size);
|
||||
UNUSED2(pageSize);
|
||||
UNUSED2(node);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -146,15 +146,13 @@ public: \
|
|||
size_t _nm::GetSerializedLength() const \
|
||||
{ \
|
||||
size_t ret=_base::GetSerializedLength(); \
|
||||
const _nm *thiz=this;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const _nm *thiz=this;
|
||||
|
||||
#define NMT_START_ARRAY(_nm) \
|
||||
std::vector <ARRAY_STRUCT_PREFIX(_nm)>::const_iterator it=_nm.begin(); \
|
||||
while (it != _nm.end()) \
|
||||
{ \
|
||||
const ARRAY_STRUCT_PREFIX(_nm) *thiz=&*it;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const ARRAY_STRUCT_PREFIX(_nm) *thiz=&*it;
|
||||
|
||||
#define NMT_END_ARRAY() \
|
||||
++it; \
|
||||
|
|
@ -191,15 +189,13 @@ u8 *_nm::Serialize(u8 *buffer) const \
|
|||
{ \
|
||||
/*printf("In " #_nm "::Serialize()\n");*/ \
|
||||
u8 *pos=_base::Serialize(buffer); \
|
||||
const _nm *thiz=this;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const _nm *thiz=this;
|
||||
|
||||
#define NMT_START_ARRAY(_nm) \
|
||||
std::vector <ARRAY_STRUCT_PREFIX(_nm)>::const_iterator it=_nm.begin(); \
|
||||
while (it != _nm.end()) \
|
||||
{ \
|
||||
const ARRAY_STRUCT_PREFIX(_nm) *thiz=&*it;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const ARRAY_STRUCT_PREFIX(_nm) *thiz=&*it;
|
||||
|
||||
#define NMT_END_ARRAY() \
|
||||
++it; \
|
||||
|
|
@ -239,16 +235,15 @@ const u8 *_nm::Deserialize(const u8 *pos, const u8 *end) \
|
|||
{ \
|
||||
pos=_base::Deserialize(pos, end); \
|
||||
if (pos == NULL) BAIL_DESERIALIZER;\
|
||||
_nm *thiz=this; \
|
||||
/*printf("In Deserialize" #_nm "\n"); */\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] _nm *thiz=this; \
|
||||
/*printf("In Deserialize" #_nm "\n"); */
|
||||
|
||||
|
||||
#define NMT_START_ARRAY(_nm) \
|
||||
while (pos < end) \
|
||||
{ \
|
||||
ARRAY_STRUCT_PREFIX(_nm) *thiz=&*_nm.insert(_nm.end(), ARRAY_STRUCT_PREFIX(_nm)());\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] ARRAY_STRUCT_PREFIX(_nm) *thiz = \
|
||||
&*_nm.insert(_nm.end(), ARRAY_STRUCT_PREFIX(_nm)());
|
||||
|
||||
#define NMT_END_ARRAY() \
|
||||
}
|
||||
|
|
@ -289,8 +284,7 @@ CStr _nm::ToString() const \
|
|||
CStr _nm::ToStringRaw() const \
|
||||
{ \
|
||||
CStr ret; \
|
||||
const _nm *thiz=this;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const _nm *thiz=this;
|
||||
|
||||
#define START_NMT_CLASS_DERIVED(_base, _nm, _tp) \
|
||||
CStr _nm::ToString() const \
|
||||
|
|
@ -301,8 +295,7 @@ CStr _nm::ToString() const \
|
|||
CStr _nm::ToStringRaw() const \
|
||||
{ \
|
||||
CStr ret=_base::ToStringRaw() + ", "; \
|
||||
const _nm *thiz=this;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const _nm *thiz=this;
|
||||
|
||||
#define NMT_START_ARRAY(_nm) \
|
||||
ret+=#_nm ": { "; \
|
||||
|
|
@ -310,8 +303,7 @@ CStr _nm::ToStringRaw() const \
|
|||
while (it != _nm.end()) \
|
||||
{ \
|
||||
ret+=" { "; \
|
||||
const ARRAY_STRUCT_PREFIX(_nm) *thiz=&*it;\
|
||||
UNUSED2(thiz); // preempt any "unused" warning
|
||||
[[maybe_unused]] const ARRAY_STRUCT_PREFIX(_nm) *thiz=&*it;
|
||||
|
||||
#define NMT_END_ARRAY() \
|
||||
++it; \
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void Put(const char* name, const u8* data, size_t len)
|
||||
void Put([[maybe_unused]] const char* name, const u8* data, size_t len)
|
||||
{
|
||||
#if DEBUG_SERIALIZER_ANNOTATE
|
||||
std::string tag = "<";
|
||||
|
|
@ -54,8 +54,6 @@ public:
|
|||
tag.append(">");
|
||||
memcpy(m_Buffer, tag.c_str(), tag.length());
|
||||
m_Buffer += tag.length();
|
||||
#else
|
||||
UNUSED2(name);
|
||||
#endif
|
||||
memcpy(m_Buffer, data, len);
|
||||
m_Buffer += len;
|
||||
|
|
@ -89,13 +87,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void Put(const char* name, const u8* /*data*/, size_t len)
|
||||
void Put([[maybe_unused]] const char* name, const u8* /*data*/, size_t len)
|
||||
{
|
||||
#if DEBUG_SERIALIZER_ANNOTATE
|
||||
m_Length += 2; // '<' and '>'
|
||||
m_Length += strlen(name);
|
||||
#else
|
||||
UNUSED2(name);
|
||||
#endif
|
||||
m_Length += len;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,11 +184,10 @@ Paths::Paths(const CmdLineArgs& args)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*static*/ OsPath Paths::RootData(const OsPath& argv0)
|
||||
/*static*/ OsPath Paths::RootData([[maybe_unused]] const OsPath& argv0)
|
||||
{
|
||||
|
||||
#ifdef INSTALLED_DATADIR
|
||||
UNUSED2(argv0);
|
||||
return OsPath(STRINGIZE(INSTALLED_DATADIR))/"";
|
||||
#else
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -182,10 +182,8 @@ void CTouchInput::Frame()
|
|||
}
|
||||
}
|
||||
|
||||
InReaction CTouchInput::HandleEvent(const SDL_Event_* ev)
|
||||
InReaction CTouchInput::HandleEvent([[maybe_unused]] const SDL_Event_* ev)
|
||||
{
|
||||
UNUSED2(ev); // may be unused depending on #ifs
|
||||
|
||||
if (!IsEnabled())
|
||||
return IN_PASS;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ GLenum GetTargetFromBufferType(const IBuffer::Type type)
|
|||
|
||||
// static
|
||||
std::unique_ptr<CBuffer> CBuffer::Create(
|
||||
CDevice* device, const char* name,
|
||||
CDevice* device, [[maybe_unused]] const char* name,
|
||||
const Type type, const uint32_t size, const uint32_t usage)
|
||||
{
|
||||
ENSURE(type == Type::VERTEX || type == Type::INDEX || type == Type::UNIFORM);
|
||||
|
|
@ -77,8 +77,6 @@ std::unique_ptr<CBuffer> CBuffer::Create(
|
|||
{
|
||||
glObjectLabel(GL_BUFFER, buffer->m_Handle, -1, name);
|
||||
}
|
||||
#else
|
||||
UNUSED2(name);
|
||||
#endif
|
||||
glBindBufferARB(target, 0);
|
||||
return buffer;
|
||||
|
|
|
|||
|
|
@ -864,18 +864,13 @@ void CDeviceCommandContext::SetGraphicsPipelineStateImpl(
|
|||
|
||||
void CDeviceCommandContext::BlitFramebuffer(
|
||||
IFramebuffer* srcFramebuffer, IFramebuffer* dstFramebuffer,
|
||||
const Rect& sourceRegion, const Rect& destinationRegion,
|
||||
const Sampler::Filter filter)
|
||||
[[maybe_unused]] const Rect& sourceRegion, [[maybe_unused]] const Rect& destinationRegion,
|
||||
[[maybe_unused]] const Sampler::Filter filter)
|
||||
{
|
||||
ENSURE(!m_InsideFramebufferPass);
|
||||
CFramebuffer* destinationFramebuffer = dstFramebuffer->As<CFramebuffer>();
|
||||
CFramebuffer* sourceFramebuffer = srcFramebuffer->As<CFramebuffer>();
|
||||
[[maybe_unused]] CFramebuffer* destinationFramebuffer = dstFramebuffer->As<CFramebuffer>();
|
||||
[[maybe_unused]] CFramebuffer* sourceFramebuffer = srcFramebuffer->As<CFramebuffer>();
|
||||
#if CONFIG2_GLES
|
||||
UNUSED2(destinationFramebuffer);
|
||||
UNUSED2(sourceFramebuffer);
|
||||
UNUSED2(destinationRegion);
|
||||
UNUSED2(sourceRegion);
|
||||
UNUSED2(filter);
|
||||
debug_warn("CDeviceCommandContext::BlitFramebuffer is not implemented for GLES");
|
||||
#else
|
||||
// Source framebuffer should not be backbuffer.
|
||||
|
|
@ -1188,7 +1183,7 @@ void CDeviceCommandContext::DrawIndexed(
|
|||
}
|
||||
|
||||
void CDeviceCommandContext::DrawInstanced(
|
||||
const uint32_t firstVertex, const uint32_t vertexCount,
|
||||
[[maybe_unused]] const uint32_t firstVertex, const uint32_t vertexCount,
|
||||
const uint32_t firstInstance, const uint32_t instanceCount)
|
||||
{
|
||||
ENSURE(m_Device->GetCapabilities().instancing);
|
||||
|
|
@ -1200,7 +1195,6 @@ void CDeviceCommandContext::DrawInstanced(
|
|||
m_ShaderProgram->AssertPointersBound();
|
||||
#if CONFIG2_GLES
|
||||
ENSURE(!m_Device->GetCapabilities().instancing);
|
||||
UNUSED2(firstVertex);
|
||||
#else
|
||||
glDrawArraysInstancedARB(GL_TRIANGLES, firstVertex, vertexCount, instanceCount);
|
||||
#endif
|
||||
|
|
@ -1209,7 +1203,7 @@ void CDeviceCommandContext::DrawInstanced(
|
|||
|
||||
void CDeviceCommandContext::DrawIndexedInstanced(
|
||||
const uint32_t firstIndex, const uint32_t indexCount,
|
||||
const uint32_t firstInstance, const uint32_t instanceCount,
|
||||
const uint32_t firstInstance, [[maybe_unused]] const uint32_t instanceCount,
|
||||
const int32_t vertexOffset)
|
||||
{
|
||||
ENSURE(m_Device->GetCapabilities().instancing);
|
||||
|
|
@ -1229,7 +1223,6 @@ void CDeviceCommandContext::DrawIndexedInstanced(
|
|||
// in Mesa 7.10 swrast with index VBOs).
|
||||
#if CONFIG2_GLES
|
||||
ENSURE(!m_Device->GetCapabilities().instancing);
|
||||
UNUSED2(instanceCount);
|
||||
#else
|
||||
glDrawElementsInstancedARB(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT,
|
||||
static_cast<const void*>((static_cast<const uint8_t*>(m_IndexBufferData) + sizeof(uint16_t) * firstIndex)),
|
||||
|
|
@ -1240,7 +1233,7 @@ void CDeviceCommandContext::DrawIndexedInstanced(
|
|||
|
||||
void CDeviceCommandContext::DrawIndexedInRange(
|
||||
const uint32_t firstIndex, const uint32_t indexCount,
|
||||
const uint32_t start, const uint32_t end)
|
||||
[[maybe_unused]] const uint32_t start, [[maybe_unused]] const uint32_t end)
|
||||
{
|
||||
ENSURE(m_ShaderProgram);
|
||||
ENSURE(m_InsidePass);
|
||||
|
|
@ -1253,8 +1246,6 @@ void CDeviceCommandContext::DrawIndexedInRange(
|
|||
// Draw with DrawRangeElements where available, since it might be more
|
||||
// efficient for slow hardware.
|
||||
#if CONFIG2_GLES
|
||||
UNUSED2(start);
|
||||
UNUSED2(end);
|
||||
glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, indices);
|
||||
#else
|
||||
glDrawRangeElementsEXT(GL_TRIANGLES, start, end, indexCount, GL_UNSIGNED_SHORT, indices);
|
||||
|
|
@ -1276,9 +1267,9 @@ void CDeviceCommandContext::EndComputePass()
|
|||
}
|
||||
|
||||
void CDeviceCommandContext::Dispatch(
|
||||
const uint32_t groupCountX,
|
||||
const uint32_t groupCountY,
|
||||
const uint32_t groupCountZ)
|
||||
[[maybe_unused]] const uint32_t groupCountX,
|
||||
[[maybe_unused]] const uint32_t groupCountY,
|
||||
[[maybe_unused]] const uint32_t groupCountZ)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
ENSURE(m_InsideComputePass);
|
||||
|
|
@ -1290,16 +1281,12 @@ void CDeviceCommandContext::Dispatch(
|
|||
glMemoryBarrier(
|
||||
GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_TEXTURE_FETCH_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT );
|
||||
}
|
||||
#else
|
||||
UNUSED2(groupCountX);
|
||||
UNUSED2(groupCountY);
|
||||
UNUSED2(groupCountZ);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::InsertMemoryBarrier(
|
||||
const uint32_t /*srcStageMask*/, const uint32_t dstStageMask,
|
||||
const uint32_t srcAccessMask, const uint32_t dstAccessMask)
|
||||
const uint32_t /*srcStageMask*/, [[maybe_unused]] const uint32_t dstStageMask,
|
||||
[[maybe_unused]] const uint32_t srcAccessMask, [[maybe_unused]] const uint32_t dstAccessMask)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
ENSURE(!m_InsideFramebufferPass);
|
||||
|
|
@ -1323,10 +1310,6 @@ void CDeviceCommandContext::InsertMemoryBarrier(
|
|||
}
|
||||
if (barriers)
|
||||
glMemoryBarrier(barriers);
|
||||
#else
|
||||
UNUSED2(dstStageMask);
|
||||
UNUSED2(srcAccessMask);
|
||||
UNUSED2(dstAccessMask);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1372,7 +1355,8 @@ void CDeviceCommandContext::SetTexture(const int32_t bindingSlot, ITexture* text
|
|||
BindTexture(unit, textureUnit.target, texture->As<CTexture>()->GetHandle());
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetStorageTexture(const int32_t bindingSlot, ITexture* texture)
|
||||
void CDeviceCommandContext::SetStorageTexture([[maybe_unused]] const int32_t bindingSlot,
|
||||
[[maybe_unused]] ITexture* texture)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
ENSURE(m_ShaderProgram);
|
||||
|
|
@ -1386,13 +1370,11 @@ void CDeviceCommandContext::SetStorageTexture(const int32_t bindingSlot, ITextur
|
|||
ENSURE(textureUnit.type == GL_IMAGE_2D);
|
||||
ENSURE(texture->GetFormat() == Format::R8G8B8A8_UNORM);
|
||||
glBindImageTexture(textureUnit.unit, texture->As<CTexture>()->GetHandle(), 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
|
||||
#else
|
||||
UNUSED2(bindingSlot);
|
||||
UNUSED2(texture);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetStorageBuffer(const int32_t bindingSlot, IBuffer* buffer)
|
||||
void CDeviceCommandContext::SetStorageBuffer([[maybe_unused]] const int32_t bindingSlot,
|
||||
[[maybe_unused]] IBuffer* buffer)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
if (bindingSlot < 0)
|
||||
|
|
@ -1401,9 +1383,6 @@ void CDeviceCommandContext::SetStorageBuffer(const int32_t bindingSlot, IBuffer*
|
|||
ENSURE(buffer);
|
||||
ENSURE(buffer->GetUsage() & Renderer::Backend::IBuffer::Usage::STORAGE);
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, m_ShaderProgram->GetStorageBuffer(bindingSlot), buffer->As<CBuffer>()->GetHandle());
|
||||
#else
|
||||
UNUSED2(bindingSlot);
|
||||
UNUSED2(buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace GL
|
|||
|
||||
// static
|
||||
std::unique_ptr<CFramebuffer> CFramebuffer::Create(
|
||||
CDevice* device, const char* name, SColorAttachment* colorAttachment,
|
||||
CDevice* device, [[maybe_unused]] const char* name, SColorAttachment* colorAttachment,
|
||||
SDepthStencilAttachment* depthStencilAttachment)
|
||||
{
|
||||
ENSURE(colorAttachment || depthStencilAttachment);
|
||||
|
|
@ -143,8 +143,6 @@ std::unique_ptr<CFramebuffer> CFramebuffer::Create(
|
|||
{
|
||||
glObjectLabel(GL_FRAMEBUFFER, framebuffer->m_Handle, -1, name);
|
||||
}
|
||||
#else
|
||||
UNUSED2(name);
|
||||
#endif
|
||||
|
||||
const GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
|
|
|
|||
|
|
@ -1254,7 +1254,7 @@ public:
|
|||
void VertexAttribPointer(
|
||||
const VertexAttributeStream stream, const Format format,
|
||||
const uint32_t offset, const uint32_t stride,
|
||||
const VertexAttributeRate rate, const void* data) override
|
||||
[[maybe_unused]] const VertexAttributeRate rate, const void* data) override
|
||||
{
|
||||
const int attributeLocation = GetAttributeLocationFromStream(m_Device, stream);
|
||||
std::vector<int>::const_iterator it =
|
||||
|
|
@ -1268,7 +1268,6 @@ public:
|
|||
attributeLocation, size, type, normalized, stride, static_cast<const u8*>(data) + offset);
|
||||
#if CONFIG2_GLES
|
||||
ENSURE(!m_Device->GetCapabilities().instancing);
|
||||
UNUSED2(rate);
|
||||
#else
|
||||
if (rate == VertexAttributeRate::PER_INSTANCE)
|
||||
ENSURE(m_Device->GetCapabilities().instancing);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ private:
|
|||
* @param wentOk - true if the conversion succeeded and wentOk was true before, false otherwise.
|
||||
*/
|
||||
template<size_t idx, typename T>
|
||||
static T DoConvertFromJS(const ScriptRequest& rq, JS::CallArgs& args, bool& wentOk)
|
||||
static T DoConvertFromJS([[maybe_unused]] const ScriptRequest& rq,
|
||||
[[maybe_unused]] JS::CallArgs& args, [[maybe_unused]] bool& wentOk)
|
||||
{
|
||||
// No need to convert JS values.
|
||||
if constexpr (std::is_same_v<T, JS::HandleValue>)
|
||||
|
|
@ -114,11 +115,7 @@ private:
|
|||
if (idx >= args.length())
|
||||
return JS::UndefinedHandleValue;
|
||||
else
|
||||
{
|
||||
// GCC (at least < 9) & VS17 prints warnings if arguments are not used in some constexpr branch.
|
||||
UNUSED2(rq); UNUSED2(args); UNUSED2(wentOk);
|
||||
return args[idx]; // This passes the null handle value if idx is beyond the length of args.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -185,14 +182,10 @@ private:
|
|||
* Wrap std::apply for the case where we have an object method or a regular function.
|
||||
*/
|
||||
template <auto callable, typename T, typename tuple>
|
||||
static typename args_info<callable>::return_type call(T* object, tuple& args)
|
||||
static typename args_info<callable>::return_type call([[maybe_unused]] T* object, tuple& args)
|
||||
{
|
||||
if constexpr(std::is_same_v<T, void>)
|
||||
{
|
||||
// GCC (at least < 9) & VS17 prints warnings if arguments are not used in some constexpr branch.
|
||||
UNUSED2(object);
|
||||
return std::apply(callable, args);
|
||||
}
|
||||
else
|
||||
return std::apply(callable, std::tuple_cat(std::forward_as_tuple(*object), args));
|
||||
}
|
||||
|
|
@ -224,7 +217,8 @@ private:
|
|||
* This could be worked around with more templates, but it doesn't seem particularly worth doing.
|
||||
*/
|
||||
template<typename R, typename ...Args>
|
||||
static bool Call_(const ScriptRequest& rq, JS::HandleValue val, const char* name, R& ret, const Args&... args)
|
||||
static bool Call_(const ScriptRequest& rq, JS::HandleValue val, const char* name,
|
||||
[[maybe_unused]] R& ret, const Args&... args)
|
||||
{
|
||||
JS::RootedObject obj(rq.cx);
|
||||
if (!JS_ValueToObject(rq.cx, val, &obj) || !obj)
|
||||
|
|
@ -251,8 +245,6 @@ private:
|
|||
if (success)
|
||||
success = Script::FromJSVal(rq, jsRet, ret);
|
||||
}
|
||||
else
|
||||
UNUSED2(ret); // VS2017 complains.
|
||||
}
|
||||
// Even if everything succeeded, there could be pending exceptions
|
||||
return !ScriptException::CatchPending(rq) && success;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void CStdDeserializer::TraceMember(JSTracer *trc)
|
|||
JS::TraceEdge(trc, &backref, "StdDeserializer::m_ScriptBackrefs");
|
||||
}
|
||||
|
||||
void CStdDeserializer::Get(const char* name, u8* data, size_t len)
|
||||
void CStdDeserializer::Get([[maybe_unused]] const char* name, u8* data, size_t len)
|
||||
{
|
||||
#if DEBUG_SERIALIZER_ANNOTATE
|
||||
std::string strName;
|
||||
|
|
@ -75,8 +75,6 @@ void CStdDeserializer::Get(const char* name, u8* data, size_t len)
|
|||
strName += c;
|
||||
}
|
||||
ENSURE(strName == name);
|
||||
#else
|
||||
UNUSED2(name);
|
||||
#endif
|
||||
m_Stream.read((char*)data, (std::streamsize)len);
|
||||
if (!m_Stream.good())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2017 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
|
||||
|
|
@ -35,14 +35,12 @@ public:
|
|||
m_Stream.flush();
|
||||
}
|
||||
|
||||
void Put(const char* name, const u8* data, size_t len)
|
||||
void Put([[maybe_unused]] const char* name, const u8* data, size_t len)
|
||||
{
|
||||
#if DEBUG_SERIALIZER_ANNOTATE
|
||||
m_Stream.put('<');
|
||||
m_Stream.write(name, strlen(name));
|
||||
m_Stream.put('>');
|
||||
#else
|
||||
UNUSED2(name);
|
||||
#endif
|
||||
m_Stream.write((const char*)data, (std::streamsize)len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,12 +128,10 @@ CSoundGroup::~CSoundGroup()
|
|||
ReleaseGroup();
|
||||
}
|
||||
|
||||
float CSoundGroup::RadiansOffCenter(const CVector3D& position, bool& onScreen, float& itemRollOff)
|
||||
float CSoundGroup::RadiansOffCenter([[maybe_unused]] const CVector3D& position,
|
||||
[[maybe_unused]] bool& onScreen, [[maybe_unused]] float& itemRollOff)
|
||||
{
|
||||
#if !CONFIG2_AUDIO
|
||||
UNUSED2(position);
|
||||
UNUSED2(onScreen);
|
||||
UNUSED2(itemRollOff);
|
||||
return 0.f;
|
||||
#else
|
||||
const int screenWidth = g_Game->GetView()->GetCamera()->GetViewPort().m_Width;
|
||||
|
|
@ -181,13 +179,10 @@ float CSoundGroup::RadiansOffCenter(const CVector3D& position, bool& onScreen, f
|
|||
#endif // !CONFIG2_AUDIO
|
||||
}
|
||||
|
||||
void CSoundGroup::UploadPropertiesAndPlay(size_t index, const CVector3D& position, entity_id_t source)
|
||||
void CSoundGroup::UploadPropertiesAndPlay([[maybe_unused]] size_t index,
|
||||
[[maybe_unused]] const CVector3D& position, [[maybe_unused]] entity_id_t source)
|
||||
{
|
||||
#if !CONFIG2_AUDIO
|
||||
UNUSED2(index);
|
||||
UNUSED2(position);
|
||||
UNUSED2(source);
|
||||
#else
|
||||
#if CONFIG2_AUDIO
|
||||
if (!g_SoundManager)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -57,8 +57,6 @@ MESSAGEHANDLER(CameraReset)
|
|||
}
|
||||
|
||||
g_Game->GetView()->ResetCameraTarget(target);
|
||||
|
||||
UNUSED2(msg);
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(ScrollConstant)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -534,7 +534,6 @@ QUERYHANDLER(PickAxis)
|
|||
|
||||
MESSAGEHANDLER(ClearPathNodePreview)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
g_AtlasGameLoop->view->SetParam(L"movetool", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,19 +43,16 @@ MESSAGEHANDLER(DoCommand)
|
|||
|
||||
MESSAGEHANDLER(UndoCommand)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
GetCommandProc().Undo();
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(RedoCommand)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
GetCommandProc().Redo();
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(MergeCommand)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
GetCommandProc().Merge();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -72,8 +72,6 @@ std::optional<ScriptInterface> g_ScriptInterface;
|
|||
|
||||
MESSAGEHANDLER(Init)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
g_Quickstart = true;
|
||||
|
||||
InitVfs(g_AtlasGameLoop->args);
|
||||
|
|
@ -98,15 +96,11 @@ MESSAGEHANDLER(InitAppWindow)
|
|||
{
|
||||
#if OS_WIN
|
||||
wutil_SetAppWindow(msg->handle);
|
||||
#else
|
||||
UNUSED2(msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(InitSDL)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
// When using GLX (Linux), SDL has to load the GL library to find
|
||||
// glXGetProcAddressARB before it can load any extensions.
|
||||
// When running in Atlas, we skip the SDL video initialisation code
|
||||
|
|
@ -128,8 +122,6 @@ MESSAGEHANDLER(InitSDL)
|
|||
|
||||
MESSAGEHANDLER(InitGraphics)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
g_VideoMode.CreateBackendDevice(false);
|
||||
|
||||
g_VideoMode.GetBackendDevice()->OnWindowResize(g_xres, g_yres);
|
||||
|
|
@ -141,8 +133,6 @@ MESSAGEHANDLER(InitGraphics)
|
|||
|
||||
MESSAGEHANDLER(Shutdown)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
// Empty the CommandProc, to get rid of its references to entities before
|
||||
// we kill the EntityManager
|
||||
GetCommandProc().Destroy();
|
||||
|
|
@ -159,7 +149,6 @@ MESSAGEHANDLER(Shutdown)
|
|||
|
||||
QUERYHANDLER(Exit)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
g_AtlasGameLoop->running = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009 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
|
||||
|
|
@ -36,7 +36,7 @@ extern msgHandlers& GetMsgHandlers();
|
|||
ENSURE(msg->GetType() == IMessage::expectedtype); \
|
||||
f##t (static_cast<prefix##t*>(msg)); \
|
||||
} \
|
||||
void f##t(prefix##t* msg)
|
||||
void f##t([[maybe_unused]] prefix##t* msg)
|
||||
|
||||
#define MESSAGEHANDLER(t) THINGHANDLER(m, Message, t)
|
||||
#define QUERYHANDLER(t) THINGHANDLER(q, Query, t)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -55,13 +55,10 @@ MESSAGEHANDLER(Screenshot)
|
|||
|
||||
QUERYHANDLER(Ping)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(SimStopMusic)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
CmpPtr<ICmpSoundManager> cmpSoundManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
|
||||
if (cmpSoundManager)
|
||||
cmpSoundManager->StopMusic();
|
||||
|
|
|
|||
|
|
@ -412,8 +412,6 @@ QUERYHANDLER(GetCurrentSelection)
|
|||
|
||||
MESSAGEHANDLER(ObjectPreviewToEntity)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
if (g_PreviewEntitiesID.size() == 0)
|
||||
return;
|
||||
|
||||
|
|
@ -713,8 +711,6 @@ QUERYHANDLER(PickSimilarObjects)
|
|||
|
||||
MESSAGEHANDLER(ResetSelectionColor)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
for (entity_id_t ent : g_Selection)
|
||||
{
|
||||
CmpPtr<ICmpVisual> cmpVisual(*g_Game->GetSimulation2(), ent);
|
||||
|
|
|
|||
Loading…
Reference in a new issue