Skip to content

Commit

Permalink
[#504] Remove cppcheck static analysis tool
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Apr 18, 2024
1 parent eb5d65c commit 6617161
Show file tree
Hide file tree
Showing 48 changed files with 0 additions and 461 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/build_linux_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
fi
if [[ "${{matrix.build-type}}" == "Debug" ]] ; then
echo "CPPCHECK_HOME=${RUNNER_WORKSPACE}/cppcheck-2.6" >> ${GITHUB_ENV}
if [[ "${{matrix.clang-version}}" == "14" ]] ; then
echo "CLANG_TIDY_BIN=clang-tidy-${{matrix.clang-version}}" >> ${GITHUB_ENV}
fi
Expand Down Expand Up @@ -106,21 +105,6 @@ jobs:
sudo apt-get install clang-${{matrix.clang-version}}
sudo apt-get install llvm-${{matrix.clang-version}}
- name: Install specific version of C++ static code analysis tool (cppcheck)
if: ${{ env.CPPCHECK_HOME != '' }}
run: |
wget https://github.com/danmar/cppcheck/archive/2.6.tar.gz -O "${RUNNER_WORKSPACE}"/cppcheck-2.6.tar.gz
tar -xf "${RUNNER_WORKSPACE}"/cppcheck-2.6.tar.gz -C "${RUNNER_WORKSPACE}"
mkdir "${RUNNER_WORKSPACE}/cppcheck-2.6/build"
pushd "${RUNNER_WORKSPACE}/cppcheck-2.6/build"
cmake .. -DHAVE_RULES=ON -DUSE_MATCHCOMPILER=ON \
-DCMAKE_INSTALL_PREFIX="${RUNNER_WORKSPACE}"/cppcheck-2.6 \
-DCMAKE_INSTALL_BINDIR=. \
-DCMAKE_BUILD_TYPE=Release \
-DFILESDIR=.
cmake --build . --target install
popd
# https://github.com/actions/runner-images/issues/9491 (remove once fixed)
- name: Reduce ASLR entropy as a temporary workaround
if: ${{ env.SANITIZERS_ENABLED == 1 }}
Expand Down Expand Up @@ -163,7 +147,6 @@ jobs:
- name: Run Zserio API compatibility checks
env:
CPPCHECK_HOME: ""
CLANG_FORMAT_BIN: ""
CLANG_TIDY_BIN: ""
GCOVR_BIN: ""
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/build_windows_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ jobs:
echo "PACKAGE=windows64-mingw" >> ${GITHUB_ENV}
fi
if [[ "${{matrix.build-type}}" == "Debug" ]] ; then
echo "CPPCHECK_HOME=/c/Program Files/Cppcheck" >> ${GITHUB_ENV}
fi
CMAKE_EXTRA_ARGS=("-DCMAKE_BUILD_TYPE=${{matrix.build-type}}"
"-DCMAKE_CXX_STANDARD=${{matrix.cxx-standard}}")
if [[ "${{matrix.msvc-toolset}}" == "" ]] ; then
Expand Down Expand Up @@ -79,11 +75,6 @@ jobs:
run: |
choco install mingw --version ${{matrix.mingw-version}}
- name: Install specific version of C++ static code analysis tool (cppcheck)
shell: bash
if: ${{ env.CPPCHECK_HOME != '' }}
run: choco install cppcheck --version=2.6

- name: "Convert environment variables to POSIX paths"
shell: bash
run: |
Expand Down Expand Up @@ -144,7 +135,6 @@ jobs:
if: ${{ matrix.msvc-toolset == '' || matrix.build-type == 'Release' }}
shell: bash
env:
CPPCHECK_HOME: ""
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
scripts/test_compat_api.sh cpp-${PACKAGE}
Expand Down
56 changes: 0 additions & 56 deletions cmake/cppcheck_utils.cmake

This file was deleted.

14 changes: 0 additions & 14 deletions compiler/extensions/cpp/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ project(ZserioCppRuntimeTests)

enable_testing()

set(CPPCHECK_HOME "" CACHE PATH "Home directory of cppcheck tool. If empty, cppcheck tool is not called.")
set(SANITIZERS_ENABLED OFF CACHE BOOL "Whether the compiler sanitizers are enabled.")
set(CLANG_TIDY_BIN "" CACHE STRING "Name of clang-tidy binary. If empty, clang-tidy tool is not called.")
set(CLANG_FORMAT_BIN "" CACHE STRING "Name of clang-format binary. If empty, clang-format tool is not called.")
Expand Down Expand Up @@ -108,19 +107,6 @@ clang_format_add_custom_target(ZserioCppRuntime-clang-format
CONFIG_FILE "${ZSERIO_PROJECT_ROOT}/.clang-format"
WERROR ON)

# add cppcheck custom command
include(cppcheck_utils)
cppcheck_add_custom_command(TARGET ZserioCppRuntime
SOURCE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/src/zserio"
"${CMAKE_CURRENT_SOURCE_DIR}/src/zserio/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/zserio/*/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/test/zserio"
"${CMAKE_CURRENT_SOURCE_DIR}/test/zserio/*.h"
INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/src"
OPTIONS --library=googletest.cfg -UZSERIO_STANDARD_TYPES_HEADER)

# build and install doxygen documentation
find_package(Doxygen REQUIRED)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/zserio/CppRuntimeVersion.h" ZSERIO_CPP_RUNTIME_VERSION_FILE)
Expand Down
31 changes: 0 additions & 31 deletions compiler/extensions/cpp/runtime/CppcheckSuppressions.txt

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/common_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ set_global_cpp_variables()
# Extra arguments to be passed by CMake to a native build tool
CMAKE_BUILD_OPTIONS="${CMAKE_BUILD_OPTIONS:-""}"

# cppcheck home directoty is empty by default
CPPCHECK_HOME="${CPPCHECK_HOME:-""}"

# gcovr binary to use for coverage report (gcc), by default is empty
GCOVR_BIN="${GCOVR_BIN:-""}"
if [[ (! -z "${GCOVR_BIN}" && ! -f "`which "${GCOVR_BIN}"`") ]] ; then
Expand Down Expand Up @@ -444,9 +441,6 @@ Uses the following environment variables for building:
SPOTBUGS_HOME Home directory of spotbugs tool where lib is located
(e.g. /usr/share/spotbugs). If set, spotbugs will be
called. Default is empty string.
CPPCHECK_HOME Home directory of cppcheck tool where cppcheck
binary is located. If set, cppcheck will be called.
Default is empty string.
CLANG_TIDY_BIN Name of clang-tidy binary. If not set, clang-tidy tool is not called.
CLANG_FORMAT_BIN Name of clang-format binary. If not set, clang-format tool is not called.
GCOVR_BIN Gcovr binary to use for coverage report generation (gcc).
Expand Down Expand Up @@ -816,12 +810,6 @@ compile_cpp_for_target()
"-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}"
"-DCMAKE_PREFIX_PATH=${SQLITE_RELEASE_ROOT}/${TARGET}")

