From b6600f90a047bc3ca694f421ba039ca954ed5dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 11 Aug 2024 13:46:35 +0200 Subject: [PATCH] CI: clarify cppcheck premium selfcheck suppressions (#6679) --- .github/workflows/cppcheck-premium.yml | 2 +- cppcheckpremium-suppressions | 192 ++++++++++++++++++------- 2 files changed, 143 insertions(+), 51 deletions(-) diff --git a/.github/workflows/cppcheck-premium.yml b/.github/workflows/cppcheck-premium.yml index 7461680ceb9..0afe6905305 100644 --- a/.github/workflows/cppcheck-premium.yml +++ b/.github/workflows/cppcheck-premium.yml @@ -29,7 +29,7 @@ jobs: run: | premium_version=${{ inputs.premium_version }} if [ -z $premium_version ]; then - premium_version=devdrop-20240804 + premium_version=devdrop-20240811 wget https://files.cppchecksolutions.com/devdrop/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz else wget https://files.cppchecksolutions.com/$premium_version/ubuntu-22.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz diff --git a/cppcheckpremium-suppressions b/cppcheckpremium-suppressions index 2be161e5ec0..91767b39c82 100644 --- a/cppcheckpremium-suppressions +++ b/cppcheckpremium-suppressions @@ -53,73 +53,50 @@ premium-cert-exp55-cpp ########################################################################################################################### # There are false positives +premium-misra-cpp-2023-6.5.1:lib/symboldatabase.cpp premium-misra-cpp-2023-6.7.2 +premium-misra-cpp-2023-6.8.3 premium-misra-cpp-2023-7.0.3 premium-misra-cpp-2023-8.2.5 premium-misra-cpp-2023-8.18.2 -premium-misra-cpp-2023-21.6.2 - -# TODO check if these should be suppressed or not -premium-misra-cpp-2023-0.2.1 -premium-misra-cpp-2023-0.2.2 -premium-misra-cpp-2023-10.0.1 -premium-misra-cpp-2023-10.2.1 -premium-misra-cpp-2023-10.2.2 -premium-misra-cpp-2023-11.6.3 premium-misra-cpp-2023-13.1.2 premium-misra-cpp-2023-13.3.1 -premium-misra-cpp-2023-13.3.2 -premium-misra-cpp-2023-13.3.3 -premium-misra-cpp-2023-15.1.2 -premium-misra-cpp-2023-15.1.3 -premium-misra-cpp-2023-18.1.1 -premium-misra-cpp-2023-18.3.2 -premium-misra-cpp-2023-18.4.1 -premium-misra-cpp-2023-19.0.3 -premium-misra-cpp-2023-19.1.3 -premium-misra-cpp-2023-19.3.1 -premium-misra-cpp-2023-19.6.1 -premium-misra-cpp-2023-21.2.1 -premium-misra-cpp-2023-21.2.2 -premium-misra-cpp-2023-21.2.3 -premium-misra-cpp-2023-23.11.1 -premium-misra-cpp-2023-26.3.1 -premium-misra-cpp-2023-28.6.1 -premium-misra-cpp-2023-30.0.1 -premium-misra-cpp-2023-5.13.2 -premium-misra-cpp-2023-5.13.4 -premium-misra-cpp-2023-6.0.3 -premium-misra-cpp-2023-6.2.4 -premium-misra-cpp-2023-6.4.2 -premium-misra-cpp-2023-6.5.1 -premium-misra-cpp-2023-6.8.3 -premium-misra-cpp-2023-6.9.2 -premium-misra-cpp-2023-7.0.1 -premium-misra-cpp-2023-7.0.4 -premium-misra-cpp-2023-7.0.6 -premium-misra-cpp-2023-7.11.2 -premium-misra-cpp-2023-7.11.3 -premium-misra-cpp-2023-8.0.1 -premium-misra-cpp-2023-8.1.1 -premium-misra-cpp-2023-8.19.1 -premium-misra-cpp-2023-8.2.11 -premium-misra-cpp-2023-8.2.6 -premium-misra-cpp-2023-8.2.7 -premium-misra-cpp-2023-8.2.8 -premium-misra-cpp-2023-9.5.1 -premium-misra-cpp-2023-9.5.2 -premium-misra-cpp-2023-9.6.4 +premium-misra-cpp-2023-21.6.2 +# False positives: #13004 +premium-misra-cpp-2023-8.2.7:lib/valueflow.cpp +premium-misra-cpp-2023-8.2.7:lib/checkclass.cpp # ignored function return value (emplace etc) premium-misra-cpp-2023-0.1.2 +# TODO there is unused map +premium-misra-cpp-2023-0.2.1:lib/symboldatabase.cpp + +# TODO use named function arguments +premium-misra-cpp-2023-0.2.2 + # we comment out code by intention in some cases premium-misra-cpp-2023-5.7.2 # TODO should we use this rule? premium-misra-cpp-2023-5.10.1 +# we use octal by intention in lib/color.cpp +premium-misra-cpp-2023-5.13.2:lib/color.cpp + +# we intentionally write numeric constants without suffixes +premium-misra-cpp-2023-5.13.4 + +# we declare variables, functions, etc in global namespace by intention +premium-misra-cpp-2023-6.0.3 + +# TODO use inline for template functions? +premium-misra-cpp-2023-6.2.4 + +# TODO ensure we don't conceal methods in derived classes +premium-misra-cpp-2023-6.4.2 + # Internal linkage using "static" keyword premium-misra-cpp-2023-6.5.2 @@ -129,12 +106,48 @@ premium-misra-cpp-2023-6.7.1 # FIXME enforce proper ref qualifications premium-misra-cpp-2023-6.8.4 +# We intentionally use the standard integer types +premium-misra-cpp-2023-6.9.2 + +# we have conversion from bool to int by intention +premium-misra-cpp-2023-7.0.1 + # we convert integer to bool by intention premium-misra-cpp-2023-7.0.2 +# signed integer expression in bitwise rhs by intention +premium-misra-cpp-2023-7.0.4 + +# sign conversions in assignments by intention +premium-misra-cpp-2023-7.0.6 + +# we intentionally have array-to-pointer decay in some function calls +premium-misra-cpp-2023-7.11.2 + +# warns when we use callbacks +premium-misra-cpp-2023-7.11.3 + +# too picky about operator precedence. +premium-misra-cpp-2023-8.0.1 + +# TODO use std::uintptr_t +premium-misra-cpp-2023-8.1.1 + # TODO should we use this rule? premium-misra-cpp-2023-8.1.2 +# TODO use strchr instead of memchr? +premium-misra-cpp-2023-8.2.6 + +# intentional pointer to int conversion in lib/utils.h to output dump files +premium-misra-cpp-2023-8.2.7:lib/utils.h + +# TODO: use std::uintptr_t +premium-misra-cpp-2023-8.2.8 + +# TODO check ellipsis usage +premium-misra-cpp-2023-8.2.11 + # we call functions etc by intention in && || RHS premium-misra-cpp-2023-8.14.1 @@ -147,35 +160,114 @@ premium-misra-cpp-2023-8.2.3 # we use recursion by intention premium-misra-cpp-2023-8.2.10 +# we separate variable declarations by intention with comma +premium-misra-cpp-2023-8.19.1 + # we leave out {} sometimes premium-misra-cpp-2023-9.3.1 # we leave out "else" by intention premium-misra-cpp-2023-9.4.1 +# looping through linked lists by intention +premium-misra-cpp-2023-9.5.1 + +# I believe it warns in some cases where we don't have UB +premium-misra-cpp-2023-9.5.2 + +# cppcheck does not understand that __builtin_unreachable() is noreturn +premium-misra-cpp-2023-9.6.4:lib/utils.h + +# we declare multiple variables by intention +premium-misra-cpp-2023-10.0.1 + +# we do not define enum type explicitly by intention +premium-misra-cpp-2023-10.2.1 + +# TODO we have unscoped enums +premium-misra-cpp-2023-10.2.2 + # we use arrays by intention premium-misra-cpp-2023-11.3.1 # we dont initialize variables directly by intention premium-misra-cpp-2023-11.6.1 +# we have enums where only last constant is initialized by intention +premium-misra-cpp-2023-11.6.3 + # we use unions by intention premium-misra-cpp-2023-12.3.1 +# TODO ensure overrides match +premium-misra-cpp-2023-13.3.2 + +# TODO use the same parameter names in overriden methods. +premium-misra-cpp-2023-13.3.3 + # we sometimes use both public/private data members by intention premium-misra-cpp-2023-14.1.1 # TODO should we use this rule? premium-misra-cpp-2023-15.0.1 +# seems too picky (explicitly calling InferModel and Analyzer base class constructors even though they are defaulted). +premium-misra-cpp-2023-15.1.2 + +# TODO use explicit for conversion operator +premium-misra-cpp-2023-15.1.3 + # TODO: should we use this rule? premium-misra-cpp-2023-16.6.1 # TODO: should we use this rule? premium-misra-cpp-2023-17.8.1 +# TODO: should we throw token pointers? +premium-misra-cpp-2023-18.1.1 + +# TODO do not throw token pointer? +premium-misra-cpp-2023-18.3.2:lib/tokenize.cpp + +# TODO use noexcept +premium-misra-cpp-2023-18.4.1 + +# in smallvector we intentionally put a constant above some preprocessor includes +premium-misra-cpp-2023-19.0.3:lib/smallvector.h + +# code is intentional, should cppcheck premium understand __has_cpp_attribute and compiler defines better? +premium-misra-cpp-2023-19.1.3:lib/config.h + +# we use #/## by intention in some cases +premium-misra-cpp-2023-19.3.1 + +# We use #pragma by intention +premium-misra-cpp-2023-19.6.1 + +# We use atoi by intention +premium-misra-cpp-2023-21.2.1 + +# We use functions by intention +premium-misra-cpp-2023-21.2.2 + +# We have limited use of std::getenv by intention +premium-misra-cpp-2023-21.2.3 + # Dynamic memory usage in std::string etc premium-misra-cpp-2023-21.6.1 +# TODO use std::make_unique when we require C++14 +premium-misra-cpp-2023-23.11.1 + # we use by intention premium-misra-cpp-2023-24.5.1 + +# we use std::vector by intention in lib/infer.cpp but in general it should be avoided +premium-misra-cpp-2023-26.3.1:lib/infer.cpp + +# TODO review that std::move is used properly +premium-misra-cpp-2023-28.6.1 + +# we use cstdio by intention +premium-misra-cpp-2023-30.0.1 +