Deprecate legacy C API (#18146)
* Deprecate legacy C API * fix code sytle * add INFERENCE_ENGINE_1_0_DEPRECATED in ie_c_api.h * fix code style * use OPENVINO_SUPPRESS_DEPRECATED * reset ie_c_api.cpp * fix code style * fix code style * fix definition * fix code style * change msg * [[deprecated(msg)]] * add cmake fun * add deprecated message to INFERENCE_ENGINE_C_API * remove deprecate msg in fun * add msg * fix code style * fix code style * add OPENVINO_SUPPRESS_DEPRECATED_END in c api test * move head after OPENVINO_SUPPRESS_DEPRECATED_START * move declaration to ie_c_api.h * reset to OPENVINO_DEPRECATED * reset to OPENVINO_DEPRECATED * try to fix code style * Revert "try to fix code style" This reverts commitcc2b8476de. * Revert "reset to OPENVINO_DEPRECATED" This reverts commit9d158c8163. * Revert "reset to OPENVINO_DEPRECATED" This reverts commitf8b2793abc. * Update src/bindings/c/include/c_api/ie_c_api.h Co-authored-by: Chen Peter <peter.chen@intel.com> * Update src/bindings/c/tests/ie_c_api_test.cpp Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com> * remove noo error in CMakeLists * remove macro * ix code style * change msg * fix C4996 * add ov_deprecated_no_errors back * add full msg --------- Co-authored-by: Chen Peter <peter.chen@intel.com> Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
This commit is contained in:
co-authored by
Chen Peter
Ilya Lavrenov
parent
c1f26d119f
commit
c7431be401
@@ -33,8 +33,23 @@
|
||||
# define INFERENCE_ENGINE_C_API_EXTERN
|
||||
#endif
|
||||
|
||||
#define IE_1_0_DEPRECATED \
|
||||
OPENVINO_DEPRECATED("The Inference Engine API is deprecated and will be removed in the 2024.0 release. " \
|
||||
"For instructions on transitioning to the new API, please refer to " \
|
||||
"https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
|
||||
#if !defined(IN_OV_COMPONENT) && !defined(C_API_LEGACY_HEADER_INCLUDED)
|
||||
# define C_API_LEGACY_HEADER_INCLUDED
|
||||
# ifdef _MSC_VER
|
||||
# pragma message(
|
||||
"The legacy C API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# else
|
||||
# warning("The legacy C API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(OPENVINO_STATIC_LIBRARY) || defined(__GNUC__) && (__GNUC__ < 4)
|
||||
# define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __VA_ARGS__
|
||||
# define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __VA_ARGS__ IE_1_0_DEPRECATED
|
||||
# define IE_NODISCARD
|
||||
#else
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
@@ -42,12 +57,13 @@
|
||||
# ifdef openvino_c_EXPORTS
|
||||
# define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __declspec(dllexport) __VA_ARGS__ __cdecl
|
||||
# else
|
||||
# define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __declspec(dllimport) __VA_ARGS__ __cdecl
|
||||
# define INFERENCE_ENGINE_C_API(...) \
|
||||
INFERENCE_ENGINE_C_API_EXTERN __declspec(dllimport) __VA_ARGS__ IE_1_0_DEPRECATED __cdecl
|
||||
# endif
|
||||
# define IE_NODISCARD
|
||||
# else
|
||||
# define INFERENCE_ENGINE_C_API(...) \
|
||||
INFERENCE_ENGINE_C_API_EXTERN __attribute__((visibility("default"))) __VA_ARGS__
|
||||
INFERENCE_ENGINE_C_API_EXTERN __attribute__((visibility("default"))) __VA_ARGS__ IE_1_0_DEPRECATED
|
||||
# define IE_NODISCARD __attribute__((warn_unused_result))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@ set(TARGET_NAME openvino_c)
|
||||
|
||||
# Suppress warnings due to catch macro with legacy exception types
|
||||
ov_deprecated_no_errors()
|
||||
add_definitions(-DIN_OV_COMPONENT)
|
||||
|
||||
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
file(GLOB_RECURSE HEADERS ${OpenVINO_C_API_SOURCE_DIR}/include/*.h)
|
||||
|
||||
@@ -1706,4 +1706,4 @@ void ie_blob_free(ie_blob_t** blob) {
|
||||
|
||||
void ie_shutdown() {
|
||||
InferenceEngine::shutdown();
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,22 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <c_api/ie_c_api.h>
|
||||
#include <inference_engine.hpp>
|
||||
#include "test_model_repo.hpp"
|
||||
#include <fstream>
|
||||
#include "inference_engine.hpp"
|
||||
#include <mutex>
|
||||
|
||||
#include "test_model_repo.hpp"
|
||||
|
||||
#define IE_EXPECT_OK(...) EXPECT_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__)
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
|
||||
#include <c_api/ie_c_api.h>
|
||||
|
||||
static std::mutex m;
|
||||
static bool ready = false;
|
||||
static std::condition_variable condVar;
|
||||
@@ -1503,3 +1508,5 @@ TEST_P(ie_c_api_test, ie_infer_set_completion_callback) {
|
||||
ie_network_free(&network);
|
||||
ie_core_free(&core);
|
||||
}
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
Reference in New Issue
Block a user