From 948347f3dd9957f122a5ebf3e899a34433720535 Mon Sep 17 00:00:00 2001 From: Serhii Pavlovskyi <82883030+serhii-pavlovskyi-altran@users.noreply.github.com> Date: Wed, 9 Mar 2022 12:42:06 +0200 Subject: [PATCH] ncc build fixes (#10367) * fix .ncc_style target names it was breaking configure on system with libclang-12-dev, clang-12, ninja and cmake 3.17+(ninja complains about duplicate target). with lower cmake version configure succeeds, but build exits immediately with error. by replacing ninja with make error becomes warning(it's still significant, make just skips duplicate rules, i.e. doesn't check style of some source files, rule duplication is genuine bug). without libclang-12-dev and clang-12 ENABLE_NCC_STYLE is OFF and bug is not triggered * silence uninitialized warning in core_integration probably it was always initialized before use, but compiler wasn't made aware of it * fix function spelling to unbreak code style checks in benchmark_app * include for std::this_thread existing code was relying on namespace pollution by old libstdc++ * replace is_pod with is_standard_layout && is_trivial is_pod is deprecated, it breaks build on current gcc Co-authored-by: Serhii Pavlovskyi Co-authored-by: Ilya Churaev --- .../developer_package/ncc_naming_style/ncc_naming_style.cmake | 4 +++- samples/cpp/benchmark_app/main.cpp | 4 ++-- src/inference/include/ie/ie_blob.h | 2 +- .../behavior/ov_plugin/core_integration.cpp | 2 +- src/tests/unit/auto/auto_release_helper_test.cpp | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake index 53b14c02c89..8efdf859a42 100644 --- a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake +++ b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake @@ -107,8 +107,10 @@ function(ov_ncc_naming_style) list(APPEND NCC_STYLE_ADDITIONAL_INCLUDE_DIRECTORIES "${NCC_STYLE_SOURCE_DIRECTORY}") + # without it sources with same name from different directories will map to same .ncc_style target + file(RELATIVE_PATH source_dir_rel ${CMAKE_SOURCE_DIR} ${NCC_STYLE_SOURCE_DIRECTORY}) foreach(source IN LISTS sources) - set(output_file "${ncc_style_bin_dir}/${source}.ncc_style") + set(output_file "${ncc_style_bin_dir}/${source_dir_rel}/${source}.ncc_style") set(full_source_path "${NCC_STYLE_SOURCE_DIRECTORY}/${source}") add_custom_command( diff --git a/samples/cpp/benchmark_app/main.cpp b/samples/cpp/benchmark_app/main.cpp index 3518ffc5eee..4604d919fea 100644 --- a/samples/cpp/benchmark_app/main.cpp +++ b/samples/cpp/benchmark_app/main.cpp @@ -32,7 +32,7 @@ static const size_t progressBarDefaultTotalCount = 1000; -bool ParseAndCheckCommandLine(int argc, char* argv[]) { +bool parse_and_check_command_line(int argc, char* argv[]) { // ---------------------------Parsing and validating input // arguments-------------------------------------- slog::info << "Parsing input parameters" << slog::endl; @@ -151,7 +151,7 @@ int main(int argc, char* argv[]) { // ------------------------------------------------- next_step(); - if (!ParseAndCheckCommandLine(argc, argv)) { + if (!parse_and_check_command_line(argc, argv)) { return 0; } diff --git a/src/inference/include/ie/ie_blob.h b/src/inference/include/ie/ie_blob.h index 357107637e2..6583c103903 100644 --- a/src/inference/include/ie/ie_blob.h +++ b/src/inference/include/ie/ie_blob.h @@ -508,7 +508,7 @@ using BlobMap = std::map; /** * @brief Represents real host memory allocated for a Tensor/Blob per C type. */ -template ::value>> +template ::value && std::is_trivial::value>> class TBlob : public MemoryBlob { template friend class TBlob; diff --git a/src/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp b/src/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp index 690651c3e51..c70e0855ccf 100644 --- a/src/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp +++ b/src/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp @@ -299,7 +299,7 @@ TEST_P(OVClassGetPropertyTest_GPU, GetMetricMemoryStatisticsAndPrintNoThrow) { TEST_P(OVClassGetPropertyTest_GPU, GetAndSetPerformanceModeNoThrow) { ov::Core ie; - ov::hint::PerformanceMode defaultMode; + ov::hint::PerformanceMode defaultMode{}; ASSERT_NO_THROW(defaultMode = ie.get_property(deviceName, ov::hint::performance_mode)); std::cout << "Default PERFORMANCE_HINT: \"" << defaultMode << "\"" << std::endl; diff --git a/src/tests/unit/auto/auto_release_helper_test.cpp b/src/tests/unit/auto/auto_release_helper_test.cpp index f3c97ae5ba3..a9b2d143f01 100644 --- a/src/tests/unit/auto/auto_release_helper_test.cpp +++ b/src/tests/unit/auto/auto_release_helper_test.cpp @@ -18,6 +18,7 @@ #include "plugin/mock_auto_device_plugin.hpp" #include "cpp/ie_plugin.hpp" #include "mock_common.hpp" +#include using ::testing::MatcherCast; using ::testing::AllOf; @@ -189,4 +190,4 @@ const std::vector testConfigs = {ConfigParams {true, true}, INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, AutoReleaseHelperTest, ::testing::ValuesIn(testConfigs), - AutoReleaseHelperTest::getTestCaseName); \ No newline at end of file + AutoReleaseHelperTest::getTestCaseName);