Configure cppcheck make target to ignore bogus warning #5962

pull celeduc wants to merge 3 commits into bitcoin:master from celeduc:cppcheck changing 2 files +4 −0
  1. celeduc commented at 3:54 PM on April 2, 2015: none

    cppcheck currently runs almost completely cleanly, with only one error (which IMO should be left unfixed):

    [src/bitcoin-tx.cpp:149]: (error) Resource leak: f

    This pull request automates running cppcheck and ignoring this specific error. This would be useful in continuous integration.

    To run: make cppcheck

  2. add cppcheck fedd9892cb
  3. add cppcheck 2b6f073049
  4. add cppcheck 9650f9169a
  5. theuni commented at 6:30 PM on April 3, 2015: member

    I appreciate the idea here, but this doesn't go far enough to do what it looks like it's doing.

    • Only the sources in src/ are checked, which may or may not be checked in.
    • Includes, defines, and un-defines aren't added, so it's not actually testing real build configs.
    • Maintaining a list of suppressions is not realistic, since things move around all the time.

    Instead, it'd need to look more like:

    cppcheck:
            cppcheck $(SOURCES) $(BITCOIN_INCLUDES) $(CPPFLAGS)
    

    But that would get unwieldy, because there are lots of gotchas wrt flags and includes. So in reality, we'd have to deal with each set of sources (internal convenience libs) separately.

    Instead, something like clang-check that's able to cope with the entire build-system is a much better solution here imo.

    Also, the resource leak pointed out above looks a real leak.

  6. laanwj added the label Build system on Apr 6, 2015
  7. laanwj commented at 2:38 PM on May 6, 2015: member

    @theuni BTW, how would one normally apply a checking tool to the entire source code? I've, in the past, done this by replacing GXX with a wrapper. But configure then complained that the compiler is unable to create executables, so I actually had to comment out parts of configure.ac. Is there a standard way of doing this?

  8. theuni commented at 4:44 PM on May 6, 2015: member

    @laanwj I've used clang's scan-build tool in the past the same way. It's actually designed to work just like that: http://clang-analyzer.llvm.org/scan-build.html#recommended_autoconf

  9. laanwj commented at 7:15 AM on May 18, 2015: member

    Yes, I was wondering how it bypassed the executable check in autoconf as I've been unsuccessful in doing that myself without patching autoconf. Anyhow, not a big issue.

  10. laanwj closed this on May 18, 2015

  11. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-01 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me