Skip to content

Commit 1f2aa82

Browse files
Remove UNUSED_VARIABLE macro
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent bf0a2e1 commit 1f2aa82

File tree

11 files changed

+24
-40
lines changed

11 files changed

+24
-40
lines changed

level_zero/core/source/builtin/builtin_functions_lib_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
230230
auto builtInCodeType = NEO::DebugManager.flags.RebuildPrecompiledKernels.get() ? BuiltInCodeType::Intermediate : BuiltInCodeType::Binary;
231231
auto builtInCode = builtInsLib->getBuiltinsLib().getBuiltinCode(builtin, builtInCodeType, *device->getNEODevice());
232232

233-
ze_result_t res;
233+
[[maybe_unused]] ze_result_t res;
234234
std::unique_ptr<Module> module;
235235
ze_module_handle_t moduleHandle;
236236
ze_module_desc_t moduleDesc = {};
@@ -248,7 +248,7 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
248248
kernelDesc.pKernelName = builtInName;
249249
res = module->createKernel(&kernelDesc, &kernelHandle);
250250
DEBUG_BREAK_IF(res != ZE_RESULT_SUCCESS);
251-
UNUSED_VARIABLE(res);
251+
252252
kernel.reset(Kernel::fromHandle(kernelHandle));
253253
return std::unique_ptr<BuiltinData>(new BuiltinData{std::move(module), std::move(kernel)});
254254
}

level_zero/core/test/unit_tests/mocks/mock_builtin_functions_lib_impl_timestamps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct MockBuiltinFunctionsLibImplTimestamps : BuiltinFunctionsLibImpl {
7777
kernelDesc.pKernelName = builtInName;
7878
res = module->createKernel(&kernelDesc, &kernelHandle);
7979
DEBUG_BREAK_IF(res != ZE_RESULT_SUCCESS);
80-
UNUSED_VARIABLE(res);
80+
8181
kernel.reset(Kernel::fromHandle(kernelHandle));
8282
return std::unique_ptr<BuiltinData>(new MockBuiltinDataTimestamp{std::move(module), std::move(kernel)});
8383
}

