enabled and mitigated debug warnings in cfg tests (#5840)

This commit is contained in:
Oliver Stöneberg 2024-01-05 17:00:51 +01:00 committed by GitHub
parent 950b285608
commit 028596f100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 47 additions and 4 deletions

View File

@ -6,6 +6,7 @@
<define name="cairo_bool_t" value="int"/> <define name="cairo_bool_t" value="int"/>
<!-- TODO: Configure cairo_status_t as an enum when this is implemented in Cppcheck --> <!-- TODO: Configure cairo_status_t as an enum when this is implemented in Cppcheck -->
<podtype name="cairo_status_t"/> <podtype name="cairo_status_t"/>
<define name="CAIRO_STATUS_READ_ERROR" value="10"/>
<!-- ########## cairo Macros / Defines ########## --> <!-- ########## cairo Macros / Defines ########## -->
<define name="CAIRO_HAS_MIME_SURFACE" value="1"/> <define name="CAIRO_HAS_MIME_SURFACE" value="1"/>
<define name="CAIRO_MIME_TYPE_CCITT_FAX" value="&quot;image/g3fax&quot;"/> <define name="CAIRO_MIME_TYPE_CCITT_FAX" value="&quot;image/g3fax&quot;"/>

View File

@ -2,6 +2,8 @@
<!-- This file once has been generated automatically. See https://github.com/scriptum/cppcheck-libs --> <!-- This file once has been generated automatically. See https://github.com/scriptum/cppcheck-libs -->
<!-- Now it is maintained and extended manually. --> <!-- Now it is maintained and extended manually. -->
<def format="2"> <def format="2">
<define name="TRUE" value="(!FALSE)"/>
<define name="FALSE" value="(0)"/>
<define name="g_return_if_fail(expr)" value="do{if(!(expr)){return;}}while(0)"/> <define name="g_return_if_fail(expr)" value="do{if(!(expr)){return;}}while(0)"/>
<define name="g_return_val_if_fail(expr, val)" value="do{if(!(expr)){return val;}}while(0)"/> <define name="g_return_val_if_fail(expr, val)" value="do{if(!(expr)){return val;}}while(0)"/>
<define name="g_return_if_reached()" value="do{return;}while(0)"/> <define name="g_return_if_reached()" value="do{return;}while(0)"/>

View File

@ -113,17 +113,22 @@ if (BUILD_TESTS)
else() else()
# TODO: remove missingInclude disabling when it no longer is implied by --enable=information # TODO: remove missingInclude disabling when it no longer is implied by --enable=information
# TODO: add syntax check # TODO: add syntax check
# need to suppress unmatchedSuppression in case valueFlowBailout is not reported
add_test(NAME cfg-${TEST_NAME} add_test(NAME cfg-${TEST_NAME}
COMMAND $<TARGET_FILE:cppcheck> COMMAND $<TARGET_FILE:cppcheck>
--library=${LIBRARY}
--check-library --check-library
--platform=${PLATFORM} --platform=${PLATFORM}
--library=${LIBRARY}
--enable=style,information --enable=style,information
--inconclusive --inconclusive
--force --force
--error-exitcode=1 --error-exitcode=1
--disable=missingInclude --disable=missingInclude
--inline-suppr --inline-suppr
--template="{file}:{line}:{severity}:{id}:{message}"
--debug-warnings
--suppress=valueFlowBailout
--suppress=unmatchedSuppression
${CMAKE_CURRENT_SOURCE_DIR}/cfg/${CFG_TEST} ${CMAKE_CURRENT_SOURCE_DIR}/cfg/${CFG_TEST}
) )
endif() endif()

View File

@ -83,6 +83,7 @@ void macros()
BOOST_PP_REPEAT(5, DECL, int x) BOOST_PP_REPEAT(5, DECL, int x)
BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) { BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) {
// cppcheck-suppress valueFlowBailoutIncompleteVar
no_state no_state
} }
BOOST_SCOPED_ENUM_DECLARE_END(future_errc) BOOST_SCOPED_ENUM_DECLARE_END(future_errc)

View File

