Put mingw on gcc code path (#16101)

* Supported mingw-w64

* Supported mingw-w64

* Supported mingw-w64
This commit is contained in:
Ilya Lavrenov
2023-05-17 00:47:55 +04:00
committed by GitHub
parent 87a39fb007
commit 04171416f4
112 changed files with 684 additions and 553 deletions

View File

@@ -35,13 +35,13 @@ public:
*/
SharedObjectLoader() = default;
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads a library with the wide char name specified.
* @param pluginName Full or relative path to the plugin library
*/
explicit SharedObjectLoader(const wchar_t* pluginName);
#endif
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads a library with the name specified.

View File

@@ -14,7 +14,7 @@
# define INFERENCE_ENGINE_API_CPP(...) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __VA_ARGS__
#else
# if defined(_WIN32)
# if defined(_WIN32) || defined(__CYGWIN__)
# ifdef IMPLEMENT_INFERENCE_ENGINE_API
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllexport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__
@@ -31,53 +31,53 @@
# endif
#endif
#if defined(_WIN32)
#if defined(__GNUC__)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ >= 6 || defined(__clang__)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# endif
#elif defined(_MSC_VER)
# define INFERENCE_ENGINE_DEPRECATED(msg) __declspec(deprecated(msg))
# if __cplusplus >= 201402L
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# endif
#elif defined __INTEL_COMPILER
#elif defined(__INTEL_COMPILER)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
#elif defined(__GNUC__)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ < 6 && !defined(__clang__)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
# endif
#else
# define INFERENCE_ENGINE_DEPRECATED(msg)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
# define IE_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
#if defined(__GNUC__)
# define IE_DO_PRAGMA(x) _Pragma(# x)
#elif defined(_MSC_VER)
# define IE_DO_PRAGMA(x) __pragma(x)
#else
# define IE_DO_PRAGMA(x)
#endif
#if defined(_MSC_VER) && !defined(__clang__)
#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405)) || defined(__clang__)
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(GCC diagnostic push) \
IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
#elif defined(_MSC_VER)
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 4996))
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
#elif defined(__INTEL_COMPILER)
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 1478))
IE_DO_PRAGMA(warning(disable : 1786))
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 1478)) \
IE_DO_PRAGMA(warning(disable : 1786))
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(GCC diagnostic push) \
IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
#else
# define IE_SUPPRESS_DEPRECATED_START
# define IE_SUPPRESS_DEPRECATED_END
@@ -92,18 +92,22 @@ IE_DO_PRAGMA(warning(disable : 1786))
# define _IE_SUPPRESS_DEPRECATED_END_GCC
#endif
#ifndef ENABLE_UNICODE_PATH_SUPPORT
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__clang__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2))
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifndef ENABLE_UNICODE_PATH_SUPPORT
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
/**
@@ -112,7 +116,7 @@ IE_DO_PRAGMA(warning(disable : 1786))
* @param type A plugin type
*/
#if defined(_WIN32) && defined(IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
# define INFERENCE_PLUGIN_API(type) extern "C" __declspec(dllexport) type
#else
# define INFERENCE_PLUGIN_API(type) INFERENCE_ENGINE_API(type)

View File

@@ -609,7 +609,7 @@ public:
* @return rvalue for the empty locked object of type T
*/
virtual LockedMemory<T> data() noexcept {
return std::move(lockme<T>());
return lockme<T>();
}
/**
@@ -618,7 +618,7 @@ public:
* @return rvalue for the empty locked const object of type T.
*/
virtual LockedMemory<const T> readOnly() const noexcept {
return std::move(lockme<const T>());
return lockme<const T>();
}
void allocate() noexcept override {
@@ -639,22 +639,22 @@ public:
}
LockedMemory<void> buffer() noexcept override {
return std::move(lockme<void>());
return lockme<void>();
}
LockedMemory<const void> cbuffer() const noexcept override {
return std::move(lockme<const void>());
return lockme<const void>();
}
LockedMemory<void> rwmap() noexcept override {
return std::move(lockme<void>());
return lockme<void>();
}
LockedMemory<const void> rmap() const noexcept override {
return std::move(lockme<const void>());
return lockme<const void>();
}
LockedMemory<void> wmap() noexcept override {
return std::move(lockme<void>());
return lockme<void>();
}
Blob::Ptr createROI(const ROI& roi) const override {

View File

@@ -504,7 +504,8 @@ struct NullStream {
} // namespace details
} // namespace InferenceEngine
#if defined(_WIN32)
#if defined(_WIN32) && !defined(__GNUC__)
# define __PRETTY_FUNCTION__ __FUNCSIG__
#else
# define __PRETTY_FUNCTION__ __PRETTY_FUNCTION__

