Let's check this test.c:
#if ((0x7fffffffffffffffL * 2UL) < 0) # error LOL #endif
$ cppcheck -DANYTHING --enable=all test.c Checking test.c ... test.c:2:0: error: #error LOL [preprocessorErrorDirective] # error LOL ^
The more fun is that that the left operand may be unsigned and the expression continues to be negative from cppcheck point of view. The expressions below are also considered negative by cppcheck preprocessor:
(0x7fffffffffffffffUL * 2UL) (0x7fffffffffffffffUL << 1UL) (0x7000000000000000UL + 0x1000000000000000UL) (0x4000000000000000UL << 1UL) (1UL << 63UL)
The platform is Debian 10 x64. Verified for cppcheck current release (2.3) and current git (2020-12-28 b94a6d595).
Thanks! I have created this issue: https://github.com/danmar/simplecpp/issues/207
Log in to post a comment.
Let's check this test.c:
The more fun is that that the left operand may be unsigned and the expression continues to be negative from cppcheck point of view. The expressions below are also considered negative by cppcheck preprocessor:
The platform is Debian 10 x64. Verified for cppcheck current release (2.3) and current git (2020-12-28 b94a6d595).
Thanks! I have created this issue: https://github.com/danmar/simplecpp/issues/207
Last edit: Daniel Marjamäki 2021-01-23