mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Remove UNUSED2
The remaining uses can be changed to `std::ignore`. Fix #7760
This commit is contained in:
parent
eb3f0166f8
commit
08d8f0f61c
6 changed files with 22 additions and 33 deletions
|
|
@ -33,21 +33,6 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* mark a function local variable or parameter as unused and avoid
|
||||
* the corresponding compiler warning.
|
||||
* note that UNUSED is not applicable to variable definitions that
|
||||
* involve initialization, nor is it sufficient in cases where
|
||||
* an argument is unused only in certain situations.
|
||||
* example: void f(int x) { ASSERT(x == 0); UNUSED2(x); }
|
||||
* this asserts in debug builds and avoids warnings in release.
|
||||
**/
|
||||
#if HAVE_C99 && GCC_VERSION // _Pragma from C99, unused from GCC
|
||||
# define UNUSED2(param) _Pragma("unused " #param)
|
||||
#else
|
||||
# define UNUSED2(param) ((void)(param))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* indicate a function will not throw any synchronous exceptions,
|
||||
* thus hopefully generating smaller and more efficient code.
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@
|
|||
#include <fcntl.h>
|
||||
#include <memory>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace ERR
|
||||
{
|
||||
const Status IO = -110301;
|
||||
|
|
@ -327,7 +329,7 @@ static inline Status Store(const OsPath& pathname, const void* data, size_t size
|
|||
io::Operation op(file, (void*)data, size);
|
||||
|
||||
#if OS_WIN
|
||||
UNUSED2(waio_Preallocate(op.m_FileDescriptor, (off_t)size));
|
||||
std::ignore = waio_Preallocate(op.m_FileDescriptor, (off_t)size);
|
||||
#endif
|
||||
|
||||
RETURN_STATUS_IF_ERR(io::Run(op, p, completedHook, issueHook));
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@
|
|||
|
||||
#include "lib/self_test.h"
|
||||
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
|
||||
#include "lib/bits.h"
|
||||
#include "lib/code_annotation.h"
|
||||
#include "lib/sysdep/os/win/win.h" // HWND
|
||||
|
|
@ -40,6 +34,12 @@
|
|||
#include "lib/sysdep/os/win/wdbg_sym.h"
|
||||
#include "lib/external_libraries/dbghelp.h"
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
|
||||
static void* callers[100];
|
||||
static size_t numCallers;
|
||||
|
|
@ -60,7 +60,7 @@ static Status OnFrame(const _tagSTACKFRAME64* frame, uintptr_t /*cbData*/)
|
|||
__declspec(noinline) static void Func1()
|
||||
{
|
||||
CONTEXT context;
|
||||
UNUSED2(debug_CaptureContext(&context));
|
||||
std::ignore = debug_CaptureContext(&context);
|
||||
wdbg_sym_WalkStack(OnFrame, 0, context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <Psapi.h>
|
||||
#include <utility>
|
||||
|
||||
#if ARCH_X86_X64
|
||||
#include "lib/sysdep/arch/x86_x64/apic.h" // ProcessorFromApicId
|
||||
|
|
@ -301,13 +302,13 @@ static Status InitTopology()
|
|||
|
||||
size_t numa_NumNodes()
|
||||
{
|
||||
UNUSED2(ModuleInit(&initState, InitTopology));
|
||||
std::ignore = ModuleInit(&initState, InitTopology);
|
||||
return numNodes;
|
||||
}
|
||||
|
||||
size_t numa_NodeFromProcessor(size_t processor)
|
||||
{
|
||||
UNUSED2(ModuleInit(&initState, InitTopology));
|
||||
std::ignore = ModuleInit(&initState, InitTopology);
|
||||
ENSURE(processor < os_cpu_NumProcessors());
|
||||
Node* node = FindNodeWithProcessor(processor);
|
||||
ENSURE(node);
|
||||
|
|
@ -316,14 +317,14 @@ size_t numa_NodeFromProcessor(size_t processor)
|
|||
|
||||
uintptr_t numa_ProcessorMaskFromNode(size_t node)
|
||||
{
|
||||
UNUSED2(ModuleInit(&initState, InitTopology));
|
||||
std::ignore = ModuleInit(&initState, InitTopology);
|
||||
ENSURE(node < numNodes);
|
||||
return nodes[node].processorMask;
|
||||
}
|
||||
|
||||
static UCHAR NodeNumberFromNode(size_t node)
|
||||
{
|
||||
UNUSED2(ModuleInit(&initState, InitTopology));
|
||||
std::ignore = ModuleInit(&initState, InitTopology);
|
||||
ENSURE(node < numa_NumNodes());
|
||||
return nodes[node].nodeNumber;
|
||||
}
|
||||
|
|
@ -401,7 +402,7 @@ static double MeasureRelativeDistance()
|
|||
maxTime = std::max(maxTime, elapsedTime);
|
||||
}
|
||||
|
||||
UNUSED2(os_cpu_SetThreadAffinityMask(previousProcessorMask));
|
||||
std::ignore = os_cpu_SetThreadAffinityMask(previousProcessorMask);
|
||||
|
||||
vm::Free(mem, size);
|
||||
|
||||
|
|
@ -434,7 +435,7 @@ static Status InitRelativeDistance()
|
|||
double numa_Factor()
|
||||
{
|
||||
static ModuleInitState _initState{ 0 };
|
||||
UNUSED2(ModuleInit(&_initState, InitRelativeDistance));
|
||||
std::ignore = ModuleInit(&_initState, InitRelativeDistance);
|
||||
return relativeDistance;
|
||||
}
|
||||
|
||||
|
|
@ -464,7 +465,7 @@ static Status InitMemoryInterleaved()
|
|||
bool numa_IsMemoryInterleaved()
|
||||
{
|
||||
static ModuleInitState _initState{ 0 };
|
||||
UNUSED2(ModuleInit(&_initState, InitMemoryInterleaved));
|
||||
std::ignore = ModuleInit(&_initState, InitMemoryInterleaved);
|
||||
return isMemoryInterleaved;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "lib/sysdep/os/win/win.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
const char* wversion_Family()
|
||||
{
|
||||
|
|
@ -37,7 +38,8 @@ const char* wversion_Family()
|
|||
{
|
||||
wchar_t windowsVersionString[32];
|
||||
DWORD size = sizeof(windowsVersionString);
|
||||
UNUSED2(RegQueryValueExW(hKey, L"CurrentVersion", 0, 0, reinterpret_cast<LPBYTE>(windowsVersionString), &size));
|
||||
std::ignore = RegQueryValueExW(hKey, L"CurrentVersion", 0, 0,
|
||||
reinterpret_cast<LPBYTE>(windowsVersionString), &size);
|
||||
|
||||
unsigned major = 0, minor = 0;
|
||||
swscanf_s(windowsVersionString, L"%u.%u", &major, &minor);
|
||||
|
|
|
|||
|
|
@ -703,10 +703,9 @@ void FieldStringizer::operator()<const char*>(size_t flags, const char*& value,
|
|||
const Structures* GetStructures()
|
||||
{
|
||||
static ModuleInitState initState{ 0 };
|
||||
Status ret = ModuleInit(&initState, InitStructures);
|
||||
std::ignore = ModuleInit(&initState, InitStructures);
|
||||
// (callers have to check if member pointers are nonzero anyway, so
|
||||
// we always return a valid pointer to simplify most use cases.)
|
||||
UNUSED2(ret);
|
||||
return &g_Structures;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue