From e3014184237f26fe5d9d2cbaa62fc573ee25791b Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 31 Oct 2023 10:53:21 +0000 Subject: [PATCH] fix: correct issues with clang tidy Signed-off-by: Mateusz Jablonski --- .../events/windows/sysman_os_events_imp.cpp | 4 ++-- .../gl/windows/gl_arb_sync_event_windows.cpp | 4 ++-- opencl/test/unit_test/gtpin/gtpin_tests.cpp | 2 +- .../sharings/d3d/context_d3d_tests.cpp | 18 +++++++++--------- .../common/os_interface/windows/sys_calls.cpp | 4 ++-- .../windows/wddm_kmdaf_listener_tests.cpp | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/level_zero/sysman/source/api/events/windows/sysman_os_events_imp.cpp b/level_zero/sysman/source/api/events/windows/sysman_os_events_imp.cpp index 8655b0c917..a345ac767a 100644 --- a/level_zero/sysman/source/api/events/windows/sysman_os_events_imp.cpp +++ b/level_zero/sysman/source/api/events/windows/sysman_os_events_imp.cpp @@ -175,11 +175,11 @@ WddmEventsImp::WddmEventsImp(OsSysman *pOsSysman) { // create an exit event with a default security decriptor with no name bool manualResetObject = FALSE; bool isEventStateSignalled = FALSE; - exitHandle = createWddmEvent(NULL, manualResetObject, isEventStateSignalled, NULL); + exitHandle = WddmEventsImp::createWddmEvent(NULL, manualResetObject, isEventStateSignalled, NULL); } WddmEventsImp::~WddmEventsImp() { - closeWddmHandle(exitHandle); + WddmEventsImp::closeWddmHandle(exitHandle); } OsEvents *OsEvents::create(OsSysman *pOsSysman) { diff --git a/opencl/source/sharings/gl/windows/gl_arb_sync_event_windows.cpp b/opencl/source/sharings/gl/windows/gl_arb_sync_event_windows.cpp index eb244c499b..a2c25e3784 100644 --- a/opencl/source/sharings/gl/windows/gl_arb_sync_event_windows.cpp +++ b/opencl/source/sharings/gl/windows/gl_arb_sync_event_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -125,7 +125,7 @@ void signalArbSyncObject(OsContext &osContext, CL_GL_SYNC_INFO &glSyncInfo) { signalServerClientSyncInfo.ObjectHandleArray[0] = glSyncInfo.serverSynchronizationObject; signalServerClientSyncInfo.ObjectHandleArray[1] = glSyncInfo.clientSynchronizationObject; signalServerClientSyncInfo.ObjectCount = 2; - NTSTATUS status = wddm->getGdi()->signalSynchronizationObject(&signalServerClientSyncInfo); + [[maybe_unused]] NTSTATUS status = wddm->getGdi()->signalSynchronizationObject(&signalServerClientSyncInfo); if (STATUS_SUCCESS != status) { DEBUG_BREAK_IF(true); return; diff --git a/opencl/test/unit_test/gtpin/gtpin_tests.cpp b/opencl/test/unit_test/gtpin/gtpin_tests.cpp index d333a4ba0e..f680c13eed 100644 --- a/opencl/test/unit_test/gtpin/gtpin_tests.cpp +++ b/opencl/test/unit_test/gtpin/gtpin_tests.cpp @@ -423,7 +423,7 @@ TEST_F(GTPinTests, givenInvalidArgumentsThenBufferUnMapFails) { ASSERT_EQ(&NEO::gtpinUnmapBuffer, driverServices.bufferUnMap); ASSERT_NE(nullptr, driverServices.bufferUnMap); - retFromGtPin = (*driverServices.bufferUnMap)(nullptr, nullptr); + retFromGtPin = NEO::gtpinUnmapBuffer(nullptr, nullptr); EXPECT_NE(GTPIN_DI_SUCCESS, retFromGtPin); cl_context ctxt = (cl_context)((Context *)pContext); diff --git a/opencl/test/unit_test/sharings/d3d/context_d3d_tests.cpp b/opencl/test/unit_test/sharings/d3d/context_d3d_tests.cpp index 3cbe8cad24..a4b794570a 100644 --- a/opencl/test/unit_test/sharings/d3d/context_d3d_tests.cpp +++ b/opencl/test/unit_test/sharings/d3d/context_d3d_tests.cpp @@ -35,7 +35,7 @@ TEST(D3DContextTest, givenDispatchTableThenItContainsValidEntries) { EXPECT_EQ(&clEnqueueReleaseDX9ObjectsINTEL, context.dispatch.crtDispatch->clEnqueueReleaseDX9ObjectsINTEL); } -struct clIntelSharingFormatQueryDX9 : public ApiTests { +struct ClIntelSharingFormatQueryDX9 : public ApiTests { std::vector supportedNonPlanarFormats; std::vector supportedPlanarFormats; std::vector supportedPlane1Formats; @@ -71,7 +71,7 @@ struct clIntelSharingFormatQueryDX9 : public ApiTests { namespace ULT { -TEST_F(clIntelSharingFormatQueryDX9, givenInvalidContextWhenMediaSurfaceFormatsRequestedThenInvalidContextError) { +TEST_F(ClIntelSharingFormatQueryDX9, givenInvalidContextWhenMediaSurfaceFormatsRequestedThenInvalidContextError) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(nullptr, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 0, static_cast(retrievedFormats.size()), &retrievedFormats[0], @@ -79,7 +79,7 @@ TEST_F(clIntelSharingFormatQueryDX9, givenInvalidContextWhenMediaSurfaceFormatsR EXPECT_EQ(CL_INVALID_CONTEXT, retVal); } -TEST_F(clIntelSharingFormatQueryDX9, givenInvalidFlagsWhenMediaSurfaceFormatsRequestedThenInvalidValueError) { +TEST_F(ClIntelSharingFormatQueryDX9, givenInvalidFlagsWhenMediaSurfaceFormatsRequestedThenInvalidValueError) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL( pContext, 0, CL_MEM_OBJECT_IMAGE2D, 0, static_cast(retrievedFormats.size()), @@ -87,13 +87,13 @@ TEST_F(clIntelSharingFormatQueryDX9, givenInvalidFlagsWhenMediaSurfaceFormatsReq EXPECT_EQ(CL_INVALID_VALUE, retVal); } -TEST_F(clIntelSharingFormatQueryDX9, givenInvalidImageTypeWhenMediaSurfaceFormatsRequestedThenInvalidValueError) { +TEST_F(ClIntelSharingFormatQueryDX9, givenInvalidImageTypeWhenMediaSurfaceFormatsRequestedThenInvalidValueError) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(pContext, CL_MEM_READ_WRITE, 0, 0, static_cast(retrievedFormats.size()), &retrievedFormats[0], &numImageFormats); EXPECT_EQ(CL_INVALID_VALUE, retVal); } -TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestedMediaSurfaceFormatsBelowMaximumThenExceedingFormatAreaRemainsUntouched) { +TEST_F(ClIntelSharingFormatQueryDX9, givenValidParametersWhenRequestedMediaSurfaceFormatsBelowMaximumThenExceedingFormatAreaRemainsUntouched) { for (cl_uint i = 0; i <= static_cast(retrievedFormats.size()); ++i) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(pContext, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 0, i, &retrievedFormats[0], &numImageFormats); @@ -104,7 +104,7 @@ TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestedMediaSurfa } } -TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlane0ThenAllKnownFormatsAreIncludedInTheResult) { +TEST_F(ClIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlane0ThenAllKnownFormatsAreIncludedInTheResult) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(pContext, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 0, static_cast(retrievedFormats.size()), &retrievedFormats[0], @@ -124,7 +124,7 @@ TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurf } } -TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlane1ThenOnlyPlanarFormatsAreIncludedInTheResult) { +TEST_F(ClIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlane1ThenOnlyPlanarFormatsAreIncludedInTheResult) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(pContext, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 1, static_cast(retrievedFormats.size()), &retrievedFormats[0], @@ -144,7 +144,7 @@ TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurf } } -TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlane2ThenOnlyYV12FormatIsIncludedInTheResult) { +TEST_F(ClIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlane2ThenOnlyYV12FormatIsIncludedInTheResult) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(pContext, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 2, static_cast(retrievedFormats.size()), &retrievedFormats[0], @@ -163,7 +163,7 @@ TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurf } } -TEST_F(clIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlaneGraterThan2ThenZeroNumFormatsIsReturned) { +TEST_F(ClIntelSharingFormatQueryDX9, givenValidParametersWhenRequestingMediaSurfaceFormatsForPlaneGraterThan2ThenZeroNumFormatsIsReturned) { retVal = clGetSupportedDX9MediaSurfaceFormatsINTEL(pContext, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 3, 0, nullptr, diff --git a/shared/test/common/os_interface/windows/sys_calls.cpp b/shared/test/common/os_interface/windows/sys_calls.cpp index cfb46b5390..ff5ef33abb 100644 --- a/shared/test/common/os_interface/windows/sys_calls.cpp +++ b/shared/test/common/os_interface/windows/sys_calls.cpp @@ -292,7 +292,7 @@ LSTATUS regQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDW if (strcmp(lpValueName, "settingSourceString") == 0) { const auto settingSource = "registry"; if (lpData) { - strcpy(reinterpret_cast(lpData), settingSource); + strcpy_s(reinterpret_cast(lpData), strlen(settingSource) + 1u, settingSource); } else { *lpcbData = static_cast(strlen(settingSource) + 1u); if (lpType) { @@ -330,7 +330,7 @@ LSTATUS regQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDW } } else if (driverStorePath && (strcmp(lpValueName, "DriverStorePathForComputeRuntime") == 0)) { if (lpData) { - strcpy(reinterpret_cast(lpData), driverStorePath); + strcpy_s(reinterpret_cast(lpData), strlen(driverStorePath) + 1u, driverStorePath); } if (lpcbData) { *lpcbData = static_cast(strlen(driverStorePath) + 1u); diff --git a/shared/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp index 0953617fd7..af6bfb7fdc 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp @@ -41,7 +41,7 @@ class WddmWithKmDafMock : public Wddm { class WddmKmDafListenerTest : public ::testing::Test { public: - void SetUp() { + void SetUp() override { executionEnvironment.initializeMemoryManager(); rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[0].get(); auto osEnvironment = new OsEnvironmentWin(); @@ -51,7 +51,7 @@ class WddmKmDafListenerTest : public ::testing::Test { wddmWithKmDafMock->init(); wddmWithKmDafMock->featureTable->flags.ftrKmdDaf = true; } - void TearDown() { + void TearDown() override { } MockExecutionEnvironment executionEnvironment{};