Hi,
With the following code:
#include <stdio.h> #define bar(x) x % 2 #define foo(x) printf(#x "\n") int main(void) { foo(bar(3)); return 0; }
cppcheck returns the following error:
Checking test.c ... test.c:8:5: error: printf format string requires 1 parameter but only 0 are given. [wrongPrintfScanfArgNum] foo(bar(3)); ^
But upon execution I get the expected behaviour:
$ gcc test.c -o test && ./test bar(3)
Can you please confirm it's a false positive?
Thanks!
Thanks! It's a preprocessor bug. I have created this issue: https://github.com/danmar/simplecpp/issues/296
Log in to post a comment.
Hi,
With the following code:
cppcheck returns the following error:
But upon execution I get the expected behaviour:
Can you please confirm it's a false positive?
Thanks!
Thanks! It's a preprocessor bug. I have created this issue:
https://github.com/danmar/simplecpp/issues/296