#8351 Check code with clang static code analyzer
Opened by cheimes. Modified

clang has a fairly good static code analyyer that is easy to use, https://clang-analyzer.llvm.org/scan-build.html . We should scan our code and fix issues. Master h

$ sudo dnf install -y clang-analyzer
$ ./autogen.sh
$ make clean
$ scan-build -o report make -j4 -s

scan-build finds 50 issues in master.
index.html


In addition to that I would suggest to enable at least -Wall maybe even -Wextra globally.
Currently -Wall is enabled for daemons and client.

master:

  • 54b42f72fb1cd70c28f52feb5c8eaf2bca9e32cb configure: Fix source tree detection to enable more warnings
  • a355646c37f8b36549d79b2f1cbaeb428d2c98d8 build: Unify compiler warning flags used
  • f9357cb986dda76dbee795e7b602662ffb4602b6 configure: Do not set -Wno-strict-aliasing -Wno-sign-compare

@frenaud is this issue fixed, please?

@pcech this is not an "issue" but rather a suggestion to scan our C code. This means executing scan-build when we build + fixing all the issues potentially uncovered by the tool.
Note that we already scan downstream using covscan.

And to answer your question, no, it's not done yet. The referenced commits are related to this issue but don't fix it.

Metadata