if [ -n "${CPPCHECK_HOME}" ] ; then
CMAKE_ARGS=("${CMAKE_ARGS[@]}" "-DCPPCHECK_HOME=${CPPCHECK_HOME}")
else
CMAKE_ARGS=("${CMAKE_ARGS[@]}" "-UCPPCHECK_HOME")
fi

if [ ${SANITIZERS_ENABLED} -eq 1 ] ; then
CMAKE_ARGS=("${CMAKE_ARGS[@]}" "-DSANITIZERS_ENABLED=ON")
else
Expand Down
12 changes: 0 additions & 12 deletions scripts/test_zs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ enable_testing()
set(ZSERIO_ROOT "${HOST_ZSERIO_ROOT}" CACHE PATH "")
set(ZSERIO_RELEASE "${HOST_ZSERIO_RELEASE}" CACHE PATH "")
set(CMAKE_MODULE_PATH "\${ZSERIO_ROOT}/cmake")
set(CPPCHECK_HOME "" CACHE PATH "Home directory of cppcheck tool. If empty, cppcheck tool is not called.")
set(CLANG_TIDY_BIN "" CACHE STRING "Name of clang-tidy binary. If empty, clang-tidy tool is not called.")
set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use.")
Expand Down Expand Up @@ -251,17 +250,6 @@ clang_tidy_add_custom_target(\${PROJECT_NAME}-clang-tidy
WERROR OFF
)
# add cppcheck custom command
include(cppcheck_utils)
cppcheck_add_custom_command(TARGET \${PROJECT_NAME}
SOURCE_DIR \${CMAKE_CURRENT_SOURCE_DIR}/gen
INCLUDE_DIR \${CMAKE_CURRENT_SOURCE_DIR}/gen
OPTIONS
--suppress=variableScope --suppress=uninitMemberVar
--suppress=noExplicitConstructor --suppress=duplicateCondition --suppress=duplicateExpression
--suppress=syntaxError # needed on Windows
)
add_test(compile_generated_cpp \${CMAKE_COMMAND} -E echo "Generated sources were successfully compiled!")
EOF
}
Expand Down
24 changes: 0 additions & 24 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ project(ZserioCppTest)
enable_testing()

