From f2b47b31783ca187ddda42ebdd2f06f148916bd5 Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Thu, 22 Feb 2024 23:28:44 +0100 Subject: [PATCH] Make banned API check optional --- intrinsiccv/CMakeLists.txt | 14 ++++++++------ scripts/ci.sh | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/intrinsiccv/CMakeLists.txt b/intrinsiccv/CMakeLists.txt index 3c5b6040f..31d3b1c8e 100644 --- a/intrinsiccv/CMakeLists.txt +++ b/intrinsiccv/CMakeLists.txt @@ -11,6 +11,7 @@ include(CheckCXXCompilerFlag) option(INTRINSICCV_ENABLE_SVE2 "Explicitly enables or disables SVE2 code paths for all supported algorithms" OFF) option(INTRINSICCV_ENABLE_SVE2_SELECTIVELY "Explicitly enables or disables SVE2 code paths for selected algorithms" ON) option(INTRINSICCV_ENABLE_SME2 "Explicitly enables or disables SME2 code paths for all supported algorithms" ON) +option(INTRINSICCV_CHECK_BANNED_FUNCTIONS "Check source for deprecated or obsolescent functions" OFF) option(INTRINSICCV_ASSUME_128BIT_SVE2 "Internal - If turned ON 128-bit SVE2 vector length is assumed" OFF) option(INTRINSICCV_PREFER_INTERLEAVING_LOAD_STORE "Internal - If turned ON interleaving loads and stores are preferred instead of continuous loads and stores" OFF) option(INTRINSICCV_EXPERIMENTAL_FEATURE_CANNY "Internal - Enable experimental Canny algorithm" OFF) @@ -86,11 +87,6 @@ set(INTRINSICCV_WARNING_FLAGS "-Wold-style-cast" ) -set(INTRINSICCV_SDL_FLAGS - "-include" - "intrinsiccv/unsafe.h" -) - set(INTRINSICCV_CLANG_FLAGS "-mllvm" "-inline-threshold=10000" @@ -106,9 +102,15 @@ set(INTRINSICCV_CXX_FLAGS "-fno-rtti" ${INTRINSICCV_CLANG_FLAGS} ${INTRINSICCV_WARNING_FLAGS} - ${INTRINSICCV_SDL_FLAGS} ) +if (INTRINSICCV_CHECK_BANNED_FUNCTIONS) + # The `SHELL:` prefix is used to turn off de-duplication of compiler flags, + # it is necessary if other headers are need to be force included. + # https://cmake.org/cmake/help/latest/command/target_compile_options.html#option-de-duplication + list(APPEND INTRINSICCV_CXX_FLAGS "SHELL:-include intrinsiccv/unsafe.h") +endif() + if (CMAKE_BUILD_TYPE EQUAL "DEBUG") list(APPEND INTRINSICCV_CXX_FLAGS "-O0" "-g") else() diff --git a/scripts/ci.sh b/scripts/ci.sh index dd868b12e..6f940903f 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# + # SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates # # SPDX-License-Identifier: Apache-2.0 @@ -33,7 +33,8 @@ cmake -S . -B build -G Ninja \ -DCMAKE_CXX_CLANG_TIDY=clang-tidy \ -DCMAKE_CXX_FLAGS="--coverage -g -O0" \ -DINTRINSICCV_ENABLE_SVE2=ON \ - -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF + -DINTRINSICCV_ENABLE_SVE2_SELECTIVELY=OFF \ + -DINTRINSICCV_CHECK_BANNED_FUNCTIONS=ON # Workaround to avoid applying clang-tidy to files in build directory echo '{"Checks": "-*,cppcoreguidelines-avoid-goto"}'>build/.clang-tidy -- GitLab