HailDB, Hudson, compiler warnings and cppcheck

I’ve integrated HailDB into our Hudson setup (haildb-trunk on Hudson). I’ve also made sure that Hudson is tracking the compiler warnings. We’ve enabled more compiler warnings than InnoDB has traditionally been compiled with – this means we’ve started off with over 4,300 compiler warnings! Most of those are not going to be anything remotely harmful – however, we often find that it’s 1 in 1000 that is a real bug. I’ve managed to get it down to about 1,700 at the moment (removing a lot of harmless ones).

I’ve also enabled a cppcheck run on it. Cppcheck is a static analysis tool for C/C++. We’ve also enabled it for Drizzle (see drizzle-build-cppcheck on Hudson). When we enabled it for Drizzle, we immediately found three real bugs! There is also a coding style checker which we’ve also enabled on both projects. So far, cppcheck has not found any real bugs in HailDB, just some style warnings.

So, I encourage you to try cppcheck if you’re writing C/C++.

6 thoughts on “HailDB, Hudson, compiler warnings and cppcheck

  1. Pingback: Tweets that mention HailDB, Hudson, compiler warnings and cppcheck | Ramblings -- Topsy.com

  2. The main one seems to be -Wshadow – lots of occurrences of:
    declaration of ‘index’ shadows a global declaration [-Wshadow]

    (which so far seem to all be harmless). I’ve been replacing with dict_index. I’m also happy to push the patches upstream, just need to know what tree to generate patches against.

    -Wunused-parameters and -Wtype-limits are also giving some.

    -Wredundant-decls is triggered mainly around #ifdef UNIV_BACKUP in header files (not entirely sure what to do about that… don’t want to submit patches that break ibbackup building).

    -Wmissing-prototypes for a few things, a bunch of -pedantic

  3. Did you find any problems with cppcheck? Among the 144 I see none looks serious.

  4. For InnoDB/HailDB? None. The only things from cppcheck are style warnings (variable scope and the like).

    I was quite impressed actually. But I do think that cppcheck has more smarts for C++ STL usage than generic C. So that probably helps :)

  5. Mind you, I do like having such things present a good list of low hanging fruit tasks for new contributors. They get their contributions have positive effect on graphs and everything!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.