Minimal reproducer: [/tmp]~> cat test.c typedef struct { char *s; int len; } Str; void f(int n) { Str tmp = {0}; Str s = n == 0 ? (Str){0} : tmp; } [/tmp]~> cppcheck test.c Checking test.c ... test.c:6:17: error: Syntax Error: AST broken, ternary operator lacks ':'. [internalAstError] Str s = n == 0 ? (Str){0} : tmp; ^ Wrapping the compound literal in a paren seems to solve it: [/tmp]~> cat test2.c typedef struct { char *s; int len; } Str; void f(int n) { Str tmp = {0}; Str s = n == 0 ? ((Str){0})...
Is it new switch The --shuffle switch was added in GNU Make v4.4 in order to detect missing dependencies that causes parallel build failures: https://trofi.github.io/posts/238-new-make-shuffle-mode.html GNU Make v4.4 was released in 31 Oct 2022, so it's not too new. I suppose your make version is older than that.
Sorry, I meant to open this as a bug not patch.
build dir isn't properly specified as a dependency
I suppose this is still not implemented? Unfortunate. I wanted to be able to optimize my screenshots before stuffing them into the clipboard. Something like: $ maim -s | optipng | xclip -selection clipboard -t image/png
Test-case (tested with cppcheck v2.8.2 as well as main branch commit 5477130): int f(void) { if (0) *(int *)0 = 1; return 0 ? *(int *)0 : 1; } This raises the following warnings: $ ./cppcheck /tmp/test.c Checking /tmp/test.c ... /tmp/test.c:5:4: error: Null pointer dereference: (int*)0 [nullPointer] *(int *)0 = 1; ^ /tmp/test.c:6:14: error: Null pointer dereference: (int*)0 [nullPointer] return 0 ? *(int *)0 : 1; ^ Use-case: this false positive was detected when used on a macro which takes an optional...
I was lagging a bit behind on v2.6.3, just upgraded to 2.8.2 the issue seems to be fixed.
Cppcheck doesn't seem to realize that when casted to a character type accessing a larger object at non-zero index is still within bounds. Funny enough, not using [] suppresses the warning, even though they're the same thing. Test case: int main(void) { int a = 4, b = 8; unsigned char *pa = &a; unsigned char *pb = &b; for (int i = 0; i < sizeof a; ++i) { pa[i] = pb[i]; /* warns */ *(pa + i) = *(pb + i); /* no warnings */ } }