Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate legacy C API #18146

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
58c4d72
Deprecate legacy C API
Jun 20, 2023
dfc968f
fix code sytle
Jun 20, 2023
5ed231c
Merge branch 'master' into haiqi/deprecate_legacy_C_API
Jun 25, 2023
8123fc9
add INFERENCE_ENGINE_1_0_DEPRECATED in ie_c_api.h
Jun 25, 2023
8a246c0
fix code style
Jun 25, 2023
357135c
use OPENVINO_SUPPRESS_DEPRECATED
Jun 25, 2023
80d66b3
reset ie_c_api.cpp
Jun 25, 2023
d878bfa
fix code style
Jun 25, 2023
fbd1cd0
fix code style
Jun 26, 2023
fdc6108
fix definition
Jun 26, 2023
33d66d2
fix code style
Jun 26, 2023
b83b011
change msg
Jun 26, 2023
d02f7d6
[[deprecated(msg)]]
Jun 26, 2023
ca50c29
add cmake fun
Jun 27, 2023
76f6014
add deprecated message to INFERENCE_ENGINE_C_API
Jul 3, 2023
ff1d259
remove deprecate msg in fun
Jul 3, 2023
6c94732
add msg
Jul 3, 2023
434f819
fix code style
Jul 3, 2023
54774a4
fix code style
Jul 3, 2023
fadf73d
add OPENVINO_SUPPRESS_DEPRECATED_END in c api test
Jul 4, 2023
eefd245
move head after OPENVINO_SUPPRESS_DEPRECATED_START
Jul 4, 2023
b21478c
move declaration to ie_c_api.h
Jul 4, 2023
f8b2793
reset to OPENVINO_DEPRECATED
Jul 4, 2023
9d158c8
reset to OPENVINO_DEPRECATED
Jul 4, 2023
cc2b847
try to fix code style
Jul 4, 2023
e64be05
Revert "try to fix code style"
Jul 5, 2023
8f3ed21
Revert "reset to OPENVINO_DEPRECATED"
Jul 5, 2023
f602274
Revert "reset to OPENVINO_DEPRECATED"
Jul 5, 2023
aae8cfd
Update src/bindings/c/include/c_api/ie_c_api.h
Jul 5, 2023
d79bb6e
Update src/bindings/c/tests/ie_c_api_test.cpp
Jul 5, 2023
11d3ad6
remove noo error in CMakeLists
Jul 5, 2023
6f5a474
Merge branch 'haiqi/deprecate_legacy_C_API' of https://github.com/pan…
Jul 5, 2023
d4d367a
remove macro
Jul 5, 2023
bfad9d9
ix code style
Jul 5, 2023
23ba47b
change msg
Jul 5, 2023
1f73ab1
fix C4996
Jul 5, 2023
fd328f6
add ov_deprecated_no_errors back
Jul 6, 2023
819d740
add full msg
Jul 6, 2023
0a70d9c
Merge branch 'master' into haiqi/deprecate_legacy_C_API
Jul 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/bindings/c/include/c_api/ie_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,37 @@
# 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__)
# define INFERENCE_ENGINE_C_API_CALLBACK __cdecl
# 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
Expand Down
1 change: 1 addition & 0 deletions src/bindings/c/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(TARGET_NAME openvino_c)

# Suppress warnings due to catch macro with legacy exception types
ov_deprecated_no_errors()
ilya-lavrenov marked this conversation as resolved.
Show resolved Hide resolved
add_definitions(-DIN_OV_COMPONENT)

peterchen-intel marked this conversation as resolved.
Show resolved Hide resolved
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE HEADERS ${OpenVINO_C_API_SOURCE_DIR}/include/*.h)
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/c/src/ie_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1706,4 +1706,4 @@ void ie_blob_free(ie_blob_t** blob) {

void ie_shutdown() {
InferenceEngine::shutdown();
}
}
13 changes: 10 additions & 3 deletions src/bindings/c/tests/ie_c_api_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
#include <gtest/gtest.h>
#include <stdio.h>
#include <stdlib.h>

#include <condition_variable>
#include <fstream>
#include "inference_engine.hpp"
#include <mutex>
#include <c_api/ie_c_api.h>
#include <inference_engine.hpp>

#include "test_model_repo.hpp"
#include <fstream>

#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
peterchen-intel marked this conversation as resolved.
Show resolved Hide resolved

#include <c_api/ie_c_api.h>

static std::mutex m;
static bool ready = false;
static std::condition_variable condVar;
Expand Down Expand Up @@ -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