This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=4fbfd0c6b3204797369e1fde5578753f380226f2

commit 4fbfd0c6b3204797369e1fde5578753f380226f2
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Nov 20 23:26:40 2022 +0100

    test: Move active line-based cppcheck suppressions into inline comments
    
    Keeping these line-based suppressions in sync with the code is
    cumbersome and error-prone. Move them as inline suppressions in
    comments, so that they can easily follow the line number when the
    code in the file moves around.
---
 dselect/pkgsublist.cc    | 1 +
 lib/dpkg/triglib.c       | 2 ++
 t/cppcheck.t             | 1 +
 t/cppcheck/cppcheck.supp | 7 -------
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/dselect/pkgsublist.cc b/dselect/pkgsublist.cc
index d25334f4b..dae40fdcf 100644
--- a/dselect/pkgsublist.cc
+++ b/dselect/pkgsublist.cc
@@ -108,6 +108,7 @@ void packagelist::addunavailable(deppossi *possi) {
     internerr("deppossi from package %s has nullptr clientdata's uprec",
               pkg_name(possi->up->up, pnaw_always));
 
+  // cppcheck-suppress[constVariable]: false positive, operator() modifies it.
   varbuf& vb= possi->up->up->clientdata->relations;
   vb(possi->ed->name);
   vb(_(" does not appear to be available\n"));
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index eebf600f1..d3fd242a5 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -374,6 +374,8 @@ static const struct trigkindinfo tki_explicit = {
 /*---------- File triggers. ----------*/
 
 static struct {
+       /* cppcheck-suppress[unusedStructMember]:
+        * False positive, macros from dlist.h use the tail member. */
        struct trigfileint *head, *tail;
 } filetriggers;
 
diff --git a/t/cppcheck.t b/t/cppcheck.t
index 6950d447c..caef6cd35 100644
--- a/t/cppcheck.t
+++ b/t/cppcheck.t
@@ -31,6 +31,7 @@ plan tests => 1;
 #  -Ilib
 my @cppcheck_opts = (qw(
   --quiet --force --error-exitcode=2
+  --inline-suppr
   --suppressions-list=t/cppcheck/cppcheck.supp
 ), (
   '--enable=warning,performance,portability,style',
diff --git a/t/cppcheck/cppcheck.supp b/t/cppcheck/cppcheck.supp
index b230e5b0f..221023c38 100644
--- a/t/cppcheck/cppcheck.supp
+++ b/t/cppcheck/cppcheck.supp
@@ -32,18 +32,11 @@ unknownMacro
 // BUG: False positive, the function returns a pointer within a local.
 returnDanglingLifetime:lib/dpkg/pkg-hash.c
 
-// BUG: False positive, the variable uses operator() which writes to it.
-constVariable:dselect/pkgsublist.cc:111
-
 // BUG: False positive.
 syntaxError:lib/dpkg/t/*.c
 
 // BUG: False positive, the loop does an early exit.
 identicalInnerCondition:lib/dpkg/fsys-hash.c:96
-
-// BUG: False positive, the macros from lib/dpkg/dlist.h use the tail member.
-unusedStructMember:lib/dpkg/triglib.c:377
-
 // BUG: False positive, does not understand non-returning functors.
 negativeIndex:src/deb/build.c
 nullPointerArithmeticRedundantCheck:lib/dpkg/db-fsys-files.c

-- 
Dpkg.Org's dpkg

Reply via email to