Recent changes to Project cppcheck (original) (raw)

Recent changes to Project cppcheckhttps://sourceforge.net/p/cppcheck/Recent changes to Project cppcheckenWed, 10 Dec 2025 21:21:19 -0000Cppcheck 2.19https://sourceforge.net/p/cppcheck/discussion/development/thread/213b5b3fd8/?limit=25#c8f4/a5ab

Sorry for the late reply. Here's an updated overview.

We need to add the suppressions in https://github.com/danmar/cppcheck/pull/8008 so it can be merged.

Still to be done for simple 1.6.4:
https://github.com/danmar/simplecpp/pull/599 (basically ready - still want to get it a closer look tomorrow)

regarding https://github.com/danmar/simplecpp/issues/556 / https://github.com/danmar/simplecpp/pull/475
I think it will be fine to release it without having the MinGW CI in-place and the known issues fixed. It only affects simplecpp since it is not hooked up in Cppcheck yet so the scope is also limited. Since the current CI does not fail and we already missed earlier issues it is obviously not a primary (or possibly even secondary) platform. It should definitely be fixed for the future 1.6.x/2.20 release (we should backport it for a patch release though). I am also pretty sure adapting the MinGW CI in Cppcheck will unearth more issues.

simplecpp 1.6.4 merge is already prepared in https://github.com/danmar/cppcheck/pull/8000

https://github.com/danmar/cppcheck/pull/7962 can also be applied after simplecpp 1.6.4 has been merged.

I still feel very strongly about reverting https://github.com/danmar/cppcheck/pull/7658 - see https://github.com/danmar/cppcheck/pull/8018. Let's keep any discussion in those tickets.

Oliver StönebergWed, 10 Dec 2025 21:21:19 -0000https://sourceforge.net44281d33ab1496f47cea64927fc668baad2ed376Cppcheck 2.19https://sourceforge.net/p/cppcheck/discussion/development/thread/213b5b3fd8/?limit=25#236d

Integrating simplecpp 1.6.4 (yet to be tagged) would fix the crash from https://trac.cppcheck.net/ticket/14268

CHRTue, 09 Dec 2025 08:24:54 -0000https://sourceforge.net83e79c9a6716456705307a7c0afab267bb370651Cppcheck 2.19https://sourceforge.net/p/cppcheck/discussion/development/thread/213b5b3fd8/?limit=25#c8f4

I would like to release soon. Customers are waiting for some of the bug fixes. What more do you feel we need to fix before the release? Imho getting latest simplecpp fixes into cppcheck should be pretty high prio. I can help out and I can ask ludvig, oleksandr and swasti to work on some tasks if there are suggestions..

Daniel MarjamäkiMon, 08 Dec 2025 08:04:37 -0000https://sourceforge.netf66926bd85802cdb105e1363c58a469f5bdd0ef1FP: knownConditionTrueFalse for assert checkhttps://sourceforge.net/p/cppcheck/discussion/general/thread/8e57da0a97/?limit=25#d80e

Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14315

CHRFri, 05 Dec 2025 18:00:02 -0000https://sourceforge.net3a64f7be8979504b24596f80f6387c6d22735c83FP truncLongCastAssignmenthttps://sourceforge.net/p/cppcheck/discussion/general/thread/86a2e4e5ed/?limit=25#1787

That seems to be a true positive. The multiplication is done using 32 bits, and the result is assigned to a 64 bit value. In case of a = 5, cppcheck knows that no overflow can occur.

CHRFri, 05 Dec 2025 17:39:23 -0000https://sourceforge.netf382e0878b25a96a2b88f6eece3afba7001bc9afFP: knownConditionTrueFalse for assert checkhttps://sourceforge.net/p/cppcheck/discussion/general/thread/8e57da0a97/?limit=25#b55d

I'm using cppcheck 2.18.0

Here is code:

static const int i = 0; int main() {  assert(i == 0); } 

When running cppcheck --enable=style I have issue:

cppcheckbug_4:4:10: style: The comparison 'i == 0' is always true. [knownConditionTrueFalse] assert(i == 0);  ^ cppcheckbug_4:1:22: note: 'i' is assigned value '0' here. static const int i = 0;  ^ cppcheckbug_4:4:10: note: The comparison 'i == 0' is always true. assert(i == 0); 

Although the cppcheck has right, the assert is to make sure the variable is 0 and e.g. no one will change it to other value because code below the assert works only for 0. That's the idea of assert and the issue shouldn't be raised here.

Marcin PytelFri, 05 Dec 2025 16:35:38 -0000https://sourceforge.neta2ce1d477c667d16f11f8a3f4a17b925cd2687ebFP truncLongCastAssignmenthttps://sourceforge.net/p/cppcheck/discussion/general/thread/86a2e4e5ed/?limit=25#8ed4

I'm using cppcheck 2.18.0

Here is code:

// scanf and printf are just to get rid of unused and uninitialized variable int main() {  uint32_t a;  scanf("%u", &a);  uint32_t i = a, j = a;  uint64_t k = i * j;  printf("%lu", k); } 

When running cppcheck --enable=style I have error:

style: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment] uint64_t k = i * j; 

There's no issue when I remove the scanf and assign some number to the a variable e.g. uint32_t a = 5;

Marcin PytelFri, 05 Dec 2025 16:17:52 -0000https://sourceforge.netc037e571b6d3649786947d02a52972cb75761c8fErrors when using external library: Eigenhttps://sourceforge.net/p/cppcheck/discussion/general/thread/6edcaa7e91/?limit=25#e261/b532

I didn't quite understand the solution of the OP. "A quick solution that wasn't immediately obvious to us was to move all our external libraries to an external directory and updating our include paths accordingly"

The idea is to not let cppcheck see the Eigen headers.

CHRWed, 03 Dec 2025 10:33:58 -0000https://sourceforge.net3a8f69ea51e79a1bf451d3788bc4b6b0a256156aErrors when using external library: Eigenhttps://sourceforge.net/p/cppcheck/discussion/general/thread/6edcaa7e91/?limit=25#e261

Hello,
sorry to move back that topic. I encounter the same issue with the usage of the eigen library.

include/eigen/src/plugins/CommonCwiseBinaryOps.h:19]: (error) syntax error
It's exactly the same issue on operator- or operator+ or any sign after operator.

I didn't manage to create an eigen.cfg that works. Don't know how to make it work.
I try to do
<define name="EIGEN_MAKE_CWISE_BINARY_OP(operator-,OPNAME)" value="">
It works with a simple sample of code, but don't work with CommonCwiseBinaryOps.h
My project is currently running with cppcheck 2.14.</define>

I didn't quite understand the solution of the OP. "A quick solution that wasn't immediately obvious to us was to move all our external libraries to an external directory and updating our include paths accordingly"
Can someone enlighten me?

hardorkWed, 03 Dec 2025 09:51:56 -0000https://sourceforge.nete344f3f0b7424610be00c0adf9f7b7c80999263cIs this invalidScanfArgType_int a false positive warning?https://sourceforge.net/p/cppcheck/discussion/general/thread/914b3fe088/?limit=25#793d

Thank you for confirming.

AlexHsiehWed, 03 Dec 2025 08:45:34 -0000https://sourceforge.netf3508595b00fba8d539ae8fe995f02f4d77a3573