[Openvpn-devel,v2] cppcheck: Review suppressions for constParameter and constParameterCallback

Message ID 20261003175407.6176-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v2] cppcheck: Review suppressions for constParameter and constParameterCallback |

Commit Message

Gert Doering Oct. 3, 2026, 5:54 p.m. UTC
  From: Frank Lichtenheld <frank@lichtenheld.com>

I reviewed all the occurrences of the two cppcheck
errors constParameter and constParameterCallback.

All of constParameterCallback occurences were bogus and
I think in most cases they will be. So continue to ignore
it completely but document that we considered it and it
is not useful.

All existing cases of constParameter were bogus, but
there might be useful hits in the future so I only
suppress the existing occurrences.

Change-Id: I76c310f9e69276d4f21a4ad31a24490553d6d5c4
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1966
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1966
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>
  

Patch

diff --git a/dev-tools/cppcheck-suppressions.xml b/dev-tools/cppcheck-suppressions.xml
index bd24c3b..33337cf 100644
--- a/dev-tools/cppcheck-suppressions.xml
+++ b/dev-tools/cppcheck-suppressions.xml
@@ -3,23 +3,20 @@ 
   <!-- We start with enable=all, but then suppress some issues that have too many
        occurences right now. They still should be fixed at some point -->
   <suppress>
-    <id>constParameter</id>
-  </suppress>
-  <suppress>
-    <id>constParameterCallback</id>
-  </suppress>
-  <suppress>
     <id>unusedFunction</id>
   </suppress>
   <suppress>
     <id>usleepCalled</id>
   </suppress>
-  <!-- We have a lot of library includes, not all of them are really required,
+  <!-- These are specific false-positives (FP) or ignored (IGN) issues
+       We might want to move some of them to inline-suppression to avoid
+       the static line-numbers -->
+  <!-- IGN: We have a lot of library includes, not all of them are really required,
        so ignore them -->
   <suppress>
     <id>missingIncludeSystem</id>
   </suppress>
-  <!-- cppcheck doesn't understand about check_malloc_return, so these are
+  <!-- FP: cppcheck doesn't understand about check_malloc_return, so these are
        usually misleading -->
   <suppress>
     <id>nullPointerOutOfMemory</id>
@@ -27,9 +24,6 @@ 
   <suppress>
     <id>nullPointerArithmeticOutOfMemory</id>
   </suppress>
-  <!-- These are specific false-positives (FP) or ignored (IGN) issues
-       We might want to move some of them to inline-suppression to avoid
-       the static line-numbers -->
   <!-- IGN: posix.cfg: We are not threadsafe -->
   <suppress>
     <id>getgrnamCalled</id>
@@ -62,6 +56,11 @@ 
     <id>badBitmaskCheck</id>
     <fileName>tests/unit_tests/openvpn/test_pkt.c</fileName>
   </suppress>
+  <!-- FP: All occurrences are either external types or types that
+       explicitly need to be non-const in some variants of the callback -->
+  <suppress>
+    <id>constParameterCallback</id>
+  </suppress>
   <!-- IGN: we use casts to remove const -->
   <suppress>
     <id>constParameterPointer</id>
@@ -74,6 +73,12 @@ 
     <fileName>src/openvpn/buffer.c</fileName>
     <symbolName>buf</symbolName>
   </suppress>
+  <!-- FP: can't change the signature of wmain -->
+  <suppress>
+    <id>constParameter</id>
+    <fileName>src/openvpn/openvpn.c</fileName>
+    <symbolName>wargv</symbolName>
+  </suppress>
   <!-- IGN: external -->
   <suppress>
     <id>constParameterPointer</id>
@@ -81,6 +86,10 @@ 
   </suppress>
   <!-- IGN: too many false-positives due to stubs -->
   <suppress>
+    <id>constParameter</id>
+    <fileName>tests/unit_tests/openvpn*/test_*</fileName>
+  </suppress>
+  <suppress>
     <id>constParameterPointer</id>
     <fileName>tests/unit_tests/openvpn*/test_*</fileName>
   </suppress>