Warning suppression for C-API. (#12669)
* Warning suppression for C-API. Signed-off-by: Yan, Xiping <xiping.yan@intel.com> * Add compiler flags for CI verification. Signed-off-by: Yan, Xiping <xiping.yan@intel.com> * Update parent cmake compiler flag, and make it work for total bindings folder. Signed-off-by: Yan, Xiping <xiping.yan@intel.com> * Open compiler check. Move "sign-compare" to below, and make it only work for bindings. Because plugins have many compare errors. Signed-off-by: Yan, Xiping <xiping.yan@intel.com> * Remove sign-compare. Signed-off-by: Yan, Xiping <xiping.yan@intel.com> Signed-off-by: Yan, Xiping <xiping.yan@intel.com> Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
This commit is contained in:
parent
28ac460817
commit
5b3cc5514a
@ -4,12 +4,6 @@
|
|||||||
|
|
||||||
project(OpenVINO_C_API)
|
project(OpenVINO_C_API)
|
||||||
|
|
||||||
# TODO: fix it
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
ie_add_compiler_flags(-Wno-error=sign-compare)
|
|
||||||
ie_add_compiler_flags(-Wno-error=missing-declarations)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
|
@ -196,7 +196,7 @@ std::map<IE::ColorFormat, colorformat_e> colorformat_map = {{IE::ColorFormat::RA
|
|||||||
/**
|
/**
|
||||||
*@brief convert the config type data to map type data.
|
*@brief convert the config type data to map type data.
|
||||||
*/
|
*/
|
||||||
std::map<std::string, std::string> config2Map(const ie_config_t* config) {
|
inline std::map<std::string, std::string> config2Map(const ie_config_t* config) {
|
||||||
std::map<std::string, std::string> m;
|
std::map<std::string, std::string> m;
|
||||||
const ie_config_t* tmp = config;
|
const ie_config_t* tmp = config;
|
||||||
while (tmp && tmp->name && tmp->value) {
|
while (tmp && tmp->name && tmp->value) {
|
||||||
@ -206,7 +206,7 @@ std::map<std::string, std::string> config2Map(const ie_config_t* config) {
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, IE::Parameter> config2ParamMap(const ie_config_t* config) {
|
inline std::map<std::string, IE::Parameter> config2ParamMap(const ie_config_t* config) {
|
||||||
std::map<std::string, IE::Parameter> param_map;
|
std::map<std::string, IE::Parameter> param_map;
|
||||||
const ie_config_t* tmp = config;
|
const ie_config_t* tmp = config;
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ std::map<std::string, IE::Parameter> config2ParamMap(const ie_config_t* config)
|
|||||||
/**
|
/**
|
||||||
*@brief convert the parameter.
|
*@brief convert the parameter.
|
||||||
*/
|
*/
|
||||||
void parameter2IEparam(const IE::Parameter param, ie_param_t* ie_param) {
|
inline void parameter2IEparam(const IE::Parameter param, ie_param_t* ie_param) {
|
||||||
if (param.is<std::string>()) {
|
if (param.is<std::string>()) {
|
||||||
std::unique_ptr<char> params_temp(new char[param.as<std::string>().length() + 1]);
|
std::unique_ptr<char> params_temp(new char[param.as<std::string>().length() + 1]);
|
||||||
ie_param->params = params_temp.release();
|
ie_param->params = params_temp.release();
|
||||||
|
@ -29,7 +29,7 @@ char const* error_infos[] = {"success",
|
|||||||
const char* ov_get_error_info(ov_status_e status) {
|
const char* ov_get_error_info(ov_status_e status) {
|
||||||
auto index = -status;
|
auto index = -status;
|
||||||
auto max_index = sizeof(error_infos) / sizeof(error_infos[0]) - 1;
|
auto max_index = sizeof(error_infos) / sizeof(error_infos[0]) - 1;
|
||||||
if (index > max_index)
|
if (static_cast<size_t>(index) > max_index)
|
||||||
return error_infos[max_index];
|
return error_infos[max_index];
|
||||||
return error_infos[index];
|
return error_infos[index];
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ ov_status_e ov_core_get_available_devices(const ov_core_t* core, ov_available_de
|
|||||||
auto available_devices = core->object->get_available_devices();
|
auto available_devices = core->object->get_available_devices();
|
||||||
devices->size = available_devices.size();
|
devices->size = available_devices.size();
|
||||||
std::unique_ptr<char*[]> tmp_devices(new char*[available_devices.size()]);
|
std::unique_ptr<char*[]> tmp_devices(new char*[available_devices.size()]);
|
||||||
for (int i = 0; i < available_devices.size(); i++) {
|
for (size_t i = 0; i < available_devices.size(); i++) {
|
||||||
tmp_devices[i] = str_to_char_array(available_devices[i]);
|
tmp_devices[i] = str_to_char_array(available_devices[i]);
|
||||||
}
|
}
|
||||||
devices->devices = tmp_devices.release();
|
devices->devices = tmp_devices.release();
|
||||||
@ -410,7 +410,7 @@ void ov_available_devices_free(ov_available_devices_t* devices) {
|
|||||||
if (!devices) {
|
if (!devices) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < devices->size; i++) {
|
for (size_t i = 0; i < devices->size; i++) {
|
||||||
if (devices->devices[i]) {
|
if (devices->devices[i]) {
|
||||||
delete[] devices->devices[i];
|
delete[] devices->devices[i];
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ ov_status_e ov_core_get_versions_by_device_name(const ov_core_t* core,
|
|||||||
versions->size = object.size();
|
versions->size = object.size();
|
||||||
auto tmp_versions(new ov_core_version_t[object.size()]);
|
auto tmp_versions(new ov_core_version_t[object.size()]);
|
||||||
auto iter = object.cbegin();
|
auto iter = object.cbegin();
|
||||||
for (int i = 0; i < object.size(); i++, iter++) {
|
for (size_t i = 0; i < object.size(); i++, iter++) {
|
||||||
const auto& tmp_version_name = iter->first;
|
const auto& tmp_version_name = iter->first;
|
||||||
tmp_versions[i].device_name = str_to_char_array(tmp_version_name);
|
tmp_versions[i].device_name = str_to_char_array(tmp_version_name);
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ void ov_core_versions_free(ov_core_version_list_t* versions) {
|
|||||||
if (!versions) {
|
if (!versions) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < versions->size; i++) {
|
for (size_t i = 0; i < versions->size; i++) {
|
||||||
if (versions->versions[i].device_name)
|
if (versions->versions[i].device_name)
|
||||||
delete[] versions->versions[i].device_name;
|
delete[] versions->versions[i].device_name;
|
||||||
if (versions->versions[i].version.buildNumber)
|
if (versions->versions[i].version.buildNumber)
|
||||||
|
@ -175,7 +175,7 @@ void ov_profiling_info_list_free(ov_profiling_info_list_t* profiling_infos) {
|
|||||||
if (!profiling_infos) {
|
if (!profiling_infos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < profiling_infos->size; i++) {
|
for (size_t i = 0; i < profiling_infos->size; i++) {
|
||||||
if (profiling_infos->profiling_infos[i].node_name)
|
if (profiling_infos->profiling_infos[i].node_name)
|
||||||
delete[] profiling_infos->profiling_infos[i].node_name;
|
delete[] profiling_infos->profiling_infos[i].node_name;
|
||||||
if (profiling_infos->profiling_infos[i].exec_type)
|
if (profiling_infos->profiling_infos[i].exec_type)
|
||||||
|
@ -87,7 +87,8 @@ ov_status_e ov_model_reshape_input_by_name(const ov_model_t* model,
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
std::map<std::string, ov::PartialShape> in_shape;
|
std::map<std::string, ov::PartialShape> in_shape;
|
||||||
if (partial_shape->rank.is_static() && (partial_shape->rank.get_length() == partial_shape->dims.size())) {
|
if (partial_shape->rank.is_static() &&
|
||||||
|
(static_cast<size_t>(partial_shape->rank.get_length()) == partial_shape->dims.size())) {
|
||||||
in_shape[tensor_name] = partial_shape->dims;
|
in_shape[tensor_name] = partial_shape->dims;
|
||||||
} else {
|
} else {
|
||||||
return ov_status_e::PARAMETER_MISMATCH;
|
return ov_status_e::PARAMETER_MISMATCH;
|
||||||
@ -107,10 +108,10 @@ ov_status_e ov_model_reshape(const ov_model_t* model,
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
std::map<std::string, ov::PartialShape> in_shapes;
|
std::map<std::string, ov::PartialShape> in_shapes;
|
||||||
for (auto i = 0; i < cnt; i++) {
|
for (size_t i = 0; i < cnt; i++) {
|
||||||
auto name = tensor_names[i];
|
auto name = tensor_names[i];
|
||||||
if (partial_shapes[i]->rank.is_static() &&
|
if (partial_shapes[i]->rank.is_static() &&
|
||||||
(partial_shapes[i]->rank.get_length() == partial_shapes[i]->dims.size())) {
|
(static_cast<size_t>(partial_shapes[i]->rank.get_length()) == partial_shapes[i]->dims.size())) {
|
||||||
in_shapes[name] = partial_shapes[i]->dims;
|
in_shapes[name] = partial_shapes[i]->dims;
|
||||||
} else {
|
} else {
|
||||||
return ov_status_e::PARAMETER_MISMATCH;
|
return ov_status_e::PARAMETER_MISMATCH;
|
||||||
@ -131,10 +132,10 @@ ov_status_e ov_model_reshape_by_ports(const ov_model_t* model,
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
std::map<size_t, ov::PartialShape> in_shapes;
|
std::map<size_t, ov::PartialShape> in_shapes;
|
||||||
for (auto i = 0; i < cnt; i++) {
|
for (size_t i = 0; i < cnt; i++) {
|
||||||
auto port_id = ports[i];
|
auto port_id = ports[i];
|
||||||
if (partial_shape[i]->rank.is_static() &&
|
if (partial_shape[i]->rank.is_static() &&
|
||||||
(partial_shape[i]->rank.get_length() == partial_shape[i]->dims.size())) {
|
(static_cast<size_t>(partial_shape[i]->rank.get_length()) == partial_shape[i]->dims.size())) {
|
||||||
in_shapes[port_id] = partial_shape[i]->dims;
|
in_shapes[port_id] = partial_shape[i]->dims;
|
||||||
} else {
|
} else {
|
||||||
return ov_status_e::PARAMETER_MISMATCH;
|
return ov_status_e::PARAMETER_MISMATCH;
|
||||||
@ -160,10 +161,10 @@ ov_status_e ov_model_reshape_by_nodes(const ov_model_t* model,
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
std::map<ov::Output<ov::Node>, ov::PartialShape> in_shapes;
|
std::map<ov::Output<ov::Node>, ov::PartialShape> in_shapes;
|
||||||
for (auto i = 0; i < cnt; i++) {
|
for (size_t i = 0; i < cnt; i++) {
|
||||||
auto node = *output_nodes[i]->object;
|
auto node = *output_nodes[i]->object;
|
||||||
if (partial_shapes[i]->rank.is_static() &&
|
if (partial_shapes[i]->rank.is_static() &&
|
||||||
(partial_shapes[i]->rank.get_length() == partial_shapes[i]->dims.size())) {
|
(static_cast<size_t>(partial_shapes[i]->rank.get_length()) == partial_shapes[i]->dims.size())) {
|
||||||
in_shapes[node] = partial_shapes[i]->dims;
|
in_shapes[node] = partial_shapes[i]->dims;
|
||||||
} else {
|
} else {
|
||||||
return ov_status_e::PARAMETER_MISMATCH;
|
return ov_status_e::PARAMETER_MISMATCH;
|
||||||
|
@ -15,7 +15,7 @@ ov_status_e ov_partial_shape_create(ov_partial_shape_t** partial_shape_obj, ov_r
|
|||||||
if (rank->object.is_dynamic()) {
|
if (rank->object.is_dynamic()) {
|
||||||
partial_shape->rank = rank->object;
|
partial_shape->rank = rank->object;
|
||||||
} else {
|
} else {
|
||||||
if (rank->object.get_length() != dims->object.size()) {
|
if (static_cast<size_t>(rank->object.get_length()) != dims->object.size()) {
|
||||||
return ov_status_e::INVALID_C_PARAM;
|
return ov_status_e::INVALID_C_PARAM;
|
||||||
}
|
}
|
||||||
partial_shape->rank = rank->object;
|
partial_shape->rank = rank->object;
|
||||||
@ -44,7 +44,7 @@ const char* ov_partial_shape_to_string(ov_partial_shape_t* partial_shape) {
|
|||||||
|
|
||||||
// static rank
|
// static rank
|
||||||
auto rank = partial_shape->rank.get_length();
|
auto rank = partial_shape->rank.get_length();
|
||||||
if (rank != partial_shape->dims.size()) {
|
if (static_cast<size_t>(rank) != partial_shape->dims.size()) {
|
||||||
return str_to_char_array("rank error");
|
return str_to_char_array("rank error");
|
||||||
}
|
}
|
||||||
std::string str = std::string("{");
|
std::string str = std::string("{");
|
||||||
|
@ -41,13 +41,13 @@ const char* plugins_xml = plugins_xml_std.c_str();
|
|||||||
#define IE_ASSERT_OK(...) ASSERT_EQ(IEStatusCode::OK, __VA_ARGS__)
|
#define IE_ASSERT_OK(...) ASSERT_EQ(IEStatusCode::OK, __VA_ARGS__)
|
||||||
#define IE_EXPECT_NOT_OK(...) EXPECT_NE(IEStatusCode::OK, __VA_ARGS__)
|
#define IE_EXPECT_NOT_OK(...) EXPECT_NE(IEStatusCode::OK, __VA_ARGS__)
|
||||||
|
|
||||||
size_t read_image_from_file(const char* img_path, unsigned char *img_data, size_t size) {
|
inline size_t read_image_from_file(const char* img_path, unsigned char *img_data, size_t size) {
|
||||||
FILE *fp = fopen(img_path, "rb+");
|
FILE *fp = fopen(img_path, "rb+");
|
||||||
size_t read_size = 0;
|
size_t read_size = 0;
|
||||||
|
|
||||||
if (fp) {
|
if (fp) {
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
if (ftell(fp) >= size) {
|
if (ftell(fp) >= static_cast<long int>(size)) {
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
read_size = fread(img_data, 1, size, fp);
|
read_size = fread(img_data, 1, size, fp);
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ size_t read_image_from_file(const char* img_path, unsigned char *img_data, size_
|
|||||||
return read_size;
|
return read_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t find_device(ie_available_devices_t avai_devices, const char *device_name) {
|
inline size_t find_device(ie_available_devices_t avai_devices, const char *device_name) {
|
||||||
for (size_t i = 0; i < avai_devices.num_devices; ++i) {
|
for (size_t i = 0; i < avai_devices.num_devices; ++i) {
|
||||||
if (strstr(avai_devices.devices[i], device_name))
|
if (strstr(avai_devices.devices[i], device_name))
|
||||||
return i;
|
return i;
|
||||||
@ -74,7 +74,7 @@ TEST(ie_c_api_version, apiVersion) {
|
|||||||
ie_version_free(&version);
|
ie_version_free(&version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void completion_callback(void *args) {
|
static void completion_callback(void *args) {
|
||||||
ie_infer_request_t *infer_request = (ie_infer_request_t *)args;
|
ie_infer_request_t *infer_request = (ie_infer_request_t *)args;
|
||||||
ie_blob_t *output_blob = nullptr;
|
ie_blob_t *output_blob = nullptr;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "ov_test.hpp"
|
#include "ov_test.hpp"
|
||||||
|
|
||||||
void get_tensor_info(ov_model_t* model,
|
inline void get_tensor_info(ov_model_t* model,
|
||||||
bool input,
|
bool input,
|
||||||
size_t idx,
|
size_t idx,
|
||||||
char** name,
|
char** name,
|
||||||
@ -286,7 +286,7 @@ TEST_P(ov_infer_request_ppp, infer_async_ppp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void infer_request_callback(void* args) {
|
inline void infer_request_callback(void* args) {
|
||||||
ov_infer_request_t* infer_request = (ov_infer_request_t*)args;
|
ov_infer_request_t* infer_request = (ov_infer_request_t*)args;
|
||||||
ov_tensor_t* out_tensor = nullptr;
|
ov_tensor_t* out_tensor = nullptr;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
#include "ov_test.hpp"
|
#include "ov_test.hpp"
|
||||||
|
|
||||||
void setup_4d_shape(ov_shape_t* shape, int64_t d0, int64_t d1, int64_t d2, int64_t d3) {
|
inline void setup_4d_shape(ov_shape_t* shape, int64_t d0, int64_t d1, int64_t d2, int64_t d3) {
|
||||||
ov_shape_init(shape, 4);
|
ov_shape_init(shape, 4);
|
||||||
shape->dims[0] = d0;
|
shape->dims[0] = d0;
|
||||||
shape->dims[1] = d1;
|
shape->dims[1] = d1;
|
||||||
@ -102,13 +102,13 @@ static size_t product(const std::vector<size_t>& dims) {
|
|||||||
return std::accumulate(std::begin(dims), std::end(dims), (size_t)1, std::multiplies<size_t>());
|
return std::accumulate(std::begin(dims), std::end(dims), (size_t)1, std::multiplies<size_t>());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t calculate_size(ov_shape_t shape) {
|
inline size_t calculate_size(ov_shape_t shape) {
|
||||||
std::vector<size_t> tmp_shape;
|
std::vector<size_t> tmp_shape;
|
||||||
std::copy_n(shape.dims, shape.rank, std::back_inserter(tmp_shape));
|
std::copy_n(shape.dims, shape.rank, std::back_inserter(tmp_shape));
|
||||||
return product(tmp_shape);
|
return product(tmp_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t calculate_byteSize(ov_shape_t shape, ov_element_type_e type) {
|
inline size_t calculate_byteSize(ov_shape_t shape, ov_element_type_e type) {
|
||||||
return (calculate_size(shape) * GET_ELEMENT_TYPE_SIZE(type) + 7) >> 3;
|
return (calculate_size(shape) * GET_ELEMENT_TYPE_SIZE(type) + 7) >> 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user