View File

@@ -56,7 +56,7 @@ public:
*/
std::map<std::string, Version> GetVersions(const std::string& deviceName) const;
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Reads models from IR and ONNX formats
* @param modelPath path to model
@@ -69,7 +69,7 @@ public:
* @return CNNNetwork
*/
CNNNetwork ReadNetwork(const std::wstring& modelPath, const std::wstring& binPath = {}) const;
#endif
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Reads models from IR and ONNX formats

View File

@@ -31,14 +31,14 @@ public:
*/
explicit Extension(const std::string& name);
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads extension from a shared library
*
* @param name Full or relative path to extension library
*/
explicit Extension(const std::wstring& name);
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Gets the extension version information
@@ -110,7 +110,7 @@ inline std::shared_ptr<T> make_so_pointer(const std::string& name) {
return std::make_shared<Extension>(name);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Creates extension using deprecated API
@@ -123,5 +123,6 @@ inline std::shared_ptr<IExtension> make_so_pointer(const std::wstring& name) {
return std::make_shared<Extension>(name);
}
#endif
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
} // namespace InferenceEngine

View File

@@ -25,13 +25,13 @@
* @def INFERENCE_EXTENSION_API(TYPE)
* @brief Defines Inference Engine Extension API method
*/
#if defined(_WIN32)
#if defined(_WIN32) || defined(__CYGWIN__)
# if defined(IMPLEMENT_INFERENCE_EXTENSION_API)
# define INFERENCE_EXTENSION_API(type) extern "C" __declspec(dllexport) type
# else
# define INFERENCE_EXTENSION_API(type) extern "C" type
# endif
#elif defined(__GNUC__) && (__GNUC__ >= 4)
#elif defined(__GNUC__) && (__GNUC__ >= 4) || defined(__clang__)
# ifdef IMPLEMENT_INFERENCE_EXTENSION_API
# define INFERENCE_EXTENSION_API(type) extern "C" __attribute__((visibility("default"))) type
# else
@@ -220,7 +220,7 @@ INFERENCE_EXTENSION_API(void) CreateExtensionShared(IExtensionPtr& ext);
* @param resp Responce
* @return InferenceEngine::OK if extension is constructed and InferenceEngine::GENERAL_ERROR otherwise
*/
#if defined(_WIN32)
#ifdef _MSC_VER
INFERENCE_ENGINE_DEPRECATED("Use IE_DEFINE_EXTENSION_CREATE_FUNCTION macro")
INFERENCE_EXTENSION_API(StatusCode)
CreateExtension(IExtension*& ext, ResponseDesc* resp) noexcept;

View File

@@ -39,6 +39,9 @@
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC system_header
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma system_header
#endif
#ifdef OV_GPU_USE_OPENCL_HPP
@@ -49,6 +52,8 @@
#ifdef __GNUC__
# pragma GCC diagnostic pop
#elif defined(_MSC_VER)
# pragma warning(pop)
#endif
/// @endcond

View File

