Activity for cppcheck

  • Ranier Fonseca Ranier Fonseca posted a comment on discussion General Discussion

    Hello. When creating project with compile_commands.json The analysis fails with: "There a critical error with a id 'preprocessorErrorDirective', when checking ... Analysis was aborted." information: Include file: "xxx.h" not found. [missingInclude] Id: missingInclude Include file: "xxx.h" not found. Thanks.

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    For information I will go to cppcon this autumn and talk about cppcheck: https://www.cppcheck.com/product-news/cppcheck-to-present-at-cppcon-2025-in-colorado

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion General Discussion

    it sounds good to clarify the output. could you give us some more details. which warning message do you see? maybe you can write some example code that resemble your code somewhat so we get an idea what we need to tweak.

  • Tal Tal posted a comment on discussion General Discussion

    Currently as far as I know, you can ask cppcheck to display in the warning message the file/line trace that called it. I'd like to have also the function name, but more importantly - the template variable assignment (and auto types resolutions) that caused the errors, both for the templates of a function and struct/class. Alternatively, do you know how to deduce which template instantiation had caused a particular warning?

  • CHR CHR posted a comment on discussion General Discussion

    Your best bet is to report the (reduced) preprocessed input (-E option).

  • vix vix posted a comment on discussion General Discussion

    I've just upgraded from v2.17-1 to v2.18 and I get an error Id: internalError Analysis failed. If the code is valid then please report this failure. First included by: myfile.c I see that the following line is highlighted, but I'm not sure iof this is the offending line slideInterfaceGetter_t getSlideInterface(int current_panel); where slideInterfaceGetter_t is a custom type defined in a .h file included at the top of the source file.

  • centralcoast167 centralcoast167 posted a comment on discussion General Discussion

    Update: Works on my Linux machine, not on Windows 11

  • centralcoast167 centralcoast167 modified a comment on discussion General Discussion

    ~~~ Hello, I am a new user and --dump is not creating a dump file as I would expect. I am using Cppcheck 2.18.0 on Windows 11 Pro 24H2. I am running the command "cppcheck --dump .\D_04_01.c". I get console output: Checking D_04_01.c ... Checking D_04_01.c: STDC_VERSION... I would expect a D_04_01.c.dump file to be created. If I run "cppcheck -f --enable=all --inconclusive --xml-version=2 -v --dump .\D_04_01.c" I get console output: <results version="2"> <cppcheck version="2.18.0"> <errors> Checking...

  • centralcoast167 centralcoast167 modified a comment on discussion General Discussion

    deleted due to duplication

  • centralcoast167 centralcoast167 posted a comment on discussion General Discussion

    Hello, I am a new user and --dump is not creating a dump file as I would expect. I am using Cppcheck 2.18.0 on Windows 11 Pro 24H2. I am running the command "cppcheck --dump .\D_04_01.c". I get console output: Checking D_04_01.c ... Checking D_04_01.c: STDC_VERSION... I would expect a D_04_01.c.dump file to be created. If I run "cppcheck -f --enable=all --inconclusive --xml-version=2 -v --dump .\D_04_01.c" I get console output: <results version="2"> <cppcheck version="2.18.0"> <errors> Checking D_04_01.c...

  • centralcoast167 centralcoast167 posted a comment on discussion General Discussion

    ~~~ Hello, I am a new user and --dump is not creating a dump file as I would expect. I am using Cppcheck 2.18.0 on Windows 11 Pro 24H2. I am running the command "cppcheck --dump .\D_04_01.c". I get console output: Checking D_04_01.c ... Checking D_04_01.c: STDC_VERSION... I would expect a D_04_01.c.dump file to be created. If I run "cppcheck -f --enable=all --inconclusive --xml-version=2 -v --dump .\D_04_01.c" I get console output: <results version="2"> <cppcheck version="2.18.0"> <errors> Checking...

  • CHR CHR posted a comment on discussion Development

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

  • Marc Zim Marc Zim posted a comment on discussion Development

    Hello, Since cppcheck 2.17 I see that there are a lot of new information messages: "Limiting analysis of branches...". But the command line I use is 'cppcheck --enable=warning,style, performance,portability' so I expect not to see 'information'. Thank you.

  • cppcheck cppcheck released /cppcheck/2.18/cppcheck-2.18.0-x64-Setup.msi

  • Daniel Marjamäki Daniel Marjamäki created a blog post

    Cppcheck-2.18.0

  • cppcheck cppcheck released /cppcheck/2.18/cppcheck-2.18.0.tar.gz

  • cppcheck cppcheck released /cppcheck/2.18/cppcheck-2.18.0.zip

  • cppcheck cppcheck released /cppcheck/2.18/cppcheck-2.18.0.tar.bz2

  • Inderjit Singh Inderjit Singh posted a comment on discussion Development

    Sorry CHR. I realised was say too brief in the description. Here is a more detailed output: cppcheck version: 2.13.0 $ cppcheck --addon=test/pipeline/coding_stds/misra.json --error-exitcode=255 -I/home/user/devel/repos/project/common/src/utils /home/user/devel/common/src/comp/comp_queue.c And the result: . . . Checking project/common/src/comp/comp_queue.c: SYSCFG_COMP_USE... project/common/src/comp/comp_queue.c:284:10: error: Variable 'pthread_mutex_t' is unknown [misra-config] if ((Q_HDR_SZ+(Q_ELEM_HDR_SZ+pkt_sz)*inbuf_cap)...

  • CHR CHR posted a comment on discussion Development

    Is the output really generated by cppcheck? I can't reproduce this with the code above.

  • Inderjit Singh Inderjit Singh posted a comment on discussion Development

    Hi. I don't seem to be able to get out of this problem. In my file queue.h I have declared: #include <pthread.h> #define Q_HDR_INT_SZ 4 #define Q_HDR_SZ (sizeof(pthread_mutex_t) + Q_HDR_INT_SZ) When using the macro, I get: Variable 'pthread_mutex_t' is unknown Anyone can guide me to why this error is being generated and to fix it?

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    Let's make final fixes this week.. I would like to release 2.18.0 in the weekend. as far as I see there is nothing super critical to fix before the release but many tickets would be really nice..

  • CHR CHR posted a comment on discussion General Discussion

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

  • CHR CHR posted a comment on discussion General Discussion

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

  • wy163 wy163 posted a comment on discussion General Discussion

    Hi, I am not sure if some commit to the cppcheck git might miss the modified .ts files to be pushed. Maybe that is the problem. git clone or pull the latest code under folder cppcheck/build: cmake -DBUILD_GUI=ON -DBUILD_TESTS=ON .. make go to folder cppcheck: git status unexpected modified .ts files are generated by cmake

  • Cyphall Cyphall modified a comment on discussion General Discussion

    It seems that saving the address of an element when iterating on a temporary std::span triggers this error. Sample code: #include <span> #include <vector> std::span<const int> getSpan(const std::vector<int>& vec) { return vec; } int main() { std::vector<int> values = {0, 1, 2, 3, 4}; const int* selectedValue = nullptr; for (const int& value : getSpan(values)) { if (value == 2) { selectedValue = &value; break; } } return selectedValue ? *selectedValue : 0; } Here, the std::span is temporary in the...

  • Cyphall Cyphall modified a comment on discussion General Discussion

    Using emplace_back on a vector may indeed invalidate references to existing objects, but not to the emplaced object itself. Sample code: #include <vector> #include <memory> struct Value { int data; }; int main() { std::vector<std::unique_ptr<Value>> values; for (int i = 0; i < 5; i++) { std::unique_ptr<Value>& value = values.emplace_back(std::make_unique<Value>(i)); value->data = 5; } return 0; } cppcheck error (file paths were removed): error: Reference to values that may be invalid. [invalidContainerReference]...

  • Cyphall Cyphall modified a comment on discussion General Discussion

    It seems that saving the address of an element when iterating on a temporary std::span triggers this error. Sample code: #include <span> #include <vector> std::span<const int> getSpan(const std::vector<int>& vec) { return vec; } int main() { std::vector<int> values = {0, 1, 2, 3, 4}; const int* selectedValue = nullptr; for (const int& value : getSpan(values)) { if (value == 2) { selectedValue = &value; break; } } return selectedValue ? *selectedValue : 0; } Here, the std::span is temporary in the...

  • Cyphall Cyphall posted a comment on discussion General Discussion

    Using emplace_back on a vector may indeed invalidate references to existing objects, but not to the emplaced object itself. Sample code: #include <vector> #include <memory> struct Value { int data; }; int main() { std::vector<std::unique_ptr<Value>> values; for (int i = 0; i < 5; i++) { std::unique_ptr<Value>& value = values.emplace_back(std::make_unique<Value>(i)); value->data = 5; } return 0; } cppcheck error (file paths were removed): error: Reference to values that may be invalid. [invalidContainerReference]...

  • Cyphall Cyphall posted a comment on discussion General Discussion

    It seems that saving the address of an element when iterating on a temporary std::span triggers this error. Sample code: #include <span> #include <vector> std::span<const int> getSpan(const std::vector<int>& vec) { return vec; } int main() { std::vector<int> values = {0, 1, 2, 3, 4}; const int* selectedValue = nullptr; for (const int& value : getSpan(values)) { if (value == 2) { selectedValue = &value; break; } } return selectedValue ? *selectedValue : 0; } Here, the std::span is temporary in the...

  • Daniel Marjamäki Daniel Marjamäki modified a comment on discussion Development

    anyway I turned on the CLI and now I can build the GUI. but I think this is a hack I'd rather avoid it.

  • Daniel Marjamäki Daniel Marjamäki modified a comment on discussion Development

    as a developer I feel that the qmake .pro file was more friendly; it just worked. maybe cmake works better when you only build a gui. was it a mistake to put gui and cli in the same cmake file? anyway I turned on the CLI and now I can build the GUI. but I think this is a hack I'd rather avoid it.

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    as a developer I feel that the qmake .pro file was more friendly; it just worked. maybe cmake works better when you only build a gui. was it a mistake to put it all in the same cmake file? anyway I turned on the CLI and now I can build the GUI. but I think this is a hack I'd rather avoid it.

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    I can't build the gui with cmake: cmake -S /home/daniel/cppchecksolutions/cppcheck -B /home/daniel/cppchecksolutions/cppcheck/gui/build-cppcheck-Desktop-Debug -DBUILD_CLI=OFF -DBUILD_GUI=ON -DUSE_QT6=ON I get these error messages: CMake Error at CMakeLists.txt:50 (add_custom_target): Error evaluating generator expression: $<TARGET_FILE:cppcheck> No target "cppcheck" CMake Error at CMakeLists.txt:53 (add_custom_target): Error evaluating generator expression: $<TARGET_FILE:cppcheck> No target "cppcheck"...

  • Taavi Remmelg Taavi Remmelg posted a comment on discussion General Discussion

    Something is wrong with pasting code. I will attach my project file as attachment

  • Taavi Remmelg Taavi Remmelg posted a comment on discussion General Discussion

    Latest project file <project version="1"> <builddir>Taavitestfail-cppcheck-build-dir</builddir> <analyze-all-vs-configs>false</analyze-all-vs-configs> <check-headers>true</check-headers> <check-unused-templates>true</check-unused-templates> <inline-suppression>true</inline-suppression> <max-ctu-depth>2</max-ctu-depth> <max-template-recursion>100</max-template-recursion> <includedir> </includedir></project> <paths> <check-level-normal> <project-name>Taavitestfail</project-name> <defines> <define name="HARBOUR_STRICT_ANSI_C">...

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion General Discussion

    your project file is messed up, this is wrong: <paths> <check-level-normal> <project-name>Taavitestfail</project-name> <options> <option>--std=c89</option> <option>--suppress=missingIncludeSystem</option> <option>-DHB_OS_WIN_64</option> <option>-DHARBOUR_STRICT_ANSI_C</option> <option>-DFIVEWIN</option> </options> </check-level-normal> </paths> paths is supposed to contain the paths only, no options.

  • Taavi Remmelg Taavi Remmelg posted a comment on discussion General Discussion

    Ok, seems there is a problem with compiling switches when processing header files for xharbour preprocessor environment. Will investigate further.

  • Taavi Remmelg Taavi Remmelg posted a comment on discussion General Discussion

    I get the same error with command line without any switch. GUI project setup file content below. Anything what can cause syntax error here? <project version="1"> <builddir>Taavitestfail-cppcheck-build-dir</builddir> <analyze-all-vs-configs>false</analyze-all-vs-configs> <check-headers>true</check-headers> <check-unused-templates>true</check-unused-templates> <inline-suppression>true</inline-suppression> <max-ctu-depth>2</max-ctu-depth> <max-template-recursion>100</max-template-recursion> <includedir>...

  • Taavi Remmelg Taavi Remmelg posted a comment on discussion General Discussion

    Did You test with GUI or command line?

  • CHR CHR posted a comment on discussion General Discussion

    I get this instead: ALLIKAS.c:54:1: error: There is an unknown macro here somewhere. Configuration is required. If HB_INIT_SYMBOLS_EX_END is a macro then please configure it. [unknownMacro] HB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_ALLIKAS, __PRG_SOURCE__, 0x000a ) ^ Maybe looking at the preprocessed output (-E) can help with identifying the issue.

  • Taavi Remmelg Taavi Remmelg posted a comment on discussion General Discussion

    Hello, how to fix this error? Syntax seems correct, code compiles ok with Borland compiler. cpptest/ALLIKAS.c:33:1: error: Unmatched '{'. Configuration: 'HARBOUR_STRICT_ANSI_C;HB_MSC_STARTUP;HB_OS_WIN_64;HB_PRAGMA_STARTUP;HB_STATIC_STARTUP;_MSC_VER;LCC;POCC;XCC;RPCNDR_H_VERSION'. [syntaxError] Taavi

  • Alexander Möhring Alexander Möhring modified a comment on discussion General Discussion

    Does this full implementation of the MISRA C 2012 rules also apply to the free version?

  • Alexander Möhring Alexander Möhring posted a comment on discussion General Discussion

    Does this full implementation of the final MISRA C 2012 rules also apply to the free version?

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    I would like to release Cppcheck 2.18 in july So I encourage more caution with refactorings and improvements.

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    Thanks for reporting this issue. I have created this ticket: https://trac.cppcheck.net/ticket/13963

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion Development

    Sorry for late reply. I don't actively improve the misra addon. New standards are added in Cppcheck Premium. Full compliance with Misra C 2025 is planned to be released in Cppcheck Premium in august.

  • CHR CHR posted a comment on discussion Development

    Thanks for reporting, this should be covered by https://trac.cppcheck.net/ticket/10739

  • Chard Chard posted a comment on discussion Development

    Invoked against repo at: 8e62a241ae1ee4ead0144e9573b129b989c58af5 #include <pair> #include <vector> void ast() { struct S {}; std::pair<int, std::vector<S>> p; std::count_if(p.second.begin(), p.second.end(),[](decltype(p.second) v)->bool { return true; }); }

  • CHR CHR posted a comment on discussion General Discussion

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

  • gruk gruk posted a comment on discussion General Discussion

    Hello, It seems to me that nullptr is not supported in C23. According to the man, the latest supported C standard is C11. C23 introduced nullptr, which is the exact same as nullptr in C++. Since this is not recognised by cppcheck, this breaks many critical checks. So far I had to suppress: nullPointerOutOfMemory nullPointerArithmeticOutOfMemory memleak Do you think that is something that could be added without having to catch up to the whole c17/c23 std ?

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion General Discussion

    Known issue tracked in https://trac.cppcheck.net/ticket/13909. Since the prerequisites have been merged I hope to finish https://github.com/danmar/cppcheck/pull/7570 later today, so it will hopefully be merged over the weekend.

  • wy163 wy163 posted a comment on discussion General Discussion

    Hi, this issue is 100% reproduced on my side. I am not sure if I did something wrong, as the steps are quite simple. The error message is as below. looking for library '/home/w/Desktop/tmp/sample/cppcheck/std.cfg' looking for library '/home/w/work/apptest/app/main_project/cppcheck_git_ssh10/cppcheck/build/bin/std.cfg' looking for library '/home/w/work/apptest/app/main_project/cppcheck_git_ssh10/cppcheck/build/bin/cfg/std.cfg' Checking project file "/home/w/Desktop/tmp/sample/cppcheck/helloworld.cppcheck"...

  • CHR CHR modified a comment on discussion General Discussion

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

  • CHR CHR posted a comment on discussion General Discussion

    Thanks for reporting. ticket is here: https://trac.cppcheck.net/ticket/13953#ticket

  • Nikita Leontiev Nikita Leontiev posted a comment on discussion General Discussion

    cppcheck 2.17.1 suggests to use const for method init that changes class member: typedef void (*InitFunc)(void**); template<typename T> class Object { private: T *m_ptr; public: Object() : m_ptr(0) {} ~Object() { if (m_ptr) delete m_ptr; } void init(InitFunc func) { func(reinterpret_cast<void**>(&m_ptr)); } }; template<typename T> void init(void **ptr) { *ptr = new T; } test\main.cpp:16:7: style: inconclusive: Technically the member function 'Object < int >::init' can be const. [functionConst] void...

  • Daniel Marjamäki Daniel Marjamäki posted a comment on discussion General Discussion

    sorry about late reply. I have created this ticket: https://trac.cppcheck.net/ticket/13946

  • CHR CHR posted a comment on discussion General Discussion

    It seems that .ctu-info files are only generated in executeAddonsWholeProgram(). Setting a breakpoint there might help.

  • CHR CHR posted a comment on discussion General Discussion

    Can you post a self-contained example that reproduces the error?

  • CHR CHR posted a comment on discussion General Discussion

    Can you tell which source file symbol.h is referenced from? It should appear somewhere in the output before the ODR warning. Once you know the file, looking at the preprocessor output (-E) might be helpful.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion General Discussion

    Thanks. Confirmed and filed as https://trac.cppcheck.net/ticket/13925.

  • James K. Lowden James K. Lowden posted a comment on discussion General Discussion

    ../../gcc/cobol/symbols.h:158:1: error: The one definition rule is violated, different classes/structs have the same name 'cbl_domain_elem_t' [ctuOneDefinitionRuleViolation] class cbl_domain_elem_t { ^ /home/jklowden/projects/3rd/gcc/parser/gcc/cobol/symbols.h:158:1: note: The one definition rule is violated, different classes/structs have the same name 'cbl_domain_elem_t' class cbl_domain_elem_t { ^ ../../gcc/cobol/symbols.h:158:1: note: The one definition rule is violated, different classes/structs...

  • James K. Lowden James K. Lowden posted a comment on discussion General Discussion

    const cdfval_base_t& cdfval_base_t::operator()( const YDFLTYPE& loc ) { static cdfval_t zero(0); return verify_integer(loc, *this) ? *this : zero; } report: ../../gcc/cobol/cdf.y:897:37: error: Reference to temporary returned. [returnTempReference] return verify_integer(loc, *this) ? *this : zero; Neither zero nor *this are temporary. cdfval_base_t is the public base class for cdfval_t.

  • Leander Schulten Leander Schulten posted a comment on discussion General Discussion

    Given the following code std::map<std::sting, std::vector<std::string>> map; void test(){ for(const auto &entry : map){ auto& names = entry.second; for(auto &name : names) { std::cout << name << std::endl; } } } I got example_const_ref.cpp:5:19: style: Variable 'name' can be declared as reference to const [constVariableReference] for(auto &name : names) { ^ before https://github.com/danmar/cppcheck/commit/6fc4d3624ba47de14f59244ec5fe9e5550f68309 but with this commit the warning is not reported anymore...

  • Richard Smith Richard Smith posted a comment on discussion Development

    With MISRA C:2025 out is there a timeline for when the MISRA addon will include the changes in C:2025?

  • Richard Smith Richard Smith posted a comment on discussion General Discussion

    Bump. No ideas?

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion General Discussion

    cppcheck-gui has an integrated editor for parts of the library files.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion Development

    Yes, the wording and handling needs to be reworked a bit. It is just misleading and noisy right now. I have not looked into it so far.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion General Discussion

    Clang 21 is still in early development and won't be released until at least September. We track the necessary changes for the upcoming Clang version and do usually not apply them until at least the RC is available so we do not have to deal with false positives and changes which might be in flux. See https://github.com/danmar/cppcheck/pull/7272 for Clang 21. I made an exception for some -Wnrvo fixes as they are reasonable changes (which I partially had locally anyways) - see https://github.com/da...

  • Andrew C Aitchison Andrew C Aitchison posted a comment on discussion General Discussion

    I get a new warning when building cppcheck with clang++-21 -Weverything on Ubuntu 25.04/plucky [ 2%] Building CXX object lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.pch In file included from <built-in>:1: In file included from /home/werdna/src/cppcheck/cppcheck/build/lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx:5: In file included from /home/werdna/src/cppcheck/cppcheck/lib/precompiled.h:22: In file included from /home/werdna/src/cppcheck/cppcheck/lib/astutils.h:39: In file included from /home/werdna/src/cppcheck/cppcheck/lib/token.h:29:...

  • CHR CHR posted a comment on discussion General Discussion

    See e.g. the lines starting with <warn in posix.cfg.

  • Andrew C Aitchison Andrew C Aitchison posted a comment on discussion General Discussion

    I am contemplating writing a .cfg library for an open source project that I am involved with, and have read reference-cfg-format.pdf Are there any tools to assist in developing or maintaining a .cfg library ? These files have a lot of "boiler-plate"; does anyone have configs for an editor to simplify entering this ? Is it cppcheck's job to inform (perhaps with --enable=style) when experimental/deprecated/obsolete APIs are used ? How would I indicate such APIs in the .cfg library ? Thanks,

  • Leander Schulten Leander Schulten modified a comment on discussion General Discussion

    Consider this code: class Test { void Test::test() {} }; which compiles without warnings on msvc but is not standard conforming (requires gcc -fpermissive). One gets the following error with cppcheck: example.cpp:2:22: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn] void Test::test() {} ^ which is wrong because the return type is void

  • xuyongchuan xuyongchuan posted a comment on discussion General Discussion

    I want to check whether macro definitions start and end with an underscore. I used the following rule file, but the detection is not working. source code: test.c #include <stdio.h> #define _pi_ 3.14 void func(){ print("nothing to do"); } int main() { func(); return 0; } c_file_rules.xml <?xml version="1.0"?> <rule> <pattern>extern</pattern> <message> <severity>warning</severity> <summary>extern keyword should not be used in .c file</summary> </message> </rule> <rule> <pattern><![CDATA[define\s+(_[a-zA-Z0-9_]+_)\s+]]></pattern>...

  • CHR CHR posted a comment on discussion General Discussion

    cppcheck does not need (and should not) process Qt headers. Instead, --library=qt should be used. But I'm not sure how to prevent the issue with a compile-commands.json.

  • CHR CHR posted a comment on discussion General Discussion

    Tracked in https://trac.cppcheck.net/ticket/11617

  • Leander Schulten Leander Schulten posted a comment on discussion General Discussion

    I have reduced the source file to the following: void test() { for (auto& maschSchichtData : ret) { std::sort(std::begin(maschSchichtData), std::end(maschSchichtData)); //std::sort(maschSchichtData.begin(), maschSchichtData.end()); } } And if I run cppcheck -i random_file.h --enable=all --project=all/all-vs2015.sln "--project-configuration=Debug|Win32" "--file-filter=*einrichtaufwand.cpp" I get ls@ws-dev-ls:~/git_projects/src$ cppcheck -i random_file.h --enable=all --project=all/all-vs2015.sln "--project-configuration=Debug|Win32"...

  • Leander Schulten Leander Schulten posted a comment on discussion General Discussion

    Consider this code: class Test { void Test::test() {} }; which compiles without warnings on msvc but is not standard conforming (requires gcc -fpermissive). One gets the following error with cppcheck: example.cpp:2:22: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn] void Test::test() {} ^

  • Grit Clef Grit Clef modified a comment on discussion General Discussion

    (Sorry but I don't know where the subject has gone) Hi, I just added cppcheck to my Qt project based on CMake build system to analyse the codes. I run Cppcheck on a Ubuntu 24.04 system and use a compile_commands.json file as the project file. But when I run cppcheck for the source, I got the following errors: /usr/include/x86_64-linux-gnu/qt6/QtCore/qsystemdetection.h:134:0: error: #error "Qt has not been ported to this OS - see http://www.qt-project.org/" [preprocessorErrorDirective] # error "Qt...

  • Grit Clef Grit Clef modified a comment on discussion General Discussion

    Hi, I just added cppcheck to my Qt project based on CMake build system to analyse the codes. I run Cppcheck on a Ubuntu 24.04 system and use a compile_commands.json file as the project file. But when I run cppcheck for the source, I got the following errors: /usr/include/x86_64-linux-gnu/qt6/QtCore/qsystemdetection.h:134:0: error: #error "Qt has not been ported to this OS - see http://www.qt-project.org/" [preprocessorErrorDirective] # error "Qt has not been ported to this OS - see http://www.qt-project.org/"...

  • Grit Clef Grit Clef posted a comment on discussion General Discussion

    Hi, I just added cppcheck to my Qt project based on CMake build system to analyse the codes. I run Cppcheck on a Ubuntu 24.04 system and use a compile_commands.json file as the project file. But when I run cppcheck for the source, I got the following errors: /usr/include/x86_64-linux-gnu/qt6/QtCore/qsystemdetection.h:134:0: error: #error "Qt has not been ported to this OS - see http://www.qt-project.org/" [preprocessorErrorDirective] # error "Qt has not been ported to this OS - see http://www.qt-project.org/"...

  • Richard Smith Richard Smith posted a comment on discussion General Discussion

    I'm trying to track down a false positive for MISRA 8.7 I've identified that the additional listing for MisraUsage for the function in question is missing. The reason seems to be that the .a1.ctu-info file for the source module is empty. The .a1 file contains the following but a1.ctu-info is empty. <?xml version="1.0"?> <analyzerinfo hash="15032439644721007550"> </analyzerinfo> I can see from some cppcheck output that it is processing the .c file and I don't see any obvious errors for that file....

  • Richard Lewis Richard Lewis posted a comment on discussion Development

    $ cat foo.c #include <stdio.h> void main(void){} $ cppcheck --enable=all foo.c nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingIncludeSystem] this is a really confusing 'error' message - it says it "cannot find" the include file, and suggests that it is "missing" but this seems to be wrong - i gather that it really means that it did not check the file listed in #include. Could you make the error clearer by changing the text to say nofile:0:0:...

  • CHR CHR posted a comment on discussion General Discussion

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

  • Michael Renken Michael Renken posted a comment on discussion General Discussion

    Hello, we are using cppcheck on a larger software project. The last days /weeks we recognized that every run of cppcheck takes about the same large amount of time, even though we are using --cppcheck-build-dir. We run cppcheck in the gitlab-CI from a powershell script. In the .a1-files I see that the hashes change every time. So in cppchecks std::size_t Preprocessor::calculateHash-function I collected the hashData string. In that string I can see that the suppression section changes. The first suppressions...

  • Chris Engel Chris Engel posted a comment on discussion General Discussion

    We are running into an issue where it appears cppcheck is not calculating the size of an object correctly and is then calling out passedByValue Here is the sample object with a bunch of different variations that all lead to an 8B value . Some work and others don't as denoted by the comments. class testObject { public: enum Base { Val1 = 0x0000 }; #if 0 // This fails Base base:32; Base ext:16; uint16_t value; #elif 0 // This works Base base:32; uint32_t value; #elif 0 // This works uint32_t base;...

  • CHR CHR posted a comment on discussion General Discussion

    Probably covered by https://trac.cppcheck.net/ticket/13800

  • Kazimierz Król Kazimierz Król modified a comment on discussion General Discussion

    Thank you sir, this fixed my problem. No manual or guide I could find mentioned this. Perhaps the official manual deserves an update :) Regarding the number of found violations, if I call it with just --addon=misra, it will find 7 violations, but when called with --addon=misra-custom.json, where the json file specifies a "rule-texts" file, it will find 10. And all of the new ones are different rules on the same lines as the previously found ones. Also I tried to fix a violation from one line the...

  • Kazimierz Król Kazimierz Król posted a comment on discussion General Discussion

    Thank you. No manual or guide I could find mentioned this. Perhaps the official manual deserves an update :) Regarding the number of found violations, if I call it with just --addon=misra, it will find 7 violations, but when called with --addon=misra-custom.json, where the json file specifies a "rule-texts" file, it will find 10. And all of the new ones are different rules on the same lines as the previously found ones. Also I tried to fix a violation from one line the first output, and then it started...

  • wy163 wy163 posted a comment on discussion General Discussion

    Hi, int main() { int x = 200; int y = 100; if(x,x,y) {} return 0; } There is no warning reported for the alwaysTrueFalse. Shall we need to raise a ticket for that? Thanks!

  • Oliver Stöneberg Oliver Stöneberg modified a comment on discussion General Discussion

    They are style warnings which are not enabled by default. You need to add --enable=style for them to show. That behavior changed in 2.11 (I do not have an exact commit). Strangely I am only seeing 6 MISRA warnings using the official Windows binaries but I am getting 10 MISRA warnings on Linux. That needs looking into. It also looks like the performance took a major hit starting with 2.5 or even earlier.

  • Oliver Stöneberg Oliver Stöneberg modified a comment on discussion General Discussion

    They are style warnings which are not enabled by default. You need to add --enable=style for them to show. That behavior changed in 2.11 (I do not have an exact commit). Strangely I am only seeing 6 MISRA warnings using the official Windows binaries but I am getting 10 MISRA warnings on Linux. That needs looking into. It also looks like the performance took a major hit starting with 2.5 and even earlier.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion General Discussion

    They are style warning which are not enabled by default. You need to add --enable=style for them to show. That behavior changed in 2.11 (I do not have an exact commit). Strangely I am only seeing 6 MISRA warnings using the official Windows binaries but I am getting 10 MISRA warnings on Linux. That needs looking into. It also looks like the performance took a major hit starting with 2.5 and even earlier.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion Development

    I also filed https://trac.cppcheck.net/ticket/13836.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion Development

    FYI --clang is still experimental so it should not be used in production. It is also magnitudes slower because it will always analyze the system headers involved (see https://trac.cppcheck.net/ticket/12376). I filed https://trac.cppcheck.net/ticket/13834 and https://trac.cppcheck.net/ticket/13835 about the issues.

  • Oliver Stöneberg Oliver Stöneberg posted a comment on discussion Development

    The issue was fixed in 2.7 and the fix has been bisected to https://github.com/danmar/cppcheck/commit/57f5b19b343a2921abe80e0060d71a30246b7bde. input.cpp:27:19: warning: Iterators to containers from different expressions 'vec1.front()' and 'vec2.front()' are used together. [mismatchingContainerExpression] if (vec1.front().begin() == vec2.front().end()) ^

  • Kazimierz Król Kazimierz Król posted a comment on discussion General Discussion

    I have just installed version 2.17.1 from the source, and it's still the same. Am I doing something wrong here? If it was a bug I don't suppose it would go unnoticed for so many releases.

  • Oliver Parczyk Oliver Parczyk posted a comment on discussion General Discussion

    Greetings! The library configuration table on page 30 in the cppcheck manual (https://cppcheck.sourceforge.io/manual.pdf) seems to be a bit broken. I've attached a screenshot.

  • CHR CHR posted a comment on discussion Development

    I can't reproduce this with current head.

  • CHR CHR posted a comment on discussion Development

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

1 >
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.