Skip to content

Commit

Permalink
Enable All warnings and warnings as errors to cleanup code
Browse files Browse the repository at this point in the history
-Related-To: VLCLJ-1951

Signed-off-by: Neil R Spruit <neil.r.spruit@intel.com>
  • Loading branch information
nrspruit committed Aug 30, 2023
1 parent 0c0f636 commit cfc05b0
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 65 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ if(NOT MSVC)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wnon-virtual-dtor")
endif()

#MSVC compile flags
Expand Down
6 changes: 5 additions & 1 deletion scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ ${tbl['export']['name']}(

${x}_result_t result = ${X}_RESULT_SUCCESS;

%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
bool atLeastOneDriverValid = false;
%endif
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -286,12 +288,14 @@ ${tbl['export']['name']}(
%else:
continue;
%endif
%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
auto getTableResult = getTable( version, &drv.dditable.${n}.${tbl['name']});
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
%if tbl['experimental'] is False:
else
drv.initStatus = getTableResult;
%else:
result = getTable( version, &drv.dditable.${n}.${tbl['name']});
%endif
}

Expand Down
1 change: 1 addition & 0 deletions scripts/templates/validation/entry_points.h.mako
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ ${line} \
%endfor
) {return ZE_RESULT_SUCCESS;}
%endfor
virtual ~${N}ValidationEntryPoints() {}
};
}
6 changes: 3 additions & 3 deletions source/inc/ze_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
///////////////////////////////////////////////////////////////////////////////
#if defined(_WIN32)
# include <Windows.h>
static void getLastErrorString(std::string &errorValue) {
inline void getLastErrorString(std::string &errorValue) {
DWORD errorID = GetLastError();
if (errorID) {

LPSTR tempErrorMessage = nullptr;

auto size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&tempErrorMessage, 0, NULL);
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&tempErrorMessage, 0, NULL);

errorValue.assign(tempErrorMessage);

Expand Down
1 change: 1 addition & 0 deletions source/layers/validation/common/ze_entry_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,6 @@ class ZEValidationEntryPoints {
virtual ze_result_t zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ze_rtas_parallel_operation_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;}
virtual ze_result_t zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) {return ZE_RESULT_SUCCESS;}
virtual ze_result_t zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) {return ZE_RESULT_SUCCESS;}
virtual ~ZEValidationEntryPoints() {}
};
}
1 change: 1 addition & 0 deletions source/layers/validation/common/zes_entry_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,6 @@ class ZESValidationEntryPoints {
virtual ze_result_t zesTemperatureGetState( zes_temp_handle_t hTemperature, double* pTemperature ) {return ZE_RESULT_SUCCESS;}
virtual ze_result_t zesPowerGetLimitsExt( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) {return ZE_RESULT_SUCCESS;}
virtual ze_result_t zesPowerSetLimitsExt( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) {return ZE_RESULT_SUCCESS;}
virtual ~ZESValidationEntryPoints() {}
};
}
1 change: 1 addition & 0 deletions source/layers/validation/common/zet_entry_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ class ZETValidationEntryPoints {
virtual ze_result_t zetMetricGroupGetGlobalTimestampsExp( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) {return ZE_RESULT_SUCCESS;}
virtual ze_result_t zetMetricGroupGetExportDataExp( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData ) {return ZE_RESULT_SUCCESS;}
virtual ze_result_t zetMetricGroupCalculateMetricExportDataExp( ze_driver_handle_t hDriver, zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t* pExportData, zet_metric_calculate_exp_desc_t* pCalculateDescriptor, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) {return ZE_RESULT_SUCCESS;}
virtual ~ZETValidationEntryPoints() {}
};
}
50 changes: 10 additions & 40 deletions source/loader/ze_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5640,7 +5640,6 @@ zeGetRTASBuilderExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -5650,9 +5649,7 @@ zeGetRTASBuilderExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetRTASBuilderExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.RTASBuilderExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.RTASBuilderExp);
}


Expand Down Expand Up @@ -5722,7 +5719,6 @@ zeGetRTASParallelOperationExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -5732,9 +5728,7 @@ zeGetRTASParallelOperationExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetRTASParallelOperationExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.RTASParallelOperationExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.RTASParallelOperationExp);
}


Expand Down Expand Up @@ -5895,7 +5889,6 @@ zeGetDriverExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -5905,9 +5898,7 @@ zeGetDriverExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetDriverExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.DriverExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.DriverExp);
}


Expand Down Expand Up @@ -6077,7 +6068,6 @@ zeGetDeviceExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -6087,9 +6077,7 @@ zeGetDeviceExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetDeviceExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.DeviceExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.DeviceExp);
}


Expand Down Expand Up @@ -6542,7 +6530,6 @@ zeGetEventExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -6552,9 +6539,7 @@ zeGetEventExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetEventExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.EventExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.EventExp);
}


Expand Down Expand Up @@ -6889,7 +6874,6 @@ zeGetImageExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -6899,9 +6883,7 @@ zeGetImageExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetImageExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.ImageExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.ImageExp);
}


