diff --git a/runtime/gmm_helper/client_context/gmm_client_context_base.h b/runtime/gmm_helper/client_context/gmm_client_context_base.h index 381aafd2b8..2f1de094b0 100644 --- a/runtime/gmm_helper/client_context/gmm_client_context_base.h +++ b/runtime/gmm_helper/client_context/gmm_client_context_base.h @@ -37,8 +37,8 @@ class GmmClientContextBase { MOCKABLE_VIRTUAL void destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo); GMM_CLIENT_CONTEXT *getHandle() const; template - static GmmClientContext *create(GMM_CLIENT clientType) { - return new T(clientType); + static std::unique_ptr create(GMM_CLIENT clientType) { + return std::make_unique(clientType); } protected: diff --git a/runtime/gmm_helper/gmm_helper.cpp b/runtime/gmm_helper/gmm_helper.cpp index d84b6d1687..9a52133841 100644 --- a/runtime/gmm_helper/gmm_helper.cpp +++ b/runtime/gmm_helper/gmm_helper.cpp @@ -56,7 +56,7 @@ void GmmHelper::initContext(const PLATFORM *pPlatform, loadLib(); bool success = GMM_SUCCESS == GmmHelper::initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo); UNRECOVERABLE_IF(!success); - gmmClientContext.reset(GmmHelper::createGmmContextWrapperFunc(GMM_CLIENT::GMM_OCL_VISTA)); + gmmClientContext = GmmHelper::createGmmContextWrapperFunc(GMM_CLIENT::GMM_OCL_VISTA); UNRECOVERABLE_IF(!gmmClientContext); } @@ -167,7 +167,7 @@ GmmHelper::~GmmHelper() { GmmHelper::destroyGlobalContextFunc(); }; bool GmmHelper::useSimplifiedMocsTable = false; -GmmClientContext *(*GmmHelper::createGmmContextWrapperFunc)(GMM_CLIENT) = GmmClientContextBase::create; +decltype(GmmHelper::createGmmContextWrapperFunc) GmmHelper::createGmmContextWrapperFunc = GmmClientContextBase::create; const HardwareInfo *GmmHelper::hwInfo = nullptr; } // namespace OCLRT diff --git a/runtime/gmm_helper/gmm_helper.h b/runtime/gmm_helper/gmm_helper.h index 6129a6f559..32795d126b 100644 --- a/runtime/gmm_helper/gmm_helper.h +++ b/runtime/gmm_helper/gmm_helper.h @@ -68,7 +68,7 @@ class GmmHelper { static decltype(GmmExportEntries::pfnCreateClientContext) createClientContextFunc; static decltype(GmmExportEntries::pfnDeleteClientContext) deleteClientContextFunc; - static GmmClientContext *(*createGmmContextWrapperFunc)(GMM_CLIENT); + static std::unique_ptr (*createGmmContextWrapperFunc)(GMM_CLIENT); static bool useSimplifiedMocsTable; static const HardwareInfo *hwInfo; diff --git a/unit_tests/mocks/CMakeLists.txt b/unit_tests/mocks/CMakeLists.txt index 24d9823423..57828200e3 100644 --- a/unit_tests/mocks/CMakeLists.txt +++ b/unit_tests/mocks/CMakeLists.txt @@ -102,6 +102,5 @@ target_include_directories(igdrcl_mocks PRIVATE target_compile_definitions(igdrcl_mocks PRIVATE MOCKABLE_VIRTUAL=virtual $) set_target_properties(igdrcl_mocks PROPERTIES POSITION_INDEPENDENT_CODE ON) -set_target_properties(igdrcl_mocks PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) set_target_properties(igdrcl_mocks PROPERTIES FOLDER "test mocks") create_project_source_tree(igdrcl_mocks)