# input parameters
set(CPPCHECK_HOME "" CACHE PATH "Home directory of cppcheck tool. If empty, cppcheck tool is not called.")
set(SANITIZERS_ENABLED OFF CACHE BOOL "Whether the compiler sanitizers are enabled.")
set(CLANG_TIDY_BIN "" CACHE STRING "Name of clang-tidy binary. If empty, clang-tidy tool is not called.")
set(CLANG_FORMAT_BIN "" CACHE STRING "Name of clang-format binary. If empty, clang-format tool is not called.")
Expand All @@ -32,7 +31,6 @@ set(CMAKE_MODULE_PATH ${ZSERIO_PROJECT_ROOT}/cmake)
include(cmake_utils)
include(clang_tidy_utils)
include(clang_format_utils)
include(cppcheck_utils)

# setup compiler
include(compiler_utils)
Expand Down Expand Up @@ -84,16 +82,6 @@ function(check_zserio_warnings ZSERIO_LOG EXPECTED_WARNINGS)
endif ()
endfunction()

# cppcheck needs to know all include directories in generated code
function(get_generated_dirs GENERATED_SOURCES GENERATED_INCLUDES_VAR)
foreach (SOURCE ${GENERATED_SOURCES})
string(REGEX REPLACE "^(${CMAKE_CURRENT_BINARY_DIR}/[^/]*)/.*$" "\\1" INC_DIR "${SOURCE}")
list(APPEND INCLUDE_DIRS "${INC_DIR}")
endforeach ()
list(REMOVE_DUPLICATES INCLUDE_DIRS)
set(${GENERATED_INCLUDES_VAR} "${INCLUDE_DIRS}" PARENT_SCOPE)
endfunction()

# functions to set globals called by included CMake lists
set(TEST_DEPENDENCIES_LIST "" CACHE INTERNAL "Test objects")
set(TEST_SOURCES_LIST "" CACHE INTERNAL "Test sources")
Expand Down Expand Up @@ -129,18 +117,6 @@ function(add_custom_test TEST_NAME)
ON)
endif ()

get_generated_dirs("${TEST_ARG_GENERATED_SOURCES}" GENERATED_DIRS)
cppcheck_add_custom_command(TARGET ${TEST_NAME}
SOURCE_DIR
"${TEST_ARG_SOURCES}"
"${GENERATED_DIRS}"
INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}"
"${GENERATED_DIRS}"
SUPPRESSION_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/CppcheckSuppressions.txt"
OPTIONS --library=googletest.cfg --suppress=assertWithSideEffect)

set(TEST_DEPENDENCIES_LIST "${TEST_DEPENDENCIES_LIST};${TEST_ARG_DEPENDS}" CACHE INTERNAL "")
if (DEFINED TEST_ARG_SOURCES)
set(TEST_SOURCES_LIST "${TEST_SOURCES_LIST};${TEST_ARG_SOURCES}" CACHE INTERNAL "")
Expand Down
5 changes: 0 additions & 5 deletions test/arguments/set_cpp_allocator/CppcheckSuppressions.txt

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions test/arguments/with_reflection_code/CppcheckSuppressions.txt

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions test/arguments/with_type_info_code/CppcheckSuppressions.txt

This file was deleted.

8 changes: 0 additions & 8 deletions test/arguments/with_validation_code/CppcheckSuppressions.txt

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions test/language/array_types/CppcheckSuppressions.txt

This file was deleted.

10 changes: 0 additions & 10 deletions test/language/bitmask_types/CppcheckSuppressions.txt

This file was deleted.

19 changes: 0 additions & 19 deletions test/language/choice_types/CppcheckSuppressions.txt

This file was deleted.

Loading

0 comments on commit 6617161

Please sign in to comment.