From 93cc178cfedb281ad05f988850d601e600361d9a Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 27 Aug 2018 15:51:41 +0000 Subject: Add tool to find directly recursive calls in toxcore. We should avoid recursion, as it makes reasoning about stack growth harder. This tool shows (currently) 4 (non-tail) recursive functions, at least 2 of which are easy to fix. --- .travis/bazel-linux | 7 ++++--- .travis/cmake-linux | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to '.travis') diff --git a/.travis/bazel-linux b/.travis/bazel-linux index b157437d..5594ff8c 100755 --- a/.travis/bazel-linux +++ b/.travis/bazel-linux @@ -16,9 +16,10 @@ travis_install() { } travis_script() { - bazel test //c-toxcore:license_test - bazel test //c-toxcore:readme_test - bazel test //c-toxcore:yamllint_test + bazel test \ + //c-toxcore:license_test \ + //c-toxcore:readme_test \ + //c-toxcore:yamllint_test # TODO(iphydf): Make tests have a chance to succeed. # Run the tests, but if they fail, at least we should be able to build. diff --git a/.travis/cmake-linux b/.travis/cmake-linux index fe5de10a..541eb014 100755 --- a/.travis/cmake-linux +++ b/.travis/cmake-linux @@ -53,8 +53,15 @@ travis_install() { } run_static_analysis() { + pylint -E other/analysis/check_recursion + export CPPFLAGS="-isystem $CACHEDIR/include" export LDFLAGS="-L $CACHEDIR/lib" + cat toxav/*.c toxcore/*.c toxencryptsave/*.c \ + | clang `pkg-config --cflags libsodium opus vpx` \ + -Itoxav -Itoxcore -Itoxencryptsave -S -emit-llvm -xc - -o- \ + | opt -analyze -print-callgraph 2>&1 \ + | other/analysis/check_recursion other/analysis/run-clang other/analysis/run-clang-analyze } -- cgit v1.2.3