Today I found out that there is a --safety option that solves the problems I described.
Came here to report same issue. This is not the first time I've encountered such a problem. The problem is more general than this particular example. As an extensive Cppcheck user, I often do: cppcheck --suppress=*:*lib/* ... or cppcheck --inline-suppr ... And having this particular JSON library in lib directory. I have the false impression that everything is ok, but it's not. Which, as a result causes to potentially have undetected problems in code. @danielmarjamaki @chrchr maybe Cppcheck needs...
Hi, I created basic QtWidgets project on Qt 5.15.2. File structure: . ├── CMakeLists.txt ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h └── mainwindow.ui In CMakeLists.txt I added Cppcheck run target (see below for used options): add_custom_target(cppcheck-check COMMAND ${CPPCHECK} --check-level=exhaustive --cppcheck-build-dir=${CMAKE_BINARY_DIR} --enable=all --error-exitcode=1 --inline-suppr --language=c++ --platform=native --project=${CMAKE_BINARY_DIR}/compile_commands.json --library=qt -i ${CMAKE_BINARY_DIR}...
UPDATE: I build Cppcheck from source from current top (Cppcheck 2.10 dev) - commit 3136a50b9). Looks like it is already fixed. Hi When I run Cppcheck 2.9 with this command: cppcheck --enable=all main.cpp on this code: // main.cpp #if __has_include(<string_view>) #endif int main() { int a; } I always get: main.cpp:1:0: error: failed to evaluate #if condition [preprocessorErrorDirective] #if __has_include(<string_view>) ^ on Windows and Linux. It does actually work with quotation marks __has_include("something"),...
UPDATE: I build Cppcheck from source from current top (Cppcheck 2.10 dev) - commit 3136a50b9). Looks like it is already fixed. Hi When I run Cppcheck 2.9 with this command: cppcheck --enable=all main.cpp on this code: // main.cpp #if __has_include(<string_view>) #endif int main() { int a; } I always get: main.cpp:1:0: error: failed to evaluate #if condition [preprocessorErrorDirective] #if __has_include(<string_view>) ^ on Windows and Linux. It does actually work with quotation marks __has_include("something"),...
Hi When I run Cppcheck 2.9 with this command: cppcheck --enable=all main.cpp on this code: // main.cpp #if __has_include(<string_view>) #endif int main() { int a; } I always get: main.cpp:1:0: error: failed to evaluate #if condition [preprocessorErrorDirective] #if __has_include(<string_view>) ^ on Windows and Linux. It does actually work with quotation marks __has_include("something"), but doesn't with angle brackets __has_include(<something>)
Hi When I run Cppcheck 2.9 with this code: #if __has_include(<string_view>) #endif int main() { int a; } I always get: main.cpp:1:0: error: failed to evaluate #if condition [preprocessorErrorDirective] #if __has_include(<string_view>) ^ on Windows and Linux. It does actually work with quotation marks __has_include("something"), but doesn't with angle brackets __has_include(<something>)
Hi When I run Cppcheck 2.9 with this code: #if __has_include(<string_view>) #endif int main() { int a; } I always get: main.cpp:1:0: error: failed to evaluate #if condition [preprocessorErrorDirective] #if __has_include(<string_view>) ^ on Windows and Linux. It does actually work with quotation marks __has_include("something"), but doesn't with angle brackets __has_include(<something>)