@ -316,6 +316,7 @@ void valid_code(int argInt1, va_list valist_arg, const int * parg)
if (__alignof__(int) == 4) {} if (__alignof__(int) == 4) {}
// cppcheck-suppress valueFlowBailoutIncompleteVar
const void * p_mmap = mmap(NULL, 1, PROT_NONE, MAP_ANONYMOUS | MAP_SHARED, -1, 0); const void * p_mmap = mmap(NULL, 1, PROT_NONE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
printf("%p", p_mmap); printf("%p", p_mmap);
munmap(p_mmap, 1); munmap(p_mmap, 1);

View File

@ -15,12 +15,15 @@ namespace ExampleNamespace {
constexpr long long TOLERANCE = 10; constexpr long long TOLERANCE = 10;
// #9397 syntaxError when MATCHER_P is not known // #9397 syntaxError when MATCHER_P is not known
// cppcheck-suppress symbolDatabaseWarning
MATCHER_P(ExampleMatcherPTest, expected, "") MATCHER_P(ExampleMatcherPTest, expected, "")
{ {
// cppcheck-suppress valueFlowBailoutIncompleteVar
return ((arg <= (expected + TOLERANCE)) && (arg >= (expected - TOLERANCE))); return ((arg <= (expected + TOLERANCE)) && (arg >= (expected - TOLERANCE)));
} }
// syntaxError when MATCHER is not known // syntaxError when MATCHER is not known
// cppcheck-suppress symbolDatabaseWarning
MATCHER(ExampleMatcherTest, "") MATCHER(ExampleMatcherTest, "")
{ {
return (arg == TOLERANCE); return (arg == TOLERANCE);

View File

@ -289,6 +289,7 @@ void g_new_if_test()
}; };
const struct a * pNew3; const struct a * pNew3;
// cppcheck-suppress valueFlowBailoutIncompleteVar
if (pNew3 = g_new(struct a, 6)) { if (pNew3 = g_new(struct a, 6)) {
printf("%p", pNew3); printf("%p", pNew3);
} }

View File

@ -15,6 +15,7 @@ void validCode()
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
if (curl) { if (curl) {
CURLcode res; CURLcode res;
// cppcheck-suppress valueFlowBailoutIncompleteVar
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
if (res != CURLE_OK) { if (res != CURLE_OK) {

View File

@ -14,6 +14,7 @@
void validCode(const char* argStr) void validCode(const char* argStr)
{ {
cv::Mat image; cv::Mat image;
// cppcheck-suppress valueFlowBailoutIncompleteVar
image = cv::imread(argStr, cv::IMREAD_COLOR); image = cv::imread(argStr, cv::IMREAD_COLOR);
if (!image.data) { if (!image.data) {
printf("No image data \n"); printf("No image data \n");

View File

@ -895,6 +895,7 @@ void validCode(va_list valist_arg1, va_list valist_arg2)
void *ptr; void *ptr;
if (posix_memalign(&ptr, sizeof(void *), sizeof(void *)) == 0) if (posix_memalign(&ptr, sizeof(void *), sizeof(void *)) == 0)
free(ptr); free(ptr);
// cppcheck-suppress valueFlowBailoutIncompleteVar
syslog(LOG_ERR, "err %u", 0U); syslog(LOG_ERR, "err %u", 0U);
syslog(LOG_WARNING, "warn %d %d", 5, 1); syslog(LOG_WARNING, "warn %d %d", 5, 1);
vsyslog(LOG_EMERG, "emerg %d", valist_arg1); vsyslog(LOG_EMERG, "emerg %d", valist_arg1);

View File

@ -316,7 +316,7 @@ QVector<int>::iterator QVector2()
// cppcheck-suppress passedByValue // cppcheck-suppress passedByValue
void duplicateExpression_QString_Compare(QString style) //#8723 void duplicateExpression_QString_Compare(QString style) //#8723
{ {
// cppcheck-suppress duplicateExpression // cppcheck-suppress [duplicateExpression,valueFlowBailoutIncompleteVar]
if (style.compare( "x", Qt::CaseInsensitive ) == 0 || style.compare( "x", Qt::CaseInsensitive ) == 0) if (style.compare( "x", Qt::CaseInsensitive ) == 0 || style.compare( "x", Qt::CaseInsensitive ) == 0)
{} {}
} }

View File

@ -2,6 +2,8 @@
set -e # abort on error set -e # abort on error
#set -x # be verbose #set -x # be verbose
# TODO: do not bail out on first error - always run all tests and return error instead
function exit_if_strict { function exit_if_strict {
if [ -n "${STRICT}" ] && [ "${STRICT}" -eq 1 ]; then if [ -n "${STRICT}" ] && [ "${STRICT}" -eq 1 ]; then
exit 1 exit 1
@ -24,7 +26,8 @@ CFG="$DIR"../../cfg/
# TODO: remove missingInclude disabling when it no longer is implied by --enable=information # TODO: remove missingInclude disabling when it no longer is implied by --enable=information
# Cppcheck options # Cppcheck options
CPPCHECK_OPT='--check-library --platform=unix64 --enable=style,information --inconclusive --force --error-exitcode=-1 --disable=missingInclude --inline-suppr --template="{file}:{line}:{severity}:{id}:{message}"' # need to suppress unmatchedSuppression in case valueFlowBailout is not reported
CPPCHECK_OPT='--check-library --platform=unix64 --enable=style,information --inconclusive --force --error-exitcode=-1 --disable=missingInclude --inline-suppr --template="{file}:{line}:{severity}:{id}:{message}" --debug-warnings --suppress=valueFlowBailout --suppress=unmatchedSuppression'
# Compiler settings # Compiler settings
CXX=g++ CXX=g++
@ -33,6 +36,7 @@ CC=gcc
CC_OPT='-fsyntax-only -w -std=c11' CC_OPT='-fsyntax-only -w -std=c11'
function get_pkg_config_cflags { function get_pkg_config_cflags {
# TODO: get rid of the error enabling/disabling?
set +e set +e
PKGCONFIG=$(pkg-config --cflags "$@") PKGCONFIG=$(pkg-config --cflags "$@")
PKGCONFIG_RETURNCODE=$? PKGCONFIG_RETURNCODE=$?
@ -65,6 +69,7 @@ function qt_fn {
if [ -n "$QTCONFIG" ]; then if [ -n "$QTCONFIG" ]; then
QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core Qt5Test) QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core Qt5Test)
[[ $QTBUILDCONFIG =~ (^|[[:space:]])reduce_relocations($|[[:space:]]) ]] && QTCONFIG="${QTCONFIG} -fPIC" [[ $QTBUILDCONFIG =~ (^|[[:space:]])reduce_relocations($|[[:space:]]) ]] && QTCONFIG="${QTCONFIG} -fPIC"
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <QString>" | ${CXX} ${CXX_OPT} ${QTCONFIG} -x c++ - echo -e "#include <QString>" | ${CXX} ${CXX_OPT} ${QTCONFIG} -x c++ -
QTCHECK_RETURNCODE=$? QTCHECK_RETURNCODE=$?
@ -107,6 +112,7 @@ function windows_fn {
# wxwidgets.cpp # wxwidgets.cpp
function wxwidgets_fn { function wxwidgets_fn {
# TODO: get rid of the error enabling/disabling?
set +e set +e
WXCONFIG=$(wx-config --cxxflags) WXCONFIG=$(wx-config --cxxflags)
WXCONFIG_RETURNCODE=$? WXCONFIG_RETURNCODE=$?
@ -115,6 +121,7 @@ function wxwidgets_fn {
echo "wx-config does not work, skipping syntax check for wxWidgets tests." echo "wx-config does not work, skipping syntax check for wxWidgets tests."
exit_if_strict exit_if_strict
else else
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <wx/filefn.h>\n#include <wx/app.h>\n#include <wx/artprov.h>\n#include <wx/version.h>\n#if wxVERSION_NUMBER<2950\n#error \"Old version\"\n#endif" | ${CXX} ${CXX_OPT} ${WXCONFIG} -x c++ - echo -e "#include <wx/filefn.h>\n#include <wx/app.h>\n#include <wx/artprov.h>\n#include <wx/version.h>\n#if wxVERSION_NUMBER<2950\n#error \"Old version\"\n#endif" | ${CXX} ${CXX_OPT} ${WXCONFIG} -x c++ -
WXCHECK_RETURNCODE=$? WXCHECK_RETURNCODE=$?
@ -137,6 +144,7 @@ function gtk_fn {
GTKCONFIG=$(get_pkg_config_cflags gtk+-2.0) GTKCONFIG=$(get_pkg_config_cflags gtk+-2.0)
fi fi
if [ -n "$GTKCONFIG" ]; then if [ -n "$GTKCONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <gtk/gtk.h>" | ${CC} ${CC_OPT} ${GTKCONFIG} -x c - echo -e "#include <gtk/gtk.h>" | ${CC} ${CC_OPT} ${GTKCONFIG} -x c -
GTKCHECK_RETURNCODE=$? GTKCHECK_RETURNCODE=$?
@ -157,6 +165,7 @@ function gtk_fn {
# boost.cpp # boost.cpp
function boost_fn { function boost_fn {
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <boost/config.hpp>" | ${CXX} ${CXX_OPT} -x c++ - echo -e "#include <boost/config.hpp>" | ${CXX} ${CXX_OPT} -x c++ -
BOOSTCHECK_RETURNCODE=$? BOOSTCHECK_RETURNCODE=$?
@ -175,6 +184,7 @@ function sqlite3_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
SQLITE3CONFIG=$(get_pkg_config_cflags sqlite3) SQLITE3CONFIG=$(get_pkg_config_cflags sqlite3)
if [ -n "$SQLITE3CONFIG" ]; then if [ -n "$SQLITE3CONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <sqlite3.h>" | ${CC} ${CC_OPT} ${SQLITE3CONFIG} -x c - echo -e "#include <sqlite3.h>" | ${CC} ${CC_OPT} ${SQLITE3CONFIG} -x c -
SQLITE3CHECK_RETURNCODE=$? SQLITE3CHECK_RETURNCODE=$?
@ -206,6 +216,7 @@ function python_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
PYTHON3CONFIG=$(get_pkg_config_cflags python3) PYTHON3CONFIG=$(get_pkg_config_cflags python3)
if [ -n "$PYTHON3CONFIG" ]; then if [ -n "$PYTHON3CONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <Python.h>" | ${CC} ${CC_OPT} ${PYTHON3CONFIG} -x c - echo -e "#include <Python.h>" | ${CC} ${CC_OPT} ${PYTHON3CONFIG} -x c -
PYTHON3CONFIG_RETURNCODE=$? PYTHON3CONFIG_RETURNCODE=$?
@ -229,6 +240,7 @@ function lua_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
LUACONFIG=$(get_pkg_config_cflags lua-5.3) LUACONFIG=$(get_pkg_config_cflags lua-5.3)
if [ -n "$LUACONFIG" ]; then if [ -n "$LUACONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <lua.h>" | ${CC} ${CC_OPT} ${LUACONFIG} -x c - echo -e "#include <lua.h>" | ${CC} ${CC_OPT} ${LUACONFIG} -x c -
LUACONFIG_RETURNCODE=$? LUACONFIG_RETURNCODE=$?
@ -252,6 +264,7 @@ function libcurl_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
LIBCURLCONFIG=$(get_pkg_config_cflags libcurl) LIBCURLCONFIG=$(get_pkg_config_cflags libcurl)
if [ -n "$LIBCURLCONFIG" ]; then if [ -n "$LIBCURLCONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <curl/curl.h>" | ${CC} ${CC_OPT} ${LIBCURLCONFIG} -x c - echo -e "#include <curl/curl.h>" | ${CC} ${CC_OPT} ${LIBCURLCONFIG} -x c -
LIBCURLCONFIG_RETURNCODE=$? LIBCURLCONFIG_RETURNCODE=$?
@ -275,6 +288,7 @@ function cairo_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
CAIROCONFIG=$(get_pkg_config_cflags cairo) CAIROCONFIG=$(get_pkg_config_cflags cairo)
if [ -n "$CAIROCONFIG" ]; then if [ -n "$CAIROCONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <cairo.h>" | ${CC} ${CC_OPT} ${CAIROCONFIG} -x c - echo -e "#include <cairo.h>" | ${CC} ${CC_OPT} ${CAIROCONFIG} -x c -
CAIROCONFIG_RETURNCODE=$? CAIROCONFIG_RETURNCODE=$?
@ -300,6 +314,7 @@ function googletest_fn {
# kde.cpp # kde.cpp
function kde_fn { function kde_fn {
# TODO: get rid of the error enabling/disabling?
set +e set +e
KDECONFIG=$(kde4-config --path include) KDECONFIG=$(kde4-config --path include)
KDECONFIG_RETURNCODE=$? KDECONFIG_RETURNCODE=$?
@ -313,6 +328,7 @@ function kde_fn {
echo "Suitable Qt not present, Qt is necessary for KDE. Skipping syntax check." echo "Suitable Qt not present, Qt is necessary for KDE. Skipping syntax check."
exit_if_strict exit_if_strict
else else
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <KDE/KGlobal>\n" | ${CXX} ${CXX_OPT} -I${KDECONFIG} ${KDEQTCONFIG} -x c++ - echo -e "#include <KDE/KGlobal>\n" | ${CXX} ${CXX_OPT} -I${KDECONFIG} ${KDEQTCONFIG} -x c++ -
KDECHECK_RETURNCODE=$? KDECHECK_RETURNCODE=$?
@ -333,6 +349,7 @@ function libsigcpp_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
LIBSIGCPPCONFIG=$(get_pkg_config_cflags sigc++-2.0) LIBSIGCPPCONFIG=$(get_pkg_config_cflags sigc++-2.0)
if [ -n "$LIBSIGCPPCONFIG" ]; then if [ -n "$LIBSIGCPPCONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <sigc++/sigc++.h>\n" | ${CXX} ${CXX_OPT} ${LIBSIGCPPCONFIG} -x c++ - echo -e "#include <sigc++/sigc++.h>\n" | ${CXX} ${CXX_OPT} ${LIBSIGCPPCONFIG} -x c++ -
LIBSIGCPPCONFIG_RETURNCODE=$? LIBSIGCPPCONFIG_RETURNCODE=$?
@ -356,6 +373,7 @@ function openssl_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
OPENSSLCONFIG=$(get_pkg_config_cflags libssl) OPENSSLCONFIG=$(get_pkg_config_cflags libssl)
if [ -n "$OPENSSLCONFIG" ]; then if [ -n "$OPENSSLCONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <openssl/ssl.h>" | ${CC} ${CC_OPT} ${OPENSSLCONFIG} -x c - echo -e "#include <openssl/ssl.h>" | ${CC} ${CC_OPT} ${OPENSSLCONFIG} -x c -
OPENSSLCONFIG_RETURNCODE=$? OPENSSLCONFIG_RETURNCODE=$?
@ -379,6 +397,7 @@ function opencv2_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then if [ $HAS_PKG_CONFIG -eq 1 ]; then
OPENCVCONFIG=$(get_pkg_config_cflags opencv) OPENCVCONFIG=$(get_pkg_config_cflags opencv)
if [ -n "$OPENCVCONFIG" ]; then if [ -n "$OPENCVCONFIG" ]; then
# TODO: get rid of the error enabling/disabling?
set +e set +e
echo -e "#include <opencv2/opencv.hpp>\n" | ${CXX} ${CXX_OPT} ${OPENCVCONFIG} -x c++ - echo -e "#include <opencv2/opencv.hpp>\n" | ${CXX} ${CXX_OPT} ${OPENCVCONFIG} -x c++ -
OPENCVCONFIG_RETURNCODE=$? OPENCVCONFIG_RETURNCODE=$?

View File

@ -16,7 +16,7 @@ void validCode()
int rc = sqlite3_open("/db", &db); int rc = sqlite3_open("/db", &db);
if (rc != SQLITE_OK) { if (rc != SQLITE_OK) {
fprintf(stderr, "Error opening sqlite3 db: %s\n", sqlite3_errmsg(db)); printf("Error opening sqlite3 db: %s\n", sqlite3_errmsg(db));
sqlite3_close(db); sqlite3_close(db);
} else { } else {
sqlite3_close(db); sqlite3_close(db);

View File

@ -185,6 +185,7 @@ size_t bufferAccessOutOfBounds_wcsrtombs(char * dest, const wchar_t ** src, size
void bufferAccessOutOfBounds(void) void bufferAccessOutOfBounds(void)
{ {
char a[5]; char a[5];
// cppcheck-suppress valueFlowBailoutIncompleteVar
fgets(a,5,stdin); fgets(a,5,stdin);
// cppcheck-suppress bufferAccessOutOfBounds // cppcheck-suppress bufferAccessOutOfBounds
fgets(a,6,stdin); fgets(a,6,stdin);

View File

@ -588,6 +588,7 @@ void *bufferAccessOutOfBounds_memchr(void *s, int c, size_t n)
#ifdef __STDC_LIB_EXT1__ #ifdef __STDC_LIB_EXT1__
void uninitvar_localtime_s(const std::time_t *restrict time, struct tm *restrict result) void uninitvar_localtime_s(const std::time_t *restrict time, struct tm *restrict result)
{ {
// cppcheck-suppress valueFlowBailoutIncompleteVar
const std::time_t *restrict Time; const std::time_t *restrict Time;
// TODO cppcheck-suppress uninitvar // TODO cppcheck-suppress uninitvar
(void)std::localtime_s(Time, result); (void)std::localtime_s(Time, result);
@ -640,6 +641,7 @@ void invalidFunctionArg_std_string_substr(const std::string &str, std::size_t po
(void)str.substr(pos,-1); (void)str.substr(pos,-1);
// no warning is expected for // no warning is expected for
(void)str.substr(pos,len); (void)str.substr(pos,len);
// cppcheck-suppress valueFlowBailoutIncompleteVar
(void)str.substr(pos, std::string::npos); (void)str.substr(pos, std::string::npos);
} }
@ -4602,8 +4604,10 @@ void stdbind()
std::bind(stdbind_helper, 1); std::bind(stdbind_helper, 1);
// TODO cppcheck-suppress unreadVariable // TODO cppcheck-suppress unreadVariable
// cppcheck-suppress autoNoType
auto f1 = std::bind(stdbind_helper, _1); auto f1 = std::bind(stdbind_helper, _1);
// TODO cppcheck-suppress unreadVariable // TODO cppcheck-suppress unreadVariable
// cppcheck-suppress autoNoType
auto f2 = std::bind(stdbind_helper, 10); auto f2 = std::bind(stdbind_helper, 10);
} }
@ -4778,6 +4782,7 @@ void smartPtr_get()
void smartPtr_get2(std::vector<std::unique_ptr<int>>& v) void smartPtr_get2(std::vector<std::unique_ptr<int>>& v)
{ {
// cppcheck-suppress autoNoType
for (auto& u : v) { for (auto& u : v) {
int* p = u.get(); int* p = u.get();
*p = 0; *p = 0;

View File

@ -234,6 +234,7 @@ void validCode()
hSemaphore1 = CreateSemaphore(NULL, 0, 1, NULL); hSemaphore1 = CreateSemaphore(NULL, 0, 1, NULL);
CloseHandle(hSemaphore1); CloseHandle(hSemaphore1);
HANDLE hSemaphore2; HANDLE hSemaphore2;
// cppcheck-suppress valueFlowBailoutIncompleteVar
hSemaphore2 = CreateSemaphoreEx(NULL, 0, 1, NULL, 0, SEMAPHORE_ALL_ACCESS); hSemaphore2 = CreateSemaphoreEx(NULL, 0, 1, NULL, 0, SEMAPHORE_ALL_ACCESS);
CloseHandle(hSemaphore2); CloseHandle(hSemaphore2);
HANDLE hSemaphore3; HANDLE hSemaphore3;