From 3b6688253f76b17772fcf05d0a1ef6bec4e68d63 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 25 Jun 2023 16:04:16 +0900 Subject: [PATCH] Address cppcheck 2.10 warnings (#2163) Disable newer cppcheck until we can diagnose this further. References #2162. --- .github/workflows/ci.yml | 4 ++-- Makefile.am | 1 + src/addhead.cpp | 4 +--- src/fdcache.cpp | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57f69da..dcf5cba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,8 +101,8 @@ jobs: - name: Cppcheck run: | - # work around resource leak false positives on older Linux distributions - if cppcheck --version | awk '{if ($2 <= 1.86) { exit(1) } }'; then + # work around resource leak false positives on older and newer Linux distributions + if cppcheck --version | awk '{if ($2 <= 1.86 || $2 >= 2.10) { exit(1) } }'; then make cppcheck fi diff --git a/Makefile.am b/Makefile.am index fbb9b36..01480d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,6 +44,7 @@ cppcheck: --enable=warning,style,information,missingInclude \ --suppress=missingIncludeSystem \ --suppress=unmatchedSuppression \ + --suppress=useStlAlgorithm \ src/ test/ # diff --git a/src/addhead.cpp b/src/addhead.cpp index 5e6db28..ac3ae7c 100644 --- a/src/addhead.cpp +++ b/src/addhead.cpp @@ -151,9 +151,7 @@ bool AdditionalHeader::Load(const char* file) addheadlist.push_back(paddhead); // set flag - if(!is_enable){ - is_enable = true; - } + is_enable = true; } return true; } diff --git a/src/fdcache.cpp b/src/fdcache.cpp index da6ed8d..841f6d6 100644 --- a/src/fdcache.cpp +++ b/src/fdcache.cpp @@ -320,7 +320,7 @@ bool FdManager::HaveLseekHole() } FdManager::checked_lseek = true; FdManager::have_lseek_hole = false; - return FdManager::have_lseek_hole; + return false; } // check SEEK_DATA/SEEK_HOLE options