#8351 Check code with clang static code analyzer
Opened 3 years ago by cheimes. Modified 2 years ago

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:

  • 54b42f7 configure: Fix source tree detection to enable more warnings
  • a355646 build: Unify compiler warning flags used
  • f9357cb 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.

Login to comment on this ticket.

Metadata
Attachments 2
Attached 3 years ago View Comment
Attached 3 years ago View Comment