Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[Cpp20] Compiler version gate (#38986)

Pawel Raasz60d87a0f2473
diff --git a/.github/workflows/job_build_linux_cpp20.yml b/.github/workflows/job_build_linux_cpp20.yml
new file mode 100644
index 00000000000..88b25b07fef
--- /dev/null
+++ b/.github/workflows/job_build_linux_cpp20.yml
@@ -0,0 +1,109 @@
+on:
+ workflow_call:
+ inputs:
+ runner:
+ description: 'Machine on which the build would run'
+ type: string
+ required: true
+ image:
+ description: 'Docker image to use for the job'
+ type: string
+ required: true
+ os:
+ description: 'OS that is used for building in the form of "ubuntu_22_04"'
+ type: string
+ required: true
+ arch:
+ description: 'Target architecture'
+ type: string
+ default: 'x86_64'
+ required: false
+ cmake-options:
+ description: 'A string of options passed to CMake'
+ type: string
+ required: true
+ cmake-build-parallel-level:
+ description: 'Number of threads for parallel build (hard-coded; nproc does not respect container CPU limits)'
+ type: string
+ required: true
+
+permissions: read-all
+
+# Compile-only C++20 check. It is intentionally separate from job_build_linux.yml, so it
+# neither uploads artifacts nor shares compiler cache, shared-drive paths or logs with the main Build.
+jobs:
+ Build:
+ name: Build
+ timeout-minutes: 150
+ continue-on-error: true # non-blocking C++20 check (CVS-189849)
+ runs-on: ${{ inputs.runner }}
+ container:
+ image: ${{ inputs.image }}
+ volumes:
+ - /mount:/mount
+ - /home/runner/secrets/:/secrets:ro
+ - ${{ github.workspace }}:${{ github.workspace }} # Needed as ${{ github.workspace }} is not working correctly when using Docker
+ options: >-
+ -e SCCACHE_AZURE_BLOB_CONTAINER
+ defaults:
+ run:
+ shell: bash
+ env:
+ DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
+ CMAKE_BUILD_TYPE: 'Release'
+ CMAKE_CXX_COMPILER_LAUNCHER: sccache
+ CMAKE_C_COMPILER_LAUNCHER: sccache
+ SCCACHE_IGNORE_SERVER_IO_ERROR: 1
+ SCCACHE_SERVER_PORT: 35555
+ SCCACHE_ERROR_LOG: ${{ github.workspace }}/sccache_log.txt
+ SCCACHE_LOG: warn
+ SCCACHE_AZURE_KEY_PREFIX: ${{ inputs.os }}_${{ inputs.arch }}_Release_cpp20
+ OPENVINO_REPO: ${{ github.workspace }}/openvino
+ BUILD_DIR: ${{ github.workspace }}/openvino/openvino_build
+ PIP_INDEX_URL: ${{ contains(inputs.runner, 'aks') && 'http://pip-proxy.pip-proxy.svc.cluster.local/simple/' || '' }}
+ PIP_TRUSTED_HOST: ${{ contains(inputs.runner, 'aks') && 'pip-proxy.pip-proxy.svc.cluster.local' || '' }}
+ # Nested cmake --build (e.g. intel_gpu onednn_gpu ExternalProject) does not inherit --parallel from the top-level build.
+ CMAKE_BUILD_PARALLEL_LEVEL: ${{ inputs.cmake-build-parallel-level }}
+ steps:
+ - name: Append the environment variable - load SCCACHE_AZURE_CONNECTION_STRING from file
+ shell: bash
+ run: |
+ SCCACHE_AZURE_CONNECTION_STRING="$(cat /secrets/sccache/connection-string)"
+ # nosemgrep: yaml.github-actions.security.audit.unsafe-add-mask-workflow-command.unsafe-add-mask-workflow-command
+ echo "::add-mask::${SCCACHE_AZURE_CONNECTION_STRING}"
+ echo "SCCACHE_AZURE_CONNECTION_STRING=${SCCACHE_AZURE_CONNECTION_STRING}" >> $GITHUB_ENV
+
+ - name: Clone OpenVINO
+ uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
+ timeout-minutes: 15
+ with:
+ path: ${{ env.OPENVINO_REPO }}
+ submodules: 'recursive'
+
+ - name: System info
+ uses: ./openvino/.github/actions/system_info
+
+ - name: Install python dependencies
+ run: python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
+
+ - name: CMake configure - OpenVINO
+ run: eval cmake ${{ env.CMAKE_OPTIONS }} -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }}
+ env:
+ CMAKE_OPTIONS: ${{ inputs.cmake-options }}
+
+ - name: Clean sccache stats
+ run: ${SCCACHE_PATH} --zero-stats
+
+ - name: Cmake build - OpenVINO
+ run: cmake --build ${BUILD_DIR} --parallel ${CMAKE_BUILD_PARALLEL_LEVEL} --config ${{ env.CMAKE_BUILD_TYPE }} -- --quiet
+
+ - name: Show sccache stats
+ if: always()
+ run: ${SCCACHE_PATH} --show-stats
+
+ - name: Report non-blocking failure
+ if: failure()
+ run: |
+ msg="C++20 build failed. This check is non-blocking (CVS-189849), the failure does not fail the workflow."
+ echo "::warning title=C++20 build failed (non-blocking)::${msg}"
+ echo "${msg}" >> "${GITHUB_STEP_SUMMARY}"
diff --git a/.github/workflows/job_build_windows_cpp20.yml b/.github/workflows/job_build_windows_cpp20.yml
new file mode 100644
index 00000000000..e313c946182
--- /dev/null
+++ b/.github/workflows/job_build_windows_cpp20.yml
@@ -0,0 +1,119 @@
+on:
+ workflow_call:
+ inputs:
+ runner:
+ description: 'Machine on which the build would run'
+ type: string
+ required: true
+ build-type:
+ description: 'OpenVINO build type, e.g., "Release"'
+ type: string
+ required: true
+ target-branch:
+ description: 'Target branch for the build'
+ type: string
+ required: true
+ cmake-options:
+ description: 'A string of options passed to CMake'
+ type: string
+ required: true
+ build-variant:
+ description: 'Build variant including toolchain, e.g., "vs2022"'
+ type: string
+ required: false
+ default: 'vs2022'
+ cmake-build-parallel-level:
+ description: 'Number of threads for parallel build (hard-coded; NUMBER_OF_PROCESSORS does not respect container CPU limits)'
+ type: string
+ required: true
+
+permissions: read-all
+
+env:
+ PYTHON_VERSION: '3.11'
+
+# Compile-only C++20 check. It is intentionally separate from job_build_windows.yml, so it
+# neither uploads artifacts nor shares compiler cache or shared-drive paths with the main Build.
+jobs:
+ Build:
+ name: Build
+ timeout-minutes: 180
+ continue-on-error: true # non-blocking C++20 check (CVS-189849)
+ defaults:
+ run:
+ shell: pwsh
+ runs-on: ${{ inputs.runner }}
+ env:
+ CMAKE_BUILD_TYPE: ${{ inputs.build-type }}
+ CMAKE_CXX_COMPILER_LAUNCHER: ccache
+ CMAKE_C_COMPILER_LAUNCHER: ccache
+ CCACHE_REMOTE_DIR: "C:\\mount\\caches\\ccache\\windows${{ inputs.build-variant }}_x86_64_${{ inputs.build-type }}_cpp20\\${{ inputs.target-branch }}"
+ CCACHE_DIR: ${{ github.workspace }}\\ccache
+ CCACHE_MAXSIZE: 3G
+ CCACHE_SLOPPINESS: pch_defines,time_macros
+ OPENVINO_REPO: "${{ github.workspace }}\\openvino"
+ BUILD_DIR: "${{ github.workspace }}\\openvino_build"
+ # Nested cmake --build (e.g. intel_gpu onednn_gpu ExternalProject) does not inherit --parallel from the top-level build.
+ CMAKE_BUILD_PARALLEL_LEVEL: ${{ inputs.cmake-build-parallel-level }}
+ steps:
+ - name: Clone OpenVINO
+ uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
+ timeout-minutes: 15
+ with:
+ path: 'openvino'
+ submodules: 'recursive'
+
+ - name: Setup Python ${{ env.PYTHON_VERSION }}
+ uses: ./openvino/.github/actions/setup_python
+ with:
+ version: ${{ env.PYTHON_VERSION }}
+ use-pip-proxy: 'true'
+ self-hosted-runner: 'true'
+
+ - name: System info
+ uses: ./openvino/.github/actions/system_info
+
+ - name: Install python dependencies
+ run: python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt
+
+ - name: Setup ccache
+ uses: ./openvino/.github/actions/cache
+ with:
+ save-always: ${{ github.event_name == 'push' && 'true' || 'false' }}
+ cleanup-always: ${{ github.event_name == 'push' && 'true' || 'false' }}
+ cache-path: ${{ env.CCACHE_REMOTE_DIR }}
+ path: ${{ env.CCACHE_DIR }}
+ key: ${{ runner.os }}-${{ runner.arch }}-cpp20-ccache-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-cpp20-ccache
+
+ - name: Configure Developer Command Prompt for Microsoft Visual C++
+ uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
+ with:
+ toolset: "14.42" # v2022
+
+ - name: CMake configure
+ env:
+ CMAKE_OPTIONS: ${{ inputs.cmake-options }}
+ run: |
+ $cmakeOptions = "$env:CMAKE_OPTIONS"
+ $splitCmakeOptions = $cmakeOptions.Split(" ")
+ $cmakeCommand = "cmake $splitCmakeOptions -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }}"
+ Invoke-Expression $cmakeCommand
+
+ - name: Clean ccache stats
+ run: '& ccache --zero-stats'
+
+ - name: Cmake build - OpenVINO
+ run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel $env:CMAKE_BUILD_PARALLEL_LEVEL -- --quiet
+
+ - name: Show ccache stats
+ if: always()
+ run: '& ccache --show-stats'
+
+ - name: Report non-blocking failure
+ if: failure()
+ run: |
+ $msg = "C++20 build failed. This check is non-blocking (CVS-189849), the failure does not fail the workflow."
+ echo "::warning title=C++20 build failed (non-blocking)::$msg"
+ echo $msg >> $env:GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml
index 8252615cf53..8db61626c03 100644
--- a/.github/workflows/ubuntu_22.yml
+++ b/.github/workflows/ubuntu_22.yml
@@ -168,6 +168,28 @@ jobs:
-DENABLE_WHEEL=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
+ # Non-blocking C++20 compile check (CVS-189849): promote to a required check when done.
+ Build_CPP20:
+ name: Build (C++20, non-blocking)
+ needs: [Docker, Smart_CI]
+ if: "!needs.smart_ci.outputs.skip_workflow"
+ uses: ./.github/workflows/job_build_linux_cpp20.yml
+ with:
+ runner: 'aks-linux-16-cores-32gb'
+ cmake-build-parallel-level: '15'
+ image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_x64 }}
+ os: 'ubuntu_22_04'
+ cmake-options: >-
+ -G 'Ninja Multi-Config'
+ -DENABLE_NCC_STYLE=OFF
+ -DENABLE_TESTS=ON
+ -DENABLE_STRICT_DEPENDENCIES=OFF
+ -DENABLE_SYSTEM_OPENCL=ON
+ -DENABLE_OV_GGUF_FRONTEND=ON
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
+ -DCMAKE_CXX_STANDARD=20
+
Debian_Packages:
name: Debian Packages
needs: [Docker, Build]
diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml
index c3a2d347502..26bf6ea784e 100644
--- a/.github/workflows/ubuntu_24.yml
+++ b/.github/workflows/ubuntu_24.yml
@@ -124,6 +124,28 @@ jobs:
-DCPACK_GENERATOR=TGZ
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
+ # Non-blocking C++20 compile check (CVS-189849): promote to a required check when done.
+ Build_CPP20:
+ name: Build (C++20, non-blocking)
+ needs: [Docker, Smart_CI]
+ if: "!needs.smart_ci.outputs.skip_workflow"
+ uses: ./.github/workflows/job_build_linux_cpp20.yml
+ with:
+ runner: 'aks-linux-16-cores-32gb'
+ cmake-build-parallel-level: '15'
+ image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_24_04_x64 }}
+ os: 'ubuntu_24_04'
+ cmake-options: >-
+ -G 'Ninja Multi-Config'
+ -DENABLE_NCC_STYLE=OFF
+ -DENABLE_TESTS=ON
+ -DENABLE_OV_GGUF_FRONTEND=ON
+ -DENABLE_STRICT_DEPENDENCIES=OFF
+ -DENABLE_SYSTEM_OPENCL=ON
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
+ -DCMAKE_CXX_STANDARD=20
+
CXX_Unit_Tests:
name: C++ unit tests
needs: [ Docker, Build, Smart_CI ]
diff --git a/.github/workflows/windows_vs2022_release.yml b/.github/workflows/windows_vs2022_release.yml
index 102ffb30684..616b2faaf14 100644
--- a/.github/workflows/windows_vs2022_release.yml
+++ b/.github/workflows/windows_vs2022_release.yml
@@ -86,6 +86,30 @@ jobs:
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DFETCHCONTENT_BASE_DIR="C:\fcc\ninja_multi_config"
+ # Non-blocking C++20 compile check (CVS-189849): promote to a required check when done.
+ Build_CPP20:
+ name: Build (C++20, non-blocking)
+ needs: [ Smart_CI ]
+ if: "!needs.smart_ci.outputs.skip_workflow"
+ uses: ./.github/workflows/job_build_windows_cpp20.yml
+ with:
+ runner: 'aks-win-16-cores-32gb-build'
+ cmake-build-parallel-level: '15'
+ build-type: 'Release'
+ target-branch: ${{ needs.smart_ci.outputs.target_branch }}
+ cmake-options: >-
+ -G 'Ninja Multi-Config'
+ -DENABLE_PYTHON=ON
+ -DENABLE_WHEEL=OFF
+ -DENABLE_TESTS=ON
+ -DENABLE_OV_GGUF_FRONTEND=ON
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
+ -DENABLE_STRICT_DEPENDENCIES=OFF
+ -DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+ -DFETCHCONTENT_BASE_DIR="C:\fcc\ninja_multi_config_cpp20"
+ -DCMAKE_CXX_STANDARD=20
+
Samples:
needs: [ Build, Smart_CI ]
if: fromJSON(needs.smart_ci.outputs.affected_components).samples
diff --git a/cmake/developer_package/compile_flags/cxx_standard.cmake b/cmake/developer_package/compile_flags/cxx_standard.cmake
new file mode 100644
index 00000000000..076f99d3adb
--- /dev/null
+++ b/cmake/developer_package/compile_flags/cxx_standard.cmake
@@ -0,0 +1,85 @@
+# Copyright (C) 2018-2026 Intel Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+
+# Verifies the toolchain can build C++20 when CMAKE_CXX_STANDARD requests it.
+
+if(NOT CMAKE_CXX_STANDARD GREATER_EQUAL 20)
+ return()
+endif()
+
+if(NOT DEFINED OV_CXX_STANDARD_FALLBACK)
+ set(OV_CXX_STANDARD_FALLBACK 17)
+endif()
+# OpenVINO has no C++20 named modules; this scanning only costs a version-matched
+# clang-scan-deps (CMP0155/CMake 3.28+) that may not exist in every toolchain/image.
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28 AND NOT DEFINED CMAKE_CXX_SCAN_FOR_MODULES)
+ set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
+endif()
+
+# CVS-190125: raise the GNU floor (currently 10) once OpenVINO drops the OSes that
+# ship it (e.g. RHEL 8) as part of the 2027.0 C++20 default switch.
+set(_ov_cxx20_floor_GNU 10)
+set(_ov_cxx20_floor_Clang 14)
+set(_ov_cxx20_floor_AppleClang 13)
+set(_ov_cxx20_floor_MSVC 19.28)
+set(_ov_cxx20_floor_IntelLLVM 2024.2)
+
+set(_ov_cxx20_error "")
+
+if(DEFINED _ov_cxx20_floor_${CMAKE_CXX_COMPILER_ID})
+ set(_ov_cxx20_floor "${_ov_cxx20_floor_${CMAKE_CXX_COMPILER_ID}}")
+
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS _ov_cxx20_floor)
+ string(CONCAT _ov_cxx20_error
+ "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} does not fully support C++20. "
+ "Minimum: ${CMAKE_CXX_COMPILER_ID} ${_ov_cxx20_floor}")
+ endif()
+
+ unset(_ov_cxx20_floor)
+else()
+ message(WARNING
+ "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} was requested, but ${CMAKE_CXX_COMPILER_ID} "
+ "has no verified minimum version in cxx_standard.cmake. Proceeding unchecked.")
+endif()
+
+# The compiler version does not guarantee the C++20 library (e.g. clang with an old libstdc++).
+if(NOT _ov_cxx20_error)
+ include(CheckCXXSourceCompiles)
+
+ check_cxx_source_compiles("
+ #include <bit>
+ #include <concepts>
+ #include <span>
+ template <std::integral T>
+ int f(std::span<const T> s) { return std::countl_zero(static_cast<unsigned>(s.size())); }
+ int main() {
+ const int a[1] = {0};
+ return f<int>(a) > 100;
+ }"
+ OV_CXX20_LIBRARY_AVAILABLE)
+
+ if(NOT OV_CXX20_LIBRARY_AVAILABLE)
+ string(CONCAT _ov_cxx20_error
+ "The C++ standard library of ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} "
+ "lacks <bit>/<concepts>/<span> required for C++20")
+ endif()
+endif()
+
+if(_ov_cxx20_error)
+ # only a defaulted standard may fall back, an explicit request must fail
+ if(OV_CXX_STANDARD_IS_DEFAULT)
+ message(STATUS "${_ov_cxx20_error}. Falling back to C++${OV_CXX_STANDARD_FALLBACK}")
+ set(CMAKE_CXX_STANDARD ${OV_CXX_STANDARD_FALLBACK})
+ else()
+ message(FATAL_ERROR
+ "${_ov_cxx20_error} (CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} was requested)")
+ endif()
+endif()
+
+unset(_ov_cxx20_error)
+unset(_ov_cxx20_floor_GNU)
+unset(_ov_cxx20_floor_Clang)
+unset(_ov_cxx20_floor_AppleClang)
+unset(_ov_cxx20_floor_MSVC)
+unset(_ov_cxx20_floor_IntelLLVM)
diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake
index f9cd14ae184..322c60b03c4 100644
--- a/cmake/developer_package/compile_flags/os_flags.cmake
+++ b/cmake/developer_package/compile_flags/os_flags.cmake
@@ -12,9 +12,13 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
+# the only place to change the project default standard
+set(OV_CXX_STANDARD_DEFAULT 17)
+
# to allows to override CMAKE_CXX_STANDARD from command line
if(NOT DEFINED CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 17)
+ set(OV_CXX_STANDARD_IS_DEFAULT ON)
+ set(CMAKE_CXX_STANDARD ${OV_CXX_STANDARD_DEFAULT})
endif()
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
@@ -25,6 +29,9 @@ if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
+# checks that the toolchain supports the requested CMAKE_CXX_STANDARD
+include(compile_flags/cxx_standard)
+
if(ENABLE_COVERAGE)
ov_add_compiler_flags(--coverage)
ov_add_compiler_flags(-fprofile-update=atomic)
diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt
index a4b4dbf04da..4e588e56e3c 100644
--- a/samples/cpp/CMakeLists.txt
+++ b/samples/cpp/CMakeLists.txt
@@ -105,7 +105,44 @@ if(NOT DEFINED CMAKE_CXX_STANDARD)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
-####################################
+
+# ###################################
+
+# standalone copy of cmake/developer_package/compile_flags/cxx_standard.cmake: this file is
+# installed and built outside the main tree (no sibling cmake/ dir), so it can't include() it
+if(CMAKE_CXX_STANDARD GREATER_EQUAL 20)
+ if(NOT DEFINED CMAKE_CXX_SCAN_FOR_MODULES)
+ set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
+ endif()
+
+ set(_ov_samples_cxx20_floor_GNU 10)
+ set(_ov_samples_cxx20_floor_Clang 14)
+ set(_ov_samples_cxx20_floor_AppleClang 13)
+ set(_ov_samples_cxx20_floor_MSVC 19.28)
+ set(_ov_samples_cxx20_floor_IntelLLVM 2024.2)
+
+ if(DEFINED _ov_samples_cxx20_floor_${CMAKE_CXX_COMPILER_ID})
+ set(_ov_samples_cxx20_floor "${_ov_samples_cxx20_floor_${CMAKE_CXX_COMPILER_ID}}")
+
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS _ov_samples_cxx20_floor)
+ message(FATAL_ERROR
+ "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} does not fully support C++20. "
+ "Minimum: ${CMAKE_CXX_COMPILER_ID} ${_ov_samples_cxx20_floor}")
+ endif()
+
+ unset(_ov_samples_cxx20_floor)
+ else()
+ message(WARNING
+ "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} was requested, but ${CMAKE_CXX_COMPILER_ID} "
+ "has no verified minimum version in cxx_standard.cmake. Proceeding unchecked.")
+ endif()
+
+ unset(_ov_samples_cxx20_floor_GNU)
+ unset(_ov_samples_cxx20_floor_Clang)
+ unset(_ov_samples_cxx20_floor_AppleClang)
+ unset(_ov_samples_cxx20_floor_MSVC)
+ unset(_ov_samples_cxx20_floor_IntelLLVM)
+endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils")
# gflags is used only in C++ samples
diff --git a/src/common/util/src/memory_prefetch.hpp b/src/common/util/src/memory_prefetch.hpp
index 9fe17c54f72..485a7a9e87c 100644
--- a/src/common/util/src/memory_prefetch.hpp
+++ b/src/common/util/src/memory_prefetch.hpp
@@ -26,7 +26,7 @@ struct PageToucher {
void operator()() const noexcept {
volatile uint8_t local = 0;
for (auto begin = m_begin; begin < m_end; begin += m_page_size) {
- local += *begin;
+ local = static_cast<uint8_t>(local + *begin);
}
}
};
diff --git a/src/core/tests/file_load_benchmark.cpp b/src/core/tests/file_load_benchmark.cpp
index 875af203091..54e1494512f 100644
--- a/src/core/tests/file_load_benchmark.cpp
+++ b/src/core/tests/file_load_benchmark.cpp
@@ -207,7 +207,7 @@ void loop_touch_mem_lock(const std::filesystem::path& path, size_t /*file_size*/
auto mapped = load_mmap_object(path);
volatile uint8_t sink = 0;
for (auto *first = mapped->data_as<uint8_t>(), *last = first + mapped->size(); first < last; first += page_size) {
- sink += *first;
+ sink = static_cast<uint8_t>(sink + *first);
}
ensure_memory_resident(mapped); // should be near no-op and just lock/unlock resident pages
}
@@ -259,7 +259,7 @@ void mmap_prefetch_then_memcpy_partial(const std::filesystem::path& path,
const size_t copy_size = std::min(chunk_size, total_copy_size - i);
std::memcpy(buffer.data(), mapped->data() + offset + i, copy_size);
// Sample multiple positions to prevent memcpy optimization
- sink += buffer[0] + buffer[copy_size / 2] + buffer[copy_size - 1];
+ sink = static_cast<char>(sink + buffer[0] + buffer[copy_size / 2] + buffer[copy_size - 1]);
}
}
diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp
index fe3ac3e52c5..6ebd186cd04 100644
--- a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp
+++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp
@@ -148,7 +148,7 @@ class PGresultHolder {
inline void decRefCounter(void) {
if (_ptr != nullptr && refCounter != nullptr) {
if (*refCounter > 0) {
- --*refCounter;
+ *refCounter = *refCounter - 1;
}
if (*refCounter == 0) {
delete refCounter;
@@ -167,14 +167,14 @@ public:
PGresultHolder(const PGresultHolder& object) {
_ptr = object._ptr;
refCounter = object.refCounter;
- ++*refCounter;
+ *refCounter = *refCounter + 1;
}
PGresultHolder& operator=(const PGresultHolder& object) {
if (_ptr != object._ptr) {
decRefCounter();
_ptr = object._ptr;
refCounter = object.refCounter;
- ++*refCounter;
+ *refCounter = *refCounter + 1;
}
return *this;
}