Expand Down Expand Up @@ -7065,7 +7047,6 @@ zeGetKernelExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -7075,9 +7056,7 @@ zeGetKernelExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetKernelExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.KernelExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.KernelExp);
}


Expand Down Expand Up @@ -7240,7 +7219,6 @@ zeGetMemExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -7250,9 +7228,7 @@ zeGetMemExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetMemExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.MemExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.MemExp);
}


Expand Down Expand Up @@ -7764,7 +7740,6 @@ zeGetFabricEdgeExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -7774,9 +7749,7 @@ zeGetFabricEdgeExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetFabricEdgeExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.FabricEdgeExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.FabricEdgeExp);
}


Expand Down Expand Up @@ -7845,7 +7818,6 @@ zeGetFabricVertexExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -7855,9 +7827,7 @@ zeGetFabricVertexExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zeGetFabricVertexExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.ze.FabricVertexExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.ze.FabricVertexExp);
}


Expand Down
34 changes: 17 additions & 17 deletions source/loader/ze_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ namespace loader
}

if(nullptr != validationLayer) {
auto getTable = reinterpret_cast<ze_pfnGetGlobalProcAddrTable_t>(
getTable = reinterpret_cast<ze_pfnGetGlobalProcAddrTable_t>(
GET_FUNCTION_PTR(validationLayer, "zeGetGlobalProcAddrTable") );
if(!getTable)
return ZE_RESULT_ERROR_UNINITIALIZED;
auto getTableResult = getTable( version, &global);
getTableResult = getTable( version, &global);
if(getTableResult != ZE_RESULT_SUCCESS) {
return ZE_RESULT_ERROR_UNINITIALIZED;
}
}

if(nullptr != tracingLayer) {
auto getTable = reinterpret_cast<ze_pfnGetGlobalProcAddrTable_t>(
getTable = reinterpret_cast<ze_pfnGetGlobalProcAddrTable_t>(
GET_FUNCTION_PTR(tracingLayer, "zeGetGlobalProcAddrTable") );
if(!getTable)
return ZE_RESULT_ERROR_UNINITIALIZED;
auto getTableResult = getTable( version, &global);
getTableResult = getTable( version, &global);
if(getTableResult != ZE_RESULT_SUCCESS) {
return ZE_RESULT_ERROR_UNINITIALIZED;
}
Expand Down Expand Up @@ -163,10 +163,10 @@ namespace loader
{
auto getVersion = reinterpret_cast<getVersion_t>(
GET_FUNCTION_PTR(validationLayer, "zelLoaderGetVersion"));
zel_component_version_t version;
if(getVersion && ZE_RESULT_SUCCESS == getVersion(&version))
zel_component_version_t compVersion;
if(getVersion && ZE_RESULT_SUCCESS == getVersion(&compVersion))
{
compVersions.push_back(version);
compVersions.push_back(compVersion);
}
} else if (debugTraceEnabled) {
GET_LIBRARY_ERROR(loadLibraryErrorValue);
Expand All @@ -184,10 +184,10 @@ namespace loader
{
auto getVersion = reinterpret_cast<getVersion_t>(
GET_FUNCTION_PTR(tracingLayer, "zelLoaderGetVersion"));
zel_component_version_t version;
if(getVersion && ZE_RESULT_SUCCESS == getVersion(&version))
zel_component_version_t compVersion;
if(getVersion && ZE_RESULT_SUCCESS == getVersion(&compVersion))
{
compVersions.push_back(version);
compVersions.push_back(compVersion);
}
} else if (debugTraceEnabled) {
GET_LIBRARY_ERROR(loadLibraryErrorValue);
Expand Down Expand Up @@ -256,14 +256,14 @@ namespace loader
};

void context_t::add_loader_version(){
zel_component_version_t version = {};
string_copy_s(version.component_name, LOADER_COMP_NAME, ZEL_COMPONENT_STRING_SIZE);
version.spec_version = ZE_API_VERSION_CURRENT;
version.component_lib_version.major = LOADER_VERSION_MAJOR;
version.component_lib_version.minor = LOADER_VERSION_MINOR;
version.component_lib_version.patch = LOADER_VERSION_PATCH;
zel_component_version_t compVersion = {};
string_copy_s(compVersion.component_name, LOADER_COMP_NAME, ZEL_COMPONENT_STRING_SIZE - 1);
compVersion.spec_version = ZE_API_VERSION_CURRENT;
compVersion.component_lib_version.major = LOADER_VERSION_MAJOR;
compVersion.component_lib_version.minor = LOADER_VERSION_MINOR;
compVersion.component_lib_version.patch = LOADER_VERSION_PATCH;

compVersions.push_back(version);
compVersions.push_back(compVersion);
}

}
5 changes: 1 addition & 4 deletions source/loader/zet_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,6 @@ zetGetMetricGroupExpProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->drivers )
{
Expand All @@ -2085,9 +2084,7 @@ zetGetMetricGroupExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zetGetMetricGroupExpProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.zet.MetricGroupExp);
if(getTableResult == ZE_RESULT_SUCCESS)
atLeastOneDriverValid = true;
result = getTable( version, &drv.dditable.zet.MetricGroupExp);
}


Expand Down

0 comments on commit cfc05b0

Please sign in to comment.