level_zero/core/test/unit_tests/sources/builtin/builtin_functions_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TestBuiltinFunctionsLibImpl : public DeviceFixture, public testing::Test {
5151
kernelDesc.pKernelName = builtInName;
5252
res = module->createKernel(&kernelDesc, &kernelHandle);
5353
DEBUG_BREAK_IF(res != ZE_RESULT_SUCCESS);
54-
UNUSED_VARIABLE(res);
54+
5555
kernel.reset(Kernel::fromHandle(kernelHandle));
5656

5757
return std::unique_ptr<BuiltinData>(new MockBuiltinData{std::move(module), std::move(kernel)});

opencl/source/helpers/hardware_commands_helper_xehp_and_later.inl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void HardwareCommandsHelper<GfxFamily>::setInterfaceDescriptorOffset(
144144
}
145145

146146
template <typename GfxFamily>
147-
void HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(LinearStream *commandStream, const CommandQueue &commandQueue, const Kernel *kernel, uint64_t postSyncAddress) {
147+
void HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(LinearStream *commandStream, const CommandQueue &commandQueue, const Kernel *kernel, [[maybe_unused]] uint64_t postSyncAddress) {
148148
// 1. make sure previous kernel finished
149149
PipeControlArgs args;
150150
auto &hardwareInfo = commandQueue.getDevice().getHardwareInfo();
@@ -170,8 +170,6 @@ void HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(Line
170170

171171
flushGpuCache<GfxFamily>(commandStream, range, postSyncAddressToFlush, hardwareInfo);
172172
}
173-
} else {
174-
UNUSED_VARIABLE(postSyncAddress);
175173
}
176174
}
177175

opencl/source/kernel/kernel.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,7 @@ cl_int Kernel::setArgImmediate(uint32_t argIndex,
16151615
if (argVal) {
16161616
storeKernelArg(argIndex, NONE_OBJ, nullptr, nullptr, argSize);
16171617

1618-
auto crossThreadDataEnd = ptrOffset(crossThreadData, crossThreadDataSize);
1618+
[[maybe_unused]] auto crossThreadDataEnd = ptrOffset(crossThreadData, crossThreadDataSize);
16191619
const auto &argAsVal = kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[argIndex].as<ArgDescValue>();
16201620
for (const auto &element : argAsVal.elements) {
16211621
DEBUG_BREAK_IF(element.size <= 0);
@@ -1624,7 +1624,6 @@ cl_int Kernel::setArgImmediate(uint32_t argIndex,
16241624
auto pSrc = ptrOffset(argVal, element.sourceOffset);
16251625

16261626
DEBUG_BREAK_IF(!(ptrOffset(pDst, element.size) <= crossThreadDataEnd));
1627-
UNUSED_VARIABLE(crossThreadDataEnd);
16281627

16291628
if (element.sourceOffset < argSize) {
16301629
size_t maxBytesToCopy = argSize - element.sourceOffset;

shared/source/helpers/debug_helpers.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#endif // _DEBUG
2929
#endif // !DEBUG_BREAK_IF
3030

31-
#define UNUSED_VARIABLE(x) ((void)(x))
32-
3331
namespace NEO {
3432
void debugBreak(int line, const char *file);
3533
[[noreturn]] void abortUnrecoverable(int line, const char *file);

shared/source/helpers/file_io.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ std::unique_ptr<char[]> loadDataFromFile(
3535
if (ret) {
3636
// we initialize to all zeroes before reading in data
3737
memset(ret.get(), 0x00, nsize + 1);
38-
auto read = fread(ret.get(), sizeof(unsigned char), nsize, fp);
38+
[[maybe_unused]] auto read = fread(ret.get(), sizeof(unsigned char), nsize, fp);
3939
DEBUG_BREAK_IF(read != nsize);
40-
UNUSED_VARIABLE(read);
4140
} else {
4241
nsize = 0;
4342
}

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,19 +517,17 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A
517517
drm_i915_gem_create create = {0, 0, 0};
518518
create.size = allocationData.imgInfo->size;
519519

520-
auto ret = this->getDrm(allocationData.rootDeviceIndex).ioctl(DRM_IOCTL_I915_GEM_CREATE, &create);
520+
[[maybe_unused]] auto ret = this->getDrm(allocationData.rootDeviceIndex).ioctl(DRM_IOCTL_I915_GEM_CREATE, &create);
521521
DEBUG_BREAK_IF(ret != 0);
522-
UNUSED_VARIABLE(ret);
523522

524523
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new (std::nothrow) BufferObject(&getDrm(allocationData.rootDeviceIndex), create.handle, allocationData.imgInfo->size, maxOsContextCount));
525524
if (!bo) {
526525
return nullptr;
527526
}
528527
bo->setAddress(gpuRange);
529528

530-
auto ret2 = bo->setTiling(I915_TILING_Y, static_cast<uint32_t>(allocationData.imgInfo->rowPitch));
529+
[[maybe_unused]] auto ret2 = bo->setTiling(I915_TILING_Y, static_cast<uint32_t>(allocationData.imgInfo->rowPitch));
531530
DEBUG_BREAK_IF(ret2 != true);
532-
UNUSED_VARIABLE(ret2);
533531

534532
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), nullptr, gpuRange, allocationData.imgInfo->size, MemoryPool::SystemCpuInaccessible);
535533
allocation->setDefaultGmm(gmm.release());
@@ -635,10 +633,10 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
635633
auto ret = this->getDrm(properties.rootDeviceIndex).ioctl(DRM_IOCTL_PRIME_FD_TO_HANDLE, &openFd);
636634

637635
if (ret != 0) {
638-
int err = errno;
636+
[[maybe_unused]] int err = errno;
639637
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(PRIME_FD_TO_HANDLE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err));
640638
DEBUG_BREAK_IF(ret != 0);
641-
UNUSED_VARIABLE(ret);
639+
642640
return nullptr;
643641
}
644642

@@ -819,9 +817,9 @@ uint64_t DrmMemoryManager::getSystemSharedMemory(uint32_t rootDeviceIndex) {
819817

820818
drm_i915_gem_context_param getContextParam = {};
821819
getContextParam.param = I915_CONTEXT_PARAM_GTT_SIZE;
822-
auto ret = getDrm(rootDeviceIndex).ioctl(DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &getContextParam);
820+
[[maybe_unused]] auto ret = getDrm(rootDeviceIndex).ioctl(DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &getContextParam);
823821
DEBUG_BREAK_IF(ret != 0);
824-
UNUSED_VARIABLE(ret);
822+
825823
uint64_t gpuMemorySize = getContextParam.value;
826824

827825
return std::min(hostMemorySize, gpuMemorySize);
@@ -887,9 +885,8 @@ void DrmMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uint32_t r
887885
if (osHandle->bo) {
888886
BufferObject *search = osHandle->bo;
889887
search->wait(-1);
890-
auto refCount = unreference(search, true);
888+
[[maybe_unused]] auto refCount = unreference(search, true);
891889
DEBUG_BREAK_IF(refCount != 1u);
892-
UNUSED_VARIABLE(refCount);
893890
}
894891
delete handleStorage.fragmentStorageData[i].osHandleStorage;
895892
handleStorage.fragmentStorageData[i].osHandleStorage = nullptr;

shared/source/os_interface/linux/os_context_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ void OsContextLinux::initializeContext() {
6868
this->drmContextIds.push_back(drmContextId);
6969

7070
if (drm.isPerContextVMRequired()) {
71-
auto ret = drm.queryVmId(drmContextId, drmVmId);
71+
[[maybe_unused]] auto ret = drm.queryVmId(drmContextId, drmVmId);
7272
DEBUG_BREAK_IF(drmVmId == 0);
7373
DEBUG_BREAK_IF(ret != 0);
74-
UNUSED_VARIABLE(ret);
74+
7575
UNRECOVERABLE_IF(this->drmVmIds.size() <= deviceIndex);
7676
this->drmVmIds[deviceIndex] = drmVmId;
7777
}

shared/source/utilities/reference_tracked_object.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ class RefCounter {
2828
}
2929

3030
void inc() {
31-
CT curr = ++val;
31+
[[maybe_unused]] CT curr = ++val;
3232
DEBUG_BREAK_IF(curr < 1);
33-
UNUSED_VARIABLE(curr);
3433
}
3534

3635
bool dec() {

0 commit comments

Comments
 (0)