@@ -61,7 +61,7 @@ Extension::Extension(const std::string& name) {
_actual = CreateExtensionFromLibrary<IExtension>(_so);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
Extension::Extension(const std::wstring& name) {
try {
_so = ov::util::load_shared_object(name.c_str());
@@ -70,7 +70,7 @@ Extension::Extension(const std::wstring& name) {
}
_actual = CreateExtensionFromLibrary<IExtension>(_so);
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::map<std::string, ngraph::OpSet> Extension::getOpSets() {
return _actual->getOpSets();

View File

@@ -161,7 +161,7 @@ public:
private:
int get_processors_group_num() const {
# if defined(_WIN32) || defined(_WIN64)
# if defined(_WIN32)
SYSTEM_INFO si;
GetNativeSystemInfo(&si);

View File

@@ -17,7 +17,7 @@ namespace threading {
#if (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
using cpu_set_t = void;
#endif // (defined(__APPLE__) || defined(_WIN32))
#endif // (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
/**
* @brief Release the cores affinity mask for the current process

View File

@@ -32,7 +32,7 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <Windows.h>
# include <windows.h>
#endif
long long FileUtils::fileSize(const char* charfilepath) {

View File

@@ -182,7 +182,7 @@ CNNNetwork load_ir_v7_network(const std::string& modelPath,
# endif
// Try to open model file
std::ifstream modelStream(model_path, std::ios::binary);
std::ifstream modelStream(model_path.c_str(), std::ios::binary);
if (!modelStream.is_open())
IE_THROW() << "Model file " << modelPath << " cannot be opened!";
@@ -214,7 +214,7 @@ CNNNetwork load_ir_v7_network(const std::string& modelPath,
std::string weights_path = bPath;
# endif
std::ifstream binStream;
binStream.open(weights_path, std::ios::binary);
binStream.open(weights_path.c_str(), std::ios::binary);
if (!binStream.is_open())
IE_THROW() << "Weights file " << bPath << " cannot be opened!";

View File

@@ -50,7 +50,7 @@ void parse_processor_info_linux(const int _processors,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_WIN32)
/**
* @brief Parse processors infomation on Windows
* @param[in] base_ptr buffer object pointer of Windows system infomation

View File

@@ -17,7 +17,7 @@
namespace InferenceEngine {
#if (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
using cpu_set_t = ov::threading::cpu_set_t;
#endif // (defined(__APPLE__) || defined(_WIN32))
#endif // (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
/**
* @brief Release the cores affinity mask for the current process

View File

@@ -586,7 +586,7 @@ INSTANTIATE_TEST_SUITE_P(CPUMap,
_1sockets_6cores_hyperthreading));
#endif
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_WIN32)
int Hex2Int(char c) {
return (c >= '0' && c <= '9')
@@ -595,7 +595,7 @@ int Hex2Int(char c) {
}
void Hex2Bin(const char* hex, std::size_t sz, char* out) {
for (int i = 0; i < sz; i += 2) {
for (size_t i = 0; i < sz; i += 2) {
out[i / 2] = (Hex2Int(hex[i]) << 4) | Hex2Int(hex[i + 1]);
}
}
@@ -626,7 +626,7 @@ public:
int test_processors = 0;
int test_sockets = 0;
int test_cores = 0;
unsigned long len = unsigned long(test_len / 2);
unsigned long len = (unsigned long)(test_len / 2);
std::vector<std::vector<int>> test_proc_type_table;
std::vector<std::vector<int>> test_cpu_mapping_table;

View File

@@ -8,12 +8,6 @@
#include "unit_test_utils/mocks/mock_allocator.hpp"
#ifdef _WIN32
# define UNUSED
#else
# define UNUSED __attribute__((unused))
#endif
class BlobTests : public ::testing::Test {
protected:
std::shared_ptr<MockAllocator> createMockAllocator() {
@@ -78,7 +72,10 @@ TEST_F(BlobTests, doesNotUnlockIfLockFailed) {
InferenceEngine::TBlob<float> blob({InferenceEngine::Precision::FP32, v, InferenceEngine::CHW},
std::dynamic_pointer_cast<InferenceEngine::IAllocator>(allocator));
blob.allocate();
{ float UNUSED* ptr = blob.data(); }
{
float* ptr = blob.data();
(void)ptr;
}
}
TEST_F(BlobTests, canAccessDataUsingAllocator) {